Re: [PATCH] sdhci: Fix SD card detection issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 15, 2024 at 4:23 PM Russell King (Oracle)
<linux@xxxxxxxxxxxxxxx> wrote:
>
> On Mon, Apr 15, 2024 at 04:17:14PM +0800, richard clark wrote:
> > On Mon, Apr 15, 2024 at 3:22 PM Russell King (Oracle)
> > <linux@xxxxxxxxxxxxxxx> wrote:
> > >
> > > On Mon, Apr 15, 2024 at 10:18:39AM +0300, Adrian Hunter wrote:
> > > > On 15/04/24 10:06, Richard Clark wrote:
> > > > > The mmc_gpio_get_cd(...) will return 0 called from sdhci_get_cd(...), which means
> > > > > the card is not present. Actually, the card detection pin is active low by default
> > > > > according to the SDHCI psec, thus the card detection result is not correct, more
> > > >
> > > > SDHCI spec covers the SDHCI lines.  GPIO is separate.
> > >
> > > ... and the key bit of information that should be mentioned is in the
> > > case of a GPIO, the GPIO library can be told if a GPIO is active-high
> > > or active-low in either firmware or via the GPIO lookup data, and this
> > > should be used instead of drivers inventing their own "quirking".
> > >
> > Agree! But unfortunately, it seems I can't find the right place to
> > handle this from either firmware or via the GPIO lookup data. Will be
> > appreciated if any suggestion about that?!
>
> If you're using DT, then, for example:
>
>         cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
>
> is all it takes. If you are using firmware then GPIO lookup data isn't
> what you should be using. I'm afraid I don't know the ACPI bindings for
> SDHCI.
>
Ah, this seems to be a bug of the Nvidia DT, its cd-gpios=<... 0x00>
meaning the GPIO_ACTIVE_HIGH, but the CD gpio value is 0 when the card
is inserted. In the kernel v5.10, the sdhci-tegra use below logic as
the card present indicator:

if (!host->mmc->cd_cap_invert)
        host->mmc->rem_card_present = (mmc_gpio_get_cd(host->mmc) == 0);

But the newer version kernel removes the 'rem_card_present', and the
CD gpio still value 0 will be interpreted as the card is not present,
thus the issue happens...

> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!





[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux