Skip to contentSkip to conversation

dt-bindings: imx: Add clock binding doc for i.MX8MN

PATCH Superseded [email protected] 2 participants 6 messages Jun 6, 2019

Subsystems (4)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/4 dt-bindings: imx: Add clock binding doc for i.MX8MN

From: Anson Huang <[email protected]>

Add the clock binding doc for i.MX8MN.

---
Changes since V3:
- switch binding doc from .txt to .yaml.

---
 .../devicetree/bindings/clock/imx8mn-clock.yaml    | 115 +++++++++++
 include/dt-bindings/clock/imx8mn-clock.h           | 215 +++++++++++++++++++++
 2 files changed, 330 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/imx8mn-clock.yaml
 create mode 100644 include/dt-bindings/clock/imx8mn-clock.h
Documentation/devicetree/bindings/clock/imx8mn-clock.yaml new file +115 -0
new file mode 100644
index 0000000..8cb8fcf
@@ -0,0 +1,115 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bindings/clock/imx8mn-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX8M Nano Clock Control Module Binding
+
+maintainers:
+  - Anson Huang <[email protected]>
+
+description: |
+  NXP i.MX8M Nano clock control module is an integrated clock controller, which
+  generates and supplies to all modules.
+
+  This binding uses common clock bindings
+  [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+properties:
+  compatible:
+    const: fsl,imx8mn-ccm
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: 32k osc
+      - description: 24m osc
+      - description: ext1 clock input
+      - description: ext2 clock input
+      - description: ext3 clock input
+      - description: ext4 clock input
+
+  clock-names:
+    items:
+      - const: osc_32k
+      - const: osc_24m
+      - const: clk_ext1
+      - const: clk_ext2
+      - const: clk_ext3
+      - const: clk_ext4
+
+  '#clock-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+examples:
+  # Clock Control Module node:
+  - |
+    clk: clock-controller@30380000 {
+        compatible = "fsl,imx8mn-ccm";
+        reg = <0x0 0x30380000 0x0 0x10000>;
+        #clock-cells = <1>;
+        clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>,
+                 <&clk_ext2>, <&clk_ext3>, <&clk_ext4>;
+        clock-names = "osc_32k", "osc_24m", "clk_ext1",
+                      "clk_ext2", "clk_ext3", "clk_ext4";
+    };
+
+  # Required external clocks for Clock Control Module node:
+  - |
+    osc_32k: clock-osc-32k {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <32768>;
+	clock-output-names = "osc_32k";
+    };
+
+    osc_24m: clock-osc-24m {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <24000000>;
+        clock-output-names = "osc_24m";
+    };
+
+    clk_ext1: clock-ext1 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <133000000>;
+        clock-output-names = "clk_ext1";
+    };
+
+    clk_ext2: clock-ext2 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <133000000>;
+        clock-output-names = "clk_ext2";
+    };
+
+    clk_ext3: clock-ext3 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <133000000>;
+        clock-output-names = "clk_ext3";
+    };
+
+    clk_ext4: clock-ext4 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency= <133000000>;
+        clock-output-names = "clk_ext4";
+    };
+
+  # The clock consumer should specify the desired clock by having the clock
+  # ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8mn-clock.h
+  # for the full list of i.MX8M Nano clock IDs.
+
+...
include/dt-bindings/clock/imx8mn-clock.h new file +215 -0

215 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v4 2/4 clk: imx8mm: Make 1416X/1443X PLL macro definitions common for usage

From: Anson Huang <[email protected]>

1416X/1443X PLL are used on i.MX8MM and i.MX8MN and maybe other i.MX8M series SoC later, the macro definitions of these PLLs' initialization should be common for usage.

---
No changes.

---
 drivers/clk/imx/clk-imx8mm.c | 17 -----------------
 drivers/clk/imx/clk.h        | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 17 deletions(-)
drivers/clk/imx/clk-imx8mm.c +0 -17
index eb9fcf0..fecb3b2 100644
@@ -26,23 +26,6 @@ static u32 share_count_dcss;
 static u32 share_count_pdm;
 static u32 share_count_nand;
 
