Skip to content

Commit ee2d2a4

Browse files
committed
Merge branches 'clk-aspeed', 'clk-keystone', 'clk-mobileye' and 'clk-allwinner' into clk-next
* clk-aspeed: clk: ast2600: Add FSI parent clock with correct rate dt-bindings: clock: ast2600: Add FSI clock * clk-keystone: clk: keystone: sci-clk: Adding support for non contiguous clocks * clk-mobileye: dt-bindings: reset: mobileye,eyeq5-reset: add bindings dt-bindings: clock: mobileye,eyeq5-clk: add bindings clk: fixed-factor: add fwname-based constructor functions clk: fixed-factor: add optional accuracy support * clk-allwinner: clk: sunxi: usb: fix kernel-doc warnings clk: sunxi: sun9i-cpus: fix kernel-doc warnings clk: sunxi: a20-gmac: fix kernel-doc warnings
5 parents cf5f06c + 56ce4e7 + ad3ac13 + c6e0897 + 84448fa commit ee2d2a4

File tree

11 files changed

+265
-35
lines changed

11 files changed

+265
-35
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/clock/mobileye,eyeq5-clk.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Mobileye EyeQ5 clock controller
8+
9+
description:
10+
The EyeQ5 clock controller handles 10 read-only PLLs derived from the main
11+
crystal clock. It also exposes one divider clock, a child of one of the PLLs.
12+
Its registers live in a shared region called OLB.
13+
14+
maintainers:
15+
- Grégory Clement <[email protected]>
16+
- Théo Lebrun <[email protected]>
17+
- Vladimir Kondratiev <[email protected]>
18+
19+
properties:
20+
compatible:
21+
const: mobileye,eyeq5-clk
22+
23+
reg:
24+
maxItems: 2
25+
26+
reg-names:
27+
items:
28+
- const: plls
29+
- const: ospi
30+
31+
"#clock-cells":
32+
const: 1
33+
34+
clocks:
35+
maxItems: 1
36+
description:
37+
Input parent clock to all PLLs. Expected to be the main crystal.
38+
39+
clock-names:
40+
items:
41+
- const: ref
42+
43+
required:
44+
- compatible
45+
- reg
46+
- reg-names
47+
- "#clock-cells"
48+
- clocks
49+
- clock-names
50+
51+
additionalProperties: false
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/reset/mobileye,eyeq5-reset.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Mobileye EyeQ5 reset controller
8+
9+
description:
10+
The EyeQ5 reset driver handles three reset domains. Its registers live in a
11+
shared region called OLB.
12+
13+
maintainers:
14+
- Grégory Clement <[email protected]>
15+
- Théo Lebrun <[email protected]>
16+
- Vladimir Kondratiev <[email protected]>
17+
18+
properties:
19+
compatible:
20+
const: mobileye,eyeq5-reset
21+
22+
reg:
23+
maxItems: 3
24+
25+
reg-names:
26+
items:
27+
- const: d0
28+
- const: d1
29+
- const: d2
30+
31+
"#reset-cells":
32+
const: 2
33+
description:
34+
The first cell is the domain (0 to 2 inclusive) and the second one is the
35+
reset index inside that domain.
36+
37+
required:
38+
- compatible
39+
- reg
40+
- reg-names
41+
- "#reset-cells"
42+
43+
additionalProperties: false

drivers/clk/clk-ast2600.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* This includes the gates (configured from aspeed_g6_gates), plus the
2020
* explicitly-configured clocks (ASPEED_CLK_HPLL and up).
2121
*/
22-
#define ASPEED_G6_NUM_CLKS 72
22+
#define ASPEED_G6_NUM_CLKS 73
2323

2424
#define ASPEED_G6_SILICON_REV 0x014
2525
#define CHIP_REVISION_ID GENMASK(23, 16)
@@ -157,7 +157,7 @@ static const struct aspeed_gate_data aspeed_g6_gates[] = {
157157
[ASPEED_CLK_GATE_UART11CLK] = { 59, -1, "uart11clk-gate", "uartx", 0 }, /* UART11 */
158158
[ASPEED_CLK_GATE_UART12CLK] = { 60, -1, "uart12clk-gate", "uartx", 0 }, /* UART12 */
159159
[ASPEED_CLK_GATE_UART13CLK] = { 61, -1, "uart13clk-gate", "uartx", 0 }, /* UART13 */
160-
[ASPEED_CLK_GATE_FSICLK] = { 62, 59, "fsiclk-gate", NULL, 0 }, /* FSI */
160+
[ASPEED_CLK_GATE_FSICLK] = { 62, 59, "fsiclk-gate", "fsiclk", 0 }, /* FSI */
161161
};
162162

