Skip to contentSkip to conversation

clk: imx8mq: Add a clock driver for the imx8mq

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

Subsystems (3)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: imx8mq: Add a clock driver for the imx8mq

Based off the imx8mm u-boot driver and the linux kernel driver

---
 drivers/clk/imx/Kconfig      |  16 +
 drivers/clk/imx/Makefile     |   2 +
 drivers/clk/imx/clk-imx8mq.c | 593 +++++++++++++++++++++++++++++++++++
 3 files changed, 611 insertions(+)
 create mode 100644 drivers/clk/imx/clk-imx8mq.c
drivers/clk/imx/Kconfig +16 -0
index cdd348020b..06d8c1a5dd 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 01bbbdf3ae..c5766901f2 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 +593 -0

593 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
Quoted 1 line · Angus Ainslie

Based off the imx8mm u-boot driver and the linux kernel driver

What does this patch do again ? (it is impossible to tell from the one-line commit message above unless you have it back-to-back with Subject).

Also, if these tables come from Linux, please include the upstream linux kernel commit ID from which these tables come from, so next time the tables need to be synchronized from Linux to U-Boot, we could only pick the new commits from Linux since the base commit.

[...]

Quoted 4 lines
drivers/clk/imx/clk-imx8mq.c new file +4 -0
+static const char *imx8mq_a53_core_sels[] = {"arm_a53_div", "arm_pll_out", };
+static const char *imx8mq_a53_sels[] = {"clock-osc-25m", "arm_pll_out", "sys_pll2_500m",
+					"sys_pll2_1000m", "sys_pll1_800m", "sys_pll1_400m",
+					"audio_pll1_out", "sys_pll3_out", };

drivers/clk/imx/clk-imx8mq.c line 84

Quoted 10 lines
drivers/clk/imx/clk-imx8mq.c new file +10 -0
+
+static const char *imx8mq_ahb_sels[] = {"clock-osc-25m", "sys_pll1_133m", "sys_pll1_800m",
+					"sys_pll1_400m", "sys_pll2_125m", "sys_pll3_out",
+					"audio_pll1_out", "video_pll1_out", };
+
+static const char *imx8mq_enet_axi_sels[] = {"clock-osc-25m", "sys_pll1_266m", "sys_pll1_800m",
+					     "sys_pll2_250m", "sys_pll2_200m", "audio_pll1_out",
+					     "video_pll1_out", "sys_pll3_out", };
+
+#ifndef CONFIG_SPL_BUILD

You might want to invert the logic -- ifdef CONFIG_SPL_BUILD -- and then NOT include a lot of these clock in SPL to reduce the size of the SPL.

[...]

The rest looks good to me, thanks.

#2 lore raw
Quoted 12 lines · Marek Vasut
Quoted 1 line · Angus Ainslie

Based off the imx8mm u-boot driver and the linux kernel driver

What does this patch do again ? (it is impossible to tell from the one-line commit message above unless you have it back-to-back with Subject).

Also, if these tables come from Linux, please include the upstream linux kernel commit ID from which these tables come from, so next time the tables need to be synchronized from Linux to U-Boot, we could only pick the new commits from Linux since the base commit.

Ok I'll update the description.

Quoted 16 lines

[...]

Quoted 14 lines

+static const char *imx8mq_a53_core_sels[] = {"arm_a53_div", "arm_pll_out", };
+static const char *imx8mq_a53_sels[] = {"clock-osc-25m", "arm_pll_out", "sys_pll2_500m",

drivers/clk/imx/clk-imx8mq.c new file +4 -0
+					"sys_pll2_1000m", "sys_pll1_800m", "sys_pll1_400m",
+					"audio_pll1_out", "sys_pll3_out", };
+
+static const char *imx8mq_ahb_sels[] = {"clock-osc-25m", 

"sys_pll1_133m", "sys_pll1_800m",

drivers/clk/imx/clk-imx8mq.c new file +4 -0
+					"sys_pll1_400m", "sys_pll2_125m", "sys_pll3_out",
+					"audio_pll1_out", "video_pll1_out", };
+
+static const char *imx8mq_enet_axi_sels[] = {"clock-osc-25m", 

"sys_pll1_266m", "sys_pll1_800m",

Quoted 9 lines

drivers/clk/imx/clk-imx8mq.c line 84

Quoted 4 lines
drivers/clk/imx/clk-imx8mq.c new file +4 -0
+					     "sys_pll2_250m", "sys_pll2_200m", "audio_pll1_out",
+					     "video_pll1_out", "sys_pll3_out", };
+
+#ifndef CONFIG_SPL_BUILD

You might want to invert the logic -- ifdef CONFIG_SPL_BUILD -- and then NOT include a lot of these clock in SPL to reduce the size of the SPL.

I don't use it in the SPL so just mirrored what was in the imx8mm driver.

I think I prefer to just drop them and then if there is an SPL user they can figure out where to disable SPL clocks based on the subsystems enabled rather than the SPL_BUILD flag.

Quoted 3 lines

[...]

The rest looks good to me, thanks.

Thanks can I add a Reviewed-by ?

#3 lore raw
Quoted 8 lines · Angus Ainslie
Quoted 7 lines · Marek Vasut
Quoted 1 line · Angus Ainslie

Based off the imx8mm u-boot driver and the linux kernel driver

What does this patch do again ? (it is impossible to tell from the one-line commit message above unless you have it back-to-back with Subject).

Quoted 7 lines
Quoted 5 lines

Also, if these tables come from Linux, please include the upstream linux kernel commit ID from which these tables come from, so next time the tables need to be synchronized from Linux to U-Boot, we could only pick the new commits from Linux since the base commit.

Ok I'll update the description.

Thank you

Quoted 27 lines
Quoted 17 lines

[...]

Quoted 15 lines

+static const char *imx8mq_a53_core_sels[] = {"arm_a53_div", "arm_pll_out", };
+static const char *imx8mq_a53_sels[] = {"clock-osc-25m", "arm_pll_out", "sys_pll2_500m",
+                    "sys_pll2_1000m", "sys_pll1_800m", "sys_pll1_400m", +                    "audio_pll1_out", "sys_pll3_out", };

(quoted diff) +2 -0
+
+static const char *imx8mq_ahb_sels[] = {"clock-osc-25m", 

"sys_pll1_133m", "sys_pll1_800m",
+                    "sys_pll1_400m", "sys_pll2_125m", "sys_pll3_out", +                    "audio_pll1_out", "video_pll1_out", };

(quoted diff) +2 -0
+
+static const char *imx8mq_enet_axi_sels[] = {"clock-osc-25m", 

"sys_pll1_266m", "sys_pll1_800m",
+                         "sys_pll2_250m", "sys_pll2_200m",

Quoted 9 lines

Review

Quoted 4 lines

"audio_pll1_out",
+                         "video_pll1_out", "sys_pll3_out", };

(quoted diff) +2 -0
+
+#ifndef CONFIG_SPL_BUILD

You might want to invert the logic -- ifdef CONFIG_SPL_BUILD -- and then NOT include a lot of these clock in SPL to reduce the size of the SPL.

Quoted 3 lines

I don't use it in the SPL so just mirrored what was in the imx8mm driver.

I think I prefer to just drop them and then if there is an SPL user they can figure out where to disable SPL clocks based on the subsystems enabled rather than the SPL_BUILD flag.

That works too, I suspect that SPL user would be you eventually anyway, since you will need clock driver to operate e.g. eMMC in HS modes.

Quoted 5 lines
Quoted 3 lines

[...]

The rest looks good to me, thanks.

Thanks can I add a Reviewed-by ?

Once I review the updated description, I will add it.