Skip to contentSkip to conversation

Add a clock driver for the imx8mq

PATCH Superseded Angus Ainslie 2 participants 11 messages Mar 14, 2022

Subsystems (4)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add a clock driver for the imx8mq

This is a DM clock driver for the imx8mq based on the linux kernel driver and the u-boot imx8mm clock driver.

It also removes some code duplication in the imx8m[nmp] clock drivers.

Changes since v2:

Added kernel commit IDs
Re-factored rate table code to remove duplication Remove duplicate code by creating a common clk-imx8m

Changes since v1:

More verbose clock driver description
Added forgotten dt-bindings
Synced PLL frequencies with mainline kernel

Angus Ainslie (4):
dt-bindings: imx8mq-clock: add mainline definitions
clk: imx8mq: Add a clock driver for the imx8mq
clk: imx8m: reduce rate table duplication
clk: imx8m: remove code duplication

 drivers/clk/imx/Kconfig                  |  16 +
 drivers/clk/imx/Makefile                 |   8 +-
 drivers/clk/imx/clk-imx8m.c              | 108 ++++++
 drivers/clk/imx/clk-imx8m.h              |  12 +
 drivers/clk/imx/clk-imx8mm.c             | 149 +-------
 drivers/clk/imx/clk-imx8mn.c             | 149 +-------
 drivers/clk/imx/clk-imx8mp.c             | 156 +-------
 drivers/clk/imx/clk-imx8mq.c             | 441 +++++++++++++++++++++++
 drivers/clk/imx/clk-pll14xx.c            |  44 +++
 drivers/clk/imx/clk.h                    |  21 ++
 include/dt-bindings/clock/imx8mq-clock.h |  16 +-
 11 files changed, 688 insertions(+), 432 deletions(-)
 create mode 100644 drivers/clk/imx/clk-imx8m.c
 create mode 100644 drivers/clk/imx/clk-imx8m.h
 create mode 100644 drivers/clk/imx/clk-imx8mq.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v3 1/4 dt-bindings: imx8mq-clock: add mainline definitions

Sync the clock ids with the mainline kernel

077de6e1c9f ("clk: imx8mq: add PLL monitor output")

---
 include/dt-bindings/clock/imx8mq-clock.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
include/dt-bindings/clock/imx8mq-clock.h +15 -1
index 9b8045d75b8..82e907ce7bd 100644
@@ -431,6 +431,20 @@
 
 #define IMX8MQ_CLK_A53_CORE			289
 
-#define IMX8MQ_CLK_END				290
+#define IMX8MQ_CLK_MON_AUDIO_PLL1_DIV		290
+#define IMX8MQ_CLK_MON_AUDIO_PLL2_DIV		291
+#define IMX8MQ_CLK_MON_VIDEO_PLL1_DIV		292
+#define IMX8MQ_CLK_MON_GPU_PLL_DIV		293
+#define IMX8MQ_CLK_MON_VPU_PLL_DIV		294
+#define IMX8MQ_CLK_MON_ARM_PLL_DIV		295
+#define IMX8MQ_CLK_MON_SYS_PLL1_DIV		296
+#define IMX8MQ_CLK_MON_SYS_PLL2_DIV		297
+#define IMX8MQ_CLK_MON_SYS_PLL3_DIV		298
+#define IMX8MQ_CLK_MON_DRAM_PLL_DIV		299
+#define IMX8MQ_CLK_MON_VIDEO_PLL2_DIV		300
+#define IMX8MQ_CLK_MON_SEL			301
+#define IMX8MQ_CLK_MON_CLK2_OUT			302
+
+#define IMX8MQ_CLK_END				303
 
 #endif /* __DT_BINDINGS_CLOCK_IMX8MQ_H */
Signature · 1 line
2.25.1
#3 lore raw

PATCH v3 2/4 clk: imx8mq: Add a clock driver for the imx8mq

In reply to Angus Ainslie

This is a DM clock drvier based off the imx8mm u-boot driver and the linux kernel driver.

