From: Shawn Lin <shawn.lin@rock-chips.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, Jaehoon Chung <jh80.chung@samsung.com>,
Shawn Lin <shawn.lin@rock-chips.com>
Subject: [PATCH v2 10/13] mmc: dw_mmc: Move clock rate stuff from struct dw_mci_slot to struct dw_mci
Date: Wed, 26 Nov 2025 08:14:50 +0800 [thread overview]
Message-ID: <1764116093-5430-11-git-send-email-shawn.lin@rock-chips.com> (raw)
In-Reply-To: <1764116093-5430-1-git-send-email-shawn.lin@rock-chips.com>
Except for moving them, this patch also renames __clk_old to clk_old.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
Changes in v2: None
drivers/mmc/host/dw_mmc.c | 8 ++++----
drivers/mmc/host/dw_mmc.h | 9 ++++-----
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 127abb5..7386a6f 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1139,7 +1139,7 @@ static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data)
static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
{
struct dw_mci *host = slot->host;
- unsigned int clock = slot->clock;
+ unsigned int clock = host->clock;
u32 div;
u32 clk_en_a;
u32 sdmmc_cmd_bits = SDMMC_CMD_UPD_CLK | SDMMC_CMD_PRV_DAT_WAIT;
@@ -1164,7 +1164,7 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
div = (host->bus_hz != clock) ? DIV_ROUND_UP(div, 2) : 0;
- if ((clock != slot->__clk_old &&
+ if ((clock != host->clk_old &&
!test_bit(DW_MMC_CARD_NEEDS_POLL, &host->flags)) ||
force_clkinit) {
/* Silent the verbose log if calling from PM context */
@@ -1207,7 +1207,7 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
mci_send_cmd(slot, sdmmc_cmd_bits, 0);
/* keep the last clock value that was requested from core */
- slot->__clk_old = clock;
+ host->clk_old = clock;
host->mmc->actual_clock = div ? ((host->bus_hz / div) >> 1) :
host->bus_hz;
}
@@ -1410,7 +1410,7 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
* Use mirror of ios->clock to prevent race with mmc
* core ios update when finding the minimum.
*/
- slot->clock = ios->clock;
+ slot->host->clock = ios->clock;
if (drv_data && drv_data->set_ios)
drv_data->set_ios(slot->host, ios);
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 3a2e1a0..99a69da 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -130,6 +130,8 @@ struct dw_mci_dma_slave {
* @mmc: The mmc_host representing this dw_mci.
* @flags: Random state bits associated with the host.
* @ctype: Card type for this host.
+ * @clock: Clock rate configured by set_ios(). Protected by host->lock.
+ * @clk_old: The last clock value that was requested from core.
*
* Locking
* =======
@@ -251,6 +253,8 @@ struct dw_mci {
#define DW_MMC_CARD_NO_USE_HOLD 3
#define DW_MMC_CARD_NEEDS_POLL 4
u32 ctype;
+ unsigned int clock;
+ unsigned int clk_old;
};
/* DMA ops for Internal/External DMAC interface */
@@ -559,8 +563,6 @@ static inline int dw_mci_runtime_resume(struct device *device) { return -EOPNOTS
* processed, or NULL when the slot is idle.
* @queue_node: List node for placing this node in the @queue list of
* &struct dw_mci.
- * @clock: Clock rate configured by set_ios(). Protected by host->lock.
- * @__clk_old: The last clock value that was requested from core.
* Keeping track of this helps us to avoid spamming the console.
*/
struct dw_mci_slot {
@@ -568,9 +570,6 @@ struct dw_mci_slot {
struct mmc_request *mrq;
struct list_head queue_node;
-
- unsigned int clock;
- unsigned int __clk_old;
};
/**
--
2.7.4
next prev parent reply other threads:[~2025-11-26 0:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 0:14 [PATCH v2 0/13] dwmmc cleanup Shawn Lin
2025-11-26 0:14 ` [PATCH v2 01/13] mmc: dw_mmc: Remove unused struct dma_pdata Shawn Lin
2025-11-26 0:14 ` [PATCH v2 02/13] mmc: dw_mmc: add dw_mci_prepare_desc() for both of 32bit and 64bit DMA Shawn Lin
2025-11-26 0:14 ` [PATCH v2 03/13] mmc: dw_mmc: Remove vqmmc_enabled from struct dw_mci and user helpers from core Shawn Lin
2025-12-15 14:30 ` Ulf Hansson
2025-12-16 1:52 ` Shawn Lin
2025-12-16 10:51 ` Ulf Hansson
2025-11-26 0:14 ` [PATCH v2 04/13] mmc: dw_mmc: Remove unused header files and keep alphabetical order Shawn Lin
2025-11-26 0:14 ` [PATCH v2 05/13] mmc: dw_mmc: Move struct mmc_host from struct dw_mci_slot to struct dw_mci Shawn Lin
2025-11-26 0:14 ` [PATCH v2 06/13] mmc: dw_mmc: Let glue drivers to use struct dw_mci as possible Shawn Lin
2025-11-26 0:14 ` [PATCH v2 07/13] mmc: dw_mmc: Move flags from struct dw_mci_slot to struct dw_mci Shawn Lin
2025-11-26 0:14 ` [PATCH v2 08/13] mmc: dw_mmc: Remove id and ctype from dw_mci_slot Shawn Lin
2025-11-26 0:14 ` [PATCH v2 09/13] mmc: dw_mmc: Remove sdio_id from struct dw_mci_slot Shawn Lin
2025-11-26 0:14 ` Shawn Lin [this message]
2025-11-26 0:14 ` [PATCH v2 11/13] mmc: dw_mmc: Remove mrq " Shawn Lin
2025-11-26 0:14 ` [PATCH v2 12/13] mmc: dw_mmc: Remove queue from dw_mci Shawn Lin
2025-11-26 0:14 ` [PATCH v2 13/13] mmc: dw_mmc: Remove struct dw_mci_slot Shawn Lin
2025-12-15 15:42 ` [PATCH v2 0/13] dwmmc cleanup Ulf Hansson
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=1764116093-5430-11-git-send-email-shawn.lin@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=jh80.chung@samsung.com \
--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