STM32MP1 Boot from eMMC and switch boot source after OTP
Currently I am trying to set up the emmc boot on a stm32mp157. I have mirrored the partitions of a working SD card to the emmc with:
sgdisk -e /dev/mmcblk1
sgdisk -R=/dev/mmcblk2 /dev/mmcblk1
sgdisk -G /dev/mmcblk2
dd if=/dev/mmcblk1p1 of=/dev/mmcblk2p1 bs=512 conv=fdatasync
dd if=/dev/mmcblk1p2 of=/dev/mmcblk2p2 bs=512 conv=fdatasync
dd if=/dev/mmcblk1p3 of=/dev/mmcblk2p3 bs=512 conv=fdatasync
dd if=/dev/mmcblk1p4 of=/dev/mmcblk2p4 bs=512 conv=fdatasync
dd if=/dev/mmcblk1p5 of=/dev/mmcblk2p5 bs=512 conv=fdatasync
dd if=/dev/mmcblk1p6 of=/dev/mmcblk2p6 bs=512 conv=fdatasync
echo 0 > /sys/block/mmcblk2boot0/force_ro
dd if=/dev/mmcblk1p1 of=/dev/mmcblk2boot0 bs=512 conv=fdatasync
echo 1 > /sys/block/mmcblk2boot0/force_ro
echo 0 > /sys/block/mmcblk2boot1/force_ro
dd if=/dev/mmcblk1p2 of=/dev/mmcblk2boot1 bs=512 conv=fdatasync
echo 1 > /sys/block/mmcblk2boot1/force_ropartition is fsbl1, fsbl2, ssbl, boot, rootfs1, rootfs2.
Then i used the OTP boot device config to set the primary and secondary boot option (because i have only acces to boot pin 2) with:
fuse prog 0 3 0x1c000000=> This should be primary = eMMc and secondary = SD
Finally a set the boot partition with:
mmc partconf 1 1 1 0After reboot i get the following output from First Stage Bootloade (FSBL):
U-Boot SPL 2020.01-stm32mp-r1-dirty (May 29 2020 - 12:00:46 +0000)
Model: hp00164
RAM: DDR3-DDR3L 16bits 533000Khz
WDT: Not found!
Trying to boot from MMC2
spl: could not initialize mmc. error: -19
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###the emmc was already working. I previously put my uboot variables there so I could edit and read them from linux side.
Questions:
- How can i clear my emmc now, respectively how can i boot from sd card again?
- What have I missed that the mmc can not be initialized?
