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.

omap2_hsmmc_info mmc[]

Dear Experts,
I got questions about DM8148-EVM/ezsdk_5_05_01_04 linux kernel omap2_hsmmc_init function.
In board-ti8148evm.c struct omap2_hsmmc_info mmc:
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 */
};

1) I am confused about ".mmc=1".
mmc=1 should be MMC0 controller, but only MMC1 can be boot device and exists at evm base board.

2) I am confused about ".gpio_cd = -EINVAL"
Why don't this program use card detect pin ? for example, .gpio_cd = GPIO_TO_PIN(1, 6),

3) If I want to add a emmc 8G iNand device at MMC2, is below code right ?

(1 sd card for boot: MMC1, 1 emmc iNand: MMC2, didn't use MMC0)
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,
    },
    {
        .mmc        = 3,
        .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 */
};


Please help resolve my question ~
thx ~

HB

  • I agree it's done in a very confusing way. I still haven't figured out how to make mmc0 work yet.

    1. .mmc=1 refers the MMC1 hardware on the chip.

    arch/arm/mach-omap2/hsmmc.c:omap2_hsmmc_init()

    hsmmc_data[c->mmc - 1] = mmc;

    then @ arch/arm/mach-omap2/devices.c:omap2_init_mmc()

    switch (i) {
            case 0:

                if (cpu_is_ti814x()) {
                    base = TI814X_MMC1_BASE;
                    irq = TI814X_IRQ_SD1;
                }

    2. ".gpio_cd = -EINVAL" means it doesn't use GPIO as card detection, instead, it use dedicted SD1_SDCD pin.

    3. you need to modify the kernel to support MMC2, TI814X_MMC2_BASE in not even defined in mmc.h (at least in psp4.04)

  • Dear Hongfeng Wang,

    Is there any patch to support MMC2 ?

    What should be modified in kernel to support MMC2 ?

    Here are my changes:

    1) mmc.h

    +#define TI81XX_NR_MMC        2
    -#define TI81XX_NR_MMC        1

    +#define TI814X_MMC2_BASE    0x47810100 /* TI814X MMC/SD config base */
    +#define TI814X_MMC2_HL_BASE    0x47810000 /* TI814X HL configuration*/

    2)board-ti8148evm.c

    static struct omap2_hsmmc_info mmc[] = {
        {
            .mmc        = 1, // hbchen , sd card
            .caps        = MMC_CAP_4_BIT_DATA,
    +        .gpio_cd    = -EINVAL, // hbchen
    -        .gpio_cd    = GPIO_TO_PIN(1, 6), /* Dedicated pins for CD and WP */
            .gpio_wp    = -EINVAL,
            .ocr_mask    = MMC_VDD_33_34,
        },
    +    {
    +        .mmc        = 2, // hbchen , on board emmc
    +        .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 */
    };

    3) Devices.c : omap2_init_mmc

    case 1:
    +             if (cpu_is_ti814x()) {
    +                base = TI814X_MMC2_BASE;
    +               irq = TI814X_IRQ_SD2;
    +            }
    +             else{
                    base = OMAP2_MMC2_BASE;
                    irq = INT_24XX_MMC2_IRQ;
    +            }
                break;

    4) Should I need to modify dma.h or any other files ??

    Please help ~ thx ~

    HB

  • That looks ok to me. Make sure your pin mux is correct.

    Try compile and run, see what happens next.

  • Dear Hongfeng Wang,

    Alexander give me a reference document in below link:

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/p/227735/808076.aspx#808076

    Did you modify your code according to the similar document ?

    There are some files that need to be modified, but you didn't mention. ~

    for example : io.h / io.c /clock814x_data.c/cm81xx.h/omap_hsmmc.c/control.h/ ... ==> Did you modify these files ?

    My custom board will be back soon, however, I want to prepare kernel first, and hope kernl will be almost ready for my custom board.

    Thus, I can't try the modifications now.

    thx ~

    HB

  • I didn't modify anything else as I can remember. But my software is based on IPNC RDK3.2, which uses psp4.04. that could be a little bit different. maybe the  mods he mentioned is already done there.

  • Dear Hongfeng Wang,

    Could you share you pinmux code for MMC2 for me ~

    I am confused about the document that Alexander provided.

    In the document, it perfroms pinmux as :

    devices.c: omap2_mmc_mux

    ==================

    if (cpu_is_ti814x()) {

        if (controller_nr == 1) {

        /* MMC2 */

        /*[mn] hopefully can be replaced with omap_mux_init_signal() when mux81xx.c will be updated for 8148*/

        omap_writel(0x00060001, 0x481409C0);    /*PINCNTL113 - MMC2_DAT7*/

        omap_writel(0x00060001, 0x481409C4);    /*PINCNTL114 - MMC2_DAT6*/

        omap_writel(0x00060001, 0x481409C8);    /*PINCNTL115 - MMC2_DAT5*/

        omap_writel(0x00060001, 0x481409CC);    /*PINCNTL116 - MMC2_DAT4*/

        omap_writel(0x00060001, 0x481409D0);    /*PINCNTL117 - MMC2_DAT3*/

        omap_writel(0x00060001, 0x481409D4);    /*PINCNTL118 - MMC2_DAT2*/

        omap_writel(0x00060001, 0x481409D8);    /*PINCNTL119 - MMC2_DAT1*/

        omap_writel(0x00060001, 0x481409DC);    /*PINCNTL120 - MMC2_DAT0*/

        omap_writel(0x00050001, 0x481409E0);    /*PINCNTL121 - MMC2_CLK*/

        omap_writel(0x00060002, 0x481409F4);    /*PINCNTL126 - MMC2_CMD*/

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

    }

    ==================

    Why need  controller_nr == 1 ??

    HB

  • I only used MMC0 and MMC1. My pinmux is all done in uboot, aka mux.h, so there was no pinmux related changes in devices.c

  • Dear Hongfeng Wang,

    Could you share the uboot mux.h about MMC0 to me ~

    thx ~

    HB