Hi, I would like to enable sdmmc3 on my custom carrier board. It seems to work except when sd card is already inserted before boot. In which case, VDD is out lo. How can I enable vmmc regulator when card is already inserted before boot?
I have GPIO06 for sdmmc_vdd_en connected to load switch. And GPIO03 for sdmmc_cd, which gets pulled to ground when card is inserted.
I configured GPIO06(PC.04) is POR=pd, Output, Drive 0 and GPIO03(PL.02) is POR=z, Input, Int PU with the pinmux spreadsheet and commented out / disabled conflicting assignments.
inserting and removing card leaves messages
mmc1: Enabling vmmc regulator
and
mmc1: Disabling vmmc regulator
It is only when the card is inserted before boot, cd pin is in lo and sdmmc-vdd-en is out lo. I have to remove and reinsert card to fix. Is there a way to force rescan? Or am I missing something?
sdmmc-vdd-en is hi when I boot whether the card is in or not. Also, removing the card with cause mmc1: Enabling vmmc regulator. This doesn’t seem right.
Looking at sdhci-tegra.c, I think card detect is wrong when there is no cd_cap_invert property. SDHCI standard specifies active low. So, for example in this block of code:
/*
If there is no card detect gpio, assume that the
card is always present.
*/
if (!gpio_is_valid(tegra_host->cd_gpio)) {
host->mmc->rem_card_present = 1;
} else { if (!host->mmc->cd_cap_invert) host->mmc->rem_card_present = (mmc_gpio_get_cd(host->mmc) == 0);
else
host->mmc->rem_card_present =
mmc_gpio_get_cd(host->mmc);
}
will always be rem_card_present=0. I think it should be
rem_card_present = !mmc_gpio_get_cd(host->mmc)
this check happens more than once in sdhci-tegra.c file.
I am using r32.7.4, and I want to use the SD car for extra storage. I don’t know if it would make any difference but I am testing now without load-switch soldered onto the board. I was just checking power sequence probing the pad. Also, was noticing unexpected behavior when I don’t use cd-inverted.
Could you use /proc/device-tree on your jetson to check the runtime device tree instead of relying on using dtsi to track? It could be defined in multiple files and you didn’t notice. For example, you deleted cd-inverted in file A but actually file B still has it. So your deletion has no effect.
I am really sorry to have wasted your time 🙈 and opened a non-issue. simply soldering load switch fixed the issue. Card now shows up on boot. However, I am still trying to understand why cd-inverted works the way it does.
I can confirm that my cd-inverted is taking effect. When I enable cd-inverted, I see it in proc/device-tree/sdhci@3440000. conversely when I comment out cd-inverted, it is not in proc/device-tree/sdhci@3440000.
Having said that, If I remove cd-inverted from device tree, but keep