All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert Yang <yangzh0906@thundersoft.com>
To: ulf.hansson@linaro.org
Cc: adrian.hunter@intel.com, arnd@arndb.de, gordon.ge@bst.ai,
	linux-mmc@vger.kernel.org, yangzh0906@thundersoft.com
Subject: Re: [PATCH v3 5/8] mmc: sdhci: add Black Sesame Technologies BST C1200 controller driver
Date: Tue,  9 Sep 2025 16:02:46 +0800	[thread overview]
Message-ID: <20250909080246.2264646-1-yangzh0906@thundersoft.com> (raw)
In-Reply-To: <CAPDyKFon7Q2UHOJbbVtPTHvqxYeOJr8HK5BOk6TAJaph8FcwvQ@mail.gmail.com>

On Mon, Aug 18, 2025 at 12:48:39PM +0200, Ulf Hansson wrote:
> On Tue, 12 Aug 2025 at 14:31, Albert Yang <yangzh0906@thundersoft.com> wrote:
> >

> > +               timeout = 20;
> > +               while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL)) &
> > +                       SDHCI_CLOCK_INT_STABLE)) {
> > +                       if (timeout == 0) {
> > +                               dev_err(mmc_dev(host->mmc), "Internal clock never stabilised\n");
> > +                               return -EBUSY;
> > +                       }
> > +                       timeout--;
> > +                       usleep_range(1000, 1100);
> > +               }
>
> Please convert into using some of the readx_poll_timeout functions
> instead of the loop above. Moreover, please add defines to specify the
> period/timeout.
>

> > +       while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL)) &
> > +               SDHCI_CLOCK_INT_STABLE)) {
> > +               if (timeout == 0) {
> > +                       dev_err(mmc_dev(host->mmc), "Internal clock never stabilised\n");
> > +                       return -EBUSY;
> > +               }
> > +               timeout--;
> > +               usleep_range(1000, 1100);
> > +       }
>
> Ditto.
>

Thanks for the review. I have created a new static function as suggested:

static int sdhci_bst_wait_int_clk(struct sdhci_host *host)
{
	u16 clk;

	if (read_poll_timeout(sdhci_readw, clk, (clk & SDHCI_CLOCK_INT_STABLE),
			BST_CLK_STABLE_POLL_US, BST_CLK_STABLE_TIMEOUT_US, false,
			host, SDHCI_CLOCK_CONTROL))
		return -EBUSY;
	return 0;
}

And I will replace the code at the call sites with the following:

		if (sdhci_bst_wait_int_clk(host)) {
			dev_err(mmc_dev(host->mmc), "Internal clock never stabilised\n");
			return -EBUSY;
		}


Best Regards,
Albert

  parent reply	other threads:[~2025-09-09  8:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12 12:31 [PATCH v3 0/8] Introduce Black Sesame Technologies C1200 SoC and CDCU1.0 board Albert Yang
2025-08-12 12:31 ` [PATCH v3 1/8] dt-bindings: vendor-prefixes: Add Black Sesame Technologies Co., Ltd Albert Yang
2025-08-12 13:34   ` Krzysztof Kozlowski
2025-08-13  4:53     ` Albert Yang
2025-08-13  6:01       ` Krzysztof Kozlowski
2025-08-13 11:37         ` Albert Yang
2025-08-12 12:31 ` [PATCH v3 2/8] dt-bindings: arm: add Black Sesame Technologies (bst) SoC Albert Yang
2025-08-12 13:35   ` Krzysztof Kozlowski
2025-08-12 12:31 ` [PATCH v3 3/8] arm64: Kconfig: add ARCH_BST for Black Sesame Technologies SoCs Albert Yang
2025-08-12 12:31 ` [PATCH v3 4/8] dt-bindings: mmc: add binding for BST DWCMSHC SDHCI controller Albert Yang
2025-08-14  8:50   ` Krzysztof Kozlowski
2025-08-12 12:31 ` [PATCH v3 5/8] mmc: sdhci: add Black Sesame Technologies BST C1200 controller driver Albert Yang
2025-08-18 10:48   ` Ulf Hansson
2025-08-18 12:08     ` Arnd Bergmann
2025-09-09  8:02     ` Albert Yang [this message]
2025-08-18 18:16   ` Adrian Hunter
2025-09-10 12:07     ` Albert Yang
2025-08-12 12:31 ` [PATCH v3 6/8] arm64: dts: bst: add support for Black Sesame Technologies C1200 CDCU1.0 board Albert Yang
2025-08-12 16:16   ` Krzysztof Kozlowski
2025-09-03  3:40     ` Albert Yang
2025-09-03  6:14       ` Krzysztof Kozlowski
2025-09-03  7:06         ` Albert Yang
2025-09-05  7:23           ` Krzysztof Kozlowski
2025-09-09  7:09             ` Albert Yang
2025-08-12 12:31 ` [PATCH v3 7/8] arm64: defconfig: enable BST platform and SDHCI controller support Albert Yang
2025-08-12 13:38   ` Krzysztof Kozlowski
2025-08-13 11:56     ` Albert Yang
2025-08-12 12:31 ` [PATCH v3 8/8] MAINTAINERS: add and consolidate Black Sesame Technologies (BST) ARM SoC support Albert Yang
2025-08-12 13:33   ` Krzysztof Kozlowski

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=20250909080246.2264646-1-yangzh0906@thundersoft.com \
    --to=yangzh0906@thundersoft.com \
    --cc=adrian.hunter@intel.com \
    --cc=arnd@arndb.de \
    --cc=gordon.ge@bst.ai \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.