All of the PLLs and clocks are initialized so the subsystems below are functional and tested.

1) USB host and peripheral
2) ECSPI
3) UART
4) I2C all busses
5) USDHC for eMMC support
6) USB storage
7) GPIO
8) DRAM

---
 drivers/clk/imx/Kconfig      |  16 +
 drivers/clk/imx/Makefile     |   2 +
 drivers/clk/imx/clk-imx8mq.c | 575 +++++++++++++++++++++++++++++++++++
 3 files changed, 593 insertions(+)
 create mode 100644 drivers/clk/imx/clk-imx8mq.c
drivers/clk/imx/Kconfig +16 -0
index cdd348020b0..06d8c1a5dd3 100644
@@ -71,6 +71,22 @@ config CLK_IMX8MP
 	help
 	  This enables support clock driver for i.MX8MP platforms.
 
+config SPL_CLK_IMX8MQ
+	bool "SPL clock support for i.MX8MQ"
+	depends on ARCH_IMX8M && SPL
+	select SPL_CLK
+	select SPL_CLK_CCF
+	help
+	  This enables SPL DM/DTS support for clock driver in i.MX8MQ
+
+config CLK_IMX8MQ
+	bool "Clock support for i.MX8MQ"
+	depends on ARCH_IMX8M
+	select CLK
+	select CLK_CCF
+	help
+	  This enables support clock driver for i.MX8MQ platforms.
+
 config SPL_CLK_IMXRT1020
 	bool "SPL clock support for i.MXRT1020"
 	depends on ARCH_IMXRT && SPL
drivers/clk/imx/Makefile +2 -0
index 01bbbdf3aea..c5766901f2b 100644
@@ -16,6 +16,8 @@ obj-$(CONFIG_$(SPL_TPL_)CLK_IMX8MN) += clk-imx8mn.o clk-pll14xx.o \
 				clk-composite-8m.o
 obj-$(CONFIG_$(SPL_TPL_)CLK_IMX8MP) += clk-imx8mp.o clk-pll14xx.o \
 				clk-composite-8m.o
+obj-$(CONFIG_$(SPL_TPL_)CLK_IMX8MQ) += clk-imx8mq.o clk-pll14xx.o \
+				clk-composite-8m.o
 
 obj-$(CONFIG_$(SPL_TPL_)CLK_IMXRT1020) += clk-imxrt1020.o
 obj-$(CONFIG_$(SPL_TPL_)CLK_IMXRT1050) += clk-imxrt1050.o
drivers/clk/imx/clk-imx8mq.c new file +575 -0

575 lines not on this page · raw message

Signature · 1 line
2.25.1
#4 lore raw

Re: [PATCH v3 2/4] clk: imx8mq: Add a clock driver for the imx8mq

Quoted 15 lines · Angus Ainslie

This is a DM clock drvier based off the imx8mm u-boot driver and the linux kernel driver.

All of the PLLs and clocks are initialized so the subsystems below are functional and tested.

1) USB host and peripheral
2) ECSPI
3) UART
4) I2C all busses
5) USDHC for eMMC support
6) USB storage
7) GPIO
8) DRAM

Quoted 1 line

s@drvier@driver@ again ?

Looks good to me otherwise, although I didn't check the tables. +CC Peng

#5 lore raw

PATCH v3 3/4 clk: imx8m: reduce rate table duplication

In reply to Angus Ainslie

Re-factor the imx8m[nmpq] rate tables into the common pll1416x clock driver.

43cdaa1567ad3 ("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place")

---
 drivers/clk/imx/clk-imx8mm.c  | 60 +++-----------------------------
 drivers/clk/imx/clk-imx8mn.c  | 60 +++-----------------------------
 drivers/clk/imx/clk-imx8mp.c  | 65 ++++++-----------------------------
 drivers/clk/imx/clk-imx8mq.c  | 59 ++++---------------------------
 drivers/clk/imx/clk-pll14xx.c | 44 ++++++++++++++++++++++++
 drivers/clk/imx/clk.h         | 21 +++++++++++
 6 files changed, 91 insertions(+), 218 deletions(-)
