Skip to content

Commit 17bbcd7

Browse files
committed
Merge tag 'clk-imx-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into clk-imx
Pull i.MX clk driver updates from Shawn Guo: - A series from Anson to convert i.MX8 clock bindings to json-schema - Update pll14xx driver to include new frequency entries for pll1443x table, and return error for invalid PLL type - Clean up header includes and unnecessary code on a few clock driver - Add mssing of_node_put() call for a number of clock drivers - Drop flag CLK_IS_CRITICAL from 'A53_CORE' mux clock, as we already have the flag on its child cpu clock - Fix a53 cpu clock for i.MX8 drivers to get it source from ARM PLL via CORE_SEL slice, and source from A53 CCM clk root when we need to change ARM PLL frequency. Thus, we can support core running above 1GHz safely - Update pfdv2 driver to check zero rate and use determine_rate for getting the best rate - Add CLKO2 for imx8mm, SNVS clock for imx8mn, and PXP clock for imx7d * tag 'clk-imx-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux: (41 commits) clk: imx: clk-gate2: Pass the device to the register function clk: imx7d: Add PXP clock clk: imx8mq: A53 core clock no need to be critical clk: imx8mp: A53 core clock no need to be critical clk: imx8mm: A53 core clock no need to be critical clk: imx8mn: A53 core clock no need to be critical clk: imx: pllv4: use prepare/unprepare clk: imx: pfdv2: determine best parent rate clk: imx: pfdv2: switch to use determine_rate clk: imx: Fix division by zero warning on pfdv2 clk: imx: clk-sscg-pll: Drop unnecessary initialization clk: imx: pll14xx: Return error if pll type is invalid clk: imx: imx8mp: fix a53 cpu clock clk: imx: imx8mn: fix a53 cpu clock clk: imx: imx8mm: fix a53 cpu clock clk: imx: imx8mq: fix a53 cpu clock clk: imx8mp: Rename the IMX8MP_CLK_HDMI_27M clock clk: imx8mn: Remove unused includes clk: imx8mm: Remove unused includes clk: imx8mp: Include slab.h instead of clkdev.h ...
2 parents bb6d3fb + b5881e8 commit 17bbcd7

26 files changed

+383
-211
lines changed

Documentation/devicetree/bindings/clock/imx8mm-clock.txt

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/bindings/clock/imx8mm-clock.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: NXP i.MX8M Mini Clock Control Module Binding
8+
9+
maintainers:
10+
- Anson Huang <[email protected]>
11+
12+
description: |
13+
NXP i.MX8M Mini clock control module is an integrated clock controller, which
14+
generates and supplies to all modules.
15+
16+
properties:
17+
compatible:
18+
const: fsl,imx8mm-ccm
19+
20+
reg:
21+
maxItems: 1
22+
23+
clocks:
24+
items:
25+
- description: 32k osc
26+
- description: 24m osc
27+
- description: ext1 clock input
28+
- description: ext2 clock input
29+
- description: ext3 clock input
30+
- description: ext4 clock input
31+
32+
clock-names:
33+
items:
34+
- const: osc_32k
35+
- const: osc_24m
36+
- const: clk_ext1
37+
- const: clk_ext2
38+
- const: clk_ext3
39+
- const: clk_ext4
40+
41+
'#clock-cells':
42+
const: 1
43+
description:
44+
The clock consumer should specify the desired clock by having the clock
45+
ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8mm-clock.h
46+
for the full list of i.MX8M Mini clock IDs.
47+
48+
required:
49+
- compatible
50+
- reg
51+
- clocks
52+
- clock-names
53+
- '#clock-cells'
54+
55+
examples:
56+
# Clock Control Module node:
57+
- |
58+
clk: clock-controller@30380000 {
59+
compatible = "fsl,imx8mm-ccm";
60+
reg = <0x30380000 0x10000>;
61+
#clock-cells = <1>;
62+
clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>, <&clk_ext2>,
63+
<&clk_ext3>, <&clk_ext4>;
64+
clock-names = "osc_32k", "osc_24m", "clk_ext1", "clk_ext2",
65+
"clk_ext3", "clk_ext4";
66+
};
67+
68+
...

Documentation/devicetree/bindings/clock/imx8mn-clock.yaml

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ properties:
4040

