[PATCH 09/17] mmc: renesas_sdhi: Add internal_divider hw_info flag for clk rate adjustment
From: Biju
Date: Sat May 30 2026 - 12:10:43 EST
From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
The RZ/G3L SoC has an internal divider for all modes except HS400 mode.
Add an internal_divider bitfield to renesas_sdhi_hw_info and a divider
field to the renesas_sdhi instance struct.
During probe, if internal_divider is set and the device does not
have the mmc-hs400-1_8v property, priv->divider is set to 2;
otherwise it defaults to 1. This divider is then applied in
renesas_sdhi_clk_update() when setting the clk rate relative to
clkh, replacing the implicit divide-by-1 that was previously assumed.
No users set internal_divider yet; this patch only introduces the
infrastructure. No functional change for existing platforms.
Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
---
drivers/mmc/host/renesas_sdhi.h | 3 +++
drivers/mmc/host/renesas_sdhi_core.c | 7 ++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
index a3c5fa368242..0ca8ec27c320 100644
--- a/drivers/mmc/host/renesas_sdhi.h
+++ b/drivers/mmc/host/renesas_sdhi.h
@@ -46,6 +46,7 @@ struct renesas_sdhi_hw_info {
unsigned int max_divider;
/* hardware features */
unsigned tuning_delay:1; /* Has tuning delay */
+ unsigned internal_divider:1; /* Has internal divider */
};
struct renesas_sdhi_of_data_with_info {
@@ -112,6 +113,8 @@ struct renesas_sdhi {
struct reset_control *rstc;
struct tmio_mmc_host *host;
struct regulator_dev *rdev;
+
+ unsigned int divider;
};
#define host_to_priv(host) \
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 868ba6a6919e..8e2fb19b994b 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -185,7 +185,7 @@ static unsigned int renesas_sdhi_clk_update(struct tmio_mmc_host *host,
clk_set_rate(ref_clk, best_freq);
if (priv->clkh)
- clk_set_rate(priv->clk, best_freq >> clkh_shift);
+ clk_set_rate(priv->clk, (best_freq >> clkh_shift) * priv->divider);
return clk_get_rate(priv->clk);
}
@@ -1223,6 +1223,11 @@ int renesas_sdhi_probe(struct platform_device *pdev,
dev_pm_domain_start(&pdev->dev);
+ if (info->internal_divider && !device_property_read_bool(dev, "mmc-hs400-1_8v"))
+ priv->divider = 2;
+ else
+ priv->divider = 1;
+
ret = renesas_sdhi_clk_enable(host);
if (ret)
return ret;
--
2.43.0