]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: dw_mmc: Move clock rate stuff from struct dw_mci_slot to struct dw_mci
authorShawn Lin <shawn.lin@rock-chips.com>
Tue, 16 Dec 2025 11:50:04 +0000 (19:50 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 23 Feb 2026 11:06:53 +0000 (12:06 +0100)
Except for moving them, this patch also renames __clk_old to clk_old.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/dw_mmc.h

index 4dbc5417c7bec86bfe8c4946ff3940974cd07501..18c44a23a698ae2ccbb8f43330d8b96959a4c4a0 100644 (file)
@@ -1142,7 +1142,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;
@@ -1167,7 +1167,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 */
@@ -1210,7 +1210,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;
        }
@@ -1413,7 +1413,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);
index 3a2e1a046b3eafffa7c6e023f2a4e1bdd5ddbacf..99a69dacb3cdd40769f790324aa0e14ab4538f08 100644 (file)
@@ -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;
 };
 
 /**