[PATCH 3/4] mmc: sdhci-of-k1: Set clock-frequency of io clock
From: Yixun Lan
Date: Wed Sep 02 2026 - 03:08:38 EST
From: Long Wan <long.wan@xxxxxxxxxxxxxxxxxx>
Add a clock-frequency property to set the rate of io clock, for SDIO
case, a clock frequency need to propagate down early.
Signed-off-by: Long Wan <long.wan@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Yixun Lan <dlan@xxxxxxxxxx>
---
drivers/mmc/host/sdhci-of-k1.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
index 37b0911e7cf2..e6ab40c9a555 100644
--- a/drivers/mmc/host/sdhci-of-k1.c
+++ b/drivers/mmc/host/sdhci-of-k1.c
@@ -438,6 +438,8 @@ static inline int spacemit_sdhci_get_clocks(struct device *dev,
struct sdhci_pltfm_host *pltfm_host)
{
struct spacemit_sdhci_host *sdhst = sdhci_pltfm_priv(pltfm_host);
+ struct device_node *np = dev->of_node;
+ u32 freq;
sdhst->clk_core = devm_clk_get_enabled(dev, "core");
if (IS_ERR(sdhst->clk_core))
@@ -447,6 +449,9 @@ static inline int spacemit_sdhci_get_clocks(struct device *dev,
if (IS_ERR(sdhst->clk_io))
return -EINVAL;
+ if (!of_property_read_u32(np, "clock-frequency", &freq))
+ clk_set_rate(sdhst->clk_io, freq);
+
pltfm_host->clk = sdhst->clk_io;
return 0;
--
2.55.0