Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: mathieu <mathieu.moneyron@gmail.com>,
	ludovic.desroches@microchip.com, ulf.hansson@linaro.org,
	nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com,
	Eugen Hristev <eugen.hristev@microchip.com>
Cc: linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: Fix force card detect in sdhci
Date: Mon, 4 Sep 2023 10:38:11 +0300	[thread overview]
Message-ID: <096e9122-23b8-5a36-7779-28994187c620@intel.com> (raw)
In-Reply-To: <20230830092314.624212-1-mathieu.moneyron@gmail.com>

+ Eugen Hristev

On 30/08/23 12:23, mathieu wrote:
> From: Mathieu Moneyron <mathieu.moneyron@gmail.com>
> 
> On the ATMEL at91 when using the non-removable flag in device tree and not
> using the card-detect pin inside the device-tree pinctrl, the card detect
> pin is physically still used which can cause unknown behaviour when this
> pin is used for other purposes.
> 
> From my interpretation this seems to be caused by a hardware design flaw
> and the real hardware is not working as intended by the documentation.
> 
> Signed-off-by: Mathieu Moneyron <mathieu.moneyron@gmail.com>
> ---
>  drivers/mmc/host/sdhci-of-at91.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 69fef88e7..4fd6bfbf6 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -51,10 +51,15 @@ struct sdhci_at91_priv {
>  static void sdhci_at91_set_force_card_detect(struct sdhci_host *host)
>  {
>  	u8 mc1r;
> +	u8 ctrl;
>  
>  	mc1r = readb(host->ioaddr + SDMMC_MC1R);
>  	mc1r |= SDMMC_MC1R_FCD;
>  	writeb(mc1r, host->ioaddr + SDMMC_MC1R);
> +
> +	ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL);
> +	ctrl |= SDHCI_CTRL_CDTEST_INS | SDHCI_CTRL_CDTEST_EN;
> +	writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL);
>  }
>  
>  static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)


  reply	other threads:[~2023-09-04  7:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30  9:23 [PATCH] mmc: Fix force card detect in sdhci mathieu
2023-09-04  7:38 ` Adrian Hunter [this message]
2023-09-23 12:44   ` Aubin Constans
2023-09-23 14:23     ` Mathieu Moneyron
2023-11-10 19:57       ` Aubin Constans
2023-11-14 11:06         ` Mathieu Moneyron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=096e9122-23b8-5a36-7779-28994187c620@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=eugen.hristev@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=mathieu.moneyron@gmail.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox