clk: renesas: r9a06g032: Improve clock tables
authorRalph Siemsen <ralph.siemsen@linaro.org>
Wed, 1 Mar 2023 21:55:20 +0000 (16:55 -0500)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 10 Mar 2023 16:09:00 +0000 (17:09 +0100)
commit1ef48138f90785ba7091fb8fa317039cd3cf9494
tree47fb444e2f1939c2a143ca871a13341bd19779b7
parent5a5ca2c758c200663fdf5c04f71796a8f300151a
clk: renesas: r9a06g032: Improve clock tables

Each entry in the clock table specifies a number of individual bits in
registers, for contolling clock reset, gaiting, etc. These reg/bit were
packed into a u16 to save space. The combined value is difficult to
understand when reviewing the clock table entries.

Introduce a "struct regbit" which still occupies only 16 bits, but
allows the register and bit values to be specified explicitly. Convert
all previous uses of u16 for reg/bit into "struct regbit".

The bulk of this patch converts the clock table to use struct regbit,
making use of the RB() helper macro. The conversion was automated by
script, and as a further verification, the compiled binary of the table
was compared before/after the change (with objdump -D).

The clk_rdesc_set() function now checks for zero reg/bit internally.
This allows callers of that function to remove those checks.

Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20230301215520.828455-5-ralph.siemsen@linaro.org
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
drivers/clk/renesas/r9a06g032-clocks.c