-#define PLL_1416X_RATE(_rate, _m, _p, _s)		\
-	{						\
-		.rate	=	(_rate),		\
-		.mdiv	=	(_m),			\
-		.pdiv	=	(_p),			\
-		.sdiv	=	(_s),			\
-	}
-
-#define PLL_1443X_RATE(_rate, _m, _p, _s, _k)		\
-	{						\
-		.rate	=	(_rate),		\
-		.mdiv	=	(_m),			\
-		.pdiv	=	(_p),			\
-		.sdiv	=	(_s),			\
-		.kdiv	=	(_k),			\
-	}
-
 static const struct imx_pll14xx_rate_table imx8mm_pll1416x_tbl[] = {
 	PLL_1416X_RATE(1800000000U, 225, 3, 0),
 	PLL_1416X_RATE(1600000000U, 200, 3, 0),
drivers/clk/imx/clk.h +17 -0
index 6dcdc91..ac8c4ae 100644
@@ -81,6 +81,23 @@ enum imx_pllv3_type {
 	IMX_PLLV3_AV_IMX7,
 };
 
+#define PLL_1416X_RATE(_rate, _m, _p, _s)		\
+	{						\
+		.rate	=	(_rate),		\
+		.mdiv	=	(_m),			\
+		.pdiv	=	(_p),			\
+		.sdiv	=	(_s),			\
+	}
+
+#define PLL_1443X_RATE(_rate, _m, _p, _s, _k)		\
+	{						\
+		.rate	=	(_rate),		\
+		.mdiv	=	(_m),			\
+		.pdiv	=	(_p),			\
+		.sdiv	=	(_s),			\
+		.kdiv	=	(_k),			\
+	}
+
 struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
 		const char *parent_name, void __iomem *base, u32 div_mask);
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH v4 3/4 clk: imx: Add support for i.MX8MN clock driver

In reply to [email protected]

From: Anson Huang <[email protected]>

This patch adds i.MX8MN clock driver support.

---
No changes.

---
 drivers/clk/imx/Kconfig      |   6 +
 drivers/clk/imx/Makefile     |   1 +
 drivers/clk/imx/clk-imx8mn.c | 630 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 637 insertions(+)
 create mode 100644 drivers/clk/imx/clk-imx8mn.c
drivers/clk/imx/Kconfig +6 -0
index 0eaf418..1ac0c79 100644
@@ -14,6 +14,12 @@ config CLK_IMX8MM
 	help
 	    Build the driver for i.MX8MM CCM Clock Driver
 
+config CLK_IMX8MN
+	bool "IMX8MN CCM Clock Driver"
+	depends on ARCH_MXC && ARM64
+	help
+	    Build the driver for i.MX8MN CCM Clock Driver
+
 config CLK_IMX8MQ
 	bool "IMX8MQ CCM Clock Driver"
 	depends on ARCH_MXC && ARM64
drivers/clk/imx/Makefile +1 -0
index 05641c6..77a3d71 100644
@@ -26,6 +26,7 @@ obj-$(CONFIG_MXC_CLK_SCU) += \
 	clk-lpcg-scu.o
 
 obj-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.o
+obj-$(CONFIG_CLK_IMX8MN) += clk-imx8mn.o
 obj-$(CONFIG_CLK_IMX8MQ) += clk-imx8mq.o
 obj-$(CONFIG_CLK_IMX8QXP) += clk-imx8qxp.o clk-imx8qxp-lpcg.o
 
drivers/clk/imx/clk-imx8mn.c new file +630 -0

630 lines not on this page · raw message

Signature · 1 line
2.7.4
#3 lore raw

PATCH v4 4/4 arm64: defconfig: Select CONFIG_CLK_IMX8MN by default

In reply to [email protected]

From: Anson Huang <[email protected]>

Enable CONFIG_CLK_IMX8MN to support i.MX8MN clock driver.

---
No changes.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 8d4f25c..ae17f45 100644
@@ -655,6 +655,7 @@ CONFIG_COMMON_CLK_S2MPS11=y
 CONFIG_CLK_QORIQ=y
 CONFIG_COMMON_CLK_PWM=y
 CONFIG_CLK_IMX8MM=y
+CONFIG_CLK_IMX8MN=y
 CONFIG_CLK_IMX8MQ=y
 CONFIG_CLK_IMX8QXP=y
 CONFIG_TI_SCI_CLK=y
