Skip to content

Commit 738e789

Browse files
committed
Merge tag 'clk-imx-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux into clk-imx
Pull i.MX clk driver updates from Abel Vesa: - Add i.MXRT1050 clock driver and bindings - Add i.MX8DXL clock driver and bindings - Add i.MX93 clock driver and bindings - Remove SYS PLL 1/2 clock gates for i.MX8M* - Remove AUDIO MCLK ROOT from i.MX7D - Add fracn gppll clock type used by i.MX93 - Add new composite clock for i.MX93 - Add missing media mipi phy ref clock for i.MX8MP - Fix off by one in imx_lpcg_parse_clks_from_dt - Rework for the pll14xx * tag 'clk-imx-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux: (24 commits) clk: imx: pll14xx: Support dynamic rates clk: imx: pll14xx: Add pr_fmt clk: imx: pll14xx: explicitly return lowest rate clk: imx: pll14xx: name variables after usage clk: imx: pll14xx: consolidate rate calculation clk: imx: pll14xx: Use FIELD_GET/FIELD_PREP clk: imx: pll14xx: Drop wrong shifting clk: imx: pll14xx: Use register defines consistently clk: imx8mp: remove SYS PLL 1/2 clock gates clk: imx8mn: remove SYS PLL 1/2 clock gates clk: imx8mm: remove SYS PLL 1/2 clock gates clk: imx: add i.MX93 clk clk: imx: support fracn gppll clk: imx: add i.MX93 composite clk dt-bindings: clock: add i.MX93 clock definition dt-bindings: clock: Add imx93 clock support clk: imx: off by one in imx_lpcg_parse_clks_from_dt() dt-bindings: fsl: scu: add imx8dxl scu clock support clk: imx7d: Remove audio_mclk_root_clk clk: imx8mp: Add missing IMX8MP_CLK_MEDIA_MIPI_PHY1_REF_ROOT clock ...
2 parents e783362 + b09c68d commit 738e789

File tree

21 files changed

+1690
-195
lines changed

21 files changed

+1690
-195
lines changed

Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ This binding uses the common clock binding[1].
8686

8787
Required properties:
8888
- compatible: Should be one of:
89+
"fsl,imx8dxl-clk"
8990
"fsl,imx8qm-clk"
9091
"fsl,imx8qxp-clk"
9192
followed by "fsl,scu-clk"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/clock/imx93-clock.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: NXP i.MX93 Clock Control Module Binding
8+
9+
maintainers:
10+
- Peng Fan <peng.fan@nxp.com>
11+
12+
description: |
13+
i.MX93 clock control module is an integrated clock controller, which
14+
includes clock generator, clock gate and supplies to all modules.
15+
16+
properties:
17+
compatible:
18+
enum:
19+
- fsl,imx93-ccm
20+
21+
reg:
22+
maxItems: 1
23+
24+
clocks:
25+
description:
26+
specify the external clocks used by the CCM module.
27+
items:
28+
- description: 32k osc
29+
- description: 24m osc
30+
- description: ext1 clock input
31+
32+
clock-names:
33+
description:
34+
specify the external clocks names used by the CCM module.
35+
items:
36+
- const: osc_32k
37+
- const: osc_24m
38+
- const: clk_ext1
39+
40+
'#clock-cells':
41+
const: 1
42+
description:
43+
See include/dt-bindings/clock/imx93-clock.h for the full list of
44+
i.MX93 clock IDs.
45+
46+
required:
47+
- compatible
48+
- reg
49+
- '#clock-cells'
50+
51+
additionalProperties: false
52+
53+
examples:
54+
# Clock Control Module node:
55+
- |
56+
clock-controller@44450000 {
57+
compatible = "fsl,imx93-ccm";
58+
reg = <0x44450000 0x10000>;
59+
#clock-cells = <1>;
60+
};
61+
62+
...
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/clock/imxrt1050-clock.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Clock bindings for Freescale i.MXRT
8+
9+
maintainers:
10+
- Giulio Benetti <giulio.benetti@benettiengineering.com>
11+
- Jesse Taube <Mr.Bossman075@gmail.com>
12+
13+
description: |
14+
The clock consumer should specify the desired clock by having the clock
15+
ID in its "clocks" phandle cell. See include/dt-bindings/clock/imxrt*-clock.h
16+
for the full list of i.MXRT clock IDs.
17+
18+
properties:
19+
compatible:
20+
const: fsl,imxrt1050-ccm
21+
22+
reg:
23+
maxItems: 1
24+
25+
interrupts:
26+
maxItems: 2
27+
28+
clocks:
29+
description: 24m osc
30+
maxItems: 1
31+
32+
clock-names:
33+
const: osc
34+
35+
'#clock-cells':
36+
const: 1
37+
38+
required:
39+
- compatible
40+
- reg
41+
- interrupts
42+
- clocks
43+
- clock-names
44+
- '#clock-cells'
45+
46+
additionalProperties: false
47+
48+
examples:
49+
- |
50+
#include <dt-bindings/clock/imxrt1050-clock.h>
51+
52+
clks: clock-controller@400fc000 {
53+
compatible = "fsl,imxrt1050-ccm";
54+
reg = <0x400fc000 0x4000>;
55+
interrupts = <95>, <96>;
56+
clocks = <&osc>;
57+
clock-names = "osc";
58+
#clock-cells = <1>;
59+
};
60+
61+
lpuart1: serial@40184000 {
62+
compatible = "fsl,imxrt1050-lpuart";
63+
reg = <0x40184000 0x4000>;
64+
interrupts = <20>;
65+
clocks = <&clks IMXRT1050_CLK_LPUART1>;
66+
clock-names = "ipg";
67+
};

