[PATCH v24 05/15] mmc: renesas_sdhi: Add SDHI_SD_CLK_CTL_DIV1 macro for 1/1 option

From: Biju

Date: Thu Aug 20 2026 - 13:24:47 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.

Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
---
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 af56b4bfb1d4..a1b2761ceccc 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 0x80000080
#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 d893a263e770..fbc0a8317b30 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -219,13 +219,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