163163
static const struct clk_div_table ast2600_eclk_div_table[] = {
@@ -821,6 +821,9 @@ static void __init aspeed_g6_cc(struct regmap *map)
821821

822822
hw = clk_hw_register_fixed_factor(NULL, "i3cclk", "apll", 0, 1, 8);
823823
aspeed_g6_clk_data->hws[ASPEED_CLK_I3C] = hw;
824+
825+
hw = clk_hw_register_fixed_factor(NULL, "fsiclk", "apll", 0, 1, 4);
826+
aspeed_g6_clk_data->hws[ASPEED_CLK_FSI] = hw;
824827
};
825828

826829
static void __init aspeed_g6_cc_init(struct device_node *np)

drivers/clk/clk-fixed-factor.c

Lines changed: 87 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,22 @@ static int clk_factor_set_rate(struct clk_hw *hw, unsigned long rate,
5757
return 0;
5858
}
5959

60+
static unsigned long clk_factor_recalc_accuracy(struct clk_hw *hw,
61+
unsigned long parent_accuracy)
62+
{
63+
struct clk_fixed_factor *fix = to_clk_fixed_factor(hw);
64+
65+
if (fix->flags & CLK_FIXED_FACTOR_FIXED_ACCURACY)
66+
return fix->acc;
67+
68+
return parent_accuracy;
69+
}
70+
6071
const struct clk_ops clk_fixed_factor_ops = {
6172
.round_rate = clk_factor_round_rate,
6273
.set_rate = clk_factor_set_rate,
6374
.recalc_rate = clk_factor_recalc_rate,
75+
.recalc_accuracy = clk_factor_recalc_accuracy,
6476
};
6577
EXPORT_SYMBOL_GPL(clk_fixed_factor_ops);
6678

@@ -79,13 +91,12 @@ static void devm_clk_hw_register_fixed_factor_release(struct device *dev, void *
7991
static struct clk_hw *
8092
__clk_hw_register_fixed_factor(struct device *dev, struct device_node *np,
8193
const char *name, const char *parent_name,
82-
const struct clk_hw *parent_hw, int index,
94+
const struct clk_hw *parent_hw, const struct clk_parent_data *pdata,
8395
unsigned long flags, unsigned int mult, unsigned int div,
84-
bool devm)
96+
unsigned long acc, unsigned int fixflags, bool devm)
8597
{
8698
struct clk_fixed_factor *fix;
8799
struct clk_init_data init = { };
88-
struct clk_parent_data pdata = { .index = index };
89100
struct clk_hw *hw;
90101
int ret;
91102

@@ -105,6 +116,8 @@ __clk_hw_register_fixed_factor(struct device *dev, struct device_node *np,
105116
fix->mult = mult;
106117
fix->div = div;
107118
fix->hw.init = &init;
119+
fix->acc = acc;
120+
fix->flags = fixflags;
108121

109122
init.name = name;
110123
init.ops = &clk_fixed_factor_ops;
@@ -114,7 +127,7 @@ __clk_hw_register_fixed_factor(struct device *dev, struct device_node *np,
114127
else if (parent_hw)
115128
init.parent_hws = &parent_hw;
116129
else
117-
init.parent_data = &pdata;
130+
init.parent_data = pdata;
118131
init.num_parents = 1;
119132

120133
hw = &fix->hw;
@@ -151,8 +164,10 @@ struct clk_hw *devm_clk_hw_register_fixed_factor_index(struct device *dev,
151164
const char *name, unsigned int index, unsigned long flags,
152165
unsigned int mult, unsigned int div)
153166
{
154-
return __clk_hw_register_fixed_factor(dev, NULL, name, NULL, NULL, index,
155-
flags, mult, div, true);
167+
const struct clk_parent_data pdata = { .index = index };
168+
169+
return __clk_hw_register_fixed_factor(dev, NULL, name, NULL, NULL, &pdata,
170+
flags, mult, div, 0, 0, true);
156171
}
157172
EXPORT_SYMBOL_GPL(devm_clk_hw_register_fixed_factor_index);
158173

@@ -173,30 +188,59 @@ struct clk_hw *devm_clk_hw_register_fixed_factor_parent_hw(struct device *dev,
173188
const char *name, const struct clk_hw *parent_hw,
174189
unsigned long flags, unsigned int mult, unsigned int div)
175190
{
191+
const struct clk_parent_data pdata = { .index = -1 };
192+
176193
return __clk_hw_register_fixed_factor(dev, NULL, name, NULL, parent_hw,
177-
-1, flags, mult, div, true);
194+
&pdata, flags, mult, div, 0, 0, true);
178195
}
179196
EXPORT_SYMBOL_GPL(devm_clk_hw_register_fixed_factor_parent_hw);
180197

181198
struct clk_hw *clk_hw_register_fixed_factor_parent_hw(struct device *dev,
182199
const char *name, const struct clk_hw *parent_hw,
183200
unsigned long flags, unsigned int mult, unsigned int div)
184201
{
185-
return __clk_hw_register_fixed_factor(dev, NULL, name, NULL,
186-
parent_hw, -1, flags, mult, div,
187-
false);
202+
const struct clk_parent_data pdata = { .index = -1 };
203+
204+
return __clk_hw_register_fixed_factor(dev, NULL, name, NULL, parent_hw,
205+
&pdata, flags, mult, div, 0, 0, false);
188206
}
189207
EXPORT_SYMBOL_GPL(clk_hw_register_fixed_factor_parent_hw);
190208

191209
struct clk_hw *clk_hw_register_fixed_factor(struct device *dev,
192210
const char *name, const char *parent_name, unsigned long flags,
193211
unsigned int mult, unsigned int div)
194212
{
195-
return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL, -1,
196-
flags, mult, div, false);
213+
const struct clk_parent_data pdata = { .index = -1 };
214+
215+
return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL,
216+
&pdata, flags, mult, div, 0, 0, false);
197217
}
198218
EXPORT_SYMBOL_GPL(clk_hw_register_fixed_factor);
199219