drivers/clk/imx/clk-imx8mm.c +5 -55
index 3aa8c641f9a..ab8f9b4d6b9 100644
@@ -15,56 +15,6 @@
 
 #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),		\
-		.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),
-	PLL_1416X_RATE(1200000000U, 300, 3, 1),
-	PLL_1416X_RATE(1000000000U, 250, 3, 1),
-	PLL_1416X_RATE(800000000U,  200, 3, 1),
-	PLL_1416X_RATE(750000000U,  250, 2, 2),
-	PLL_1416X_RATE(700000000U,  350, 3, 2),
-	PLL_1416X_RATE(600000000U,  300, 3, 2),
-};
-
-static const struct imx_pll14xx_rate_table imx8mm_drampll_tbl[] = {
-	PLL_1443X_RATE(650000000U, 325, 3, 2, 0),
-};
-
-static struct imx_pll14xx_clk imx8mm_dram_pll __initdata = {
-		.type = PLL_1443X,
-		.rate_table = imx8mm_drampll_tbl,
-		.rate_count = ARRAY_SIZE(imx8mm_drampll_tbl),
-};
-
-static struct imx_pll14xx_clk imx8mm_arm_pll __initdata = {
-		.type = PLL_1416X,
-		.rate_table = imx8mm_pll1416x_tbl,
-		.rate_count = ARRAY_SIZE(imx8mm_pll1416x_tbl),
-};
-
-static struct imx_pll14xx_clk imx8mm_sys_pll __initdata = {
-		.type = PLL_1416X,
-		.rate_table = imx8mm_pll1416x_tbl,
-		.rate_count = ARRAY_SIZE(imx8mm_pll1416x_tbl),
-};
-
 static const char *pll_ref_sels[] = { "clock-osc-24m", "dummy", "dummy", "dummy", };
 static const char *dram_pll_bypass_sels[] = {"dram_pll", "dram_pll_ref_sel", };
 static const char *arm_pll_bypass_sels[] = {"arm_pll", "arm_pll_ref_sel", };
@@ -250,19 +200,19 @@ static int imx8mm_clk_probe(struct udevice *dev)
 
 	clk_dm(IMX8MM_DRAM_PLL,
 	       imx_clk_pll14xx("dram_pll", "dram_pll_ref_sel",
-			       base + 0x50, &imx8mm_dram_pll));
+			       base + 0x50, &imx_1443x_dram_pll));
 	clk_dm(IMX8MM_ARM_PLL,
 	       imx_clk_pll14xx("arm_pll", "arm_pll_ref_sel",
-			       base + 0x84, &imx8mm_arm_pll));
+			       base + 0x84, &imx_1416x_pll));
 	clk_dm(IMX8MM_SYS_PLL1,
 	       imx_clk_pll14xx("sys_pll1", "sys_pll1_ref_sel",
-			       base + 0x94, &imx8mm_sys_pll));
+			       base + 0x94, &imx_1416x_pll));
 	clk_dm(IMX8MM_SYS_PLL2,
 	       imx_clk_pll14xx("sys_pll2", "sys_pll2_ref_sel",
-			       base + 0x104, &imx8mm_sys_pll));
+			       base + 0x104, &imx_1416x_pll));
 	clk_dm(IMX8MM_SYS_PLL3,
 	       imx_clk_pll14xx("sys_pll3", "sys_pll3_ref_sel",
-			       base + 0x114, &imx8mm_sys_pll));
+			       base + 0x114, &imx_1416x_pll));
 
 	/* PLL bypass out */
 	clk_dm(IMX8MM_DRAM_PLL_BYPASS,
drivers/clk/imx/clk-imx8mn.c +5 -55

80 lines not on this page · raw message

drivers/clk/imx/clk-imx8mp.c +10 -55

77 lines not on this page · raw message

drivers/clk/imx/clk-imx8mq.c +6 -53

85 lines not on this page · raw message

drivers/clk/imx/clk-pll14xx.c +44 -0

50 lines not on this page · raw message

drivers/clk/imx/clk.h +21 -0
index 60f287046b9..ac7e50fbe97 100644
@@ -41,6 +41,27 @@ struct imx_pll14xx_clk {
 	int flags;
 };
 
+extern struct imx_pll14xx_clk imx_1416x_pll;
+extern struct imx_pll14xx_clk imx_1443x_pll;
+extern struct imx_pll14xx_clk imx_1443x_dram_pll;
+
+#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_pll14xx(const char *name, const char *parent_name,
 			    void __iomem *base,
 			    const struct imx_pll14xx_clk *pll_clk);
