Skip to contentSkip to conversation

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

PATCH Superseded [email protected] 3 participants 8 messages Jun 3, 2019

Subsystems (4)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

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

From: Anson Huang <[email protected]>

Add the clock binding doc for i.MX8MN.

---
No changes.

---
 .../devicetree/bindings/clock/imx8mn-clock.txt     |  29 +++
 include/dt-bindings/clock/imx8mn-clock.h           | 215 +++++++++++++++++++++
 2 files changed, 244 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/imx8mn-clock.txt
 create mode 100644 include/dt-bindings/clock/imx8mn-clock.h
Documentation/devicetree/bindings/clock/imx8mn-clock.txt new file +29 -0
new file mode 100644
index 0000000..d83db5c
@@ -0,0 +1,29 @@
+* Clock bindings for NXP i.MX8M Nano
+
+Required properties:
+- compatible: Should be "fsl,imx8mn-ccm"
+- reg: Address and length of the register set
+- #clock-cells: Should be <1>
+- clocks: list of clock specifiers, must contain an entry for each required
+          entry in clock-names
+- clock-names: should include the following entries:
+    - "osc_32k"
+    - "osc_24m"
+    - "clk_ext1"
+    - "clk_ext2"
+    - "clk_ext3"
+    - "clk_ext4"
+
+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";
+};
+
+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 v2 2/3 clk: imx: Add support for i.MX8MN clock driver

From: Anson Huang <[email protected]>

This patch adds i.MX8MN clock driver support.

---
Changes since V1:
- add GPIOx clocks.

---
 drivers/clk/imx/Kconfig      |   6 +
 drivers/clk/imx/Makefile     |   1 +
 drivers/clk/imx/clk-imx8mn.c | 614 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 621 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..70a55cd 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_MXC_CLK_SCU) += \
 	clk-scu.o \
 	clk-lpcg-scu.o
 
+obj-$(CONFIG_CLK_IMX8MN) += clk-imx8mn.o
 obj-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.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 +614 -0

614 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH V2 2/3] clk: imx: Add support for i.MX8MN clock driver

Quoted 8 lines · On 19-06-03 09:35:02, [email protected] wrote:

From: Anson Huang <[email protected]>

This patch adds i.MX8MN clock driver support.

---
Changes since V1:
- add GPIOx clocks.

...

drivers/clk/imx/clk-imx8mn.c line 119

Quoted 6 lines
drivers/clk/imx/clk-imx8mn.c new file +6 -0
+static struct imx_pll14xx_clk imx8mn_sys_pll __initdata = {
+		.type = PLL_1416X,
+		.rate_table = imx8mn_pll1416x_tbl,
+};
+
+static const char *pll_ref_sels[] = { "osc_24m", "dummy", "dummy", "dummy", };

All of these should be "static const char * const ".

Quoted 2 lines
drivers/clk/imx/clk-imx8mn.c new file +2 -0
+static const char *audio_pll1_bypass_sels[] = {"audio_pll1", "audio_pll1_ref_sel", };
+static const char *audio_pll2_bypass_sels[] = {"audio_pll2", "audio_pll2_ref_sel", };

...

drivers/clk/imx/clk-imx8mn.c line 614

Quoted 13 lines
drivers/clk/imx/clk-imx8mn.c new file +13 -0
+	clk_data.clks = clks;
+	clk_data.clk_num = ARRAY_SIZE(clks);
+	ret = of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+	if (ret < 0) {
+		pr_err("failed to register clks for i.MX8MN\n");
+		return -EINVAL;
+	}
+
+	imx_register_uart_clocks(uart_clks);
+
+	return 0;
+}
+CLK_OF_DECLARE_DRIVER(imx8mn, "fsl,imx8mn-ccm", imx8mn_clocks_init);

Any reason why this cannot be a platform driver ?

Quoted 3 lines
Signature · 1 line
2.7.4
#3 lore raw

RE: [PATCH V2 2/3] clk: imx: Add support for i.MX8MN clock driver

Hi, Abel

Quoted 29 lines

-----Original Message-----
From: Abel Vesa
Sent: Monday, June 3, 2019 3:30 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]; [email protected]; Leonard Crestez <[email protected]>; [email protected]; [email protected]; Aisheng Dong <[email protected]>; Jacky Bai <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH V2 2/3] clk: imx: Add support for i.MX8MN clock driver

Quoted 8 lines · On 19-06-03 09:35:02, [email protected] wrote:

From: Anson Huang <[email protected]>

This patch adds i.MX8MN clock driver support.

---
Changes since V1:
- add GPIOx clocks.

...

Quoted 9 lines

drivers/clk/imx/clk-imx8mn.c

Quoted 7 lines
drivers/clk/imx/clk-imx8mn.c new file +7 -0
+static struct imx_pll14xx_clk imx8mn_sys_pll __initdata = {
+		.type = PLL_1416X,
+		.rate_table = imx8mn_pll1416x_tbl,
+};
+
+static const char *pll_ref_sels[] = { "osc_24m", "dummy", "dummy",
+"dummy", };

All of these should be "static const char * const ".

OK.

Quoted 22 lines
Quoted 4 lines

+static const char *audio_pll1_bypass_sels[] = {"audio_pll1", +"audio_pll1_ref_sel", }; static const char *audio_pll2_bypass_sels[] += {"audio_pll2", "audio_pll2_ref_sel", };

