Skip to content

Commit 52239eb

Browse files
bijudasgeertu
authored andcommitted
clk: renesas: rzv2h: Support static dividers without RMW
Add support for static dividers that do not require read-modify-write (RMW) operations. This enables the use of the generic clk_divider_ops instead of the custom RMW-based implementation. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Co-developed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/20250407165202.197570-4-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 6e1c795 commit 52239eb

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

drivers/clk/renesas/rzv2h-cpg.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,10 @@ rzv2h_cpg_ddiv_clk_register(const struct cpg_core_clk *core,
374374
return ERR_PTR(-ENOMEM);
375375

376376
init.name = core->name;
377-
init.ops = &rzv2h_ddiv_clk_divider_ops;
377+
if (cfg_ddiv.no_rmw)
378+
init.ops = &clk_divider_ops;
379+
else
380+
init.ops = &rzv2h_ddiv_clk_divider_ops;
378381
init.parent_names = &parent_name;
379382
init.num_parents = 1;
380383

drivers/clk/renesas/rzv2h-cpg.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ struct pll {
3737
* @shift: position of the divider bit
3838
* @width: width of the divider
3939
* @monbit: monitor bit in CPG_CLKSTATUS0 register
40+
* @no_rmw: flag to indicate if the register is read-modify-write
41+
* (1: no RMW, 0: RMW)
4042
*/
4143
struct ddiv {
4244
unsigned int offset:11;
4345
unsigned int shift:4;
4446
unsigned int width:4;
4547
unsigned int monbit:5;
48+
unsigned int no_rmw:1;
4649
};
4750

4851
/*
@@ -61,6 +64,15 @@ struct ddiv {
6164
.monbit = _monbit \
6265
})
6366

67+
#define DDIV_PACK_NO_RMW(_offset, _shift, _width, _monbit) \
68+
((struct ddiv){ \
69+
.offset = (_offset), \
70+
.shift = (_shift), \
71+
.width = (_width), \
72+
.monbit = (_monbit), \
73+
.no_rmw = 1 \
74+
})
75+
6476
/**
6577
* struct smuxed - Structure for static muxed clocks
6678
*

0 commit comments

Comments
 (0)