mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Erick Shepherd <erick.shepherd@ni.com>, <linux-kernel@vger.kernel.org>
Cc: <linux-mmc@vger.kernel.org>, <ulf.hansson@linaro.org>,
	<gratian.crisan@emerson.com>,
	Kyle Roeschley <kyle.roeschley@ni.com>,
	"Brad Mouring" <brad.mouring@ni.com>
Subject: Re: [PATCH] mmc: sdhci: Disable SD card clock before changing parameters
Date: Thu, 6 Mar 2025 10:12:34 +0200	[thread overview]
Message-ID: <f76517de-9d59-4cf7-a7f5-b19ee4b2b3b2@intel.com> (raw)
In-Reply-To: <20250211214645.469279-1-erick.shepherd@ni.com>

On 11/02/25 23:46, Erick Shepherd wrote:
> Per the SD Host Controller Simplified Specification v4.20 §3.2.3, change
> the SD card clock parameters only after first disabling the external card
> clock. Doing this fixes a spurious clock pulse on Baytrail and Apollo Lake
> SD controllers which otherwise breaks voltage switching with a specific
> Swissbit SD card.
> 
> Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com>
> Signed-off-by: Brad Mouring <brad.mouring@ni.com>
> Signed-off-by: Erick Shepherd <erick.shepherd@ni.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index f4a7733a8ad2..5f91b44891f9 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2065,10 +2065,15 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
>  
>  	host->mmc->actual_clock = 0;
>  
> -	sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
> +	clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
> +	if (clk & SDHCI_CLOCK_CARD_EN)
> +		sdhci_writew(host, clk & ~SDHCI_CLOCK_CARD_EN,
> +			SDHCI_CLOCK_CONTROL);
>  
> -	if (clock == 0)
> +	if (clock == 0) {
> +		sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
>  		return;
> +	}
>  
>  	clk = sdhci_calc_clk(host, clock, &host->mmc->actual_clock);
>  	sdhci_enable_clk(host, clk);


  reply	other threads:[~2025-03-06  8:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-11 21:46 Erick Shepherd
2025-03-06  8:12 ` Adrian Hunter [this message]
2025-03-12 11:24 ` Ulf Hansson
2025-06-19  3:29 ` Jonathan Liu
2025-06-24 10:53   ` Adrian Hunter
2025-07-22 21:29     ` Erick Shepherd
2025-07-23  6:09       ` Adrian Hunter

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=f76517de-9d59-4cf7-a7f5-b19ee4b2b3b2@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=brad.mouring@ni.com \
    --cc=erick.shepherd@ni.com \
    --cc=gratian.crisan@emerson.com \
    --cc=kyle.roeschley@ni.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®