lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52c08a01-8357-44dd-b727-a06438ec6c30@intel.com>
Date: Mon, 15 Apr 2024 10:18:39 +0300
From: Adrian Hunter <adrian.hunter@...el.com>
To: Richard Clark <richard.xnu.clark@...il.com>, ulf.hansson@...aro.org
Cc: linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] sdhci: Fix SD card detection issue

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.

> specificly below if condition is true in mmc_rescan(...):
> 	...
> 	if (mmc_card_is_removable(host) && host->ops->get_cd &&
> 		host->ops->get_cd(host) == 0) {
> 		...
> 		goto out;
> 	}
> The SD card device will have no chance to be created.
> 
> This commit fixes this detection issue via the MMC_CAP2_CD_ACTIVE_HIGH cap2 flag,
> parsed from the 'cd-inverted' property of DT.

What hardware / driver is it?

> 
> Signed-off-by: Richard Clark <richard.xnu.clark@...il.com>
> ---
>  drivers/mmc/host/sdhci.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index c79f73459915..79f33a161ca8 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2483,6 +2483,9 @@ static int sdhci_get_cd(struct mmc_host *mmc)
>  	 * Try slot gpio detect, if defined it take precedence
>  	 * over build in controller functionality
>  	 */
> +	if (!(mmc->caps2 & MMC_CAP2_CD_ACTIVE_HIGH))
> +		gpio_cd = !gpio_cd;

MMC_CAP2_CD_ACTIVE_HIGH is already handled in 
mmc_gpiod_request_cd(), and this turns an error (gpio_cd < 0)
into 0, which is not right.

> +
>  	if (gpio_cd >= 0)
>  		return !!gpio_cd;
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