How to Enable SD Card on TX2 NX

I am trying to enable the SD Card on a custom carrier board for the TX2 NX.

I have added the following to my device tree:

   sdhci@3440000 {
            status = "okay";
            cd-gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(X, 4) GPIO_ACTIVE_HIGH>;
            nvidia,cd-wakeup-capable;
            /delete-property/ non-removable;
            vmmc-always-on;
            nvidia,sd-device;
    };
    pinmux@2430000 {
                pinctrl-names = "default", "drive", "unused";
                pinctrl-0 = <&pinmux_default>;
            pinmux_default: common {
                    sdmmc3_clk_pg0 {
                            nvidia,pins = "sdmmc3_clk_pg0";
                            nvidia,function = "sdmmc3";
                            nvidia,pull = <TEGRA_PIN_PULL_NONE>;
                            nvidia,tristate = <TEGRA_PIN_DISABLE>;
                            nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                    };

                    sdmmc3_cmd_pg1 {
                            nvidia,pins = "sdmmc3_cmd_pg1";
                            nvidia,function = "sdmmc3";
                            nvidia,pull = <TEGRA_PIN_PULL_UP>;
                            nvidia,tristate = <TEGRA_PIN_DISABLE>;
                            nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                    };

                    sdmmc3_dat0_pg2 {
                            nvidia,pins = "sdmmc3_dat0_pg2";
                            nvidia,function = "sdmmc3";
                            nvidia,pull = <TEGRA_PIN_PULL_UP>;
                            nvidia,tristate = <TEGRA_PIN_DISABLE>;
                            nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                    };

                    sdmmc3_dat1_pg3 {
                            nvidia,pins = "sdmmc3_dat1_pg3";
                            nvidia,function = "sdmmc3";
                            nvidia,pull = <TEGRA_PIN_PULL_UP>;
                            nvidia,tristate = <TEGRA_PIN_DISABLE>;
                            nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                    };

                    sdmmc3_dat2_pg4 {
                            nvidia,pins = "sdmmc3_dat2_pg4";
                            nvidia,function = "sdmmc3";
                            nvidia,pull = <TEGRA_PIN_PULL_UP>;
                            nvidia,tristate = <TEGRA_PIN_DISABLE>;
                            nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                    };

                    sdmmc3_dat3_pg5 {
                            nvidia,pins = "sdmmc3_dat3_pg5";
                            nvidia,function = "sdmmc3";
                            nvidia,pull = <TEGRA_PIN_PULL_UP>;
                            nvidia,tristate = <TEGRA_PIN_DISABLE>;
                            nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                    };
      };

Our design uses the card detect pin but always applies power to the SD Card.
When the card is inserted I get many errors like the following:

mmc1: CMD CRC or end bit error, int mask 0x40000

I also see the following when checking /sys/kernel/debug/mmc1/ios

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

please check this thread.

1 Like

Thank you for pointing me to that thread. the fixes mentioned worked. My SD Card hotplugs and is writable. here is my final devicetree node:

sdhci@3440000 {
        status = "okay";
        cd-gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(X, 4) GPIO_ACTIVE_HIGH>;
        nvidia,cd-wakeup-capable;
        /delete-property/ non-removable;
        /delete-property/ force-non-removable-rescan;
        nvidia,sd-device;
        vmmc-supply = <&spmic_sd3>;
        mmc-ocr-mask = <3>;
        sd-uhs-sdr104;
        sd-uhs-sdr50;
        sd-uhs-sdr25;
        sd-uhs-sdr12;
        mmc-ddr-1_8v;
        mmc-hs200-1_8v;
    };
1 Like