Skip to content

Commit 99767cd

Browse files
osctobebebarino
authored andcommitted
clk: at91: allow setting PCKx parent via DT
This exposes PROGx clocks for use in assigned-clocks DeviceTree property for selecting PCKx parent clock. Signed-off-by: Michał Mirosław <[email protected]> Link: https://lkml.kernel.org/r/0054532c00163ddf405dad658b32f0d7d97fcc8e.1588630999.git.mirq-linux@rere.qmqm.pl Acked-by: Alexandre Belloni <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 7425f24 commit 99767cd

File tree

13 files changed

+46
-13
lines changed

13 files changed

+46
-13
lines changed

drivers/clk/at91/at91rm9200.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
100100

101101
at91rm9200_pmc = pmc_data_allocate(PMC_MAIN + 1,
102102
nck(at91rm9200_systemck),
103-
nck(at91rm9200_periphck), 0);
103+
nck(at91rm9200_periphck), 0, 4);
104104
if (!at91rm9200_pmc)
105105
return;
106106

@@ -159,6 +159,8 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
159159
&at91rm9200_programmable_layout);
160160
if (IS_ERR(hw))
161161
goto err_free;
162+
163+
at91rm9200_pmc->pchws[i] = hw;
162164
}
163165

164166
for (i = 0; i < ARRAY_SIZE(at91rm9200_systemck); i++) {

drivers/clk/at91/at91sam9260.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
354354

355355
at91sam9260_pmc = pmc_data_allocate(PMC_MAIN + 1,
356356
ndck(data->sck, data->num_sck),
357-
ndck(data->pck, data->num_pck), 0);
357+
ndck(data->pck, data->num_pck),
358+
0, data->num_progck);
358359
if (!at91sam9260_pmc)
359360
return;
360361

@@ -434,6 +435,8 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
434435
&at91rm9200_programmable_layout);
435436
if (IS_ERR(hw))
436437
goto err_free;
438+
439+
at91sam9260_pmc->pchws[i] = hw;
437440
}
438441

439442
for (i = 0; i < data->num_sck; i++) {

drivers/clk/at91/at91sam9g45.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
117117

118118
at91sam9g45_pmc = pmc_data_allocate(PMC_MAIN + 1,
119119
nck(at91sam9g45_systemck),
120-
nck(at91sam9g45_periphck), 0);
120+
nck(at91sam9g45_periphck), 0, 2);
121121
if (!at91sam9g45_pmc)
122122
return;
123123

@@ -182,6 +182,8 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
182182
&at91sam9g45_programmable_layout);
183183
if (IS_ERR(hw))
184184
goto err_free;
185+
186+
at91sam9g45_pmc->pchws[i] = hw;
185187
}
186188

187189
for (i = 0; i < ARRAY_SIZE(at91sam9g45_systemck); i++) {

drivers/clk/at91/at91sam9n12.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
129129
return;
130130

131131
at91sam9n12_pmc = pmc_data_allocate(PMC_MAIN + 1,
132-
nck(at91sam9n12_systemck), 31, 0);
132+
nck(at91sam9n12_systemck), 31, 0, 2);
133133
if (!at91sam9n12_pmc)
134134
return;
135135

@@ -198,6 +198,8 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
198198
&at91sam9x5_programmable_layout);
199199
if (IS_ERR(hw))
200200
goto err_free;
201+
202+
at91sam9n12_pmc->pchws[i] = hw;
201203
}
202204

203205
for (i = 0; i < ARRAY_SIZE(at91sam9n12_systemck); i++) {

drivers/clk/at91/at91sam9rl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
8989

9090
at91sam9rl_pmc = pmc_data_allocate(PMC_MAIN + 1,
9191
nck(at91sam9rl_systemck),
92-
nck(at91sam9rl_periphck), 0);
92+
nck(at91sam9rl_periphck), 0, 2);
9393
if (!at91sam9rl_pmc)
9494
return;
9595

@@ -138,6 +138,8 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
138138
&at91rm9200_programmable_layout);
139139
if (IS_ERR(hw))
140140
goto err_free;
141+
142+
at91sam9rl_pmc->pchws[i] = hw;
141143
}
142144

