[PATCH v6 1/9] clk: bcm: kona: Move CLOCK_COUNT defines into the driver
From: Artur Weber <aweber.kernel@gmail.com>
Date: 2025-08-13 11:00:20
Also in:
linux-clk, linux-devicetree, lkml
Subsystem:
common clk framework, the rest · Maintainers:
Michael Turquette, Stephen Boyd, Linus Torvalds
CLOCK_COUNT defines for each CCU are stored in the DT binding header. This is not correct - they are not used by device trees, only internally by the driver. Move the CLOCK_COUNT defines directly into the driver in preparation for dropping them from the DT binding include. To avoid conflicts with the old defines, rename them to use the CLK_COUNT suffix. Signed-off-by: Artur Weber <aweber.kernel@gmail.com> --- Changes in v4: - Rename CLOCK_COUNT to CLK_COUNT to avoid redefinition Changes in v3: - Add this commit --- drivers/clk/bcm/clk-bcm21664.c | 16 ++++++++++++---- drivers/clk/bcm/clk-bcm281xx.c | 20 +++++++++++++++----- drivers/clk/bcm/clk-kona.h | 2 +- 3 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/drivers/clk/bcm/clk-bcm21664.c b/drivers/clk/bcm/clk-bcm21664.c
index 520c3aeb4ea9c4a431512c0909f9545c1761d17a..14b7db824704824b4a6bfcce79308afa44e092c6 100644
--- a/drivers/clk/bcm/clk-bcm21664.c
+++ b/drivers/clk/bcm/clk-bcm21664.c@@ -17,13 +17,15 @@ static struct peri_clk_data frac_1m_data = { .clocks = CLOCKS("ref_crystal"), }; +#define BCM21664_ROOT_CCU_CLK_COUNT (BCM21664_ROOT_CCU_FRAC_1M + 1) + static struct ccu_data root_ccu_data = { BCM21664_CCU_COMMON(root, ROOT), /* no policy control */ .kona_clks = { [BCM21664_ROOT_CCU_FRAC_1M] = KONA_CLK(root, frac_1m, peri), - [BCM21664_ROOT_CCU_CLOCK_COUNT] = LAST_KONA_CLK, + [BCM21664_ROOT_CCU_CLK_COUNT] = LAST_KONA_CLK, }, };
@@ -39,6 +41,8 @@ static struct peri_clk_data hub_timer_data = { .trig = TRIGGER(0x0a40, 4), }; +#define BCM21664_AON_CCU_CLK_COUNT (BCM21664_AON_CCU_HUB_TIMER + 1) + static struct ccu_data aon_ccu_data = { BCM21664_CCU_COMMON(aon, AON), .policy = {
@@ -48,7 +52,7 @@ static struct ccu_data aon_ccu_data = { .kona_clks = { [BCM21664_AON_CCU_HUB_TIMER] = KONA_CLK(aon, hub_timer, peri), - [BCM21664_AON_CCU_CLOCK_COUNT] = LAST_KONA_CLK, + [BCM21664_AON_CCU_CLK_COUNT] = LAST_KONA_CLK, }, };
@@ -122,6 +126,8 @@ static struct peri_clk_data sdio4_sleep_data = { .gate = HW_SW_GATE(0x0360, 18, 2, 3), }; +#define BCM21664_MASTER_CCU_CLK_COUNT (BCM21664_MASTER_CCU_SDIO4_SLEEP + 1) + static struct ccu_data master_ccu_data = { BCM21664_CCU_COMMON(master, MASTER), .policy = {
@@ -145,7 +151,7 @@ static struct ccu_data master_ccu_data = { KONA_CLK(master, sdio3_sleep, peri), [BCM21664_MASTER_CCU_SDIO4_SLEEP] = KONA_CLK(master, sdio4_sleep, peri), - [BCM21664_MASTER_CCU_CLOCK_COUNT] = LAST_KONA_CLK, + [BCM21664_MASTER_CCU_CLK_COUNT] = LAST_KONA_CLK, }, };
@@ -225,6 +231,8 @@ static struct peri_clk_data bsc4_data = { .trig = TRIGGER(0x0afc, 19), }; +#define BCM21664_SLAVE_CCU_CLK_COUNT (BCM21664_SLAVE_CCU_BSC4 + 1) + static struct ccu_data slave_ccu_data = { BCM21664_CCU_COMMON(slave, SLAVE), .policy = {
@@ -246,7 +254,7 @@ static struct ccu_data slave_ccu_data = { KONA_CLK(slave, bsc3, peri), [BCM21664_SLAVE_CCU_BSC4] = KONA_CLK(slave, bsc4, peri), - [BCM21664_SLAVE_CCU_CLOCK_COUNT] = LAST_KONA_CLK, + [BCM21664_SLAVE_CCU_CLK_COUNT] = LAST_KONA_CLK, }, };
diff --git a/drivers/clk/bcm/clk-bcm281xx.c b/drivers/clk/bcm/clk-bcm281xx.c
index 823d5dfa31b84f502fcd6ada1eff6d8f4673b3dd..62c3bf4656259261ae4f7d81dae48c90ab26c04e 100644
--- a/drivers/clk/bcm/clk-bcm281xx.c
+++ b/drivers/clk/bcm/clk-bcm281xx.c@@ -19,12 +19,14 @@ static struct peri_clk_data frac_1m_data = { .clocks = CLOCKS("ref_crystal"), }; +#define BCM281XX_ROOT_CCU_CLK_COUNT (BCM281XX_ROOT_CCU_FRAC_1M + 1) + static struct ccu_data root_ccu_data = { BCM281XX_CCU_COMMON(root, ROOT), .kona_clks = { [BCM281XX_ROOT_CCU_FRAC_1M] = KONA_CLK(root, frac_1m, peri), - [BCM281XX_ROOT_CCU_CLOCK_COUNT] = LAST_KONA_CLK, + [BCM281XX_ROOT_CCU_CLK_COUNT] = LAST_KONA_CLK, }, };
@@ -57,6 +59,8 @@ static struct peri_clk_data pmu_bsc_var_data = { .trig = TRIGGER(0x0a40, 2), }; +#define BCM281XX_AON_CCU_CLK_COUNT (BCM281XX_AON_CCU_PMU_BSC_VAR + 1) + static struct ccu_data aon_ccu_data = { BCM281XX_CCU_COMMON(aon, AON), .kona_clks = {
@@ -66,7 +70,7 @@ static struct ccu_data aon_ccu_data = { KONA_CLK(aon, pmu_bsc, peri), [BCM281XX_AON_CCU_PMU_BSC_VAR] = KONA_CLK(aon, pmu_bsc_var, peri), - [BCM281XX_AON_CCU_CLOCK_COUNT] = LAST_KONA_CLK, + [BCM281XX_AON_CCU_CLK_COUNT] = LAST_KONA_CLK, }, };
@@ -80,12 +84,14 @@ static struct peri_clk_data tmon_1m_data = { .trig = TRIGGER(0x0e84, 1), }; +#define BCM281XX_HUB_CCU_CLK_COUNT (BCM281XX_HUB_CCU_TMON_1M + 1) + static struct ccu_data hub_ccu_data = { BCM281XX_CCU_COMMON(hub, HUB), .kona_clks = { [BCM281XX_HUB_CCU_TMON_1M] = KONA_CLK(hub, tmon_1m, peri), - [BCM281XX_HUB_CCU_CLOCK_COUNT] = LAST_KONA_CLK, + [BCM281XX_HUB_CCU_CLK_COUNT] = LAST_KONA_CLK, }, };
@@ -172,6 +178,8 @@ static struct peri_clk_data hsic2_12m_data = { .trig = TRIGGER(0x0afc, 5), }; +#define BCM281XX_MASTER_CCU_CLK_COUNT (BCM281XX_MASTER_CCU_HSIC2_12M + 1) + static struct ccu_data master_ccu_data = { BCM281XX_CCU_COMMON(master, MASTER), .kona_clks = {
@@ -189,7 +197,7 @@ static struct ccu_data master_ccu_data = { KONA_CLK(master, hsic2_48m, peri), [BCM281XX_MASTER_CCU_HSIC2_12M] = KONA_CLK(master, hsic2_12m, peri), - [BCM281XX_MASTER_CCU_CLOCK_COUNT] = LAST_KONA_CLK, + [BCM281XX_MASTER_CCU_CLK_COUNT] = LAST_KONA_CLK, }, };
@@ -301,6 +309,8 @@ static struct peri_clk_data pwm_data = { .trig = TRIGGER(0x0afc, 15), }; +#define BCM281XX_SLAVE_CCU_CLK_COUNT (BCM281XX_SLAVE_CCU_PWM + 1) + static struct ccu_data slave_ccu_data = { BCM281XX_CCU_COMMON(slave, SLAVE), .kona_clks = {
@@ -324,7 +334,7 @@ static struct ccu_data slave_ccu_data = { KONA_CLK(slave, bsc3, peri), [BCM281XX_SLAVE_CCU_PWM] = KONA_CLK(slave, pwm, peri), - [BCM281XX_SLAVE_CCU_CLOCK_COUNT] = LAST_KONA_CLK, + [BCM281XX_SLAVE_CCU_CLK_COUNT] = LAST_KONA_CLK, }, };
diff --git a/drivers/clk/bcm/clk-kona.h b/drivers/clk/bcm/clk-kona.h
index 348a3454ce4013e4e2b06b9542f5895a8397dd8e..d7cae437333c83e05b2960ba8d51e718480e6155 100644
--- a/drivers/clk/bcm/clk-kona.h
+++ b/drivers/clk/bcm/clk-kona.h@@ -483,7 +483,7 @@ struct ccu_data { #define KONA_CCU_COMMON(_prefix, _name, _ccuname) \ .name = #_name "_ccu", \ .lock = __SPIN_LOCK_UNLOCKED(_name ## _ccu_data.lock), \ - .clk_num = _prefix ## _ ## _ccuname ## _CCU_CLOCK_COUNT + .clk_num = _prefix ## _ ## _ccuname ## _CCU_CLK_COUNT /* Exported globals */
--
2.50.1