4141
'#clock-cells':
4242
const: 1
43-
description: |
43+
description:
4444
The clock consumer should specify the desired clock by having the clock
4545
ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8mn-clock.h
4646
for the full list of i.MX8M Nano clock IDs.
@@ -57,56 +57,12 @@ examples:
5757
- |
5858
clk: clock-controller@30380000 {
5959
compatible = "fsl,imx8mn-ccm";
60-
reg = <0x0 0x30380000 0x0 0x10000>;
60+
reg = <0x30380000 0x10000>;
6161
#clock-cells = <1>;
6262
clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>,
6363
<&clk_ext2>, <&clk_ext3>, <&clk_ext4>;
6464
clock-names = "osc_32k", "osc_24m", "clk_ext1",
6565
"clk_ext2", "clk_ext3", "clk_ext4";
6666
};
6767
68-
# Required external clocks for Clock Control Module node:
69-
- |
70-
osc_32k: clock-osc-32k {
71-
compatible = "fixed-clock";
72-
#clock-cells = <0>;
73-
clock-frequency = <32768>;
74-
clock-output-names = "osc_32k";
75-
};
76-
77-
osc_24m: clock-osc-24m {
78-
compatible = "fixed-clock";
79-
#clock-cells = <0>;
80-
clock-frequency = <24000000>;
81-
clock-output-names = "osc_24m";
82-
};
83-
84-
clk_ext1: clock-ext1 {
85-
compatible = "fixed-clock";
86-
#clock-cells = <0>;
87-
clock-frequency = <133000000>;
88-
clock-output-names = "clk_ext1";
89-
};
90-
91-
clk_ext2: clock-ext2 {
92-
compatible = "fixed-clock";
93-
#clock-cells = <0>;
94-
clock-frequency = <133000000>;
95-
clock-output-names = "clk_ext2";
96-
};
97-
98-
clk_ext3: clock-ext3 {
99-
compatible = "fixed-clock";
100-
#clock-cells = <0>;
101-
clock-frequency = <133000000>;
102-
clock-output-names = "clk_ext3";
103-
};
104-
105-
clk_ext4: clock-ext4 {
106-
compatible = "fixed-clock";
107-
#clock-cells = <0>;
108-
clock-frequency= <133000000>;
109-
clock-output-names = "clk_ext4";
110-
};
111-
11268
...

Documentation/devicetree/bindings/clock/imx8mq-clock.txt

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/bindings/clock/imx8mq-clock.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: NXP i.MX8M Quad Clock Control Module Binding
8+
9+
maintainers:
10+
- Anson Huang <[email protected]>
11+
12+
description: |
13+
NXP i.MX8M Quad clock control module is an integrated clock controller, which
14+
generates and supplies to all modules.
15+
16+
properties:
17+
compatible:
18+
const: fsl,imx8mq-ccm
19+
20+
reg:
21+
maxItems: 1
22+
23+
clocks:
24+
items:
25+
- description: 32k osc
26+
- description: 25m osc
27+
- description: 27m osc
28+
- description: ext1 clock input
29+
- description: ext2 clock input
30+
- description: ext3 clock input
31+
- description: ext4 clock input
32+
33+
clock-names:
34+
items:
35+
- const: ckil
36+
- const: osc_25m
37+
- const: osc_27m
38+
- const: clk_ext1
39+
- const: clk_ext2
40+
- const: clk_ext3
41+
- const: clk_ext4
42+
43+
'#clock-cells':
44+
const: 1
45+
description:
46+
The clock consumer should specify the desired clock by having the clock
47+
ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8mq-clock.h
48+
for the full list of i.MX8M Quad clock IDs.
49+
50+
required:
51+
- compatible
52+
- reg
53+
- clocks
54+
- clock-names
55+
- '#clock-cells'
56+
57+
examples:
58+
# Clock Control Module node:
59+
- |
60+
clk: clock-controller@30380000 {
61+
compatible = "fsl,imx8mq-ccm";
62+
reg = <0x30380000 0x10000>;
63+
#clock-cells = <1>;
64+
clocks = <&ckil>, <&osc_25m>, <&osc_27m>,
65+
<&clk_ext1>, <&clk_ext2>,
66+
<&clk_ext3>, <&clk_ext4>;
67+
clock-names = "ckil", "osc_25m", "osc_27m",
68+
"clk_ext1", "clk_ext2",
69+
"clk_ext3", "clk_ext4";
70+
};
71+
72+
...

drivers/clk/imx/clk-composite-8m.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define PCG_PREDIV_MAX 8
1616

1717
#define PCG_DIV_SHIFT 0
18+
#define PCG_CORE_DIV_WIDTH 3
1819
#define PCG_DIV_WIDTH 6
1920
#define PCG_DIV_MAX 64
2021

