Skip to contentSkip to conversation

clk: imx: Add PLLs driver for imx8mm soc

PATCH Applied Jacky Bai 3 participants 7 messages Jan 22, 2019 – Feb 21, 2019

Subsystems (4)
lore
Share & tools
lore

Jacky Bai

author
#0 lore raw

PATCH v2 1/3 clk: imx: Add PLLs driver for imx8mm soc

From: Bai Ping <[email protected]>

New PLLs are introduced on i.MX8M Mini SOC.
PLL1416X is Integer PLL, PLL1443X is a Frac PLL.

---
change v1->v2
- remove the unnecessary parenthesis & brackets
- use readl_poll_timeout for pll lock check

---
 drivers/clk/imx/Makefile      |   3 +-
 drivers/clk/imx/clk-pll14xx.c | 392 ++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/imx/clk.h         |  24 +++
 3 files changed, 418 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/imx/clk-pll14xx.c
drivers/clk/imx/Makefile +2 -1
index 73119fb..ff74287 100644
@@ -18,7 +18,8 @@ obj-$(CONFIG_MXC_CLK) += \
 	clk-pllv2.o \
 	clk-pllv3.o \
 	clk-pllv4.o \
-	clk-sccg-pll.o
+	clk-sccg-pll.o \
+	clk-pll14xx.o
 
 obj-$(CONFIG_MXC_CLK_SCU) += \
 	clk-scu.o \
drivers/clk/imx/clk-pll14xx.c new file +392 -0

392 lines not on this page · raw message

drivers/clk/imx/clk.h +24 -0
index 028312d..71929bf 100644
@@ -27,6 +27,30 @@ enum imx_sccg_pll_type {
 	SCCG_PLL2,
 };
 
+enum imx_pll14xx_type {
+	PLL_1416X,
+	PLL_1443X,
+};
+
+/* NOTE: Rate table should be kept sorted in descending order. */
+struct imx_pll14xx_rate_table {
+	unsigned int rate;
+	unsigned int pdiv;
+	unsigned int mdiv;
+	unsigned int sdiv;
+	unsigned int kdiv;
+};
+
+struct imx_pll14xx_clk {
+	enum imx_pll14xx_type type;
+	const struct imx_pll14xx_rate_table *rate_table;
+	int rate_count;
+	int flags;
+};
+
+struct clk *imx_clk_pll14xx(const char *name, const char *parent_name,
+		 void __iomem *base, const struct imx_pll14xx_clk *pll_clk);
+
 struct clk *imx_clk_pllv1(enum imx_pllv1_type type, const char *name,
 		const char *parent, void __iomem *base);
 
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v2 2/3 dt-bindings: imx: Add clock binding doc for imx8mm

From: Bai Ping <[email protected]>

Add the clock binding doc for i.MX8MM.

---
change v1->v2
- add the provider node example;
- replace table with space after define.

---
 .../devicetree/bindings/clock/imx8mm-clock.txt     |  29 +++
 include/dt-bindings/clock/imx8mm-clock.h           | 244 +++++++++++++++++++++
 2 files changed, 273 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/imx8mm-clock.txt
 create mode 100644 include/dt-bindings/clock/imx8mm-clock.h
Documentation/devicetree/bindings/clock/imx8mm-clock.txt new file +29 -0
new file mode 100644
index 0000000..8e4ab9e
@@ -0,0 +1,29 @@
+* Clock bindings for NXP i.MX8M Mini
+
+Required properties:
+- compatible: Should be "fsl,imx8mm-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,imx8mm-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/imx8mm-clock.h
+for the full list of i.MX8M Mini clock IDs.
include/dt-bindings/clock/imx8mm-clock.h new file +244 -0

244 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer Reviewed-by on v2 2/3
#2 lore raw

Re: [PATCH v2 2/3] dt-bindings: imx: Add clock binding doc for imx8mm

Quoted 9 lines · Jacky Bai

From: Bai Ping <[email protected]>

Add the clock binding doc for i.MX8MM.

---
change v1->v2
- add the provider node example;
- replace table with space after define.

Quoted 7 lines
---
 .../devicetree/bindings/clock/imx8mm-clock.txt     |  29 +++
 include/dt-bindings/clock/imx8mm-clock.h           | 244 +++++++++++++++++++++
 2 files changed, 273 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/imx8mm-clock.txt
 create mode 100644 include/dt-bindings/clock/imx8mm-clock.h
author
#4 lore raw

PATCH v2 3/3 clk: imx: Add clock driver support for imx8mm

In reply to Jacky Bai

From: Bai Ping <[email protected]>

Add clock driver support for i.MX8MM SOC.

---
change v1->v2
- remove the uncessary print log
- back to use CLK_OF_DECLARE_DRIVER, it is because some comsumer side
- dose not carefully handle the DEFER_PROBE, so for now, we just keep
- the driver registered as old i.MX6/7.

---
 drivers/clk/imx/Kconfig      |   6 +
 drivers/clk/imx/Makefile     |   1 +
 drivers/clk/imx/clk-imx8mm.c | 675 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 682 insertions(+)
 create mode 100644 drivers/clk/imx/clk-imx8mm.c
drivers/clk/imx/Kconfig +6 -0
index 4aae31a..0eaf418 100644
@@ -8,6 +8,12 @@ config MXC_CLK_SCU
 	bool
 	depends on IMX_SCU
 
+config CLK_IMX8MM
+	bool "IMX8MM CCM Clock Driver"
+	depends on ARCH_MXC && ARM64
+	help
+	    Build the driver for i.MX8MM CCM Clock Driver
+
 config CLK_IMX8MQ
 	bool "IMX8MQ CCM Clock Driver"
 	depends on ARCH_MXC && ARM64
drivers/clk/imx/Makefile +1 -0
index ff74287..0d5180f 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_MXC_CLK_SCU) += \
 	clk-scu.o \
 	clk-lpcg-scu.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-imx8mm.c new file +675 -0

675 lines not on this page · raw message

Signature · 1 line
1.9.1