Signature · 1 line
2.7.4
Reviewed-by on v4 1/4
#4 lore raw
In reply to [email protected]

Hi,

Quoted 28 lines · On Thu, Jun 06, 2019 at 09:33:20AM +0800, [email protected] wrote:

From: Anson Huang <[email protected]>

Add the clock binding doc for i.MX8MN.

---
Changes since V3:
- switch binding doc from .txt to .yaml.

---
 .../devicetree/bindings/clock/imx8mn-clock.yaml    | 115 +++++++++++
 include/dt-bindings/clock/imx8mn-clock.h           | 215 +++++++++++++++++++++
 2 files changed, 330 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/imx8mn-clock.yaml
 create mode 100644 include/dt-bindings/clock/imx8mn-clock.h
Documentation/devicetree/bindings/clock/imx8mn-clock.yaml new file +7 -0
new file mode 100644
index 0000000..8cb8fcf
@@ -0,0 +1,115 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bindings/clock/imx8mn-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX8M Nano Clock Control Module Binding

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

Quoted 10 lines
Documentation/devicetree/bindings/clock/imx8mn-clock.yaml new file +10 -0
+
+maintainers:
+  - Anson Huang <[email protected]>
+
+description: |
+  NXP i.MX8M Nano clock control module is an integrated clock controller, which
+  generates and supplies to all modules.
+
+  This binding uses common clock bindings
+  [1] Documentation/devicetree/bindings/clock/clock-bindings.txt

Which part exactly are you using?

I'm not sure it's worth referring to. Any provider property should be listed here, and the consumer properties are already checked.

Quoted 85 lines
Documentation/devicetree/bindings/clock/imx8mn-clock.yaml new file +85 -0
+properties:
+  compatible:
+    const: fsl,imx8mn-ccm
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: 32k osc
+      - description: 24m osc
+      - description: ext1 clock input
+      - description: ext2 clock input
+      - description: ext3 clock input
+      - description: ext4 clock input
+
+  clock-names:
+    items:
+      - const: osc_32k
+      - const: osc_24m
+      - const: clk_ext1
+      - const: clk_ext2
+      - const: clk_ext3
+      - const: clk_ext4
+
+  '#clock-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+examples:
+  # Clock Control Module node:
+  - |
+    clk: clock-controller@30380000 {
+        compatible = "fsl,imx8mn-ccm";
+        reg = <0x0 0x30380000 0x0 0x10000>;
+        #clock-cells = <1>;
+        clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>,
+                 <&clk_ext2>, <&clk_ext3>, <&clk_ext4>;
+        clock-names = "osc_32k", "osc_24m", "clk_ext1",
+                      "clk_ext2", "clk_ext3", "clk_ext4";
+    };
+
+  # Required external clocks for Clock Control Module node:
+  - |
+    osc_32k: clock-osc-32k {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <32768>;
+	clock-output-names = "osc_32k";
+    };
+
+    osc_24m: clock-osc-24m {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <24000000>;
+        clock-output-names = "osc_24m";
+    };
+
+    clk_ext1: clock-ext1 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <133000000>;
+        clock-output-names = "clk_ext1";
+    };
+
+    clk_ext2: clock-ext2 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <133000000>;
+        clock-output-names = "clk_ext2";
+    };
+
+    clk_ext3: clock-ext3 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <133000000>;
+        clock-output-names = "clk_ext3";
+    };
+

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

Quoted 10 lines
Documentation/devicetree/bindings/clock/imx8mn-clock.yaml new file +10 -0
+    clk_ext4: clock-ext4 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency= <133000000>;
+        clock-output-names = "clk_ext4";
+    };
+
+  # The clock consumer should specify the desired clock by having the clock
+  # ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8mn-clock.h
+  # for the full list of i.MX8M Nano clock IDs.

I guess this could be part of the clock-cells description.

Once fixed,

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw

Hi, Maxime

Quoted 67 lines

-----Original Message-----
From: Maxime Ripard <[email protected]>
Sent: Thursday, June 6, 2019 3:41 PM
To: Anson Huang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Leonard Crestez <[email protected]>; [email protected]; [email protected]; Aisheng Dong <[email protected]>; Abel Vesa <[email protected]>; Jacky Bai <[email protected]>; [email protected]; Peng Fan <[email protected]>; linux- [email protected]; [email protected]; linux-arm- [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH V4 1/4] dt-bindings: imx: Add clock binding doc for i.MX8MN

