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.

NOR and eMMC flashing without CCS and JTAG

Hi,

We have an custom board based on J5 ti811x
NOR flash: 4MB

SD-card connected to MMC1 (0x481D8000)

eMMC 4GB connected to MMC2 (0x47810000)

ezsdk uboot version    :u-boot-2010.06-psp04.07.00.02
ezsdk kernel version    :linux-2.6.37-psp04.07.00.02

As per our booting scheme, we need to configure and copy uboot and kernel into NOR flash and RFS into eMMC. I have few questions.

1) How to add support for MMC2 in kernel. Please find the code below which i have done for enabling eMMC on MMC2. Is this enough?

2) When I boot linux with this code, there is no mmcblk1 device under /dev. But I can see mmcblk0 which is used for SD-card(Currently booting from SD-card). How to configure linux to create dev/mmcblk1 for eMMC. In production system instead of SD card RFS will be mounted from eMMC

3) Could you please tell me how to partition and program NOR and eMMC flash without using CCS and JTAG.

mmc.h

---------

+#define TI81XX_NR_MMC        2 //1
+#define TI811X_MMC2_BASE    0x47810100 /* TI811X MMC/SD2 config base */
+#define TI811X_MMC2_HL_BASE    0x47810000 /* TI811X HL configuration*/

board-ti811x

---------------

static struct omap2_hsmmc_info mmc[] = {
    {
        .mmc        = 1,
        .caps        = MMC_CAP_4_BIT_DATA,
        .gpio_cd    = GPIO_TO_PIN(1, 6), /* Dedicated pins for CD and WP */
           .gpio_wp     = GPIO_TO_PIN(0, 22),
        .ocr_mask    = MMC_VDD_33_34,
    },
    {
        .name        ="RSB_eMMC",
        .mmc        = 2,
        .caps        = MMC_CAP_8_BIT_DATA,
        .gpio_cd    = -EINVAL, /* No Dedicated pins for CD and WP */
           .gpio_wp     = -EINVAL,
        .ocr_mask    = MMC_VDD_33_34,
        .nonremovable   = true,
    },
    {}    /* Terminator */
};

devices.c

-------------

void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
            int nr_controllers)
{
    int i;
    char *name;
    printk("%s: nr_controllers = %d \n",__func__, nr_controllers);
    for (i = 0; i < nr_controllers; i++) {
        unsigned long base = 0;
        unsigned long size;
        unsigned int irq = 0;

        if (!mmc_data[i])
            continue;
        printk("%s: i = %d \n",__func__, i);
        omap2_mmc_mux(mmc_data[i], i);

        switch (i) {
        case 0:
            if (!cpu_is_ti81xx()) {
                base = OMAP2_MMC1_BASE;
                irq = INT_24XX_MMC_IRQ;
            } else if (cpu_is_ti816x()) {
                base = TI816X_MMC1_BASE;
                irq = TI81XX_IRQ_SD;
            } else if (cpu_is_ti814x()) {
                base = TI814X_MMC1_BASE;
                irq = TI814X_IRQ_SD1;
            }
            break;
        case 1:
            if (cpu_is_ti811x()) {                
                base = TI811X_MMC2_BASE;
                irq = TI814X_IRQ_SD2;
                printk("%s: i = %d, base = 0x%x, irq = %d\n",__func__, i, TI811X_MMC2_BASE,TI814X_IRQ_SD2);
            }else{
                base = OMAP2_MMC2_BASE;
                irq = INT_24XX_MMC2_IRQ;
            }
            break;
        case 2:
            if (!cpu_is_omap44xx() && !cpu_is_omap34xx())
                return;
            base = OMAP3_MMC3_BASE;
            irq = INT_34XX_MMC3_IRQ;
            break;
       
        }

        if (cpu_is_omap2420()) {
            size = OMAP2420_MMC_SIZE;
            name = "mmci-omap";
        } else if (cpu_is_omap44xx()) {
            if (i < 3)
                irq += OMAP44XX_IRQ_GIC_START;
            size = OMAP4_HSMMC_SIZE;
            name = "mmci-omap-hs";
        } else if (cpu_is_ti81xx()) {
            if (i){
                size = TI81XX_HSMMC_SIZE;
                name = mmc_data[i]->slots[0].name; //"RSB_eMMC"
            }else{ //default
                size = TI81XX_HSMMC_SIZE;
                name = "mmci-omap-hs";
            }
        } else {
            size = OMAP3_HSMMC_SIZE;
            name = "mmci-omap-hs";
        }
        printk("%s: name =%s, i = %d, base = 0x%lx, size = %d \n",__func__, name, i, base, size);
        omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
    };
}

