I/O Error on SD Card over SDMMC3

Hi,

I’m having troubles setting up an SD card connection over SDMMC3.
In the OS I can spot the SD card (it shows up under /dev/mmcblk1) and I can inspect basic things like size and the name of the SD card, but I cannot mount (it gives an I/O error). Also when trying to format using fdisk, it disappears again.

Our hardware setup can be seen below.

We’ve done some changes to the device tree (looking at threads like MicroSD card not detected on Jetson Nano production module), these can be seen below. Also tried with nvidia,function=“sdmmc3” in the pinmux file, to no avail.

diff --git a/platform/t210/jetson/kernel-dts/tegra210-jetson-cv-base-p2597-2180-a00.dts b/platform/t210/jetson/kernel-dts/tegra210-jetson-cv-base-p2597-2180-a00.dts
index f44fa10..084d718 100644
--- a/platform/t210/jetson/kernel-dts/tegra210-jetson-cv-base-p2597-2180-a00.dts
+++ b/platform/t210/jetson/kernel-dts/tegra210-jetson-cv-base-p2597-2180-a00.dts
@@ -900,8 +900,8 @@
 			gpio-controller;
 			#gpio-cells = <2>;
 			reg = <0x77>;
-			interrupt-parent = <&gpio>;
-			interrupts = <TEGRA_GPIO(Z, 2) 0x0>;
+			//interrupt-parent = <&gpio>;						//remove
+			//interrupts = <TEGRA_GPIO(Z, 2) 0x0>;					//remove GPIO Z2 is used for SD card detection
 			#interrupt-cells = <2>;
 			interrupt-controller;
 			vcc-supply = <&battery_reg>;
diff --git a/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi b/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi
index 4fe15ed..92345ea 100644
--- a/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi
+++ b/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi
@@ -354,7 +354,7 @@
 
 			pz2 {
 				nvidia,pins = "pz2";
-				nvidia,function = "sdmmc3";
+				nvidia,function = "rsvd2";
 				nvidia,pull = <TEGRA_PIN_PULL_UP>;
 				nvidia,tristate = <TEGRA_PIN_DISABLE>;
 				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
diff --git a/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pwm-fan.dtsi b/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pwm-fan.dtsi
index c7c26d3..2d2e5cc 100644
--- a/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pwm-fan.dtsi
+++ b/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pwm-fan.dtsi
@@ -26,7 +26,7 @@
 		step_time = <100>; /* mesecs */
 		state_cap = <7>;
 		active_pwm_max = <255>;
-		tach_gpio =  <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_LOW>; /* TEGRA_GPIO_PZ2 */
+		//tach_gpio =  <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_LOW>; /* TEGRA_GPIO_PZ2 */			//remove
 		pwm_gpio = <&gpio TEGRA_GPIO(E, 7) GPIO_ACTIVE_LOW>; /* TEGRA_GPIO_PE7 */
 		pwm_polarity = <PWM_POLARITY_NORMAL>;
 		suspend_state = <0>;
diff --git a/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi b/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
index 2dc032f..f9c19af 100644
--- a/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
+++ b/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
@@ -183,6 +183,7 @@
 				_overlay_ {
 					keep-power-in-suspend;
 					non-removable;
+				    status="okay";							//add
 				};
 			};
 		};
@@ -215,6 +216,7 @@
 			override@1 {
 				target = <&sdhci2>;
 				_overlay_ {
+				    status="okay";							//add
 					vqmmc-supply = <&max77620_ldo6>;
 					no-sdio;
 					no-mmc;
diff --git a/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts b/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
index 30ccb03..248c276 100644
--- a/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
+++ b/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
@@ -38,6 +38,10 @@
 		status = "disabled";
 	};
 
+	sdhci@700b0400 { /* SDMMC3 for SD card */				//added for sd card on JN30(fd)
+		status = "okay";
+	};
+
 	spi@70410000 { /* QSPI */
 		status = "disabled";
 	};
diff --git a/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi b/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi
index bf4875b..70239ef 100644
--- a/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi
+++ b/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi
@@ -278,13 +278,14 @@
 		max-clk-limit = <0xbebc200>;
 	};
 
