SD Card Detect not working

The SD card detect pin was not recognized in /sys/kernel/debug/gpio even though it was set using the pinmux configurator and set in sdhci configurations.

Issue happened on your custom carrier board?

Yes, i configured the GPIO and Pinmux for the SD_CD pin but it would not show up in /sys/kernel/debug/gpio

in the tegra210-porg-p3448-common.dtsi file

sdhci@700b0400 { /* SDMMC3 for SD CARD with EMMC*/
		default-drv-type = <1>;
		status = "okay";
		cd-gpios = <&gpio TEGRA_GPIO(Z, 2) 0>;
		vmmc-supply = <&p3448_vdd_3v3_sd>;
		vqmmc-supply = <&max77620_ldo6>;
		mmc-ocr-mask = <0>;
		tap-delay = <3>;

		nvidia,pmc-wakeup = <&tegra_pmc PMC_WAKE_TYPE_GPIO 35

		// regulator-always-on;
		// force-non-removable-rescan;

in the gpio file

gpio_default: default {
			gpio-input = <
				TEGRA_GPIO(A, 5)
				TEGRA_GPIO(X, 4)
				TEGRA_GPIO(X, 5)
				TEGRA_GPIO(X, 6)
				TEGRA_GPIO(Y, 1)
				TEGRA_GPIO(V, 1)
				TEGRA_GPIO(J, 5)
				TEGRA_GPIO(J, 6)
				TEGRA_GPIO(J, 4)
				TEGRA_GPIO(J, 7)
				TEGRA_GPIO(H, 2)
				TEGRA_GPIO(H, 5)
				TEGRA_GPIO(Z, 2)

in the pinmux file

pz2 {
				nvidia,pins = "pz2";
				nvidia,function = "sdmmc3";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;

by using multimeter, i was able to get a HIGH signal at the track when the sd card is plugged into the slot, but it was not registering on the dmesg output

hello yat-weng.wong,

could you please also modify device tree sources to comment-out PZ.02 for fan usage,
for example,

/ {
        pwm_fan_shared_data: pfsd {
                tach_gpio =  <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_LOW>; /* TEGRA_GPIO_PZ2 */

Yes, they have been corrected and commented. Still is not working

hello yat-weng.wong,

can kernel side recognize SD card? did you see sdhci logs while inserting the card?
please see-also kernel documentation for sdhci-tegra controller settings,
for example, public_sources/kernel_src/kernel/nvidia/Documentation/devicetree/bindings/mmc/sdhci-tegra.txt

Kernel side could not recognize the SD card when plugged in. dmesg does not indicate any changes even with quiet removed. However, with the SD enabled forced high, I was able to connect and use the SD card as normal but could not mount a different SD card apart from the one mounted at boot.

hello yat-weng.wong,

you may need to review regulator settings, since it’s customize board, please check you’ve given correct power-supply.

sure, will feedback more when i get to this tomorrow.

Hi, here is the regulator settings that is attached to sdmmc3

p3448_vdd_3v3_sd: regulator@3 {
			compatible = "regulator-fixed-sync";
			reg = <3>;
			regulator-name = "vdd-3v3-sd";
			regulator-min-microvolt = <3300000>;
			regulator-max-microvolt = <3300000>;
			// gpio = <&gpio TEGRA_GPIO(Z, 3) 0>;
			gpio = <&gpio TEGRA_GPIO(I, 0) 0>;
			vin-supply = <&p3448_vdd_3v3_sys>;
hdr40_vdd_3v3: p3448_vdd_3v3_sys: regulator@2 {
			compatible = "regulator-fixed-sync";
			reg = <2>;
			regulator-name = "vdd-3v3-sys";
			regulator-min-microvolt = <3300000>;
			regulator-max-microvolt = <3300000>;
			gpio = <&max77620 3 0>;
			vin-supply = <&p3449_vdd_5v0_sys>;
			regulator-enable-ramp-delay = <240>;
			regulator-disable-ramp-delay = <11340>;

The voltage was measured to be 1.8 output at boot but drops to 0 after the boot is completed

please remove vqmmc-supply and only keep the vmmc supply.

Done that in sdhci@700b0400 { /* SDMMC3 for SD CARD with EMMC*/ but still not detected

Then post your schematic, dts file converted back from dtb and dmesg.

Or just search sdmmc3 post in this forum. This is already kind of old topic here and you can search out 30~40 topics for this.

okay, i will have a look a second time and feedback here. Thanks a lot