Micro-SD card on custom jetson nano

This is still not working. I followed the steps froms severals post, like this one: https://forums.developer.nvidia.com/t/microsd-card-not-detected-on-jetson-nano-production-module/80776

Here are the files that I have modified:

hardware/nvidia/platform/t210/common/kernel-dts/t210-common-platforms/tegra210-p2530-common.dtsi

changing sdhci@700b0400 status at “okay”.

hardware/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi b/hardware/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
override@1 {
 				target = <&sdhci2>;
 				_overlay_ {
-					vmmc-supply = <&max77620_ldo6>;
+					status = "okay";
+					vqmmc-supply = <&max77620_ldo6>;
 					no-sdio;
 					no-mmc;
 					sd-uhs-sdr104;
hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi

sdhci@700b0400 {
-		status = "disabled";
+		status = "okay";
		/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>;
+		tap-delay = <3>;
	};

And added in the dts file tegra210-p3448-0002-p3449-0000-b00.dts

sdhci@700b0400 {
		status = "okay";
		cd-gpios = <&gpio TEGRA_GPIO(Z, 2) 0>;
		/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>;
		tap-delay = <3>;
	};

Then I rebuild everything and flashed the board but it isn’t detecting the micro-sd card.

Honestly, I don’t know if I’m doing something wrong, if the cd-gpio I added is correct or what.

Here is the latest dmesg and the dtb. Please, let me know if I need to add any more data.

dmeg.txt (63.2 KB)
tegra210-p3448-0002-p3449-0000-b00.dtb (237.7 KB)

Please check this page → Device tree debug tips.
https://elinux.org/Jetson/General_debug

You can use the node in that path to see if your patch is really on the device.

According to your dmesg, it looks like your change is not taking effect at all. At least the sdhci@700b0400 is not enabled.

There are some possibilities

  1. Your dtb didn’t get flashed into the board at all.

  2. Your dtb does not include the patch you added.

For (2), you can use the dtc tool to convert the dtb back to a full dts file and check.

I looked into my device and said that sdhci@700b0400 is enabled:

:/proc/device-tree$ xxd sdhci@700b0400/status
00000000: 6f6b 6179 00                             okay.

Ok, then do you have vmmc-supply in your device tree?

There are only few things that are necessary for enabling the sdcard slot.

  1. controller has to be enabled.

  2. cd-gpios to detect the card

  3. vmmc-supply to provide the sdmmc the power. If this one is missing, then it will just give you no response in log.

And all actually for later user to enable sd slot on sdmmc3, this thread includes all the patches needed.

I did everything it says here:

That thread seems missing the vmmc-supply. Please add it.

Is it just adding vmmc-always-on in sdhci@700b0400 ?

If your power supply to the sdmmc is just a system 3.3v power source and there is no gpio to control it, then that one is a always-on power source and you need to add the always on property to the sdhci@700b0400.

And also need to add something like vmmc-supply = <&max77620_ldo6>;.

The supply here should be a 3v3 power source. You can track your dts and see what does max77620_ldo6 indicate.
This is regulator framework provided in linux kernel, not nvidia rule.

1 Like

Hi,

I notice there is another error here.

[ 1.425646] sdhci-tegra: probe of sdhci-tegra.2 failed with error -16

Can you try to add some debug print inside kernel/kernel-4.9/drivers/mmc/host/sdhci-tegra.c ->sdhci_tegra_probe and see which one gets the error return?

Since “16” in linux error code is “busy resources”, I can only guess something in your device tree is occupied by other driver. In such case, mostly it is the gpio.

Your problem is similar to this. Probably cd-gpios is in use by another driver.

Hi, I added vmmc-supply and I changed the cd-gpio. Now I don’t see that error from sdhci-tegra but the sd still doesn’t work.

I’m going to check the board, see if the voltage is changing to try to detect the micro-sd card and make sure that this is not a hardware issue.

All the changes I’m making for sdhci@700b0400, in which file should I make them, in tegra210-porg-p3448-common.dtsi or in tegra210-p3448-0002-p3449-0000-b00.dts? Because I’m getting confuse with that and maybe I’m making the changes in the wrong file.

dmesg.txt (65.0 KB)
tegra210.dts (327.0 KB)

Hi,

There is no 100% correct answer in device tree world for where you should put the file.

The structure is like A.dtsi → B.dtsi → C.dtsi → … → and finally the tegra210-p3448-0002-p3449-0000-b00.dts.
Above means B.dtsi includes A.dtsi, and B is again included by C. And keep going.

You can write anything inside A, for example, you can enable sdhci or add cd-gpios to A. However, they have chance to be overwritten by later dts like B,C,D…

If you want a concrete answer for where to put the property, then tegra210-p3448-0002-p3449-0000-b00.dts will be the one you need. But if you are sure adding to previous dtsi can take effect, then it is ok too.

Actually, I don’t memorize what file should I do the modification. What I do every time is just check what files are included and track down the code. It is a little unrealistic for me to remember every dtsi file since I have to work with every jetson platforms.

For your current issue, you give vmmc-supply the vddio-sdmmc3-ap. Sorry that I think that might be wrong because this one only has 2.8V. Please try with vdd-3v3-sd which is a contant 3v3 regulator.

1 Like

To give vmmc-supply the vdd-3v3-sd, do I have to make the next change into the dts?

sdhci@700b0400 {
         // vmmc-supply = <&max77620_ldo6>;
        vmmc-supply = <&p3448_vdd_3v3_sys>;
};

Yes, just make sure this node is mapping to the vdd-3v3-sd regulator.

Still not working :(

We tried the board and it’s getting 3.3v.

tegra210.dts (326.9 KB)
dmesg.txt (65.6 KB)

Hi,

If you hotplug the sdcard, will the dmesg print new log from it?

I just notice there is still no “nvidia,vmmc-always-on” in your sdhci controller. Can you add it too?

With this the driver would take your 3.3v power as always on.

Hi,

I did the hotplug and there is no newline.

I added the “nvidia,vmmc-always-on” but then remove it because I asked what you told me here

about the sdmmc and they told me that it wasn’t necessary to add it. I’ll add it again.

Sorry that my previous description is not completed.

The correct one is

  1. If you have a gpio to control the 3.3v power, then you have to write your own regulator in the device tree as below document says.

https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/gpio-regulator.txt

And assign the regulator to the vmmc-supply. Currently, p3448_vdd_3v3_sys is a fake 3.3v power regulator that we provided in original dts. This fake one is a always-on power. When the system is ON, then it will be always on.

  1. However, some users’ sdcard slot can be working with nvidia,vmmc-always-on even when they use a gpio to control it. Just make sure the VDD IN to sdmmc is really 3.3v.

Thus, we can take (2) as a easy option here first.