Signature · 1 line
2.25.1
#6 lore raw

Re: [PATCH v3 3/4] clk: imx8m: reduce rate table duplication

Quoted 6 lines · Angus Ainslie

Re-factor the imx8m[nmpq] rate tables into the common pll1416x clock driver.

43cdaa1567ad3 ("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place")

Thanks

[...]

drivers/clk/imx/clk-imx8mm.c static int imx8mm_clk_probe(struct udevice *dev) · line 215

Quoted 3 lines

imx_clk_pll14xx("sys_pll3", "sys_pll3_ref_sel",

drivers/clk/imx/clk-imx8mm.c +1 -1
-			       base + 0x114, &imx8mm_sys_pll));
+			       base + 0x114, &imx_1416x_pll));

imx8m_pll1416x , since those samsung PLL14xxx are new on MX8M I think.

[...]

Quoted 74 lines
drivers/clk/imx/clk-pll14xx.c +44 -0
index b0ccb6c8eda..a60cf9bdcb0 100644
@@ -52,6 +52,50 @@ struct clk_pll14xx {
 
  #define to_clk_pll14xx(_clk) container_of(_clk, struct clk_pll14xx, clk)
 
+static const struct imx_pll14xx_rate_table imx_pll1416x_tbl[] = {
+	PLL_1416X_RATE(1800000000U, 225, 3, 0),
+	PLL_1416X_RATE(1600000000U, 200, 3, 0),
+	PLL_1416X_RATE(1500000000U, 375, 3, 1),
+	PLL_1416X_RATE(1400000000U, 350, 3, 1),
+	PLL_1416X_RATE(1200000000U, 300, 3, 1),
+	PLL_1416X_RATE(1000000000U, 250, 3, 1),
+	PLL_1416X_RATE(800000000U,  200, 3, 1),
+	PLL_1416X_RATE(750000000U,  250, 2, 2),
+	PLL_1416X_RATE(700000000U,  350, 3, 2),
+	PLL_1416X_RATE(600000000U,  300, 3, 2),
+};
+
+const struct imx_pll14xx_rate_table imx_pll1443x_tbl[] = {
+	PLL_1443X_RATE(1039500000U, 173, 2, 1, 16384),
+	PLL_1443X_RATE(650000000U, 325, 3, 2, 0),
+	PLL_1443X_RATE(594000000U, 198, 2, 2, 0),
+	PLL_1443X_RATE(519750000U, 173, 2, 2, 16384),
+	PLL_1443X_RATE(393216000U, 262, 2, 3, 9437),
+	PLL_1443X_RATE(361267200U, 361, 3, 3, 17511),
+};
+
+struct imx_pll14xx_clk imx_1443x_pll __initdata = {
+	.type = PLL_1443X,
+	.rate_table = imx_pll1443x_tbl,
+	.rate_count = ARRAY_SIZE(imx_pll1443x_tbl),
+};
+EXPORT_SYMBOL_GPL(imx_1443x_pll);
+
+struct imx_pll14xx_clk imx_1443x_dram_pll __initdata = {
+	.type = PLL_1443X,
+	.rate_table = imx_pll1443x_tbl,
+	.rate_count = ARRAY_SIZE(imx_pll1443x_tbl),
+	.flags = CLK_GET_RATE_NOCACHE,
+};
+EXPORT_SYMBOL_GPL(imx_1443x_dram_pll);
+
+struct imx_pll14xx_clk imx_1416x_pll __initdata = {
+	.type = PLL_1416X,
+	.rate_table = imx_pll1416x_tbl,
+	.rate_count = ARRAY_SIZE(imx_pll1416x_tbl),
+};
+EXPORT_SYMBOL_GPL(imx_1416x_pll);
+
  static const struct imx_pll14xx_rate_table *imx_get_pll_settings(
  		struct clk_pll14xx *pll, unsigned long rate)
  {
drivers/clk/imx/clk.h +11 -0
index 60f287046b9..ac7e50fbe97 100644
@@ -41,6 +41,27 @@ struct imx_pll14xx_clk {
  	int flags;
  };
 
+extern struct imx_pll14xx_clk imx_1416x_pll;
+extern struct imx_pll14xx_clk imx_1443x_pll;
+extern struct imx_pll14xx_clk imx_1443x_dram_pll;
+
+#define PLL_1416X_RATE(_rate, _m, _p, _s)		\
+	{						\
+		.rate	=	(_rate),		\
+		.mdiv	=	(_m),			\
+		.pdiv	=	(_p),			\
+		.sdiv	=	(_s),			\
+	}

drivers/clk/imx/clk.h struct imx_pll14xx_clk { · line 64

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

Should these macros be in drivers/clk/imx/clk-pll14xx.c ?

#7 lore raw

Re: [PATCH v3 3/4] clk: imx8m: reduce rate table duplication

Quoted 10 lines · Marek Vasut
Quoted 6 lines · Angus Ainslie

Re-factor the imx8m[nmpq] rate tables into the common pll1416x clock driver.

43cdaa1567ad3 ("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place")

Thanks

Quoted 8 lines

[...]

drivers/clk/imx/clk-imx8mm.c static int imx8mm_clk_probe(struct udevice *dev) · line 215

Quoted 3 lines

imx_clk_pll14xx("sys_pll3", "sys_pll3_ref_sel",

drivers/clk/imx/clk-imx8mm.c +1 -1
-			       base + 0x114, &imx8mm_sys_pll));
+			       base + 0x114, &imx_1416x_pll));