220+
struct clk_hw *clk_hw_register_fixed_factor_fwname(struct device *dev,
221+
struct device_node *np, const char *name, const char *fw_name,
222+
unsigned long flags, unsigned int mult, unsigned int div)
223+
{
224+
const struct clk_parent_data pdata = { .index = -1, .fw_name = fw_name };
225+
226+
return __clk_hw_register_fixed_factor(dev, np, name, NULL, NULL,
227+
&pdata, flags, mult, div, 0, 0, false);
228+
}
229+
EXPORT_SYMBOL_GPL(clk_hw_register_fixed_factor_fwname);
230+
231+
struct clk_hw *clk_hw_register_fixed_factor_with_accuracy_fwname(struct device *dev,
232+
struct device_node *np, const char *name, const char *fw_name,
233+
unsigned long flags, unsigned int mult, unsigned int div,
234+
unsigned long acc)
235+
{
236+
const struct clk_parent_data pdata = { .index = -1, .fw_name = fw_name };
237+
238+
return __clk_hw_register_fixed_factor(dev, np, name, NULL, NULL,
239+
&pdata, flags, mult, div, acc,
240+
CLK_FIXED_FACTOR_FIXED_ACCURACY, false);
241+
}
242+
EXPORT_SYMBOL_GPL(clk_hw_register_fixed_factor_with_accuracy_fwname);
243+
200244
struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
201245
const char *parent_name, unsigned long flags,
202246
unsigned int mult, unsigned int div)
@@ -239,16 +283,43 @@ struct clk_hw *devm_clk_hw_register_fixed_factor(struct device *dev,
239283
const char *name, const char *parent_name, unsigned long flags,
240284
unsigned int mult, unsigned int div)
241285
{
242-
return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL, -1,
243-
flags, mult, div, true);
286+
const struct clk_parent_data pdata = { .index = -1 };
287+
288+
return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL,
289+
&pdata, flags, mult, div, 0, 0, true);
244290
}
245291
EXPORT_SYMBOL_GPL(devm_clk_hw_register_fixed_factor);
246292

