Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/TMS320DM8148: CD pins are not working as per expectation.

Part Number: TMS320DM8148

Tool/software: Linux

Hi All,

I am facing issue with SD-Card detection with use of only CD pins. I have DM8148 based custom board and it supports two SD card and both are connected to CD pins as uart0_ctsn.mmc0_sdcd & spi0_cs1.mmc1_sdcd pins respectively. Also I am using DVRRDK_04.01.00.02 reference source code for kernel & all.

Now below is my mmc structure from board file,

static struct omap2_hsmmc_info mmc[] = {
   {
      .mmc     = 2,
      .caps    = MMC_CAP_4_BIT_DATA,
      .gpio_cd    = -EINVAL, /* Dedicated pins for CD and WP */
      .gpio_wp    = -EINVAL,
      .ocr_mask   = MMC_VDD_33_34,
   },
   {
      .mmc     = 1,
      .caps    = MMC_CAP_4_BIT_DATA,
      .gpio_cd    = -EINVAL, /* Dedicated pins for CD and WP */
      .gpio_wp    = -EINVAL,
      .ocr_mask   = MMC_VDD_33_34,
   },
   {} /* Terminator */
};


With these setting i am unable to use both SD-Cards as hot-pluggable.

Now after some trials, i have modified my mmc structure of board file as below,

static struct omap2_hsmmc_info mmc[] = {
   {
      .mmc     = 2,
      .caps    = MMC_CAP_4_BIT_DATA,
      .gpio_cd    = GPIO_TO_PIN(1, 6), /* Dedicated pins for CD and WP */
      .gpio_wp    = -EINVAL,
      .ocr_mask   = MMC_VDD_33_34,
   },
   {
      .mmc     = 1,
      .caps    = MMC_CAP_4_BIT_DATA,
      .gpio_cd    = GPIO_TO_PIN(1, 15), /* Dedicated pins for CD and WP */
      .gpio_wp    = -EINVAL,
      .ocr_mask   = MMC_VDD_33_34,
   },
   {} /* Terminator */
};

And with these i have changed my MUX settings to spi0_cs1.gpio1_6 & mmc2_clk.gpio1_15 respectively. With this change i am able to use both SD-Cards as hot-pluggable.

Now my question is, why CD pin feature is not working properly with DM8148? Is there any extra patch needed to fix this?

Let me know if you need any further details. Also find reference schematic snapshots in case of any need.

Regards,

