From: Michael Wu <michael@allwinnertech.com>
To: ulf.hansson@linaro.org, mripard@kernel.org, wens@csie.org,
samuel@sholland.org, andre.przywara@arm.com
Cc: jernej.skrabec@gmail.com, linux-mmc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
Michael Wu <michael@allwinnertech.com>
Subject: [PATCH 2/3] mmc:sunxi-mmc:fix clock division for timing mode
Date: Wed, 22 Dec 2021 11:15:21 +0800 [thread overview]
Message-ID: <20211222031521.34170-1-michael@allwinnertech.com> (raw)
When use new timings,all speed mode requires a doubled module clock
if speed mode is ddr,requires a four times module clock
When use old timings,only 8 bit ddr requires a doubled module clock
Signed-off-by: Michael Wu <michael@allwinnertech.com>
---
drivers/mmc/host/sunxi-mmc.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index afeefead6501..7b47ec453fb6 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -774,20 +774,23 @@ static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host,
if (!ios->clock)
return 0;
- /*
- * Under the old timing mode, 8 bit DDR requires the module
- * clock to be double the card clock. Under the new timing
- * mode, all DDR modes require a doubled module clock.
- *
- * We currently only support the standard MMC DDR52 mode.
- * This block should be updated once support for other DDR
- * modes is added.
+ /**
+ * When use new timings, all speed mode requires a doubled module clock.
+ * if speed mode is ddr, requires a four times module clock.
+ * When use old timings, only 8 bit ddr requires a doubled module clock.
*/
- if (ios->timing == MMC_TIMING_MMC_DDR52 &&
- (host->use_new_timings ||
- ios->bus_width == MMC_BUS_WIDTH_8)) {
- div = 2;
+ if (host->use_new_timings) {
clock <<= 1;
+ if (ios->timing == MMC_TIMING_MMC_DDR52) {
+ div = 2;
+ clock <<= 1;
+ }
+ } else {
+ if (ios->timing == MMC_TIMING_MMC_DDR52 &&
+ (ios->bus_width == MMC_BUS_WIDTH_8)) {
+ div = 2;
+ clock <<= 1;
+ }
}
if (host->use_new_timings && host->cfg->ccu_has_timings_switch) {
--
2.29.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2021-12-22 3:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 3:15 Michael Wu [this message]
2022-01-12 9:20 ` [PATCH 2/3] mmc:sunxi-mmc:fix clock division for timing mode Maxime Ripard
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=20211222031521.34170-1-michael@allwinnertech.com \
--to=michael@allwinnertech.com \
--cc=andre.przywara@arm.com \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=samuel@sholland.org \
--cc=ulf.hansson@linaro.org \
--cc=wens@csie.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