...

drivers/clk/imx/clk-imx8mn.c

Quoted 13 lines
drivers/clk/imx/clk-imx8mn.c new file +13 -0
+	clk_data.clks = clks;
+	clk_data.clk_num = ARRAY_SIZE(clks);
+	ret = of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+	if (ret < 0) {
+		pr_err("failed to register clks for i.MX8MN\n");
+		return -EINVAL;
+	}
+
+	imx_register_uart_clocks(uart_clks);
+
+	return 0;
+}
+CLK_OF_DECLARE_DRIVER(imx8mn, "fsl,imx8mn-ccm",

imx8mn_clocks_init);

Quoted 1 line

Any reason why this cannot be a platform driver ?

It should can be, I just did NOT take care of it, 8MQ uses platform driver model, while 8MM does NOT, I will modify both of them to use platform driver model.

Thanks,
Anson.

Quoted 4 lines
Quoted 4 lines

--
2.7.4

#4 lore raw

Re: [PATCH V2 2/3] clk: imx: Add support for i.MX8MN clock driver

In reply to [email protected]
Quoted 12 lines · On 6/3/2019 4:33 AM, [email protected] wrote:

From: Anson Huang <[email protected]>

This patch adds i.MX8MN clock driver support.

drivers/clk/imx/clk-imx8mn.c new file +8 -0
+#include "clk.h"
+
+#define PLL_1416X_RATE(_rate, _m, _p, _s)		\
+	{						\
+		.rate	=	(_rate),		\
+		.mdiv	=	(_m),			\
+		.pdiv	=	(_p),			\
+		.sdiv	=	(_s),			\

drivers/clk/imx/clk-imx8mn.c line 57

Quoted 10 lines
drivers/clk/imx/clk-imx8mn.c new file +10 -0
+	}
+
+#define PLL_1443X_RATE(_rate, _m, _p, _s, _k)		\
+	{						\
+		.rate	=	(_rate),		\
+		.mdiv	=	(_m),			\
+		.pdiv	=	(_p),			\
+		.sdiv	=	(_s),			\
+		.kdiv	=	(_k),			\
+	}

These macros are shared with clk-imx8mm (and perhaps some future chips) so they should be moved to driver/clk/imx/clk.h

#5 lore raw

RE: [PATCH V2 2/3] clk: imx: Add support for i.MX8MN clock driver

Quoted 37 lines

-----Original Message-----
From: Leonard Crestez
Sent: Monday, June 3, 2019 4:45 PM
To: Anson Huang <[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]; [email protected]; [email protected]; [email protected]; [email protected]; Aisheng Dong <[email protected]>; Jacky Bai <[email protected]>; Abel Vesa <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Cc: dl-linux-imx <[email protected]>
Subject: Re: [PATCH V2 2/3] clk: imx: Add support for i.MX8MN clock driver

Quoted 17 lines · On 6/3/2019 4:33 AM, [email protected] wrote:

From: Anson Huang <[email protected]>

This patch adds i.MX8MN clock driver support.

drivers/clk/imx/clk-imx8mn.c new file +13 -0
+#include "clk.h"
+
+#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),		\
Quoted 8 lines

drivers/clk/imx/clk-imx8mn.c line 57

Quoted 5 lines
drivers/clk/imx/clk-imx8mn.c new file +5 -0
+		.mdiv	=	(_m),			\
+		.pdiv	=	(_p),			\
+		.sdiv	=	(_s),			\
+		.kdiv	=	(_k),			\
+	}

These macros are shared with clk-imx8mm (and perhaps some future chips) so they should be moved to driver/clk/imx/clk.h

OK, will move them into clk.h in V3.

Anson.

#6 lore raw

PATCH v2 3/3 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..aef797c 100644
@@ -654,6 +654,7 @@ CONFIG_COMMON_CLK_CS2000_CP=y
 CONFIG_COMMON_CLK_S2MPS11=y
 CONFIG_CLK_QORIQ=y
 CONFIG_COMMON_CLK_PWM=y
+CONFIG_CLK_IMX8MN=y
 CONFIG_CLK_IMX8MM=y
 CONFIG_CLK_IMX8MQ=y
 CONFIG_CLK_IMX8QXP=y
Signature · 1 line
2.7.4
#7 lore raw

Re: [PATCH V2 3/3] arm64: defconfig: Select CONFIG_CLK_IMX8MN by default

Quoted 16 lines · On 19-06-03 09:35:03, [email protected] wrote:

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 +0 -0
index 8d4f25c..aef797c 100644

arch/arm64/configs/defconfig CONFIG_COMMON_CLK_CS2000_CP=y · line 657

Quoted 4 lines
arch/arm64/configs/defconfig +1 -0
@@ -654,6 +654,7 @@ CONFIG_COMMON_CLK_CS2000_CP=y
 CONFIG_COMMON_CLK_S2MPS11=y
 CONFIG_CLK_QORIQ=y
 CONFIG_COMMON_CLK_PWM=y
+CONFIG_CLK_IMX8MN=y

Nitpick: Move this after IMX8MM so it can stay alphabetically ordered.

Quoted 6 lines
arch/arm64/configs/defconfig +0 -0
 CONFIG_CLK_IMX8MM=y
 CONFIG_CLK_IMX8MQ=y
 CONFIG_CLK_IMX8QXP=y
Signature · 1 line
2.7.4