From: Inochi Amaoto <inochiama@gmail.com>
To: Ulf Hansson <ulfh@kernel.org>,
Karol Gugala <kgugala@antmicro.com>,
Mateusz Holenko <mholenko@antmicro.com>,
Gabriel Somlo <gsomlo@gmail.com>, Joel Stanley <joel@jms.id.au>,
Paul Mackerras <paulus@ozlabs.org>,
Maciej Dudek <mdudek@internships.antmicro.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Inochi Amaoto <inochiama@gmail.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Yixun Lan <dlan@gentoo.org>, Longbin Li <looong.bin@gmail.com>
Subject: [PATCH v3 1/2] mmc: litex_mmc: Move litex_mmc_setclk() to bottom for reuse
Date: Sun, 26 Apr 2026 19:20:14 +0800 [thread overview]
Message-ID: <20260426112016.1370929-2-inochiama@gmail.com> (raw)
In-Reply-To: <20260426112016.1370929-1-inochiama@gmail.com>
Move the litex_mmc_setclk() to the bottom of the driver, this
function is needed to set the idle clock for CMD0
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
drivers/mmc/host/litex_mmc.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/mmc/host/litex_mmc.c b/drivers/mmc/host/litex_mmc.c
index d2f19c2dc673..a8d9c0ece16a 100644
--- a/drivers/mmc/host/litex_mmc.c
+++ b/drivers/mmc/host/litex_mmc.c
@@ -99,6 +99,20 @@ struct litex_mmc_host {
bool app_cmd;
};
+static void litex_mmc_setclk(struct litex_mmc_host *host, unsigned int freq)
+{
+ struct device *dev = mmc_dev(host->mmc);
+ u32 div;
+
+ div = freq ? host->ref_clk / freq : 256U;
+ div = roundup_pow_of_two(div);
+ div = clamp(div, 2U, 256U);
+ dev_dbg(dev, "sd_clk_freq=%d: set to %d via div=%d\n",
+ freq, host->ref_clk / div, div);
+ litex_write16(host->sdphy + LITEX_PHY_CLOCKERDIV, div);
+ host->sd_clk = freq;
+}
+
static int litex_mmc_sdcard_wait_done(void __iomem *reg, struct device *dev)
{
u8 evt;
@@ -431,20 +445,6 @@ static void litex_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
mmc_request_done(mmc, mrq);
}
-static void litex_mmc_setclk(struct litex_mmc_host *host, unsigned int freq)
-{
- struct device *dev = mmc_dev(host->mmc);
- u32 div;
-
- div = freq ? host->ref_clk / freq : 256U;
- div = roundup_pow_of_two(div);
- div = clamp(div, 2U, 256U);
- dev_dbg(dev, "sd_clk_freq=%d: set to %d via div=%d\n",
- freq, host->ref_clk / div, div);
- litex_write16(host->sdphy + LITEX_PHY_CLOCKERDIV, div);
- host->sd_clk = freq;
-}
-
static void litex_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct litex_mmc_host *host = mmc_priv(mmc);
--
2.54.0
next prev parent reply other threads:[~2026-04-26 11:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-26 11:20 [PATCH v3 0/2] mmc: litex_mmc: Set mandatory idle clocks before CMD0 Inochi Amaoto
2026-04-26 11:20 ` Inochi Amaoto [this message]
2026-04-26 11:20 ` [PATCH v3 2/2] " Inochi Amaoto
2026-04-26 15:59 ` [PATCH v3 0/2] " Gabriel L. Somlo
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=20260426112016.1370929-2-inochiama@gmail.com \
--to=inochiama@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=dlan@gentoo.org \
--cc=gsomlo@gmail.com \
--cc=joel@jms.id.au \
--cc=kgugala@antmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=looong.bin@gmail.com \
--cc=mdudek@internships.antmicro.com \
--cc=mholenko@antmicro.com \
--cc=paulus@ozlabs.org \
--cc=ulfh@kernel.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