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/AM5708: Error in booting MLO and u-boot image from emmc default partition

Part Number: AM5708
Other Parts Discussed in Thread: CSD, DRA742, PMP

Tool/software: Linux

Hi,

I'm using AM5708 processor based board.

I want to boot my MLO and u-boot image from emmc default boot partiton mmcblk0boot0.

I've changed BOOT_ACK and BOOT_PARTITION_ENABLE fields in PART_CONF register of emmc.

I've changed following fields in EXT_CSD register for emmc,

Boot configuration bytes [PARTITION_CONFIG: 0x48]
 Boot Partition 1 enabled
 No access to boot partition

Boot bus Conditions [BOOT_BUS_CONDITIONS: 0x12] - for ddr mode

H/W reset function [RST_N_FUNCTION]: 0x01

Then, I copied my MLO and u-boot image to /dev/mmcblk0boot0 by dd command.

On bootup, I'm getting following error,

spl: mmc partition switch failed
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

It is throwing error in mmc switch command for part_cong register.

Can anyone help me on how to boot MLO and u-boot from emmc default mmcblk0boot0 partition ?

Thanks,

Gunjal

  • Hello Gunjal,

    /dev/mmcblk0bootX are for various configuration settings. Can you copy the MLO adn u-boot.img to /dev/mmcblk0p1?

    Best regards,
    Kemal

  • Hi,

    We have already done that and it's working fine, but we want to enable support of "Alternative Boot Operation mode" (AM57xx TRM : Topic  33.3.7.6.2.3 "Booting Procedure").

    We are able to load MLO from mmcblk0boot0 partition also, but I'm facing above issue during booting.

    Here is my logs,

    U-Boot SPL EDGE

    DRA722-GP ES2.0

    Trying to boot from MMC2

    In mmc_switch in d: set = 1, index = 179, value = 1

    In mmc_switch in x: set = 1, index = b3, value = 1

    In mmc_switch : cmdargs = 3b30100

    CMD_SEND:6

                   ARG                      0x03B30100

    In Omap send_cmd fun

    omap_hsmmc_send_cmd : Line: 942

    omap_hsmmc_send_cmd : Line: 951

    omap_hsmmc_send_cmd : Line: 962

    omap_hsmmc_send_cmd : Line: 1000

    omap_hsmmc_send_cmd : Line: 1024

    omap_hsmmc_send_cmd : Line: 1029

    omap_hsmmc_send_cmd : Line: 1033

    omap_hsmmc_send_cmd : Line: 1043, mmc_stat = 18001

                   RET                      -19

    In mmc_switch : ret of mmc_send_cmd = -19

    In mmc_switch : ret of mmc_send_status = -19

    spl: mmc partition switch failed

    SPL: failed to boot from all boot devices

    ### ERROR ### Please RESET the board ###

     


    Can you help me in this case?

    Thanks,

    Gunjal

  • Hi Kemel,

    I looked in the code for spl for my above mentioned error.
    So, what happens is during booting MLO from /dev/mmcblk0boot0, my boot mode is set MMCSD_MODE_EMMCBOOT.
    In this case it tries to send MMC_SWITCH command for EXT_CSD_PART_CONF register, during which it writes cmdargs on MMCHS_ARG (Command Argument Register) of mmc and reads MMCHS_STAT (Interrupt Status Register). and in MMCHS_STAT read value CTO (Command Timeout Error) bit is set. So, it throws error from that.
    So, can you tell me how to resolve this error and boot u-boot image from /mmcblk0boot0 ?

    And, you said that "/dev/mmcblk0bootX are for various configuration settings", does that mean that I can't boot my u-boot image from /mmcblk0bootx ?

    Thanks,
    Gunjal
  • When the boot ROM jumps to MLO, it has the address of a booting parameters block in r0. One field is where the boot ROM found MLO. See the Initialization chapter in the TRM. I think the u-boot code has a bug. The TRM has a value of 5 for SD Card (mmc1), 6 for emmc boot pardition,  and 7 for emmc (mmc2). If you look in the u-boot code, you'll find in arch/arm/include/asm/arch-omap5/spl.h

    #define BOOT_DEVICE_MMC1        0x05
    #define BOOT_DEVICE_MMC2        0x06
    #define BOOT_DEVICE_MMC2_2      0x07

    6 and 7 should be swapped. What led me to this was that I saw a message about trying to boot from MMC2 when it should have been MMC2_2.

    I am curious, you said MLO/u-boot.img are in mmc1 (mmcblk0boot0), yet the boot ROM looks for the boot partition in mmc2 (mmcblk1boot0).

    Steve k.

  • Hi Steve,

    Thanks for your reply.

    About the thing you mentioned in the last line, actually we have SD card on mmc1 and EMMC on mmc2. On file-system, when SD card is not connected, emmc partitions are shown as mmcblk0, but in boot sequence EMMC is MMC2. That's why it is showing boot from MMC2.

    And about swapping MMC2 MMC2_2, I tried doing that but still I'm getting same problem.

    Also, I saw that in function spl_mmc_load_image() in spl_mmc.c file, our SDK has below code,

           switch (boot_mode) {

           case MMCSD_MODE_EMMCBOOT:

                           /*

                            * We need to check what the partition is configured to.

                            * 1 and 2 match up to boot0 / boot1 and 7 is user data

                            * which is the first physical partition (0).

                            */

                           part = (mmc->part_config >> 3) & PART_ACCESS_MASK;

                           if (part == 7)

                                   part = 0;

                           err = mmc_switch_part(0, part);

                           if (err) {

    #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT

                                   puts("spl: mmc partition switch failed\n");

    #endif

                                   return err;

                           }


    And when I checked in latest SDK, it has below code in same function,

            switch (boot_mode) {
            case MMCSD_MODE_EMMCBOOT:
                            /*
                             * We need to check what the partition is configured to.
                             * 1 and 2 match up to boot0 / boot1 and 7 is user data
                             * which is the first physical partition (0).
                             */
                            part = (mmc->part_config >> 3) & PART_ACCESS_MASK;

                            if (part == 7)
                                    part = 0;

                            if (CONFIG_IS_ENABLED(MMC_TINY))
                                    err = mmc_switch_part(mmc, part);
                            else
                                    err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);

                            if (err) {
    #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                                    puts("spl: mmc partition switch failed\n");
    #endif
                                    return err;
                            }

    So, it has some added functionality. I'm guessing this is the reason of our problem.

    Can you tell me about that? or is there some other problem?

    Regards,

    Gunjal

  • I am able to boot from the eMMC boot partition 0 on a DRA7 EVM since I can change the boot modes easily. DRA7 and AM57xx use the same sysboot modes. I made three small changes to the source code:

    1. In arch/arm/mach-omap2/omap5/boot.c I added BOOT_DEVICE_MMC2_2

    static u32 boot_devices[] = {
    #if defined(CONFIG_DRA7XX)
            BOOT_DEVICE_MMC2_2,
            BOOT_DEVICE_MMC2,
            BOOT_DEVICE_NAND,
            BOOT_DEVICE_MMC1,
            BOOT_DEVICE_SATA,
            BOOT_DEVICE_XIP,
            BOOT_DEVICE_XIP,
            BOOT_DEVICE_SPI,
            BOOT_DEVICE_SPI,
    #else

    2. Swapped the 6 and the 7 in arch/arm/include/asm/arch-omap5/spl.h

    #define BOOT_DEVICE_MMC1        0x05
    #define BOOT_DEVICE_MMC2        0x07
    #define BOOT_DEVICE_MMC2_2      0x06

    3. Added CONFIG_EMMC_BOOT to configs/dra7xx_evm_defconfig

    CONFIG_FIT=y
    CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT"
    CONFIG_OF_BOARD_SETUP=y

    I boot from an SD Card, and do the following from linux

    dd if=/dev/zero of=/dev/mmcblk1boot0 bs=512
    dd if=MLO of=/dev/mmcblk1boot0 bs=512
    dd if=u-boot.img of=/dev/mmcblk1boot0 bs=512 seek=768

    Assuming the eMMC is on mmc2. Console output shows

    U-Boot SPL 2017.01-00319-gfe893f73f0e4-dirty (Sep 28 2017 - 07:47:12)
    DRA752-GP ES1.1
    Trying to boot from MMC2_2
    *** Warning - bad CRC, using default environment

    U-Boot 2017.01-00319-gfe893f73f0e4-dirty (Sep 28 2017 - 07:47:12 -0500)

    CPU  : DRA752-GP ES1.1
    Model: TI DRA742
    Board: DRA74x EVM REV G.0
    DRAM:  1.5 GiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    SCSI:  SATA link 0 timeout.
    AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
    flags: 64bit ncq stag pm led clo only pmp pio slum part ccc apst
    scanning bus for devices...
    Found 0 device(s).
    Net:   eth0: ethernet@48484000
    Hit any key to stop autoboot:  0
    MMC: no card present
    MMC: no card present
    MMC: no card present
    MMC: no card present
    switch to partitions #0, OK
    mmc1(part 0) is current device
    SD/MMC found on device 1
    ** Invalid partition 2 **
    =>

    Steve K.

  • Forgot one important step, make the boot partition rw before trying to write to it

    echo 0 > /sys/block/mmcblk1boot0/force_ro

    Steve K.
  • Hi,

    Although I wasn't able to solve the problem by doing the changes you mentioned, but however I found the solution to it.
    it was in this function call,

    err = mmc_switch_part(0, part);

    From spl_mmc_load_image() function , it was doing mmc switch for mmc block device 0.
    But, our EMMC was getting detected on mmc block device 1.
    So, by changing mmc_switch_part(1, part), I was able to load my uboot image from emmc boot partition successfully.

    Thanks for your response.

    Regards,
    Gunjal