Project

General

Profile

Boot EMMC

NOTE: The AM62x has multiple MMC interfaces. The EMMC is configured on MMC1

To boot the Dev Kit from EMMC using a CL supplied image, set the boot pins as follows:
Reference: TRM Section 5.3 "Boot Mode Pins"

B9 B8 B7 B6 B5 B4 B3
Reserved (X) Reserved (X) Reserved (X) 1 0 0 1

emmc_boot.jpg

Based on the TI wiki procedure ( https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/08_03_00_19/exports/docs/linux/Foundational_Components/U-Boot/UG-Memory.html )

EMMC Layout

             boot0 partition (4 MB)                        user partition
     0x0+----------------------------------+      0x0+-------------------------+
        |      tiboot3.bin (512 KB)        |         |                         |
  0x8000+----------------------------------+         |                         |
        |        tispl.bin (2 MB)          |         |                         |
0x280000+----------------------------------+         |        rootfs           |
        |      u-boot.img (1.412 MB)       |         |                         |
0x3E1000+----------------------------------+         |                         |
        |      environment (124 KB)        |         |                         |
0x400000+----------------------------------+         +-------------------------+

Steps

  • Optional: Run through Clearing_the_eMMC if you want to test flashing a clean eMMC
  • Boot to linux using a valid sd card image
  • Make the partition label
    root@mitysom-am62x:~# parted /dev/mmcblk0 mklabel gpt
    
  • Make the partiton
    root@mitysom-am62x:~# parted /dev/mmcblk0 mkpart primary ext4 0% 100%
    
  • Print the newly created partition
    root@mitysom-am62x:~# parted /dev/mmcblk0 print
    Model: MMC KC3032 (sd/mmc)
    Disk /dev/mmcblk0: 31.3GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags:
    
    Number  Start   End     Size    File system  Name     Flags
     1      1049kB  31.3GB  31.3GB               primary
    
    
  • Manually mount the partition or Reboot
    root@mitysom-am62x:~# mkfs.ext4 /dev/mmcblk0p1
    root@mitysom-am62x:~# mkdir /run/media/mmcblk0p1
    root@mitysom-am62x:~# mount /dev/mmcblk0p1 /run/media/mmcblk0p1
    
    or
    
    root@mitysom-am62x:~# reboot
    
  • Check the partition table
    *root@mitysom-am62x:~# lsblk
    NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    mmcblk0      179:0    0 58.3G  0 disk
    `-mmcblk0p1  179:1    0 58.3G  0 part /run/media/mmcblk0p1
    mmcblk0boot0 179:32   0    4M  1 disk
    mmcblk0boot1 179:64   0    4M  1 disk
    mmcblk1      179:96   0 29.8G  0 disk
    |-mmcblk1p1  179:97   0  128M  0 part /run/media/boot-mmcblk1p1
    `-mmcblk1p2  179:98   0 29.7G  0 part /*
    
  • enable writing to the mmbblk0boot0 partition
    root@mitysom-am62x:~# echo 0 > /sys/block/mmcblk0boot0/force_ro
    
  • Copy the needed images from the SD card to the eMMC boot partition
    root@mitysom-am62x:~# cd /run/media/boot-mmcblk1p1
    root@mitysom-am62x:~# dd if=tiboot3.bin of=/dev/mmcblk0boot0 bs=512 seek=0
    root@mitysom-am62x:~# dd if=tispl.bin of=/dev/mmcblk0boot0 bs=512 seek=1024
    root@mitysom-am62x:~# dd if=u-boot.img  of=/dev/mmcblk0boot0 bs=512 seek=5120
    
  • Enable the boot partition of the eMMC device
    root@mitysom-am62x:~# mmc bootpart enable 1 1 /dev/mmcblk0
    root@mitysom-am62x:~# mmc bootbus set single_backward x1 x8 /dev/mmcblk0
    
  • Copy the filesystem
    root@mitysom-am62x:~# mkdir -p /mnt/sd-rootfs
    root@mitysom-am62x:~# mkdir -p /mnt/emmc-rootfs
    root@mitysom-am62x:~# mount /dev/mmcblk1p2 /mnt/sd-rootfs
    root@mitysom-em62x:~# umount /dev/mmcblk0p1
    root@mitysom-am62x:~# mkfs.ext4 /dev/mmcblk0p1
    root@mitysom-am62x:~# mount /dev/mmcblk0p1 /mnt/emmc-rootfs/
    root@mitysom-am62x:~# cp -a /mnt/sd-rootfs/* /mnt/emmc-rootfs/
    
  • Power off the board by toggling the S1 switch
  • Set the boot mode to boot from the eMMC and remove the SD card
    SW1 BM7-0 = x1001xxx
    SW2 BM15-8 = 000000xx

emmc_boot.jpg

  • Toggle S1 to power on the board, and you should successfully boot to the login prompt.
  • Check to make sure we have booted from eMMC
    root@mitysom-am62x:~# lsblk
    NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    mmcblk0      179:0    0 58.3G  0 disk
    `-mmcblk0p1  179:1    0 58.3G  0 part /    <----- */ should be on eMMC partition*
    mmcblk0boot0 179:32   0    4M  1 disk
    mmcblk0boot1 179:64   0    4M  1 disk
    
  • To test if eMMC fallback is functional, Toggle S1 to turn off the board, insert the SD card, power on and you should boot to linux.
  • Run the following command
    root@mitysom-am62x:~# lsblk
    NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    mmcblk0      179:0    0 58.3G  0 disk
    `-mmcblk0p1  179:1    0 58.3G  0 part /run/media/mmcblk0p1
    mmcblk0boot0 179:32   0    4M  1 disk
    mmcblk0boot1 179:64   0    4M  1 disk
    mmcblk1      179:96   0 29.8G  0 disk
    |-mmcblk1p1  179:97   0  128M  0 part /run/media/boot-mmcblk1p1
    `-mmcblk1p2  179:98   0 29.7G  0 part /    <----- */ should be on MMC partition*
    

Hardware Reset setting

NOTE: We enable hw reset in our factory test environment, setting this yourself should not be necessary.

The eMMC part ships with hardware reset disabled. This caused reset/reboot to hang when booting from the eMMC.
To fix this, the HW reset needs to be enabled in the part. This is done by writing a 1 to the RST_N_FUNCTION CSD register in the part.
THIS IS A ONE-TIME-PROGRAMMABLE VALUE
If you write a 2 to this register, you will permanently DISABLE reset and effectively prevent using the eMMC as a boot device.

From linux

root@mitysom-am62x:~# mmc hwreset enable /dev/mmcblk0

The state of this register can be checked using the extcsd read command
root@mitysom-am62x:~# mmc extcsd read /dev/mmcblk0 | grep RST
H/W reset function [RST_N_FUNCTION]: 0x01

From U-Boot

mmc rst-function 0 1

Go to top
Add picture from clipboard (Maximum size: 1 GB)