imx8m_pll1416x , since those samsung PLL14xxx are new on MX8M I think.

For the kernel driver it uses the generic ones ?

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/imx/clk-imx8mm.c#n346

Quoted 78 lines

[...]

Quoted 76 lines
drivers/clk/imx/clk-pll14xx.c +43 -0
index b0ccb6c8eda..a60cf9bdcb0 100644
@@ -52,6 +52,50 @@ struct clk_pll14xx {
    #define to_clk_pll14xx(_clk) container_of(_clk, struct 
 clk_pll14xx, clk)
  +static const struct imx_pll14xx_rate_table imx_pll1416x_tbl[] = {
+	PLL_1416X_RATE(1800000000U, 225, 3, 0),
+	PLL_1416X_RATE(1600000000U, 200, 3, 0),
+	PLL_1416X_RATE(1500000000U, 375, 3, 1),
+	PLL_1416X_RATE(1400000000U, 350, 3, 1),
+	PLL_1416X_RATE(1200000000U, 300, 3, 1),
+	PLL_1416X_RATE(1000000000U, 250, 3, 1),
+	PLL_1416X_RATE(800000000U,  200, 3, 1),
+	PLL_1416X_RATE(750000000U,  250, 2, 2),
+	PLL_1416X_RATE(700000000U,  350, 3, 2),
+	PLL_1416X_RATE(600000000U,  300, 3, 2),
+};
+
+const struct imx_pll14xx_rate_table imx_pll1443x_tbl[] = {
+	PLL_1443X_RATE(1039500000U, 173, 2, 1, 16384),
+	PLL_1443X_RATE(650000000U, 325, 3, 2, 0),
+	PLL_1443X_RATE(594000000U, 198, 2, 2, 0),
+	PLL_1443X_RATE(519750000U, 173, 2, 2, 16384),
+	PLL_1443X_RATE(393216000U, 262, 2, 3, 9437),
+	PLL_1443X_RATE(361267200U, 361, 3, 3, 17511),
+};
+
+struct imx_pll14xx_clk imx_1443x_pll __initdata = {
+	.type = PLL_1443X,
+	.rate_table = imx_pll1443x_tbl,
+	.rate_count = ARRAY_SIZE(imx_pll1443x_tbl),
+};
+EXPORT_SYMBOL_GPL(imx_1443x_pll);
+
+struct imx_pll14xx_clk imx_1443x_dram_pll __initdata = {
+	.type = PLL_1443X,
+	.rate_table = imx_pll1443x_tbl,
+	.rate_count = ARRAY_SIZE(imx_pll1443x_tbl),
+	.flags = CLK_GET_RATE_NOCACHE,
+};
+EXPORT_SYMBOL_GPL(imx_1443x_dram_pll);
+
+struct imx_pll14xx_clk imx_1416x_pll __initdata = {
+	.type = PLL_1416X,
+	.rate_table = imx_pll1416x_tbl,
+	.rate_count = ARRAY_SIZE(imx_pll1416x_tbl),
+};
+EXPORT_SYMBOL_GPL(imx_1416x_pll);
+
  static const struct imx_pll14xx_rate_table *imx_get_pll_settings(
  		struct clk_pll14xx *pll, unsigned long rate)
  {
drivers/clk/imx/clk.h +14 -0
index 60f287046b9..ac7e50fbe97 100644
@@ -41,6 +41,27 @@ struct imx_pll14xx_clk {
  	int flags;
  };
  +extern struct imx_pll14xx_clk imx_1416x_pll;
+extern struct imx_pll14xx_clk imx_1443x_pll;
+extern struct imx_pll14xx_clk imx_1443x_dram_pll;
+
+#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.h struct imx_pll14xx_clk { · line 64

Quoted 6 lines
drivers/clk/imx/clk.h +6 -0
+		.mdiv	=	(_m),			\
+		.pdiv	=	(_p),			\
+		.sdiv	=	(_s),			\
+		.kdiv	=	(_k),			\
+	}
+

