Enable SD Card on custom carrier board

Hi,

We have a custom carrier board for a Jetson Nano, and we are unable to automatically detect the SD card. The only way the card is recognized is by setting GPIO07 to HIGH through a script. We’ve tried many configurations as suggested in various threads, but nothing has changed.

Here is the device tree overlay we are using:

fragment@0 {
    target = <&sdmmc3>;
    __overlay__ {
        status = "okay";
        max-clk-limit = <48000000>;
        nvidia,vmmc-always-on;
        sd-uhs-sdr104;
        no-sdio;
        no-mmc;
    };
};

The nvidia,vmmc-always-on property allows us to detect the SD card through the script, but we need to boot from the SD card, so we have to set that PIN high on power on.

Additionally, here is the output of cat /sys/kernel/debug/mmc1/ios before and after setting that PIN high, in case it helps:
Before:

clock:		300000 Hz
vdd:		21 (3.3 ~ 3.4 V)
bus mode:	2 (push-pull)
chip select:	0 (don't care)
power mode:	2 (on)
bus width:	0 (1 bits)
timing spec:	0 (legacy)
signal voltage:	0 (3.30 V)
driver type:	0 (driver type B)

After:

clock:		204000000 Hz
vdd:		21 (3.3 ~ 3.4 V)
bus mode:	2 (push-pull)
chip select:	0 (don't care)
power mode:	2 (on)
bus width:	2 (4 bits)
timing spec:	6 (sd uhs SDR104)
signal voltage:	1 (1.80 V)
driver type:	0 (driver type B)

Although I am a developer, my understanding of device tree is quite limited, sorry for that.
If carrier board schematics are needed, I can provide them.

Thanks in advance.

You should share what is “GPIO07” doing in your design.

Search cd-gpios and vmmc-supply in other posts. This question has been asked many times. These two keywords will help.


Screenshot 2024-06-17 145813

Yes, you didn’t configure anything related to what I just told.

cd-gpios is for card detection gpio. Didn’t see you add for SD2_CD_B
vbus-supply should have a regulator that is using GPIO07 as control. Didn’t see it either.

BTW, this won’t really happen if you understand the boot flow. Modifying kernel would only make you able to detect sdcard in kernel. It won’t let you really boot from it.

Yes I know it won’t really boot from SD card.

SD2_CD_B is connected to GPIO08.
Btw, we changed vmmc-supply basing on the SD regulator address and it finally works.

Thank you.

1 Like

If you need to hotplug the sdcard, then you need to configure cd-gpios too.

The SD card won’t be removable, thanks.

then please add “non-removable” to the sdhci DT.

Ok, everything is working well now.
I’ll post the overlay and some minor changes in case someone encounters the same issues.

/dts-v1/;
/plugin/;

#include <dt-bindings/pinctrl/tegra210-p3448-0000-p3449-0000-a02.h>
#include <dt-bindings/pinctrl/pinctrl-tegra.h>

/ {
	overlay-name = "reComputer sdmmc";
	jetson-header-name = "Jetson 40pin Header";
	compatible = "nvidia,p3449-0000-b00+p3448-0002-b00", "nvidia,jetson-nano", "nvidia,tegra210";

	fragment@0 {
		target = <&sdmmc3>;
		__overlay__ {
			status = "okay";
			max-clk-limit = <48000000>;
			nvidia,vmmc-always-on;
			sd-uhs-sdr104;
			no-sdio;
			no-mmc;
			vmmc-supply = <0x9d>; /* regulator@3 phandle value */
			non-removable;
		};
	};
};

In the DTB, we manually changed regulator@3 GPIO values as follows:

regulator@3 {
			compatible = "regulator-fixed-sync";
			reg = <0x3>;
			regulator-name = "vdd-3v3-sd";
			regulator-min-microvolt = <0x325aa0>;
			regulator-max-microvolt = <0x325aa0>;
			gpio = <0x5b 0xa8 0x1>; // 0xa8 is GPIO07 address, found in cat /sys/kernel/debug/gpio
			enable-active-high;
			regulator-boot-on;
			vin-supply = <0x4c>;
			linux,phandle = <0x9d>;
			phandle = <0x9d>;
		};

Finally, we changed “extlinux.conf” as follows:

TIMEOUT 30
DEFAULT primary
MENU TITLE L4T boot options
LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} quiet root=/dev/mmcblk1p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 sdhc_tegra.en_boot_part_access=1 pcie_aspm=off

Now it loads the rootfs from the SD card.

Thank you again.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.