-	sdhci@700b0400 {
-		status = "disabled";
+	sdhci@700b0400 { /* SDMMC3 for SD card on NANO */
+		status = "okay";				//change
 		/delete-property/ keep-power-in-suspend;
 		/delete-property/ non-removable;
 		mmc-ddr-1_8v;
 		mmc-ocr-mask = <3>;
 		uhs-mask = <0x0>;
+		//max-clk-limit = <400000>;			//remove it for all SD card to work with full speed
 		tap-delay = <3>;
 	};
 
diff --git a/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi b/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
index c65c30e..1eacc7f 100644
--- a/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
+++ b/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
@@ -65,6 +65,7 @@
 	};
 
 	sdmmc3: sdhci@700b0400 {
+		status="okay";							//add
 		tap-delay = <1>;
 		trim-delay = <3>;
 		mmc-ocr-mask = <0>;
@@ -75,6 +76,7 @@
 		calib-1v8-offsets = <0x7B7B>;
 		compad-vref-3v3 = <0x7>;
 		compad-vref-1v8 = <0x7>;
+		cd-gpios = <&gpio TEGRA_GPIO(Z, 2) 0>;				//add
 		pll_source = "pll_p", "pll_c4_out2";
 		resets = <&tegra_car TEGRA210_CLK_SDMMC3>;
 		reset-names = "sdhci";
@@ -93,8 +95,8 @@
                 cd-inverted;
                 wp-inverted;
 		pwrdet-support;
-		nvidia,min-tap-delay = <106>;
-		nvidia,max-tap-delay = <185>;
+		//nvidia,min-tap-delay = <106>;					//removed for all SD cards to work
+		//nvidia,max-tap-delay = <185>;					//removed for all SD cards to work
 		pinctrl-names = "sdmmc_schmitt_enable", "sdmmc_schmitt_disable", "sdmmc_clk_schmitt_enable", "sdmmc_clk_schmitt_disable", "sdmmc_drv_code", "sdmmc_default_drv_code", "sdmmc_e_33v_enable", "sdmmc_e_33v_disable";
 		pinctrl-0 = <&sdmmc3_schmitt_enable_state>;
 		pinctrl-1 = <&sdmmc3_schmitt_disable_state>;
diff --git a/soc/t210/kernel-dts/tegra210b01-soc/tegra210b01-soc-common-platform.dtsi b/soc/t210/kernel-dts/tegra210b01-soc/tegra210b01-soc-common-platform.dtsi
index e6da401..fe767f0 100644
--- a/soc/t210/kernel-dts/tegra210b01-soc/tegra210b01-soc-common-platform.dtsi
+++ b/soc/t210/kernel-dts/tegra210b01-soc/tegra210b01-soc-common-platform.dtsi
@@ -501,8 +501,8 @@
 	sdhci@700b0400 {
 		tap-delay = <11>;
 		trim-delay = <18>;
-		nvidia,min-tap-delay = <91>;
-		nvidia,max-tap-delay = <149>;
+		//nvidia,min-tap-delay = <91>;					//removed for all SD cards to work
+		//nvidia,max-tap-delay = <149>;					//removed for all SD cards to work
 		status = "disabled";
 	};

I’ve also attached the dmesg output during startup + while attempting to mount.
dmesg.log (88.1 KB)

Just check some latest posts. Actually, the most important components are vmmc-supply and cd-gpios.

There should be no need to remove max and min tap delay.

I’ve added the cd-gpios entry, as well as ‘nvidia,vmmc-always-on;’ just to be sure. I’m not sure about the vmmc-supply as it is not clearly explained in the thread you’ve mentioned (and other recent threads regarding the same topic). If I read thread Micro-SD card on custom jetson nano - #22 by mjnm I see that in the plugin-manager.dtsi vmmc-supply = <&max77620_ldo6>; is replaced by vqmmc-supply = <&max77620_ldo6>; which is also the case in my setup; do I need to change this (or somewhere else)?

diff --git a/node-installation/dekimo/custom-nvidia-dtsi/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts b/node-installation/dekimo/custom-nvidia-dtsi/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
index 248c276..0bff2f1 100644
--- a/node-installation/dekimo/custom-nvidia-dtsi/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
+++ b/node-installation/dekimo/custom-nvidia-dtsi/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
@@ -40,6 +40,7 @@
 
 	sdhci@700b0400 { /* SDMMC3 for SD card */				//added for sd card on JN30(fd)
 		status = "okay";
+		cd-gpios = <&gpio TEGRA_GPIO(Z, 2) 0>;
 	};
 
 	spi@70410000 { /* QSPI */
diff --git a/node-installation/dekimo/custom-nvidia-dtsi/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi b/node-installation/dekimo/custom-nvidia-dtsi/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
index 1eacc7f..b228282 100644
--- a/node-installation/dekimo/custom-nvidia-dtsi/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
+++ b/node-installation/dekimo/custom-nvidia-dtsi/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
@@ -77,6 +77,7 @@
 		compad-vref-3v3 = <0x7>;
 		compad-vref-1v8 = <0x7>;
 		cd-gpios = <&gpio TEGRA_GPIO(Z, 2) 0>;				//add
+		nvidia,vmmc-always-on;
 		pll_source = "pll_p", "pll_c4_out2";
 		resets = <&tegra_car TEGRA210_CLK_SDMMC3>;
 		reset-names = "sdhci";

The device tree needs to match your hardware design, but not just a give it as “always-on” without thinking the consequence.

What is your power source of SDMMC_VDD_EN?

Also, you should also check the debug method on the post you shared. I believe I already shared those method to mjnm.

Got it to work, seems like vqmmc-supply was not persisted all the way into the final device tree… Solution was to just include it in the tegra210-p3448-0002-p3449-0000-b00.dts, not sure if this is the best solution.
“always-on” was something we need to do given our hardware design.
I’ve left out the min/max tap delays, but had to leave the “max-clk-limit” commented out, as it gave us troubles when booting; didn’t really investigate any further there.

Final changes I had to do starting from the base dtsi files.

diff --git a/platform/t210/jetson/kernel-dts/tegra210-jetson-cv-base-p2597-2180-a00.dts b/platform/t210/jetson/kernel-dts/tegra210-jetson-cv-base-p2597-2180-a00.dts
index f44fa10..084d718 100644
--- a/platform/t210/jetson/kernel-dts/tegra210-jetson-cv-base-p2597-2180-a00.dts
+++ b/platform/t210/jetson/kernel-dts/tegra210-jetson-cv-base-p2597-2180-a00.dts
@@ -900,8 +900,8 @@
 			gpio-controller;
 			#gpio-cells = <2>;
 			reg = <0x77>;
-			interrupt-parent = <&gpio>;
-			interrupts = <TEGRA_GPIO(Z, 2) 0x0>;
+			//interrupt-parent = <&gpio>;						//remove
+			//interrupts = <TEGRA_GPIO(Z, 2) 0x0>;					//remove GPIO Z2 is used for SD card detection
 			#interrupt-cells = <2>;
 			interrupt-controller;
 			vcc-supply = <&battery_reg>;
diff --git a/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi b/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi
index 4fe15ed..92345ea 100644
--- a/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi
+++ b/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi
@@ -354,7 +354,7 @@
 
 			pz2 {
 				nvidia,pins = "pz2";
-				nvidia,function = "sdmmc3";
+				nvidia,function = "rsvd2";
 				nvidia,pull = <TEGRA_PIN_PULL_UP>;
 				nvidia,tristate = <TEGRA_PIN_DISABLE>;
 				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
diff --git a/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pwm-fan.dtsi b/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pwm-fan.dtsi
index c7c26d3..2d2e5cc 100644
--- a/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pwm-fan.dtsi
+++ b/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-pwm-fan.dtsi
@@ -26,7 +26,7 @@
 		step_time = <100>; /* mesecs */
 		state_cap = <7>;
 		active_pwm_max = <255>;
-		tach_gpio =  <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_LOW>; /* TEGRA_GPIO_PZ2 */
+		//tach_gpio =  <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_LOW>; /* TEGRA_GPIO_PZ2 */			//remove
 		pwm_gpio = <&gpio TEGRA_GPIO(E, 7) GPIO_ACTIVE_LOW>; /* TEGRA_GPIO_PE7 */
 		pwm_polarity = <PWM_POLARITY_NORMAL>;
 		suspend_state = <0>;
diff --git a/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi b/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
index 2dc032f..1cdb3d6 100644
--- a/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
+++ b/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
@@ -183,6 +183,7 @@
 				_overlay_ {
 					keep-power-in-suspend;
 					non-removable;
+				    status="okay";							//add
 				};
 			};
 		};
@@ -215,7 +216,7 @@
 			override@1 {
 				target = <&sdhci2>;
 				_overlay_ {
-					vqmmc-supply = <&max77620_ldo6>;
+				    status="okay";							//add
 					no-sdio;
 					no-mmc;
 					sd-uhs-sdr104;
diff --git a/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts b/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
index 30ccb03..0e16c3d 100644
--- a/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
+++ b/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
@@ -38,6 +38,11 @@
 		status = "disabled";
 	};
 
+	sdhci@700b0400 { /* SDMMC3 for SD card */				//added for sd card on JN30(fd)
+		status = "okay";
+		vqmmc-supply = <&max77620_ldo6>;
+	};
+
 	spi@70410000 { /* QSPI */
 		status = "disabled";
 	};
diff --git a/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi b/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi
index bf4875b..70239ef 100644
--- a/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi
+++ b/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi
@@ -278,13 +278,14 @@
 		max-clk-limit = <0xbebc200>;
 	};
 
-	sdhci@700b0400 {
-		status = "disabled";
+	sdhci@700b0400 { /* SDMMC3 for SD card on NANO */
+		status = "okay";				//change
 		/delete-property/ keep-power-in-suspend;
 		/delete-property/ non-removable;
 		mmc-ddr-1_8v;
 		mmc-ocr-mask = <3>;
 		uhs-mask = <0x0>;
+		//max-clk-limit = <400000>;			//remove it for all SD card to work with full speed
 		tap-delay = <3>;
 	};
 
diff --git a/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi b/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
index c65c30e..cbc00d6 100644
--- a/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
+++ b/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
@@ -65,6 +65,7 @@
 	};
 
 	sdmmc3: sdhci@700b0400 {
+		status="okay";							//add
 		tap-delay = <1>;
 		trim-delay = <3>;
 		mmc-ocr-mask = <0>;
@@ -75,6 +76,8 @@
 		calib-1v8-offsets = <0x7B7B>;
 		compad-vref-3v3 = <0x7>;
 		compad-vref-1v8 = <0x7>;
+		cd-gpios = <&gpio TEGRA_GPIO(Z, 2) 0>;				//add
+		nvidia,vmmc-always-on;
 		pll_source = "pll_p", "pll_c4_out2";
 		resets = <&tegra_car TEGRA210_CLK_SDMMC3>;
 		reset-names = "sdhci";
1 Like