Microchip-Ethernet / EVB-KSZ9477

Repository for using Microchip EVB-KSZ9477 board. Product Supported: KSZ9477, KSZ9567, KSZ9897, KSZ9896, KSZ8567, KSZ8565, KSZ9893, KSZ9563, KSZ8563, LAN9646, Phys(KSZ9031/9131, LAN8770
76 stars 78 forks source link

MMC Boot fails with SD version 3 cards #50

Open danglin44 opened 3 years ago

danglin44 commented 3 years ago

We are seeing problems booting from SD version 3 cards. The failure is somewhat random but failure is much more likely. This occurs when u-boot attempts to load the uboot.env file.

RomBOOT

AT91Bootstrap 3.8.5 (Sat Oct 24 12:39:36 EDT 2020)

SD/MMC: Image: Read file u-boot.bin to 0x26f00000 SD: Card Capacity: High or Extended SD: Specification Version 3.0X SD/MMC: Done to load image

U-Boot 2016.03-linux4sam_5.3 (Oct 24 2020 - 12:39:49 -0400)

CPU: SAMA5D36 Crystal frequency: 12 MHz CPU clock : 528 MHz Master clock : 132 MHz I2C: ready DRAM: 256 MiB NAND: 256 MiB MMC: mci: 0 Card did not respond to voltage select! Bad device mmc 0 Using default environment

In: serial Out: serial Err: serial Net: gmac0 Hit any key to stop autoboot: 0 => mmcinfo Device: mci Manufacturer ID: 3 OEM: 5344 Name: SC32G Tran Speed: 50000000 Rd Block Len: 512 SD version 3.0 High Capacity: Yes Capacity: 29.7 GiB Bus Width: 4-bit Erase Group Size: 512 Bytes

It seems that after RomBOOT loads u-boot the SD card is left in a state where partition 1 is not accessible. But after u-boot attempts to load uboot.env, the fatls and fatload commands work fine using "mmc 0:1".

After some trial and error, I found this patch fixes the loading of uboot.env: sama5d3_xplained.c.txt and the board then boots linux successfully.

The patch cycles the power on the SD card once just before uboot.env is loaded.

However, all is not well. If you interrupt the boot in u-boot, the "mmc part" command fails. There are also errors if one attempts to change the default device and partition with "mmc dev".

Don't know enough about SD cards or u-boot to fix this.