293+
struct clk_hw *devm_clk_hw_register_fixed_factor_fwname(struct device *dev,
294+
struct device_node *np, const char *name, const char *fw_name,
295+
unsigned long flags, unsigned int mult, unsigned int div)
296+
{
297+
const struct clk_parent_data pdata = { .index = -1, .fw_name = fw_name };
298+
299+
return __clk_hw_register_fixed_factor(dev, np, name, NULL, NULL,
300+
&pdata, flags, mult, div, 0, 0, true);
301+
}
302+
EXPORT_SYMBOL_GPL(devm_clk_hw_register_fixed_factor_fwname);
303+
304+
struct clk_hw *devm_clk_hw_register_fixed_factor_with_accuracy_fwname(struct device *dev,
305+
struct device_node *np, const char *name, const char *fw_name,
306+
unsigned long flags, unsigned int mult, unsigned int div,
307+
unsigned long acc)
308+
{
309+
const struct clk_parent_data pdata = { .index = -1, .fw_name = fw_name };
310+
311+
return __clk_hw_register_fixed_factor(dev, np, name, NULL, NULL,
312+
&pdata, flags, mult, div, acc,
313+
CLK_FIXED_FACTOR_FIXED_ACCURACY, true);
314+
}
315+
EXPORT_SYMBOL_GPL(devm_clk_hw_register_fixed_factor_with_accuracy_fwname);
316+
247317
#ifdef CONFIG_OF
248318
static struct clk_hw *_of_fixed_factor_clk_setup(struct device_node *node)
249319
{
250320
struct clk_hw *hw;
251321
const char *clk_name = node->name;
322+
const struct clk_parent_data pdata = { .index = 0 };
252323
u32 div, mult;
253324
int ret;
254325

@@ -266,8 +337,8 @@ static struct clk_hw *_of_fixed_factor_clk_setup(struct device_node *node)
266337

267338
of_property_read_string(node, "clock-output-names", &clk_name);
268339

269-
hw = __clk_hw_register_fixed_factor(NULL, node, clk_name, NULL, NULL, 0,
270-
0, mult, div, false);
340+
hw = __clk_hw_register_fixed_factor(NULL, node, clk_name, NULL, NULL,
341+
&pdata, 0, mult, div, 0, 0, false);
271342
if (IS_ERR(hw)) {
272343
/*
273344
* Clear OF_POPULATED flag so that clock registration can be

drivers/clk/keystone/sci-clk.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider)
516516
struct sci_clk *sci_clk, *prev;
517517
int num_clks = 0;
518518
int num_parents;
519+
bool state;
519520
int clk_id;
520521
const char * const clk_names[] = {
521522
"clocks", "assigned-clocks", "assigned-clock-parents", NULL
@@ -586,6 +587,15 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider)
586587
clk_id = args.args[1] + 1;
587588

588589
while (num_parents--) {
590+
/* Check if this clock id is valid */
591+
ret = provider->ops->is_auto(provider->sci,
592+
sci_clk->dev_id, clk_id, &state);
593+
594+
if (ret) {
595+
clk_id++;
596+
continue;
597+
}
598+
589599
sci_clk = devm_kzalloc(dev,
590600
sizeof(*sci_clk),
591601
GFP_KERNEL);

drivers/clk/sunxi/clk-a20-gmac.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,19 @@
1515

1616
static DEFINE_SPINLOCK(gmac_lock);
1717

18+
19+
#define SUN7I_A20_GMAC_GPIT 2
20+
#define SUN7I_A20_GMAC_MASK 0x3
21+
#define SUN7I_A20_GMAC_PARENTS 2
22+
23+
static u32 sun7i_a20_gmac_mux_table[SUN7I_A20_GMAC_PARENTS] = {
24+
0x00, /* Select mii_phy_tx_clk */
25+
0x02, /* Select gmac_int_tx_clk */
26+
};
27+
1828
/**
1929
* sun7i_a20_gmac_clk_setup - Setup function for A20/A31 GMAC clock module
30+
* @node: &struct device_node for the clock
2031
*
2132
* This clock looks something like this
2233
* ________________________
@@ -39,16 +50,6 @@ static DEFINE_SPINLOCK(gmac_lock);
3950
* enable/disable this clock to configure the required state. The clock
4051
* driver then responds by auto-reparenting the clock.
4152
*/
42-
43-
#define SUN7I_A20_GMAC_GPIT 2
44-
#define SUN7I_A20_GMAC_MASK 0x3
45-
#define SUN7I_A20_GMAC_PARENTS 2
46-
47-
static u32 sun7i_a20_gmac_mux_table[SUN7I_A20_GMAC_PARENTS] = {
48-
0x00, /* Select mii_phy_tx_clk */
49-
0x02, /* Select gmac_int_tx_clk */
50-
};
51-
5253
static void __init sun7i_a20_gmac_clk_setup(struct device_node *node)
5354
{
5455
struct clk *clk;

drivers/clk/sunxi/clk-sun9i-cpus.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818

1919
static DEFINE_SPINLOCK(sun9i_a80_cpus_lock);
2020

21-
/**
22-
* sun9i_a80_cpus_clk_setup() - Setup function for a80 cpus composite clk
23-
*/
2421

2522
#define SUN9I_CPUS_MAX_PARENTS 4
2623
#define SUN9I_CPUS_MUX_PARENT_PLL4 3
@@ -180,6 +177,10 @@ static const struct clk_ops sun9i_a80_cpus_clk_ops = {
180177
.set_rate = sun9i_a80_cpus_clk_set_rate,
181178
};
182179

180+
/**
181+
* sun9i_a80_cpus_setup() - Setup function for a80 cpus composite clk
182+
* @node: &struct device_node for the clock
183+
*/
183184
static void sun9i_a80_cpus_setup(struct device_node *node)
184185
{
185186
const char *clk_name = node->name;

0 commit comments

Comments
 (0)