How to enable Xavier NX SDIO to identify sd card slot?

Hello forum,

I have a 16G-EMMC NX with Jetpack4.4 working on our carrier board,HW sdcard slot connect to NX SDMMC3_HV (3.3V Capable), and I can’t find the sdcard info when system power up.
Do I need modify kernel & dts code to enable sdmmc3?

Thanks.

Yes, you need to modify the dts code.

Thanks WayneWWW,

I have checked the topic you mentioned.

I got an error when sd card hotplug.
[ 319.277527] mmc1: Enabling vmmc regulator
[ 319.351241] mmc1: CMD CRC or end bit error, int mask 0x20001
[ 319.352795] mmc1: error -110 whilst initialising SD card
[ 319.573457] mmc1: Disabling vmmc regulator
[ 319.948817] mmc1: Enabling vmmc regulator
[ 320.023223] mmc1: CMD CRC or end bit error, int mask 0x20001
[ 320.023674] mmc1: error -123 whilst initialising SD card
[ 320.297147] mmc1: error -110 whilst initialising SD card

this is dmesg info:dmesg.log (64.7 KB)

my dts code in file tegra194-p3668-common.dtsi:
+++ add sdmmc3 +++

sdmmc3: sdhci@3440000 {
	mmc-ocr-mask = <0x0>;
	cd-inverted;
	cd-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 2) 0>;
	nvidia,cd-wakeup-capable;
	mmc-ocr-mask = <0>;
	cd-inverted;
	vmmc-supply = <&p3668_vdd_sdmmc1_sw>;
	status = "okay";
};

nvidia@nvidia:~$ cat /proc/device-tree/sdhci@3440000/status
okay

I don’t know why the error happend.

Kind regards,

Do you use the same GPIO as p3668_vdd_sdmmc1_sw for vmmc-supply?

Hello,WayneWWW,
p3668_vdd_sdmmc1_sw and cd-gpios is not the same GPIO.
TEGRA194_MAIN_GPIO(Q, 2) GPIO8 is for sdmmc3 cd-gpios and 3668_vdd_sdmmc1_sw use TEGRA194_MAIN_GPIO(G, 2).

Hi,

Then that pin is cd-pin but not vmmc-supply. If you don’t have a pin for sdmmc_vdd_en, please add nvidia,vmmc-always-on in the controller and set vmmc-supply to battery_reg.

Thank you WayneWWW,

I changed dts code as below:

sdmmc3: sdhci@3440000 {
	mmc-ocr-mask = <0x0>;
	cd-inverted;
	cd-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 2) 0>;
	nvidia,cd-wakeup-capable;
	nvidia,vmmc-always-on;
	mmc-ocr-mask = <0>;
	cd-inverted;
	vmmc-supply = <&battery_reg>;
	status = "okay";
};

got error:
[ 5.174304] sdhci-tegra 3440000.sdhci: could not set regulator OCR (-22)
[ 5.177355] sdhci-tegra 3440000.sdhci: could not set regulator OCR (-22)
[ 5.185332] sdhci-tegra 3440000.sdhci: could not set regulator OCR (-22)
[ 5.188775] sdhci-tegra 3440000.sdhci: could not set regulator OCR (-22)
[ 5.212600] sdhci-tegra 3440000.sdhci: could not set regulator OCR (-22)

could you point me where should I to add “nvidia,vmmc-always-on”

Many thanks.

Hi,

Will you see this error if you directly remove vmmc-supply = <&battery_reg>;?

Hi WayneWWW,

remove vmmc-supply = <&battery_reg>; then no " could not set regulator OCR" error,but sd card still not being detected:

[ 61.686363] mmc1: error -123 whilst initialising SD card
[ 62.827586] mmc1: error -110 whilst initialising SD card

dmesg |grep sd

