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.

Card detect pin connectivity in case of eMMC card on DM8148

Hi All,

We are interfacing on board e-MMC card with DM8148 MMC/SD1 . As card is on board so there is no mechanical switch.

e-MMC card specification doesn't talk about card detect pin.

Please suggest recommended connection of card detect (SDCD) at DM8148 to mount "onbord eMMC".

Regards

Sandeep Bansal

  • Sandeep,

    Refer to the below e2e thread:

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/p/144963/526799.aspx

    It is for eMMC attached to MMC/SD2 (not MMC/SD1), but should be similar.

    Here is an extract from http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/p/144963/526799.aspx#526799

    MMC (eMMC)

    1) A new device driver entry

    2) Region mapping

    3) Clocks

    4) Pinmux

    omap_writel(0x00050040, 0x48140920); /*PINCNTL73 - MMC2_SDCD*/

    Please note that pin definition is not available for DM8148 yet so explicit write is needed! Please note also that MMC2_SDCD is enabled only to satisfy the host controller implementation.

    This pin is not used in case of eMMC device but is enabled with pulled-up high to satisfy controller.

    BR
    Pavel

  • Hello Pavel,

    I have a question...related to your above reply..

    In normal Card detectible case, pin SD_CD is logic LOW at the process side.

    So shouldn't we make this pin pulled LOW to fool processor, that eMMC is permanently connected insted of HIGH?

    We also tried this, that if we pulled this line externally LOW, or kept this SD_CD line floating, and did the internal pull down enabled by,

    omap_writel(0x00040002, 0x4814093c); /*PINCNTL80 - MMC1_SDCD*/

    we are able to detect the MMC0.

    Can you please suggest, if we are doing it correctly?

     

    br

    Vikas

     

  • Vikas,

    Vikas Rustagi said:
    So shouldn't we make this pin pulled LOW to fool processor, that eMMC is permanently connected insted of HIGH?

    In eMMC case, SD1_SDCD pin is not used (it is input pin), and DM814x datasheet is providing the following info:

    4.4 Handling Unused Pins
    When device signal pins are unused in the system, they can be left unconnected unless otherwise noted in the Terminal Functions tables (see Section 3.2). For unused input pins, the internal pull resistor should be enabled, or an external pull resistor should be used, to prevent floating inputs. Unless otherwise noted, all supply pins must always be connected to the correct voltage, even when their associated signal pins are unused.

    And it seems that the DM814x MMC driver does not use SD1_SDCD pin for card detect:

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/p/179512/717206.aspx#717206

    The other thing to look for is the Write Protect and Card Detect lines. These are GPIOs. Usually WP and CD can be optional. If not specified, The MMC driver is supposed to assume always writeable and always inserted.

    Vikas Rustagi said:

    We also tried this, that if we pulled this line externally LOW, or kept this SD_CD line floating, and did the internal pull down enabled by,

    omap_writel(0x00040002, 0x4814093c); /*PINCNTL80 - MMC1_SDCD*/

    we are able to detect the MMC0.

    I suspect that if you try with pull up, you should also be able to detect the eMMC?

    The card detect functionality is implemented in interrupt mode only. Initially, the card insert and remove status registers bits were used to cause interrupts. But due to a race condition encountered in our driver code, we switched to GPIO based interrupt implementation for TI814x.

    You can find the relevant patches implementing the GPIO based card insert/remove functionality here:
    1) Uboot patches http://arago-project.org/git/projects/?p=u-boot-omap3.git;a=commit;h=3c863dfc6777dc062d40ab51eb9a84a1bb3d64e1
    ti8148: mmc: use gpio pin for card detection

    2) Kernel patches (http://arago-project.org/git/projects/?p=linux-omap3.git;a=shortlog):
    ti81xx: mmc: remove the usage of card detect status...
    ti8148: mmc: use gpio pin for card detection


    Best regards,
    Pavel

  • Hello Pavel,

    I already checked that, when CD line is pulled high externally, then MMC0 is not detected in kernel.

    How to inform driver, that WP and CD lines are optional, and consider it always inserted and writable.

    Is this related to below struct,

    static struct omap2_hsmmc_info mmc[] = {
     {
      .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 */
    };

    When it was pulled high, i made a change in "drivers/mmc/host/omap_hsmmc.c" method "omap_hsmmc_card_detect()"

    "if cpu_is_ti814x(), then return 1" in the else part of  MMC_CTRL_VERSION_2.

    to make it detectible.

     

    br

    Vikas

     

     

  • Vikas,

    Is this the same project as the original post from Sandeep: "We are interfacing on board e-MMC card with DM8148 MMC/SD1" ?

    Or you are trying to interface SD/MMC card with DM8148 MMC0/SD0 controller?

    Can you also try the below patch, does it make any difference?

    http://arago-project.org/git/projects/?p=linux-omap3.git;a=commit;h=a1105d559a0d6fa1b5b8496f60d070f48efb74d2

    --- a/arch/arm/mach-omap2/board-ti8148evm.c
    +++ b/arch/arm/mach-omap2/board-ti8148evm.c
    @@ -55,6 +55,9 @@
     
     #define GPIO_TSC               31
     
    +/* Convert GPIO signal to GPIO pin number */
    +#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))
    +
     #ifdef CONFIG_OMAP_MUX
     static struct omap_board_mux board_mux[] __initdata = {
            { .reg_offset = OMAP_MUX_TERMINATOR },
    @@ -67,7 +70,7 @@ static struct omap2_hsmmc_info mmc[] = {
            {
                    .mmc            = 1,
                    .caps           = MMC_CAP_4_BIT_DATA,
    -               .gpio_cd        = -EINVAL, /* Dedicated pins for CD and WP */
    +               .gpio_cd        = GPIO_TO_PIN(1, 6), /* Dedicated pins for CD and WP */
                    .gpio_wp        = -EINVAL,
                    .ocr_mask       = MMC_VDD_33_34,
            },

    Best regards,
    Pavel

  • Hello Pavel,

    Sorry for the late reply.

    Yes, Sandeep and me are working on the same project...so i took over this thread.

    We are interfacing e-MMC card on MMC/SD1 on same lines as eval board, but yes we see this as mmc0(??) in kernel and u-boot( replies on...mmcinfo 0).

    I tried your above change( but without changing MUX to select that line as GPIO) with line pulled up on outside with 10k, but it was not detected in kernel.

    How-ever when i made this line floated..and did internal pull down, i was able to detect MMC. 

    br

    Vikas