143145
for (i = 0; i < ARRAY_SIZE(at91sam9rl_systemck); i++) {

drivers/clk/at91/at91sam9x5.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
151151
return;
152152

153153
at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1,
154-
nck(at91sam9x5_systemck), 31, 0);
154+
nck(at91sam9x5_systemck), 31, 0, 2);
155155
if (!at91sam9x5_pmc)
156156
return;
157157

@@ -227,6 +227,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
227227
&at91sam9x5_programmable_layout);
228228
if (IS_ERR(hw))
229229
goto err_free;
230+
231+
at91sam9x5_pmc->pchws[i] = hw;
230232
}
231233

232234
for (i = 0; i < ARRAY_SIZE(at91sam9x5_systemck); i++) {

drivers/clk/at91/pmc.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ struct clk_hw *of_clk_hw_pmc_get(struct of_phandle_args *clkspec, void *data)
6767
if (idx < pmc_data->ngck)
6868
return pmc_data->ghws[idx];
6969
break;
70+
case PMC_TYPE_PROGRAMMABLE:
71+
if (idx < pmc_data->npck)
72+
return pmc_data->pchws[idx];
73+
break;
7074
default:
7175
break;
7276
}
@@ -77,9 +81,10 @@ struct clk_hw *of_clk_hw_pmc_get(struct of_phandle_args *clkspec, void *data)
7781
}
7882

7983
struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem,
80-
unsigned int nperiph, unsigned int ngck)
84+
unsigned int nperiph, unsigned int ngck,
85+
unsigned int npck)
8186
{
82-
unsigned int num_clks = ncore + nsystem + nperiph + ngck;
87+
unsigned int num_clks = ncore + nsystem + nperiph + ngck + npck;
8388
struct pmc_data *pmc_data;
8489

8590
pmc_data = kzalloc(struct_size(pmc_data, hwtable, num_clks),
@@ -99,6 +104,9 @@ struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem,
99104
pmc_data->ngck = ngck;
100105
pmc_data->ghws = pmc_data->phws + nperiph;
101106

107+
pmc_data->npck = npck;
108+
pmc_data->pchws = pmc_data->ghws + ngck;
109+
102110
return pmc_data;
103111
}
104112

drivers/clk/at91/pmc.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ struct pmc_data {
2424
struct clk_hw **phws;
2525
unsigned int ngck;
2626
struct clk_hw **ghws;
27+
unsigned int npck;
28+
struct clk_hw **pchws;
2729

2830
struct clk_hw *hwtable[];
2931
};
@@ -96,7 +98,8 @@ struct clk_pcr_layout {
9698
#define ndck(a, s) (a[s - 1].id + 1)
9799
#define nck(a) (a[ARRAY_SIZE(a) - 1].id + 1)
98100
struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem,
99-
unsigned int nperiph, unsigned int ngck);
101+
unsigned int nperiph, unsigned int ngck,
102+
unsigned int npck);
100103

101104
int of_at91_get_clk_range(struct device_node *np, const char *propname,
102105
struct clk_range *range);

drivers/clk/at91/sam9x60.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
185185
sam9x60_pmc = pmc_data_allocate(PMC_MAIN + 1,
186186
nck(sam9x60_systemck),
187187
nck(sam9x60_periphck),
188-
nck(sam9x60_gck));
188+
nck(sam9x60_gck), 8);
189189
if (!sam9x60_pmc)
190190
return;
191191

@@ -255,6 +255,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
255255
&sam9x60_programmable_layout);
256256
if (IS_ERR(hw))
257257
goto err_free;
258+
259+
sam9x60_pmc->pchws[i] = hw;
258260
}
259261

260262
for (i = 0; i < ARRAY_SIZE(sam9x60_systemck); i++) {

drivers/clk/at91/sama5d2.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
170170
sama5d2_pmc = pmc_data_allocate(PMC_I2S1_MUX + 1,
171171
nck(sama5d2_systemck),
172172
nck(sama5d2_periph32ck),
173-
nck(sama5d2_gck));
173+
nck(sama5d2_gck), 3);
174174
if (!sama5d2_pmc)
175175
return;
176176

@@ -268,6 +268,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
268268
&sama5d2_programmable_layout);
269269
if (IS_ERR(hw))
270270
goto err_free;
271+
272+
sama5d2_pmc->pchws[i] = hw;
271273
}
272274

273275
for (i = 0; i < ARRAY_SIZE(sama5d2_systemck); i++) {

0 commit comments

Comments
 (0)