Hi,

Quoted 11 lines · On Thu, Jun 06, 2019 at 09:33:20AM +0800, [email protected] wrote:

From: Anson Huang <[email protected]>

Add the clock binding doc for i.MX8MN.

---
Changes since V3:
- switch binding doc from .txt to .yaml.

---
 .../devicetree/bindings/clock/imx8mn-clock.yaml    | 115 +++++++++++
 include/dt-bindings/clock/imx8mn-clock.h           | 215

+++++++++++++++++++++

Quoted 20 lines
 2 files changed, 330 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/clock/imx8mn-clock.yaml
 create mode 100644 include/dt-bindings/clock/imx8mn-clock.h
Documentation/devicetree/bindings/clock/imx8mn-clock.yaml new file +8 -0
new file mode 100644
index 0000000..8cb8fcf
@@ -0,0 +1,115 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bindings/clock/imx8mn-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX8M Nano Clock Control Module Binding
+

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

Quoted 10 lines
Documentation/devicetree/bindings/clock/imx8mn-clock.yaml new file +10 -0
+maintainers:
+  - Anson Huang <[email protected]>
+
+description: |
+  NXP i.MX8M Nano clock control module is an integrated clock
+controller, which
+  generates and supplies to all modules.
+
+  This binding uses common clock bindings  [1]
+ Documentation/devicetree/bindings/clock/clock-bindings.txt

Which part exactly are you using?

Quoted 2 lines

I'm not sure it's worth referring to. Any provider property should be listed here, and the consumer properties are already checked.

Agreed, I will remove this reference statement in next version.

Quoted 91 lines
Quoted 91 lines
Documentation/devicetree/bindings/clock/imx8mn-clock.yaml new file +90 -0
+properties:
+  compatible:
+    const: fsl,imx8mn-ccm
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: 32k osc
+      - description: 24m osc
+      - description: ext1 clock input
+      - description: ext2 clock input
+      - description: ext3 clock input
+      - description: ext4 clock input
+
+  clock-names:
+    items:
+      - const: osc_32k
+      - const: osc_24m
+      - const: clk_ext1
+      - const: clk_ext2
+      - const: clk_ext3
+      - const: clk_ext4
+
+  '#clock-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+examples:
+  # Clock Control Module node:
+  - |
+    clk: clock-controller@30380000 {
+        compatible = "fsl,imx8mn-ccm";
+        reg = <0x0 0x30380000 0x0 0x10000>;
+        #clock-cells = <1>;
+        clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>,
+                 <&clk_ext2>, <&clk_ext3>, <&clk_ext4>;
+        clock-names = "osc_32k", "osc_24m", "clk_ext1",
+                      "clk_ext2", "clk_ext3", "clk_ext4";
+    };
+
+  # Required external clocks for Clock Control Module node:
+  - |
+    osc_32k: clock-osc-32k {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <32768>;
+	clock-output-names = "osc_32k";
+    };
+
+    osc_24m: clock-osc-24m {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <24000000>;
+        clock-output-names = "osc_24m";
+    };
+
+    clk_ext1: clock-ext1 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <133000000>;
+        clock-output-names = "clk_ext1";
+    };
+
+    clk_ext2: clock-ext2 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <133000000>;
+        clock-output-names = "clk_ext2";
+    };
+
+    clk_ext3: clock-ext3 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <133000000>;
+        clock-output-names = "clk_ext3";
+    };
+
+    clk_ext4: clock-ext4 {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency= <133000000>;
+        clock-output-names = "clk_ext4";
Quoted 9 lines

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

Quoted 6 lines
Documentation/devicetree/bindings/clock/imx8mn-clock.yaml new file +6 -0
+    };
+
+  # The clock consumer should specify the desired clock by having the
+ clock  # ID in its "clocks" phandle cell. See
+ include/dt-bindings/clock/imx8mn-clock.h
+  # for the full list of i.MX8M Nano clock IDs.

I guess this could be part of the clock-cells description.

OK.

Thanks,
Anson.

Quoted 9 lines

Once fixed,

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com