Jetson TX2 NX L4T 32.7.1 SD card is not working

I am working on Jetson TX2 NX L4T 32.7.1 BSP and I have customized carrier board.
I have changed USB2.0 to host mode from OTG by below changes and my USB is not up, same changes I have made in L4T 32.5.1 based BSP and it works. I have attached my DTS file(tegra186-p3636-0001-p3509-0000-a01.dts)

tegra186-p3636-0001-p3509-0000-a01-modified.dts (239.3 KB)

Here is the change I have made for /source/public/hardware/nvidia/soc/t18x/kernel-dts/tegra186-soc/tegra186-soc-sdhci.dtsi:
sdmmc3: sdhci@3440000 {
compatible = “nvidia,tegra186-sdhci”;
reg = <0x0 0x3440000 0x0 0x210>;
interrupts = < 0 64 0x04>;
max-clk-limit = <204000000>;
ddr-clk-limit = <48000000>;
tap-delay = <11>;
trim-delay = <5>;
nvidia,ddr-tap-delay = <11>;
ddr-trim-delay = <5>;
bus-width = <4>;
ignore-pm-notify;
mmc-ocr-mask = <0>;
keep-power-in-suspend;
/non-removable;/
cap-mmc-highspeed;
cap-sd-highspeed;
pwrdet-support;
pinctrl-names = “sdmmc_e_33v_enable”, “sdmmc_e_33v_disable”;
pinctrl-0 = <&sdmmc3_e_33V_enable>;
pinctrl-1 = <&sdmmc3_e_33V_disable>;
compad-vref-3v3 = <0x1>;
compad-vref-1v8 = <0x2>;
nvidia,min-tap-delay = <84>;
nvidia,max-tap-delay = <136>;
pll_source = “pll_p”;
resets = <&tegra_car TEGRA186_RESET_SDMMC3>;
reset-names = “sdhci”;
clocks = <&tegra_car TEGRA186_CLK_SDMMC3>,
<&tegra_car TEGRA186_CLK_PLLP_OUT0>,
<&tegra_car TEGRA186_CLK_SDMMC_LEGACY_TM>;
clock-names = “sdmmc”, “pll_p”, “sdmmc_legacy_tm”;
cd-gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(L, 4) 0>
iommus = <&smmu TEGRA_SID_SDMMC3A>;
nvidia,en-periodic-calib;
/force-non-removable-rescan;/
mmc-ocr-mask = <0x0>;
nvidia,cd-wakeup-capable;
vmmc-supply = <&battery_reg>;
nvidia,vmmc-always-on;
cd-inverted;
nvidia,sd-device;
status = “okay”;
sd-uhs-sdr104;
sd-uhs-sdr50;
sd-uhs-sdr25;
sd-uhs-sdr12;
mmc-ddr-1_8v;
mmc-hs200-1_8v;
}
tegra186-soc-sdhci.dtsi (5.9 KB)

In our design we use GPIO00 (USB_VBUS_EN0) Pin 87 for SD card CD(detection)

When I remove and hotplug SD card:

[ 33.096585] tegradc 15200000.nvdisplay: unblank
[ 33.096595] tegradc 15210000.nvdisplay: blank - powerdown
[ 35.357307] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[ 90.557040] extcon-gpio-states external-connection:extcon@1: Cable state:0, cable id:0
[ 90.557068] tegra-xudc-new 3550000.xudc: vbus state: 0
[ 90.557088] tegra-xudc-new 3550000.xudc: device mode off: 0
[ 90.557132] tegra-xudc-new 3550000.xudc: active: 1 => 0
[ 90.557156] tegra-xudc-new 3550000.xudc: entering ELPG
[ 90.558992] tegra-xudc-new 3550000.xudc: entering ELPG done
[ 111.392758] extcon-gpio-states external-connection:extcon@1: Cable state:1, cable id:1
[ 111.392826] tegra-xudc-new 3550000.xudc: vbus state: 1
[ 111.392835] tegra-xudc-new 3550000.xudc: exiting ELPG
[ 111.393814] tegra-xudc-new 3550000.xudc: exiting ELPG done
[ 111.393824] tegra-xudc-new 3550000.xudc: device mode on: 0
[ 111.393839] tegra-xudc-new 3550000.xudc: active: 0 => 1

attached dmesg log file below:
dmesg_TX2_NX_l4t32.7.1_FSC_sd_card_not_up (71.5 KB)

You should assign vmmc-supply to a 3.3v always on regulator. Also, are you sure TEGRA194_MAIN_GPIO(L, 4) is the one you are using for cd? The kernel log directly gives you “[ 1.408590] sdhci-tegra: probe of 3440000.sdhci failed with error -16”.

You can google search for linux error code this 16 to know what does that mean… I think it is related to your cd-gpios…

Also, putting the change inside tegra186-soc-sdhci.dtsi is a little dangerous. If you know how the device tree works, you will know what I mean.

1 Like

Hi,
1)You should assign vmmc-supply to a 3.3v always on regulator. → Sure I will check that.
2)Also, are you sure TEGRA194_MAIN_GPIO(L, 4) is the one you are using for cd? – > Yes as I have explained earlier in our design we use GPIO00 (USB_VBUS_EN0) Pin 87 for SD card CD(detection) so it is TEGRA194_MAIN_GPIO(L, 4) right?
3) I will check the error again and look on cd-GPIO
4)Also, putting the change inside tegra186-soc-sdhci.dtsi is a little dangerous. If you know how the device tree works, you will know what I mean. → OK, where do you suggest I should make changes?

You can write your change in later dts so that it may prevent other changes coming from later dts to modify your change in sdhci accidentally.

The dts in “soc” directory is for common case over the same SoC. For example, TX2, TX2i, TX2-4GB and TX2-NX all use the same dts from “soc” because they are all t186 soc. But they have their own difference in each platform. For such diff, we put them in the “platform” directory.

What you are doing has some potential problem that if some dts in “platform” modify sdhci again, then your change in “soc” will not take effect.

If you don’t understand what I am talking about, maybe you should study the device tree structure first…

Hi, I got that. thank you I will try out this option.

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