@@ -91,7 +92,7 @@ static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw,
9192
unsigned long parent_rate)
9293
{
9394
struct clk_divider *divider = to_clk_divider(hw);
94-
unsigned long flags = 0;
95+
unsigned long flags;
9596
int prediv_value;
9697
int div_value;
9798
int ret;
@@ -126,13 +127,15 @@ static const struct clk_ops imx8m_clk_composite_divider_ops = {
126127
struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
127128
const char * const *parent_names,
128129
int num_parents, void __iomem *reg,
130+
u32 composite_flags,
129131
unsigned long flags)
130132
{
131133
struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw;
132134
struct clk_hw *div_hw, *gate_hw;
133135
struct clk_divider *div = NULL;
134136
struct clk_gate *gate = NULL;
135137
struct clk_mux *mux = NULL;
138+
const struct clk_ops *divider_ops;
136139

137140
mux = kzalloc(sizeof(*mux), GFP_KERNEL);
138141
if (!mux)
@@ -150,8 +153,16 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
150153

151154
div_hw = &div->hw;
152155
div->reg = reg;
153-
div->shift = PCG_PREDIV_SHIFT;
154-
div->width = PCG_PREDIV_WIDTH;
156+
if (composite_flags & IMX_COMPOSITE_CORE) {
157+
div->shift = PCG_DIV_SHIFT;
158+
div->width = PCG_CORE_DIV_WIDTH;
159+
divider_ops = &clk_divider_ops;
160+
} else {
161+
div->shift = PCG_PREDIV_SHIFT;
162+
div->width = PCG_PREDIV_WIDTH;
163+
divider_ops = &imx8m_clk_composite_divider_ops;
164+
}
165+
155166
div->lock = &imx_ccm_lock;
156167
div->flags = CLK_DIVIDER_ROUND_CLOSEST;
157168

@@ -166,8 +177,7 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
166177

167178
hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,
168179
mux_hw, &clk_mux_ops, div_hw,
169-
&imx8m_clk_composite_divider_ops,
170-
gate_hw, &clk_gate_ops, flags);
180+
divider_ops, gate_hw, &clk_gate_ops, flags);
171181
if (IS_ERR(hw))
172182
goto fail;
173183

drivers/clk/imx/clk-fixup-div.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static int clk_fixup_div_set_rate(struct clk_hw *hw, unsigned long rate,
5555
struct clk_fixup_div *fixup_div = to_clk_fixup_div(hw);
5656
struct clk_divider *div = to_clk_divider(hw);
5757
unsigned int divider, value;
58-
unsigned long flags = 0;
58+
unsigned long flags;
5959
u32 val;
6060

6161
divider = parent_rate / rate;

drivers/clk/imx/clk-fixup-mux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static int clk_fixup_mux_set_parent(struct clk_hw *hw, u8 index)
4242
{
4343
struct clk_fixup_mux *fixup_mux = to_clk_fixup_mux(hw);
4444
struct clk_mux *mux = to_clk_mux(hw);
45-
unsigned long flags = 0;
45+
unsigned long flags;
4646
u32 val;
4747

4848
spin_lock_irqsave(mux->lock, flags);

drivers/clk/imx/clk-gate2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static int clk_gate2_enable(struct clk_hw *hw)
4040
{
4141
struct clk_gate2 *gate = to_clk_gate2(hw);
4242
u32 reg;
43-
unsigned long flags = 0;
43+
unsigned long flags;
4444

4545
spin_lock_irqsave(gate->lock, flags);
4646

@@ -62,7 +62,7 @@ static void clk_gate2_disable(struct clk_hw *hw)
6262
{
6363
struct clk_gate2 *gate = to_clk_gate2(hw);
6464
u32 reg;
65-
unsigned long flags = 0;
65+
unsigned long flags;
6666

6767
spin_lock_irqsave(gate->lock, flags);
6868

@@ -101,7 +101,7 @@ static int clk_gate2_is_enabled(struct clk_hw *hw)
101101
static void clk_gate2_disable_unused(struct clk_hw *hw)
102102
{
103103
struct clk_gate2 *gate = to_clk_gate2(hw);
104-
unsigned long flags = 0;
104+
unsigned long flags;
105105
u32 reg;
106106

107107
spin_lock_irqsave(gate->lock, flags);
@@ -154,7 +154,7 @@ struct clk_hw *clk_hw_register_gate2(struct device *dev, const char *name,
154154
gate->hw.init = &init;
155155
hw = &gate->hw;
156156

157-
ret = clk_hw_register(NULL, hw);
157+
ret = clk_hw_register(dev, hw);
158158
if (ret) {
159159
kfree(gate);
160160
return ERR_PTR(ret);

drivers/clk/imx/clk-imx6sl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
208208
np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-anatop");
209209
base = of_iomap(np, 0);
210210
WARN_ON(!base);
211+
of_node_put(np);
211212
anatop_base = base;
212213

213214
hws[IMX6SL_PLL1_BYPASS_SRC] = imx_clk_hw_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));

0 commit comments

Comments
 (0)