SDMMC3 CD device tree problem.

Hi All

So I have got my SD card working on my custom carrier board running R32.3.1, but not without some drama. I would like some clarification on the CD signal. For now I have had to add the property “non-removable” in before the kernel-4.9/drivers/mmc/core/host.c will even try and probe the kernel-4.9/drivers/mmc/host/sdhci-tegra.c file.

Without this property the /core/host.c needs a property called “cd” set to the appropriate GPIO, otherwise it bombs out. But then in the sdhci-tegra.c it is looking for property “cd-gpios” so there seems to be 2 stages of CD detect and none of the default DTS from the R32.3.1 appear to set the property “cd”. So by setting the “non-removable” property the host driver assumes the card is always there and everything is ok.

What is the correct thing to do here? Surely not set both “cd” and “cd-gpios”? Did something change in R32.3.1, or what am I missing?

sdhci@700b0400 { /* SDMMC3 for SD card on production module */
 		non-removable;
	};

and this is code from host.c:

ret = mmc_gpiod_request_cd(host, "cd", 0, true,
					   0, &cd_gpio_invert);
		if (!ret)
			dev_info(host->parent, "Got CD GPIO\n");
		else if (ret != -ENOENT && ret != -ENOSYS)
			return ret;
 
              // THE CODE NEVER GETS HERE, IT BOMBS OUT ON PREVIOUS LINE

Thanks.

Please refer to this thread for the dt change you need.

https://devtalk.nvidia.com/default/topic/1067459