[PATCH v25 05/11] mmc: renesas_sdhi: Add SDHI_SD_CLK_CTL_DIV1 macro for 1/1 option

From: Biju Das

Date: Wed Oct 28 2026 - 08:52:35 EST


From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

Replace the magic number 0xff, used for selecting the SD clock 1/1
divider option, with a new SDHI_SD_CLK_CTL_DIV1 macro. This improves
readability and self-documents the purpose of the value at each use
site (setting/clearing the divider bits and comparing against
CLK_CTL_DIV_MASK).

No functional change.

Reviewed-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
---
v24->v25:
* No change
v24:
* New patch
---
drivers/mmc/host/renesas_sdhi.h | 1 +
drivers/mmc/host/renesas_sdhi_core.c | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
index b54802c0807c..b759376103d7 100644
--- a/drivers/mmc/host/renesas_sdhi.h
+++ b/drivers/mmc/host/renesas_sdhi.h
@@ -24,6 +24,7 @@ struct renesas_sdhi_scc {
#define SDHI_FLAG_NEED_CLKH_FALLBACK BIT(0)
#define SDHI_CLK_MASK_DEFAULT 0x80000080ULL
#define SDHI_MAX_DIVIDER_DEFAULT 512
+#define SDHI_SD_CLK_CTL_DIV1 0xff

struct renesas_sdhi_of_data {
unsigned long tmio_flags;
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 74834e72f038..500ecc357095 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -227,13 +227,13 @@ static void renesas_sdhi_set_clock(struct tmio_mmc_host *host,
/* 1/1 clock is option */
if ((host->pdata->flags & TMIO_MMC_CLK_ACTUAL) && ((clk >> 22) & 0x1)) {
if (!(host->mmc->ios.timing == MMC_TIMING_MMC_HS400))
- clk |= 0xff;
+ clk |= SDHI_SD_CLK_CTL_DIV1;
else
- clk &= ~0xff;
+ clk &= ~SDHI_SD_CLK_CTL_DIV1;
}

clock = clk & CLK_CTL_DIV_MASK;
- if (clock != CLK_CTL_DIV_MASK)
+ if (clock != SDHI_SD_CLK_CTL_DIV1)
host->mmc->actual_clock /= (1 << (ffs(clock) + 1));

sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clock);

--
2.43.0