drivers/clk/imx/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,16 @@ config CLK_IMX8ULP
105105
select MXC_CLK
106106
help
107107
Build the driver for i.MX8ULP CCM Clock Driver
108+
109+
config CLK_IMX93
110+
tristate "IMX93 CCM Clock Driver"
111+
depends on ARCH_MXC || COMPILE_TEST
112+
help
113+
Build the driver for i.MX93 CCM Clock Driver
114+
115+
config CLK_IMXRT1050
116+
tristate "IMXRT1050 CCM Clock Driver"
117+
depends on SOC_IMXRT
118+
select MXC_CLK
119+
help
120+
Build the driver for i.MXRT1050 CCM Clock Driver

drivers/clk/imx/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ mxc-clk-objs += clk.o
44
mxc-clk-objs += clk-busy.o
55
mxc-clk-objs += clk-composite-7ulp.o
66
mxc-clk-objs += clk-composite-8m.o
7+
mxc-clk-objs += clk-composite-93.o
8+
mxc-clk-objs += clk-fracn-gppll.o
79
mxc-clk-objs += clk-cpu.o
810
mxc-clk-objs += clk-divider-gate.o
911
mxc-clk-objs += clk-fixup-div.o
@@ -26,9 +28,12 @@ obj-$(CONFIG_CLK_IMX8MN) += clk-imx8mn.o
2628
obj-$(CONFIG_CLK_IMX8MP) += clk-imx8mp.o
2729
obj-$(CONFIG_CLK_IMX8MQ) += clk-imx8mq.o
2830

31+
obj-$(CONFIG_CLK_IMX93) += clk-imx93.o
32+
2933
obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
3034
clk-imx-scu-$(CONFIG_CLK_IMX8QXP) += clk-scu.o clk-imx8qxp.o \
31-
clk-imx8qxp-rsrc.o clk-imx8qm-rsrc.o
35+
clk-imx8qxp-rsrc.o clk-imx8qm-rsrc.o \
36+
clk-imx8dxl-rsrc.o
3237
clk-imx-lpcg-scu-$(CONFIG_CLK_IMX8QXP) += clk-lpcg-scu.o clk-imx8qxp-lpcg.o
3338

