linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Tony Huang" <tonyhuang.sunplus@gmail.com>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	krzk+dt@kernel.org,
	"linux-mmc @ vger . kernel . org" <linux-mmc@vger.kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	wells.lu@sunplus.com
Subject: Re: [PATCH v10 2/2] mmc: Add mmc driver for Sunplus SP7021
Date: Mon, 17 Oct 2022 09:25:14 +0200	[thread overview]
Message-ID: <f8f803a8-ee36-4f32-8920-1fcf6b2265d1@app.fastmail.com> (raw)
In-Reply-To: <039075b210d78d2f4fdeb66b6826b8d2c2836088.1665931914.git.tonyhuang.sunplus@gmail.com>

On Sun, Oct 16, 2022, at 5:48 PM, Tony Huang wrote:
> This is a patch for mmc driver for Sunplus SP7021 SOC.
> Supports eMMC 4.41 DDR 104MB/s speed mode.
>
> Signed-off-by: Tony Huang <tonyhuang.sunplus@gmail.com>

Looks ok to me me overall.

Acked-by: Arnd Bergmann <arnd@arndb.de>

Just one more thing I noticed:

> +#define SPMMC_TIMEOUT			500000
...
> +static inline int spmmc_wait_finish(struct spmmc_host *host)
> +{
> +	u32 state;
> +
> +	return readl_poll_timeout_atomic(host->base + SPMMC_SD_STATE_REG, 
> state,
> +					(state & SPMMC_SDSTATE_FINISH), 1, SPMMC_TIMEOUT);
> +}
> +
> +static inline int spmmc_wait_sdstatus(struct spmmc_host *host, 
> unsigned int status_bit)
> +{
> +	u32 status;
> +
> +	return readl_poll_timeout_atomic(host->base + SPMMC_SD_STATUS_REG, 
> status,
> +					(status & status_bit), 1, SPMMC_TIMEOUT);
> +}

500ms seems like an awfully long time for a busy-wait, I wonder if this
could be improved in some way. Is this always called from atomic context?

If not, any callers from non-atomic context could use
readl_poll_timeout() instead, or maybe there could be a shorter
timeout in atomic context, with a fallback to a non-atomic
workqueue if that times out, so only the MMC access will stall but
not the entire system.

The same problem does appear to be in dw_mmc.c and mtk-sd.c but not
in sdhci*.c, so I don't know if this is avoidable.

     Arnd

  reply	other threads:[~2022-10-17  7:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 15:48 [PATCH v10 0/2] Add mmc driver for Sunplus SP7021 SOC Tony Huang
2022-10-16 15:48 ` [PATCH v10 1/2] dt-binding: mmc: Add mmc yaml file for Sunplus SP7021 Tony Huang
2022-10-16 15:48 ` [PATCH v10 2/2] mmc: Add mmc driver " Tony Huang
2022-10-17  7:25   ` Arnd Bergmann [this message]
2022-10-19  2:10     ` 黃懷厚

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=f8f803a8-ee36-4f32-8920-1fcf6b2265d1@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tonyhuang.sunplus@gmail.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wells.lu@sunplus.com \
    /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;
as well as URLs for NNTP newsgroup(s).