Skip to content

Commit 8e33f91

Browse files
bjdooks-ctMike Turquette
authored andcommitted
clk: shmobile: clk-mstp: change to using clock-indices
With the addition of clock-indices, we need to change the renesas clock implementation to use these instead of the local definition of "renesas,clock-indices". Since this will break booting with older device trees, we add a simple auto-detection of which properties are present. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Mike Turquette <mturquette@linaro.org>
1 parent 874f224 commit 8e33f91

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Example
4343
clock-output-names =
4444
"tpu0", "mmcif1", "sdhi3", "sdhi2",
4545
"sdhi1", "sdhi0", "mmcif0";
46-
renesas,clock-indices = <
46+
clock-indices = <
4747
R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
4848
R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0
4949
R8A7790_CLK_MMCIF0

‎drivers/clk/shmobile/clk-mstp.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ cpg_mstp_clock_register(const char *name, const char *parent_name,
156156
static void __init cpg_mstp_clocks_init(struct device_node *np)
157157
{
158158
struct mstp_clock_group *group;
159+
const char *idxname;
159160
struct clk **clks;
160161
unsigned int i;
161162

@@ -184,6 +185,11 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
184185
for (i = 0; i < MSTP_MAX_CLOCKS; ++i)
185186
clks[i] = ERR_PTR(-ENOENT);
186187

188+
if (of_find_property(np, "clock-indices", &i))
189+
idxname = "clock-indices";
190+
else
191+
idxname = "renesas,clock-indices";
192+
187193
for (i = 0; i < MSTP_MAX_CLOCKS; ++i) {
188194
const char *parent_name;
189195
const char *name;
@@ -197,8 +203,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
197203
continue;
198204

199205
parent_name = of_clk_get_parent_name(np, i);
200-
ret = of_property_read_u32_index(np, "renesas,clock-indices", i,
201-
&clkidx);
206+
ret = of_property_read_u32_index(np, idxname, i, &clkidx);
202207
if (parent_name == NULL || ret < 0)
203208
break;
204209

0 commit comments

Comments
 (0)