BR/-

Nihad

  • Hi Nihad,

    Abdul VK said:

    1) How to add support for MMC2 in kernel. Please find the code below which i have done for enabling eMMC on MMC2. Is this enough?

    2) When I boot linux with this code, there is no mmcblk1 device under /dev. But I can see mmcblk0 which is used for SD-card(Currently booting from SD-card). How to configure linux to create dev/mmcblk1 for eMMC. In production system instead of SD card RFS will be mounted from eMMC

    There are some other differences between using MMC1 and MMC2.  These are discussed in Ch 5 "ROM Bootloader" of the TRM.  For example, MMC2 supports only raw mode (not file systems) for boot.

    See also the below pointers:

    Abdul VK said:
    3) Could you please tell me how to partition and program NOR and eMMC flash without using CCS and JTAG.

    Regarding NOR:

    The J5Eco/TI811x u-boot user guide is clear about that, NOR flash can be written with u-boot only through JTAG/CCS. I am not aware of any other method.

     

    BR
    Pavel

  • Regarding booting from eMMC:

    I have also found that AM335x TRM states the same as J5Eco TRM (that ROM Code support only raw mode), but some engineers are able to use the eMMC with FAT (not raw mode).

    e2e.ti.com/.../207075.aspx

    e2e.ti.com/.../336877.aspx

    May be it is worth trying if this is valid on the J5Eco device also.

    One collage program his AM335x custom board eMMC (in FAT mode) from the linux kernel with the below set of commands:

    4. The eMMC is /dev/mmcblk1. Format it this way:
    4.01. fdisk /dev/mmcblk1
    4.02. o - this clears the existing partitions
    4.03. p - this lists all partition tables on the card (there should be none)
    4.04. n - create a new partition
    4.05. p - primary partition
    4.06. 1 - partition number
    4.07. 2048 - default value for the first sector
    4.08. +16M - last sector / partition size
    4.09. t - change the partition type (select partition 1)
    4.10. e - change tha partition type to "W95 FAT16 (LBA)"
    4.11. a - set the bootable flag for the selected partition (1)
    4.12. n - create a new partition
    4.13. p - primary partition
    4.14. 2 - partition number
    4.15. hit Enter to choose the default (next available) value for the
    first sector
    4.16. hit Enter to choose the default (last) value for the last sector
    4.17. p - this lists all partition tables on the card (there should be two)
    4.18. w - write all the above changes to disk
    4.19. umount /dev/mmcblk1p1; mkfs.vfat -F 16 /dev/mmcblk1p1 - format the
    first partition
    4.20. umount /dev/mmcblk1p2; mkfs.ext4 /dev/mmcblk1p2 - format the
    second partition

    5. Copy the {MLO,u-boot.img,uEnv.txt,uImage} files to the first partition:
    # mkdir boot
    # mount /dev/mmcblk1p1 boot
    # cp {MLO,u-boot.img,uEnv.txt,uImage} boot
    # umount boot

    6. Copy the root file system to the second partition:
    # mkdir root
    # mount /dev/mmcblk1p2 root
    # tar -xf tisdk-rootfs-image-am335x-evm.tar.gz -C root
    # umount root

    7. Shutdown the BBB, remove the SD card and start it from the eMMC.

    Below is one thread for the SPI + eMMC that might be in help:

    e2e.ti.com/.../276907.aspx

    Also these pointers might help:

    http://processors.wiki.ti.com/index.php/DRA7xx_GLSDK_Software_Developers_Guide#Using_eMMC_Boot

    omappedia.org/.../Embedded_MMC(eMMC)_boot

    e2e.ti.com/.../528635

    e2e.ti.com/.../1442398

    e2e.ti.com/.../968551

    BR
    Pavel

  • Dear Pavel,

    I am able to bring up eMMC mounted on MMC2 interface. Prepare mmcblk1p1 with RFS image and mounted RFS from eMMC successfully. For Nor related queries I will create new thread. Thanks for your support.

    BR/-
    Nihad