Ravi Bhuva.

  • Hi Ravi,

    Ravi Bhuva said:
          .gpio_cd    = -EINVAL, /* Dedicated pins for CD and WP */

    Actually the code there is:

    .gpio_cd        = -EINVAL, /* check setup_mmc2_pin_mux() */

    This setup_mmc2_pin_mux() is exporting gpio1_6 signal on the spi0_cs1 pin. Boot up with the default settings and check register PINCNTL80 from user space, you will see that the value there is actually for gpio1_6, not mmc1_sdcd.

    Make sure you have the below patches in your code base:

    Regards,
    Pavel

  • I have cross checked your inputs with my code. Still both SD-Cards are not usable with hot-pluggable feature.
    Please find below things of my setup & testing,
    From U-Boot pin mux of used pins:
    MMC-1:
    MUX_VAL(PINCNTL72, (IEN | IPU | FCN7 )) /* SD0_SDCD */\

    MMC-2:
    MUX_VAL(PINCNTL80, (IEN | IPU | FCN2 )) /* SD1_SDCD */\


    From Kernel use of both MMC in board file,
    static struct omap2_hsmmc_info mmc[] = {
    {
    .mmc = 2,
    .caps = MMC_CAP_4_BIT_DATA,
    .gpio_cd = -EINVAL, /* check setup_mmc2_pin_mux() */
    .gpio_wp = -EINVAL,
    .ocr_mask = MMC_VDD_33_34,
    },
    {
    .mmc = 1,
    .caps = MMC_CAP_4_BIT_DATA,
    .gpio_cd = -EINVAL, /* check setup_mmc1_pin_mux() */
    .gpio_wp = -EINVAL,
    .ocr_mask = MMC_VDD_33_34,
    },
    {} /* Terminator */
    };

    static int setup_mmc2_pin_mux(void)
    {
    return omap_mux_init_signal("spi0_cs1.gpio1_6", TI814X_PIN_INPUT_PULL_UP);
    }
    static int setup_mmc1_pin_mux(void)
    {
    return omap_mux_init_signal("uart0_ctsn.mmc0_sdcd",
    TI814X_PIN_INPUT_PULL_UP);
    }
    static void __init ti8148_evm_init(void)
    {
    ...
    setup_mmc2_pin_mux();
    setup_mmc1_pin_mux();
    ...
    }


    Run time behaviour:
    On system bootup logs,
    mmc0: host does not support reading read-only switch. assuming write-enable.
    mmc0: new SDXC card at address aaaa
    mmcblk0: mmc0:aaaa SC64G 59.4 GiB
    mmcblk0:
    mmc1: host does not support reading read-only switch. assuming write-enable.
    mmc1: new SDXC card at address aaaa
    mmcblk1: mmc1:aaaa SC64G 59.4 GiB
    mmcblk1:

    # mount
    rootfs on / type rootfs (rw)
    ubi0:rootfs on / type ubifs (rw,relatime)
    devtmpfs on /dev type devtmpfs (rw,relatime,size=503580k,nr_inodes=103567,mode=755)
    proc on /proc type proc (rw,relatime)
    none on /dev/shm type tmpfs (rw,relatime)
    devpts on /dev/pts type devpts (rw,relatime,mode=600)
    usbfs on /proc/bus/usb type usbfs (rw,relatime)
    tmpfs on /var/volatile type tmpfs (rw,relatime,size=16384k)
    tmpfs on /media/ram type tmpfs (rw,relatime,size=16384k)
    sysfs on /sys type sysfs (rw,relatime)
    /dev/mmcblk0 on /media/mmcblk0 type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed
    ,errors=remount-ro)
    /dev/mmcblk1 on /media/mmcblk1 type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed
    ,errors=remount-ro)


    After removing MMC2 from system at run time below prints start coming and in top CPU utilization by system is almost 100%,
    mmcblk1: error -110 sending status command
    mmcblk1: error -110 sending read/write command, response 0x0, card status 0x0
    mmcblk1: error -110 transferring data, sector 229550, nr 32, card status 0x0
    end_request: I/O error, dev mmcblk1, sector 229550
    mmcblk1: error -110 sending status command
    mmcblk1: error -110 sending read/write command, response 0x0, card status 0x0
    mmcblk1: error -110 transferring data, sector 229551, nr 31, card status 0x0
    end_request: I/O error, dev mmcblk1, sector 229551

    Also /dev/mmcblk1 is not removed.

    After removing MMC1 from system at run time below prints start coming and in top CPU utilization by system is almost 100%,
    mmcblk0: error -110 sending status command
    mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
    mmcblk0: error -110 transferring data, sector 5942094, nr 128, card status 0x0
    mmcblk0: error -110 requesting status
    end_request: I/O error, dev mmcblk0, sector 5942094
    end_request: I/O error, dev mmcblk0, sector 5942102

    Also /dev/mmcblk0 is not removed.


    Let me know where it's going wrong.

  • Ravi Bhuva said:
    MMC-1:
    MUX_VAL(PINCNTL72, (IEN | IPU | FCN7 )) /* SD0_SDCD */\

    MMC-2:
    MUX_VAL(PINCNTL80, (IEN | IPU | FCN2 )) /* SD1_SDCD */\

    Ravi Bhuva said:
    omap_mux_init_signal("uart0_ctsn.mmc0_sdcd",

    You are still using sdx_sdcd signal instead of gpio.

    Regards,
    Pavel

  • Hi Pavel,

    I have two SD-Cards in my system. And i don't want to use external GPIO for card detection, i want to use in-built CD pins only.

    It's MMC1 with below MUX,
    omap_mux_init_signal("uart0_ctsn.mmc0_sdcd",

    This pin doesn't have any GPIO MUX functionality.

       _TI814X_MUXENTRY(UART0_CTSN, 0,
             "uart0_ctsn", "uart4_rxd_mux3", NULL, "dcan1_tx",
             "spi1_cs3", NULL, "mmc0_sdcd", NULL, NULL, NULL, NULL,
             NULL),
    We have provided GP1[15] externally but we will remove it if all is working with CD pin only, so i am not using this pin here. Also i have kept GP1[15] pin mux as below,

    MUX_VAL(PINCNTL121, (IEN | IPU | DISABLED )) /* safe_mode */\

    Also i have mmc2 with below configuration,
    return omap_mux_init_signal("spi0_cs1.gpio1_6", TI814X_PIN_INPUT_PULL_UP);
    Still MMC2 is not usable with hot-pluggable feature.

    Let me know if we have any disconnect.

  • Ravi,

    I would suggest you first focus on MMC1 (0x481D8000) with GPIO for card detect. This setup should work fine, see the below e2e thread for more info:

    e2e.ti.com/.../445353

    Regarding sd1_sdcd usage (instead of GPIO), the problem is "The controller uses a status register for the card detect functionality. The implementation of this functionality caused a kernel hang in case the card was removed while I/O was in progress." The use is solved with switch from sd1_sdcd to GPIO

    arago-project.org/.../

    arago-project.org/.../

    arago-project.org/.../

    See also the below e2e threads:

    e2e.ti.com/.../1262085
    e2e.ti.com/.../1316410

    Regards,
    Pavel
  • Hi Pavel,


    With provision of GPIO i am already able to get hot-pluggable functionality. And with only CD pins (sdcd pins) i believe we will not able to get hot-pluggable feature.

    Only one query now, if I remove CD pins (sdcd pins) from my hardware, it will not affect any functionality loss right? (GPIOs are connected and I have provided them with mmc structure in board file)

    Regards,

    Ravi Bhuva.

  • Ravi,

    The usage of the card detect input signal (SDCD) is optional and depends on the system integration and the type of the connector housing that accommodates the card.

    Regards,
    Pavel