Skip to content

Commit fca77a6

Browse files
committed
Merge tag 'renesas-clk-for-v6.15-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into clk-renesas
Pull more Renesas clk driver updates from Geert Uytterhoeven: - Add DMA clocks and reset on Renesas RZ/V2H - Add thermal (TSU) clock and reset on Renesas RZ/G3E * tag 'renesas-clk-for-v6.15-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers: clk: renesas: r9a09g047: Add clock and reset signals for the TSU IP clk: renesas: rzv2h: Adjust for CPG_BUS_m_MSTOP starting from m = 1 clk: renesas: r7s9210: Distinguish clocks by clock type clk: renesas: rzg2l: Remove unneeded nullify checks clk: renesas: cpg-mssr: Remove obsolete nullify check clk: renesas: r9a09g057: Add entries for the DMACs
2 parents a0e2025 + e1a0983 commit fca77a6

File tree

7 files changed

+39
-27
lines changed

7 files changed

+39
-27
lines changed

drivers/clk/renesas/r7s9210-cpg-mssr.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,12 @@ static struct clk * __init rza2_cpg_clk_register(struct device *dev,
170170
if (IS_ERR(parent))
171171
return ERR_CAST(parent);
172172

173-
switch (core->id) {
174-
case CLK_MAIN:
173+
switch (core->type) {
174+
case CLK_TYPE_RZA_MAIN:
175+
r7s9210_update_clk_table(parent, base);
175176
break;
176177

177-
case CLK_PLL:
178+
case CLK_TYPE_RZA_PLL:
178179
if (cpg_mode)
179180
mult = 44; /* Divider 1 is 1/2 */
180181
else
@@ -185,9 +186,6 @@ static struct clk * __init rza2_cpg_clk_register(struct device *dev,
185186
return ERR_PTR(-EINVAL);
186187
}
187188

188-
if (core->id == CLK_MAIN)
189-
r7s9210_update_clk_table(parent, base);
190-
191189
return clk_register_fixed_factor(NULL, core->name,
192190
__clk_get_name(parent), 0, mult, div);
193191
}

drivers/clk/renesas/r9a09g047-cpg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ static const struct rzv2h_mod_clk r9a09g047_mod_clks[] __initconst = {
183183
BUS_MSTOP(9, BIT(4))),
184184
DEF_MOD("cru_0_pclk", CLK_PLLDTY_DIV16, 13, 4, 6, 20,
185185
BUS_MSTOP(9, BIT(4))),
186+
DEF_MOD("tsu_1_pclk", CLK_QEXTAL, 16, 10, 8, 10,
187+
BUS_MSTOP(2, BIT(15))),
186188
};
187189

188190
static const struct rzv2h_reset r9a09g047_resets[] __initconst = {
@@ -211,6 +213,7 @@ static const struct rzv2h_reset r9a09g047_resets[] __initconst = {
211213
DEF_RST(12, 5, 5, 22), /* CRU_0_PRESETN */
212214
DEF_RST(12, 6, 5, 23), /* CRU_0_ARESETN */
213215
DEF_RST(12, 7, 5, 24), /* CRU_0_S_RESETN */
216+
DEF_RST(15, 8, 7, 9), /* TSU_1_PRESETN */
214217
};
215218

216219
const struct rzv2h_cpg_info r9a09g047_cpg_info __initconst = {

drivers/clk/renesas/r9a09g057-cpg.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ enum clk_ids {
3131
CLK_PLLVDO,
3232

3333
/* Internal Core Clocks */
34+
CLK_PLLCM33_DIV4,
35+
CLK_PLLCM33_DIV4_PLLCM33,
3436
CLK_PLLCM33_DIV16,
3537
CLK_PLLCLN_DIV2,
3638
CLK_PLLCLN_DIV8,
@@ -39,6 +41,8 @@ enum clk_ids {
3941
CLK_PLLDTY_ACPU_DIV2,
4042
CLK_PLLDTY_ACPU_DIV4,
4143
CLK_PLLDTY_DIV16,
44+
CLK_PLLDTY_RCPU,
45+
CLK_PLLDTY_RCPU_DIV4,
4246
CLK_PLLVDO_CRU0,
4347
CLK_PLLVDO_CRU1,
4448
CLK_PLLVDO_CRU2,
@@ -85,6 +89,9 @@ static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = {
8589
DEF_FIXED(".pllvdo", CLK_PLLVDO, CLK_QEXTAL, 105, 2),
8690

8791
/* Internal Core Clocks */
92+
DEF_FIXED(".pllcm33_div4", CLK_PLLCM33_DIV4, CLK_PLLCM33, 1, 4),
93+
DEF_DDIV(".pllcm33_div4_pllcm33", CLK_PLLCM33_DIV4_PLLCM33,
94+
CLK_PLLCM33_DIV4, CDDIV0_DIVCTL1, dtable_2_64),
8895
DEF_FIXED(".pllcm33_div16", CLK_PLLCM33_DIV16, CLK_PLLCM33, 1, 16),
8996

9097
DEF_FIXED(".pllcln_div2", CLK_PLLCLN_DIV2, CLK_PLLCLN, 1, 2),
@@ -95,6 +102,8 @@ static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = {
95102
DEF_FIXED(".plldty_acpu_div2", CLK_PLLDTY_ACPU_DIV2, CLK_PLLDTY_ACPU, 1, 2),
96103
DEF_FIXED(".plldty_acpu_div4", CLK_PLLDTY_ACPU_DIV4, CLK_PLLDTY_ACPU, 1, 4),
97104
DEF_FIXED(".plldty_div16", CLK_PLLDTY_DIV16, CLK_PLLDTY, 1, 16),
105+
DEF_DDIV(".plldty_rcpu", CLK_PLLDTY_RCPU, CLK_PLLDTY, CDDIV3_DIVCTL2, dtable_2_64),
106+
DEF_FIXED(".plldty_rcpu_div4", CLK_PLLDTY_RCPU_DIV4, CLK_PLLDTY_RCPU, 1, 4),
98107

99108
DEF_DDIV(".pllvdo_cru0", CLK_PLLVDO_CRU0, CLK_PLLVDO, CDDIV3_DIVCTL3, dtable_2_4),
100109
DEF_DDIV(".pllvdo_cru1", CLK_PLLVDO_CRU1, CLK_PLLVDO, CDDIV4_DIVCTL0, dtable_2_4),
@@ -115,6 +124,16 @@ static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = {
115124
};
116125

117126
static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = {
127+
DEF_MOD("dmac_0_aclk", CLK_PLLCM33_DIV4_PLLCM33, 0, 0, 0, 0,
128+
BUS_MSTOP(5, BIT(9))),
129+
DEF_MOD("dmac_1_aclk", CLK_PLLDTY_ACPU_DIV2, 0, 1, 0, 1,
130+
BUS_MSTOP(3, BIT(2))),
131+
DEF_MOD("dmac_2_aclk", CLK_PLLDTY_ACPU_DIV2, 0, 2, 0, 2,
132+
BUS_MSTOP(3, BIT(3))),
133+
DEF_MOD("dmac_3_aclk", CLK_PLLDTY_RCPU_DIV4, 0, 3, 0, 3,
134+
BUS_MSTOP(10, BIT(11))),
135+
DEF_MOD("dmac_4_aclk", CLK_PLLDTY_RCPU_DIV4, 0, 4, 0, 4,
136+
BUS_MSTOP(10, BIT(12))),
118137
DEF_MOD_CRITICAL("icu_0_pclk_i", CLK_PLLCM33_DIV16, 0, 5, 0, 5,
119138
BUS_MSTOP_NONE),
120139
DEF_MOD_CRITICAL("gic_0_gicclk", CLK_PLLDTY_ACPU_DIV4, 1, 3, 0, 19,
@@ -223,6 +242,11 @@ static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = {
223242

224243
static const struct rzv2h_reset r9a09g057_resets[] __initconst = {
225244
DEF_RST(3, 0, 1, 1), /* SYS_0_PRESETN */
245+
DEF_RST(3, 1, 1, 2), /* DMAC_0_ARESETN */
246+
DEF_RST(3, 2, 1, 3), /* DMAC_1_ARESETN */
247+
DEF_RST(3, 3, 1, 4), /* DMAC_2_ARESETN */
248+
DEF_RST(3, 4, 1, 5), /* DMAC_3_ARESETN */
249+
DEF_RST(3, 5, 1, 6), /* DMAC_4_ARESETN */
226250
DEF_RST(3, 6, 1, 7), /* ICU_0_PRESETN_I */
227251
DEF_RST(3, 8, 1, 9), /* GIC_0_GICRESET_N */
228252
DEF_RST(3, 9, 1, 10), /* GIC_0_DBG_GICRESET_N */

drivers/clk/renesas/renesas-cpg-mssr.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,6 @@ static void __init cpg_mssr_register_core_clk(const struct cpg_core_clk *core,
338338
WARN_DEBUG(id >= priv->num_core_clks);
339339
WARN_DEBUG(PTR_ERR(priv->clks[id]) != -ENOENT);
340340

341-
if (!core->name) {
342-
/* Skip NULLified clock */
343-
return;
344-
}
345-
346341
switch (core->type) {
347342
case CLK_TYPE_IN:
348343
clk = of_clk_get_by_name(priv->np, core->name);

drivers/clk/renesas/rzg2l-cpg.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,11 +1116,6 @@ rzg2l_cpg_register_core_clk(const struct cpg_core_clk *core,
11161116
WARN_DEBUG(id >= priv->num_core_clks);
11171117
WARN_DEBUG(PTR_ERR(priv->clks[id]) != -ENOENT);
11181118

1119-
if (!core->name) {
1120-
/* Skip NULLified clock */
1121-
return;
1122-
}
1123-
11241119
switch (core->type) {
11251120
case CLK_TYPE_IN:
11261121
clk = of_clk_get_by_name(priv->dev->of_node, core->name);
@@ -1355,11 +1350,6 @@ rzg2l_cpg_register_mod_clk(const struct rzg2l_mod_clk *mod,
13551350
WARN_DEBUG(mod->parent >= priv->num_core_clks + priv->num_mod_clks);
13561351
WARN_DEBUG(PTR_ERR(priv->clks[id]) != -ENOENT);
13571352

1358-
if (!mod->name) {
1359-
/* Skip NULLified clock */
1360-
return;
1361-
}
1362-
13631353
parent = priv->clks[mod->parent];
13641354
if (IS_ERR(parent)) {
13651355
clk = parent;

drivers/clk/renesas/rzv2h-cpg.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,7 @@ static void rzv2h_mod_clock_mstop_enable(struct rzv2h_cpg_priv *priv,
447447
{
448448
unsigned long mstop_mask = FIELD_GET(BUS_MSTOP_BITS_MASK, mstop_data);
449449
u16 mstop_index = FIELD_GET(BUS_MSTOP_IDX_MASK, mstop_data);
450-
unsigned int index = (mstop_index - 1) * 16;
451-
atomic_t *mstop = &priv->mstop_count[index];
450+
atomic_t *mstop = &priv->mstop_count[mstop_index * 16];
452451
unsigned long flags;
453452
unsigned int i;
454453
u32 val = 0;
@@ -469,8 +468,7 @@ static void rzv2h_mod_clock_mstop_disable(struct rzv2h_cpg_priv *priv,
469468
{
470469
unsigned long mstop_mask = FIELD_GET(BUS_MSTOP_BITS_MASK, mstop_data);
471470
u16 mstop_index = FIELD_GET(BUS_MSTOP_IDX_MASK, mstop_data);
472-
unsigned int index = (mstop_index - 1) * 16;
473-
atomic_t *mstop = &priv->mstop_count[index];
471+
atomic_t *mstop = &priv->mstop_count[mstop_index * 16];
474472
unsigned long flags;
475473
unsigned int i;
476474
u32 val = 0;
@@ -630,8 +628,7 @@ rzv2h_cpg_register_mod_clk(const struct rzv2h_mod_clk *mod,
630628
} else if (clock->mstop_data != BUS_MSTOP_NONE && mod->critical) {
631629
unsigned long mstop_mask = FIELD_GET(BUS_MSTOP_BITS_MASK, clock->mstop_data);
632630
u16 mstop_index = FIELD_GET(BUS_MSTOP_IDX_MASK, clock->mstop_data);
633-
unsigned int index = (mstop_index - 1) * 16;
634-
atomic_t *mstop = &priv->mstop_count[index];
631+
atomic_t *mstop = &priv->mstop_count[mstop_index * 16];
635632
unsigned long flags;
636633
unsigned int i;
637634
u32 val = 0;
@@ -926,6 +923,9 @@ static int __init rzv2h_cpg_probe(struct platform_device *pdev)
926923
if (!priv->mstop_count)
927924
return -ENOMEM;
928925

926+
/* Adjust for CPG_BUS_m_MSTOP starting from m = 1 */
927+
priv->mstop_count -= 16;
928+
929929
priv->resets = devm_kmemdup(dev, info->resets, sizeof(*info->resets) *
930930
info->num_resets, GFP_KERNEL);
931931
if (!priv->resets)

drivers/clk/renesas/rzv2h-cpg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ struct ddiv {
3838
#define CPG_CDDIV3 (0x40C)
3939
#define CPG_CDDIV4 (0x410)
4040

41+
#define CDDIV0_DIVCTL1 DDIV_PACK(CPG_CDDIV0, 4, 3, 1)
4142
#define CDDIV0_DIVCTL2 DDIV_PACK(CPG_CDDIV0, 8, 3, 2)
4243
#define CDDIV1_DIVCTL0 DDIV_PACK(CPG_CDDIV1, 0, 2, 4)
4344
#define CDDIV1_DIVCTL1 DDIV_PACK(CPG_CDDIV1, 4, 2, 5)
4445
#define CDDIV1_DIVCTL2 DDIV_PACK(CPG_CDDIV1, 8, 2, 6)
4546
#define CDDIV1_DIVCTL3 DDIV_PACK(CPG_CDDIV1, 12, 2, 7)
47+
#define CDDIV3_DIVCTL2 DDIV_PACK(CPG_CDDIV3, 8, 3, 14)
4648
#define CDDIV3_DIVCTL3 DDIV_PACK(CPG_CDDIV3, 12, 1, 15)
4749
#define CDDIV4_DIVCTL0 DDIV_PACK(CPG_CDDIV4, 0, 1, 16)
4850
#define CDDIV4_DIVCTL1 DDIV_PACK(CPG_CDDIV4, 4, 1, 17)

0 commit comments

Comments
 (0)