Should these macros be in drivers/clk/imx/clk-pll14xx.c ?

Yeah I guess they aren't used anywhere else.

#8 lore raw

Re: [PATCH v3 3/4] clk: imx8m: reduce rate table duplication

Quoted 17 lines · Angus Ainslie
Quoted 16 lines · Marek Vasut
Quoted 6 lines · Angus Ainslie

Re-factor the imx8m[nmpq] rate tables into the common pll1416x clock driver.

43cdaa1567ad3 ("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place")

Thanks

[...]

Quoted 3 lines

             imx_clk_pll14xx("sys_pll3", "sys_pll3_ref_sel", -                   base + 0x114, &imx8mm_sys_pll)); +                   base + 0x114, &imx_1416x_pll));

Quoted 6 lines
Quoted 2 lines

imx8m_pll1416x , since those samsung PLL14xxx are new on MX8M I think.

For the kernel driver it uses the generic ones ?

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/imx/clk-imx8mm.c#n346

You could try sending a patch to kernel too, since I don't think I saw these samsung plls in iMX before iMX8M.

But then, if you want to keep the naming consistent between linux and u-boot, that's fine by me.

#9 lore raw

PATCH v3 4/4 clk: imx8m: remove code duplication

In reply to Angus Ainslie

All of the imx8m[nmpq] use the same clk_ops functions so move them to a common file.

---
 drivers/clk/imx/Makefile     |   8 +--
 drivers/clk/imx/clk-imx8m.c  | 108 +++++++++++++++++++++++++++++++++++
 drivers/clk/imx/clk-imx8m.h  |  12 ++++
 drivers/clk/imx/clk-imx8mm.c |  89 +----------------------------
 drivers/clk/imx/clk-imx8mn.c |  89 +----------------------------
 drivers/clk/imx/clk-imx8mp.c |  91 +----------------------------
 drivers/clk/imx/clk-imx8mq.c |  91 +----------------------------
 7 files changed, 132 insertions(+), 356 deletions(-)
 create mode 100644 drivers/clk/imx/clk-imx8m.c
 create mode 100644 drivers/clk/imx/clk-imx8m.h