3439
obj-$(CONFIG_CLK_IMX8ULP) += clk-imx8ulp.o
@@ -46,4 +51,5 @@ obj-$(CONFIG_CLK_IMX6SX) += clk-imx6sx.o
4651
obj-$(CONFIG_CLK_IMX6UL) += clk-imx6ul.o
4752
obj-$(CONFIG_CLK_IMX7D) += clk-imx7d.o
4853
obj-$(CONFIG_CLK_IMX7ULP) += clk-imx7ulp.o
54+
obj-$(CONFIG_CLK_IMXRT1050) += clk-imxrt1050.o
4955
obj-$(CONFIG_CLK_VF610) += clk-vf610.o

drivers/clk/imx/clk-composite-93.c

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// SPDX-License-Identifier: GPL-2.0+
2+
/*
3+
* Copyright 2021 NXP
4+
*
5+
* Peng Fan <peng.fan@nxp.com>
6+
*/
7+
8+
#include <linux/clk-provider.h>
9+
#include <linux/errno.h>
10+
#include <linux/export.h>
11+
#include <linux/io.h>
12+
#include <linux/slab.h>
13+
14+
#include "clk.h"
15+
16+
#define CCM_DIV_SHIFT 0
17+
#define CCM_DIV_WIDTH 8
18+
#define CCM_MUX_SHIFT 8
19+
#define CCM_MUX_MASK 3
20+
#define CCM_OFF_SHIFT 24
21+
22+
#define AUTHEN_OFFSET 0x30
23+
#define TZ_NS_SHIFT 9
24+
#define TZ_NS_MASK BIT(9)
25+
26+
struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *parent_names,
27+
int num_parents, void __iomem *reg,
28+
unsigned long flags)
29+
{
30+
struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw;
31+
struct clk_hw *div_hw, *gate_hw;
32+
struct clk_divider *div = NULL;
33+
struct clk_gate *gate = NULL;
34+
struct clk_mux *mux = NULL;
35+
bool clk_ro = false;
36+
37+
mux = kzalloc(sizeof(*mux), GFP_KERNEL);
38+
if (!mux)
39+
goto fail;
40+
41+
mux_hw = &mux->hw;
42+
mux->reg = reg;
43+
mux->shift = CCM_MUX_SHIFT;
44+
mux->mask = CCM_MUX_MASK;
45+
mux->lock = &imx_ccm_lock;
46+
47+
div = kzalloc(sizeof(*div), GFP_KERNEL);
48+
if (!div)
49+
goto fail;
50+
51+
div_hw = &div->hw;
52+
div->reg = reg;
53+
div->shift = CCM_DIV_SHIFT;
54+
div->width = CCM_DIV_WIDTH;
55+
div->lock = &imx_ccm_lock;
56+
div->flags = CLK_DIVIDER_ROUND_CLOSEST;
57+
58+
if (!(readl(reg + AUTHEN_OFFSET) & TZ_NS_MASK))
59+
clk_ro = true;
60+
61+
if (clk_ro) {
62+
hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,
63+
mux_hw, &clk_mux_ro_ops, div_hw,
64+
&clk_divider_ro_ops, NULL, NULL, flags);
65+
} else {
66+
gate = kzalloc(sizeof(*gate), GFP_KERNEL);
67+
if (!gate)
68+
goto fail;
69+
70+
gate_hw = &gate->hw;
71+
gate->reg = reg;
72+
gate->bit_idx = CCM_OFF_SHIFT;
73+
gate->lock = &imx_ccm_lock;
74+
gate->flags = CLK_GATE_SET_TO_DISABLE;
75+
76+
hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,
77+
mux_hw, &clk_mux_ops, div_hw,
78+
&clk_divider_ops, gate_hw,
79+
&clk_gate_ops, flags | CLK_SET_RATE_NO_REPARENT);
80+
}
81+
82+
if (IS_ERR(hw))
83+
goto fail;
84+
85+
return hw;
86+
87+
fail:
88+
kfree(gate);
89+
kfree(div);
90+
kfree(mux);
91+
return ERR_CAST(hw);
92+
}
93+
EXPORT_SYMBOL_GPL(imx93_clk_composite_flags);

0 commit comments

Comments
 (0)