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.

AM335X: eMMC interface with MMC2

Dear Team,

        One of my customer board we are using eMMC interface, which connected to MMC2, I can access the eMMC in Kernel (Read, Write, Partition)  but i cant access in

in uboot, as per TRM MMC2 doesn't support boot, So i try to boot from SD and from uboot i try to access eMMC but it fails to initialised, I verified my pin mux settings

and module clocks, all are perfect. Is there any extra configuration for eMMC ?

Regards

Jithin

  • Hi Jithin,

    What is the output when you run this in U-Boot:

    # mmc rescan
    # mmc list
    # mmc part

    Best regards,
    Miroslav

  • Dear Team,

       Changes i made for MMC2 for eMMC BOOT

    ./arch/arm/include/asm/arch/mmc_host_def.h

    #elif defined(CONFIG_AM335X)
    # define OMAP_HSMMC1_BASE               0x48060100
    # define OMAP_HSMMC2_BASE               0x481D8100
    # define OMAP_HSMMC3_BASE               0x47810100  /* Added for EMMC Support */

    arch/arm/include/asm/omap_common.h

    #define BOOT_DEVICE_MMC1        8
    #define BOOT_DEVICE_MMC2        9 /* eMMC or daughter card */
    #define BOOT_DEVICE_MMC3        10 /* eMMC or daughter card */ /* Added for EMMC Support */

    ./board/ti/am335x/pll.c

    writel(PRCM_MOD_EN, CM_PER_MMC2_CLKCTRL);
           while (readl(CM_PER_MMC2_CLKCTRL) != PRCM_MOD_EN); /* Added for Calixto EMMC Support */

    ./common/cmd_bootm.c

      if (!strcmp(argv[1], "mmc0")) {
                    mmcc = 0;
            } else if (!strcmp(argv[1], "mmc1")) {
                    mmcc = 1;
            } else if (!strcmp(argv[1], "mmc2")) {  /* Added for EMMC Support */
                    mmcc = 2;
            } else {


    char *mmc_sel[3] = {"mmc", "dev", "0",};
                            if (mmcc == 0)
                            mmc_sel[2] = "0";
                    else if (mmcc == 1)
                            mmc_sel[2] = "1";
                    else if (mmcc == 2)
                            mmc_sel[2] = "2"; /* Added for EMMC Support */


    include/configs/am335x_evm.h
    #ifdef CONFIG_STORAGE_EMMC

    /* Enable below MACRO to use MMC0 as the boot device, for eMMC raw boot */
    /* #define CONFIG_USE_MMC0 */
    /* Enable below MACRO to use MMC1 as the boot device, for eMMC raw boot */
    /*#define CONFIG_USE_MMC1*/

    #define CONFIG_USE_MMC2

    #ifdef CONFIG_USE_MMC0
    #undef CONFIG_USE_MMC1
    #undef CONFIG_USE_MMC2
    #endif

    #ifdef CONFIG_USE_MMC2
    #undef CONFIG_USE_MMC0
    #undef CONFIG_USE_MMC1
    #endif

    #endif

    #ifdef CONFIG_STORAGE_EMMC
    #ifdef CONFIG_USE_MMC0
    #define CONFIG_BOOTCOMMAND "booti mmc0"
    #endif
    #ifdef CONFIG_USE_MMC1
    #define CONFIG_BOOTCOMMAND "booti mmc1"
    #endif
    #ifdef CONFIG_USE_MMC2
    #define CONFIG_BOOTCOMMAND "booti mmc2"
    #endif
    #else

    ********************************************************************

    OUTPUT AFTER BOOTs:

    U-Boot 2011.09 (Nov 30 2012 - 16:23:17)

    I2C:   ready
    DRAM:  512 MiB
    WARNING: Caches not enabled
    Could not probe the EEPROM; something fundamentally wrong on the I2C bus.
    NAND:  HW ECC Hamming Code selected
    No NAND device found!!!
    0 MiB
    MMC:   Inside OMAP_HSMMC3_BASE
    OMAP SD/MMC: 0, OMAP SD/MMC: 2
    Card did not respond to voltage select!
    mmc2(part 0) is current device
    Card did not respond to voltage select!
    FAIL:Init of MMC cardLoaded eMMC partition table*** Warning - readenv() failed, using default environment

    Net:   cpsw
    Hit any key to stop autoboot:  0
    Card did not respond to voltage select!
    mmc2(part 0) is current device
    booti: cannot find 'boot' partition

    Regards

    Jithin

  • Clocks, pinmux for mmc2 needs to be handled in board file.

  • Dear Team,

    Here is my current setting for PIN MUX

    /u-boot-r/board/ti/am335x/mux.c

    static struct module_pin_mux emmc_mmc2_pin_mux[] = {
            {OFFSET(mii1_col), (MODE(5) | RXACTIVE | PULLUP_EN)},   /* MMC2_DAT3 */
            {OFFSET(mii1_txd2), (MODE(5) | RXACTIVE | PULLUP_EN)},  /* MMC2_DAT2 */
            {OFFSET(mii1_txd3), (MODE(5) | RXACTIVE | PULLUP_EN)},  /* MMC2_DAT1 */
            {OFFSET(mii1_rxdv), (MODE(5) | RXACTIVE | PULLUP_EN)},  /* MMC2_DAT0 */
            {OFFSET(gpmc_clk), (MODE(3) | RXACTIVE | PULLUP_EN)},   /* MMC2_CLK */
            {OFFSET(gpmc_csn3), (MODE(3) | RXACTIVE | PULLUP_EN)},  /* MMC2_CMD */
            {OFFSET(gpmc_wpn), (MODE(7) | RXACTIVE | PULLUP_EN)},   /* MMC2_CD */
            {-1},
    };

    void enable_emmc_mmc2_pin_mux(void)
    {
            configure_module_pin_mux(emmc_mmc2_pin_mux);
    }

    /u-boot-r/board/ti/am335x/mux.c

    int board_init(void)
    {

        enable_emmc_mmc2_pin_mux();

       ......

       ......

    }

    The above mentioned  are done for pin mux setting,

    As per your suggestion i want  to add the below clock settings in evm.c

    writel(PRCM_MOD_EN, CM_PER_MMC2_CLKCTRL);
            while (readl(CM_PER_MMC2_CLKCTRL) != PRCM_MOD_EN);

    Please comment whether my statement is correct.

    Regards

    Jithin



  • Depending on the version of u-boot, look in either board/ti/am335x/board.c or arch/arm/cpu/armv7/am33xx/board.c for omap_mmc_init. In the code I have, only mmc0 and mmc1 are initialized. You probably have to add mmc2. The code I have is below.

    int cpu_mmc_init(bd_t *bis)
    {
            int ret;

            ret = omap_mmc_init(0, 0, 0);
            if (ret)
                    return ret;

            return omap_mmc_init(1, 0, 0);
    }

    Steve K.

  • Dear Team,

    We resolved the issue.

        Thanks for the co-operation.

    Regards

    Jithin

  • Jithin,

    Can you please tell me what the solution was?  I am also running into the same error: "Card did not respond to voltage select!"

    Thanks,

    Chuck

  • hi,

          Just enable MMC_HS support in omap_hmmc.c in uboot

    Regards

    Jithin

     

  • Hi Jithin :

    Sorry to bother you!

    We have a custom board that uses mmc2 for eMMc and I do not know if AM335x can boot from mmc2.

    According your design, do you boot from mmc2?

    If the answer is yes, how do you connect your sysboot pin?

    Please give me your suggestion.

    Thank you!

    Best regard,

    Marcus

  • Dear Marcus,

             AM335x doesn't have MMC2 boot, Supported interfaces are MMC0 and MMC1. if you have SPI Flash in you board you can boot first from SPI and then from EMMC, if you add support for EMMC and SPI Flash in uboot, below following way you can boot.

    SPI FLASH -> MLO and u-boot.img

    EMMC -> uImage and Filesystem

    if you are planning to change the MMC2 to MMC1 Please refer TRM for boot pins to connect  MMC1, because only dedicated pins are support for MMC1 boot.

    Otherwise you can have a SPI Flash in your Board.


    Regards

    Jithin

  • Hi Jithin :

    I appreciate your reply.

    I think I need to find out another way to replace mmc2 boot device.

    Best regards,

    Marcus

  • Hi Jithin,

    Exactly the same issue we are also facing.(We are using SDK7.0)

    In our design we have NOR flash and eMMC connected to MMC2  port. We are able to see the eMMC in kernel when we boot from NOR flash. But facing problem to program the filesystem into eMMC.

    We need your suggestions to make it working.

    I need to access the eMMC in uboot to flash the filesystem.

    I did the changes which all you suggested.

    Here below are the changes.

    --- a/arch/arm/cpu/armv7/am33xx/board.c
    +++ b/arch/arm/cpu/armv7/am33xx/board.c
    @@ -49,11 +49,15 @@ int cpu_mmc_init(bd_t *bis)
     {
            int ret;
     
    +#ifdef eMMC2_ENABLE
    +       return omap_mmc_init(2, 0, 0, -1, -1);
    +#else
            ret = omap_mmc_init(0, 0, 0, -1, -1);
            if (ret)
                    return ret;
    -
    +       
            return omap_mmc_init(1, 0, 0, -1, -1);
    +#endif
     }
     #endif

    --- a/arch/arm/cpu/armv7/am33xx/clock_ti814x.c
    +++ b/arch/arm/cpu/armv7/am33xx/clock_ti814x.c
    @@ -173,6 +173,11 @@ static void enable_per_clocks(void)
            writel(PRCM_MOD_EN, &cmalwon->mmchs1clkctrl);
            while (readl(&cmalwon->mmchs1clkctrl) != PRCM_MOD_EN)
                    ;
    +       
    +       /* HSMMC2 */
    +       writel(PRCM_MOD_EN, &cmalwon->mmchs2clkctrl);
    +       while (readl(&cmalwon->mmchs2clkctrl) != PRCM_MOD_EN)/*added MMC2 eMMC support*/
    +               ;
     
            /* Ethernet */
            writel(PRCM_MOD_EN, &cmalwon->ethclkstctrl);

    --- a/arch/arm/include/asm/arch-am33xx/mmc_host_def.h
    +++ b/arch/arm/include/asm/arch-am33xx/mmc_host_def.h
    @@ -23,6 +23,7 @@
      */
     #define OMAP_HSMMC1_BASE               0x48060100
     #define OMAP_HSMMC2_BASE               0x481D8100
    +#define OMAP_HSMMC3_BASE               0x47810100 /*Added for eMMC support on MMC2 port*/
     
     #if defined(CONFIG_TI814X)
     #undef MMC_CLOCK_REFERENCE

    --- a/arch/arm/include/asm/arch-am33xx/spl.h
    +++ b/arch/arm/include/asm/arch-am33xx/spl.h
    @@ -28,6 +28,7 @@
     #if defined(CONFIG_AM33XX)
     #define BOOT_DEVICE_MMC1       8
     #define BOOT_DEVICE_MMC2       9       /* eMMC or daughter card */
    +#define BOOT_DEVICE_MMC3       10
     #elif defined(CONFIG_TI814X)
     #define BOOT_DEVICE_MMC1       9
     #define BOOT_DEVICE_MMC2       8       /* ROM only supports 2nd instance */

    --- a/drivers/mmc/omap_hsmmc.c
    +++ b/drivers/mmc/omap_hsmmc.c
    @@ -637,10 +637,15 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio,
     #ifdef OMAP_HSMMC3_BASE
            case 2:
                    priv_data->base_addr = (struct hsmmc *)OMAP_HSMMC3_BASE;
    +#ifdef eMMC2_ENABLE
    +               host_caps_val |= MMC_MODE_8BIT;
    +               printf("\nOMAP_HSMMC3_BASE case\n");
    +#else          
     #if defined(CONFIG_DRA7XX) && defined(CONFIG_HSMMC3_8BIT)
                    /* Enable 8-bit interface for eMMC on DRA7XX */
                    host_caps_val |= MMC_MODE_8BIT;
     #endif
    +#endif
                    break;
     #endif
            default:

    Here below are the pinmux details,

    static struct module_pin_mux mmc2_pin_mux[] = {
        {OFFSET(gpmc_a9), (MODE(3) | RXACTIVE | PULLUP_EN)},    /* MMC2_DAT7 */
        {OFFSET(gpmc_a8), (MODE(3) | RXACTIVE | PULLUP_EN)},    /* MMC2_DAT6 */
        {OFFSET(gpmc_a7), (MODE(3) | RXACTIVE | PULLUP_EN)},    /* MMC2_DAT5 */
        {OFFSET(gpmc_a6), (MODE(3) | RXACTIVE | PULLUP_EN)},    /* MMC2_DAT4 */
        {OFFSET(gpmc_be1n), (MODE(3) | RXACTIVE | PULLUP_EN)},    /* MMC2_DAT3 */
        {OFFSET(gpmc_a3), (MODE(3) | RXACTIVE | PULLUP_EN)},    /* MMC2_DAT2 */
        {OFFSET(gpmc_a2), (MODE(3) | RXACTIVE | PULLUP_EN)},    /* MMC2_DAT1 */
        {OFFSET(gpmc_a1), (MODE(3) | RXACTIVE | PULLUP_EN)},    /* MMC2_DAT0 */
        {OFFSET(gpmc_clk), (MODE(3) | RXACTIVE | PULLUP_EN)},    /* MMC2_CLK */
        {OFFSET(gpmc_csn3), (MODE(3) | RXACTIVE | PULLUP_EN)},    /* MMC2_CMD */
        {-1},
    };

    Rgds,

    chandra

  • After all this change I am getting the log in uboot as follows and device resets,

    U-Boot 2013.10-00193-g7f472be-dirty (Jul 10 2014 - 16:58:58)

    I2C:   ready
    DRAM:  256 MiB
    board_init.
    Flash: 32 MiB
    MMC:   
    OMAP_HSMMC3_BASE case
    OMAP SD/MMC: 0
    Using default environment

    Net:   usb_ether
    Hit any key to stop autoboot:  0
    data abort

        MAYBE you should read doc/README.arm-unaligned-accesses

    pc : [<8f776bb8>]          lr : [<8f77667c>]
    sp : 8f337960  ip : 8f33ed7a     fp : 8f33ed48
    r10: 8f7a501c  r9 : 8f337f38     r8 : 00000003
    r7 : 8f33ed88  r6 : 8ffbbb10     r5 : 00000000  r4 : 47810100
    r3 : 8ffbb820  r2 : 00001563     r1 : 00001562  r0 : 8ffbbb10
    Flags: nZCv  IRQs off  FIQs on  Mode SVC_32
    Resetting CPU ...

    resetting ...

    Rgds,

    chandra

  • Chandra,

    Enable the clock in /arch/arm/cpu/armv7/am33xx clock_am33xx.c

    Steve K.

  • I went through all steps described here, but still cannot make MMC2 to work. U-boot does list it, however, there no clock signal.
    (Yes, I've enabled clock in arch/arm/cpu/armv7/am33xx clock_am33xx.c).
    Thanks for ideas and directions!

    Sergey