[ 0.720516] iommu: Adding device 3460000.sdhci to group 6
[ 0.721081] iommu: Adding device 3440000.sdhci to group 7
[ 0.799371] vdd-sdmmc1-sw: 3300 mV
[ 0.799720] vdd-1v8-sd: 1800 mV
[ 0.924287] vddio-sdmmc1-3v3: at 3300 mV
[ 1.548896] sd: No Scsi addr parsed to reserve index
[ 2.001209] sdhci: Secure Digital Host Controller Interface driver
[ 2.001212] sdhci: Copyright© Pierre Ossman
[ 2.001214] sdhci-pltfm: SDHCI platform and OF driver helper
[ 2.002556] sdhci-tegra 3460000.sdhci: Client registration for eMC Successful
[ 2.004849] sdhci-tegra 3440000.sdhci: Got CD GPIO
[ 2.005845] sdhci-tegra 3440000.sdhci: Client registration for eMC Successful
[ 2.007377] sdhci-tegra 3440000.sdhci: wakeup init done, cdirq 321
[ 2.046148] mmc0: SDHCI controller on 3460000.sdhci [3460000.sdhci] using ADMA 64-bit with 64 bit addr
[ 2.062363] mmc1: SDHCI controller on 3440000.sdhci [3440000.sdhci] using ADMA 64-bit with 64 bit addr
[ 2.092176] mmc0: mmc_decode_ext_csd: CMDQ supported: depth: 31, cmdq_support: 1
[ 3.448044] vdd-sdmmc1-sw: disabling
[ 3.448048] vdd-1v8-sd: disabling
[ 4.166012] cgroup: cgroup2: unknown option “nsdelegate”
[ 4.233427] sd 0:0:0:0: [sda] 122142720 512-byte logical blocks: (62.5 GB/58.2 GiB)
[ 4.234253] sd 0:0:0:0: [sda] Write Protect is off
[ 4.234284] sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
[ 4.235107] sd 0:0:0:0: [sda] No Caching mode page found
[ 4.235322] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 4.243106] sd 0:0:0:0: [sda] Attached SCSI removable disk

Please share the full one as a txt file. You don’t need to grep something for me.

ok,dmesg logdmesg.log (64.5 KB)

dmesg.txtdmesg.log (64.5 KB)

Hi WayneWWW,
Our carrier board has no PM ic,is it a matter to this sd card detect?

Hi,

Looks like you still need to set battery_reg here. Also, one patch( 9875882.diff (1).zip) is needed. Please check if your kernel has it or not.

Hi WayneWWW,
I apply the patch file, rebuild kernel add battery_reg to dtb,and still got error “could not set regulator OCR”.
About kernel I only replace Image, with this patch below driver is rebuild too:
CC drivers/misc/cb710/cb710.mod.o
CC drivers/misc/mods/mods.mod.o
LD [M] drivers/mmc/host/cb710-mmc.ko
LD [M] drivers/mmc/host/mmc_spi.ko
LD [M] drivers/mmc/host/mtk-sd.ko
LD [M] drivers/mmc/host/of_mmc_spi.ko
LD [M] drivers/mmc/host/tifm_sd.ko
LD [M] drivers/mmc/host/toshsd.ko
LD [M] drivers/mmc/host/usdhi6rol0.ko
LD [M] drivers/mmc/host/ushc.ko
LD [M] drivers/mmc/host/via-sdmmc.ko
LD [M] drivers/mmc/host/vub300.ko
Do I have to replace them too?

dmesg after apply patchdmesg.txt (65.9 KB)

Hello WayneWWW,

We found HW esd problem,fix it and test again,I got error “mmc1: Data CRC error”.
9875882.diff (1).zip patch applied,
dtsi code as below:

sdmmc3: sdhci@3440000 {
	mmc-ocr-mask = <0x0>;
	cd-inverted;
	cd-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 2) 0>;
	nvidia,cd-wakeup-capable;
	nvidia,vmmc-always-on;
	mmc-ocr-mask = <0>;
	cd-inverted;
	vmmc-supply = <&battery_reg>;
	status = "okay";
};

dmesg kernel-dmesg.txt (101.3 KB)

What did I miss?

Thanks