drivers/clk/imx/Makefile +4 -4
index c5766901f2b..09030f1ded2 100644
@@ -11,13 +11,13 @@ obj-$(CONFIG_IMX8QXP) += clk-imx8qxp.o
 obj-$(CONFIG_IMX8QM) += clk-imx8qm.o
 endif
 obj-$(CONFIG_$(SPL_TPL_)CLK_IMX8MM) += clk-imx8mm.o clk-pll14xx.o \
-				clk-composite-8m.o
+				clk-composite-8m.o clk-imx8m.o
 obj-$(CONFIG_$(SPL_TPL_)CLK_IMX8MN) += clk-imx8mn.o clk-pll14xx.o \
-				clk-composite-8m.o
+				clk-composite-8m.o clk-imx8m.o
 obj-$(CONFIG_$(SPL_TPL_)CLK_IMX8MP) += clk-imx8mp.o clk-pll14xx.o \
-				clk-composite-8m.o
+				clk-composite-8m.o clk-imx8m.o
 obj-$(CONFIG_$(SPL_TPL_)CLK_IMX8MQ) += clk-imx8mq.o clk-pll14xx.o \
-				clk-composite-8m.o
+				clk-composite-8m.o clk-imx8m.o
 
 obj-$(CONFIG_$(SPL_TPL_)CLK_IMXRT1020) += clk-imxrt1020.o
 obj-$(CONFIG_$(SPL_TPL_)CLK_IMXRT1050) += clk-imxrt1050.o
drivers/clk/imx/clk-imx8m.c new file +108 -0

108 lines not on this page · raw message

drivers/clk/imx/clk-imx8m.h new file +12 -0
new file mode 100644
index 00000000000..7c0892e148d
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2022 Purism SPC
+ */
+
+extern ulong imx8m_clk_get_rate(struct clk *clk);
+extern ulong imx8m_clk_set_rate(struct clk *clk, unsigned long rate);
+extern int imx8m_clk_disable(struct clk *clk);
+extern int imx8m_clk_enable(struct clk *clk);
+extern int imx8m_clk_set_parent(struct clk *clk, struct clk *parent);
+
+extern struct clk_ops imx8m_clk_ops;
drivers/clk/imx/clk-imx8mm.c +2 -87

107 lines not on this page · raw message

drivers/clk/imx/clk-imx8mn.c +2 -87

107 lines not on this page · raw message

drivers/clk/imx/clk-imx8mp.c +2 -89

109 lines not on this page · raw message

drivers/clk/imx/clk-imx8mq.c +2 -89

109 lines not on this page · raw message

Signature · 1 line
2.25.1
Reviewed-by on v3 4/4
#10 lore raw

Re: [PATCH v3 4/4] clk: imx8m: remove code duplication

Quoted 13 lines · Angus Ainslie

All of the imx8m[nmpq] use the same clk_ops functions so move them to a common file.

---
  drivers/clk/imx/Makefile     |   8 +--
  drivers/clk/imx/clk-imx8m.c  | 108 +++++++++++++++++++++++++++++++++++
  drivers/clk/imx/clk-imx8m.h  |  12 ++++
  drivers/clk/imx/clk-imx8mm.c |  89 +----------------------------
  drivers/clk/imx/clk-imx8mn.c |  89 +----------------------------
  drivers/clk/imx/clk-imx8mp.c |  91 +----------------------------
  drivers/clk/imx/clk-imx8mq.c |  91 +----------------------------
  7 files changed, 132 insertions(+), 356 deletions(-)
Quoted 2 lines

create mode 100644 drivers/clk/imx/clk-imx8m.c
create mode 100644 drivers/clk/imx/clk-imx8m.h

Thanks