Skip to content

Commit 6380440

Browse files
Phil Edworthygeertu
authored andcommitted
clk: renesas: rzg2l: Make use of CLK_MON registers optional
The RZ/V2M SoC doesn't use CLK_MON registers, so make them optional. Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20220503115557.53370-9-phil.edworthy@renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 75b0ad4 commit 6380440

4 files changed

Lines changed: 16 additions & 1 deletion

File tree

drivers/clk/renesas/r9a07g043-cpg.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,6 @@ const struct rzg2l_cpg_info r9a07g043_cpg_info = {
315315
/* Resets */
316316
.resets = r9a07g043_resets,
317317
.num_resets = R9A07G043_TSU_PRESETN + 1, /* Last reset ID + 1 */
318+
319+
.has_clk_mon_regs = true,
318320
};

drivers/clk/renesas/r9a07g044-cpg.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ const struct rzg2l_cpg_info r9a07g044_cpg_info = {
418418
/* Resets */
419419
.resets = r9a07g044_resets,
420420
.num_resets = R9A07G044_TSU_PRESETN + 1, /* Last reset ID + 1 */
421+
422+
.has_clk_mon_regs = true,
421423
};
422424

423425
#ifdef CONFIG_CLK_R9A07G054
@@ -440,5 +442,7 @@ const struct rzg2l_cpg_info r9a07g054_cpg_info = {
440442
/* Resets */
441443
.resets = r9a07g044_resets,
442444
.num_resets = R9A07G054_STPAI_ARESETN + 1, /* Last reset ID + 1 */
445+
446+
.has_clk_mon_regs = true,
443447
};
444448
#endif

drivers/clk/renesas/rzg2l-cpg.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,9 @@ static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable)
926926
if (!enable)
927927
return 0;
928928

929+
if (!priv->info->has_clk_mon_regs)
930+
return 0;
931+
929932
for (i = 1000; i > 0; --i) {
930933
if (((readl(priv->base + CLK_MON_R(reg))) & bitmask))
931934
break;
@@ -996,7 +999,10 @@ static int rzg2l_mod_clock_is_enabled(struct clk_hw *hw)
996999
if (clock->sibling)
9971000
return clock->enabled;
9981001

999-
value = readl(priv->base + CLK_MON_R(clock->off));
1002+
if (priv->info->has_clk_mon_regs)
1003+
value = readl(priv->base + CLK_MON_R(clock->off));
1004+
else
1005+
value = readl(priv->base + clock->off);
10001006

10011007
return value & bitmask;
10021008
}

drivers/clk/renesas/rzg2l-cpg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ struct rzg2l_reset {
236236
* @crit_mod_clks: Array with Module Clock IDs of critical clocks that
237237
* should not be disabled without a knowledgeable driver
238238
* @num_crit_mod_clks: Number of entries in crit_mod_clks[]
239+
* @has_clk_mon_regs: Flag indicating whether the SoC has CLK_MON registers
239240
*/
240241
struct rzg2l_cpg_info {
241242
/* Core Clocks */
@@ -256,6 +257,8 @@ struct rzg2l_cpg_info {
256257
/* Critical Module Clocks that should not be disabled */
257258
const unsigned int *crit_mod_clks;
258259
unsigned int num_crit_mod_clks;
260+
261+
bool has_clk_mon_regs;
259262
};
260263

261264
extern const struct rzg2l_cpg_info r9a07g043_cpg_info;

0 commit comments

Comments
 (0)