There can only be one SD card in town

On the Aries MCV, the MMC pins of the HPS are already used to control the MMC flash. However, we need an SD card. So, we decided to add a µSD card on the SPI1 interface because SD cards can be controlled in SPI. So, I added the µSD card to the SPI1 interface like this:

&spi1 {
	status = "okay";
	clock-frequency = <100000000>;

	mmc-slot@0 {
		reg = <0>;
		compatible = "mmc-spi-slot";
		spi-max-frequency = <50000000>;
		voltage-ranges = <3300 3300>;
	};
	
};

Before testing on the MCV, we realize tests on the DE1-SoC. Something to notice, we already built the Linux kernel for the DE1-SoC and it booted correctly without the SD card on the SPI interface.

But now, after I have added the SD card on the SPI1 interface, the SD card is correctly detected, as you can see below but, the DE1-SoC cannot boot correctly anymore.

[    1.391468] mmc_spi spi0.0: SD/MMC host mmc0, no WP, no poweroff, cd polling

Here you can see the last instructions realized when I tried to boot with the SD card:

[    1.604256] Waiting for root device /dev/mmcblk0p2...
[    1.641248] mmc_host mmc1: Bus speed (slot 0) = 12500000Hz (slot req 50000000Hz, actual 12500000HZ div = 0)
[    1.651051] mmc1: new high speed SDHC card at address 0007
[    1.657101] mmcblk1: mmc1:0007 SD8GB 7.42 GiB 
[    1.664231]  mmcblk1: p1 p2 p3
[    1.818801] usb 1-1: new high-speed USB device number 2 using dwc2
[    1.849495] hub 1-1:1.0: USB hub found
[    1.853298] hub 1-1:1.0: 2 ports detected
[    6.915128] random: crng init done

An here the same instructions without the SD card:

[    1.574009] Waiting for root device /dev/mmcblk0p2...
[    1.607680] mmc_host mmc0: Bus speed (slot 0) = 12500000Hz (slot req 50000000Hz, actual 12500000HZ div = 0)
[    1.617498] mmc0: new high speed SDHC card at address 0007
[    1.623583] mmcblk0: mmc0:0007 SD8GB 7.42 GiB 
[    1.630987]  mmcblk0: p1 p2 p3
[    1.639829] EXT4-fs (mmcblk0p2): mounting ext3 file system using the ext4 subsystem
[    1.763679] random: fast init done
[    1.828610] usb 1-1: new high-speed USB device number 2 using dwc2
[    1.859334] hub 1-1:1.0: USB hub found
[    1.863147] hub 1-1:1.0: 2 ports detected
[    3.670590] EXT4-fs (mmcblk0p2): recovery complete
[    4.115559] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    4.123693] VFS: Mounted root (ext3 filesystem) on device 179:2.
[    4.131474] devtmpfs: mounted
[    4.136793] Freeing unused kernel memory: 1024K
[    4.141570] Run /sbin/init as init process

It seems to look for a specific partition inside the first SD card it finds (mmcblk0). It seems to be an EXT 4 or EXT 3 partition. When I look inside the boot sd card, this partition matches the root of the file system. However, this is not present in the µSD Card in SPI.

So, I have to find how can I choose which SD card has to be checked to look for the root of the file system.

Leave a Reply

Your email address will not be published. Required fields are marked *