Add a clock driver for the imx8mq
v2 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.
Changes since v1:
More verbose clock driver description
Added forgotten dt-bindings
Synced PLL frequencies with mainline kernel
Angus Ainslie (2):
dt-bindings: imx8mq-clock: add mainline definitions
clk: imx8mq: Add a clock driver for the imx8mq
drivers/clk/imx/Kconfig | 16 + drivers/clk/imx/Makefile | 2 + drivers/clk/imx/clk-imx8mq.c | 575 +++++++++++++++++++++++ include/dt-bindings/clock/imx8mq-clock.h | 16 +- 4 files changed, 608 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/imx/clk-imx8mq.c
Signature · 1 line
2.25.1
PATCH v2 1/2 dt-bindings: imx8mq-clock: add mainline definitions
Sync the clock ids with the mainline kernel
--- include/dt-bindings/clock/imx8mq-clock.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
include/dt-bindings/clock/imx8mq-clock.h +15 -1
@@ -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
Re: [PATCH v2 1/2] dt-bindings: imx8mq-clock: add mainline definitions
Quoted 1 line · Angus Ainslie
Sync the clock ids with the mainline kernel
Commit ID from mainline Linux kernel from which this was copied is missing.
PATCH v2 2/2 clk: imx8mq: Add a clock driver for the imx8mq
In reply to Angus AinslieThis 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
The PLL rate tables are from the kernel
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=43cdaa1567ad3931fbde438853947d45238cc040
--- 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
@@ -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
@@ -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
Re: [PATCH v2 2/2] clk: imx8mq: Add a clock driver for the imx8mq
Quoted 2 lines · Angus Ainslie
This is a DM clock drvier based off the imx8mm u-boot driver and the linux kernel driver.
s@drvier@driver@
Quoted 12 lines
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 2 lines
The PLL rate tables are from the kernel
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=43cdaa1567ad3931fbde438853947d45238cc040
That patch is three years old.
That patch is for MX8M Mini clock, not for MX8M(Q).
You can use the abbreviated commit ID instead:43cdaa1567ad3 ("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place") But that seems to be the wrong commit.
Re: [PATCH v2 2/2] clk: imx8mq: Add a clock driver for the imx8mq
Quoted 6 lines · Marek Vasut
Quoted 2 lines · Angus Ainslie
This is a DM clock drvier based off the imx8mm u-boot driver and the linux kernel driver.
s@drvier@driver@
Thanks
Quoted 16 lines
Quoted 12 lines
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) DRAMQuoted 3 lines
The PLL rate tables are from the kernel
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=43cdaa1567ad3931fbde438853947d45238cc040
Quoted 6 lines
That patch is three years old.
That patch is for MX8M Mini clock, not for MX8M(Q).You can use the abbreviated commit ID instead:
43cdaa1567ad3("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place") But that seems to be the wrong commit.
That's the commit where the imx8m PLL frequency table is moved to a common file for use by all of the imx8m variants. The imx8mq linux driver does not even use the frequency tables so there is not a specific commit for it.
Re: [PATCH v2 2/2] clk: imx8mq: Add a clock driver for the imx8mq
Quoted 8 lines · Angus Ainslie
Quoted 6 lines · Marek Vasut
Quoted 2 lines · Angus Ainslie
This is a DM clock drvier based off the imx8mm u-boot driver and the linux kernel driver.
s@drvier@driver@
Thanks
Sure
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
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) DRAMThe PLL rate tables are from the kernel
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=43cdaa1567ad3931fbde438853947d45238cc040
Quoted 8 lines
Quoted 6 lines
That patch is three years old.
That patch is for MX8M Mini clock, not for MX8M(Q).You can use the abbreviated commit ID instead:
43cdaa1567ad3("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place") But that seems to be the wrong commit.That's the commit where the imx8m PLL frequency table is moved to a common file for use by all of the imx8m variants. The imx8mq linux driver does not even use the frequency tables so there is not a specific commit for it.
Isn't large part of this driver coming from these tables ?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/clk/imx/clk-imx8mq.c
Re: [PATCH v2 2/2] clk: imx8mq: Add a clock driver for the imx8mq
Quoted 25 lines · Marek Vasut
Quoted 24 lines · Angus Ainslie
Quoted 22 lines · Marek Vasut
Quoted 12 lines · Angus Ainslie
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) DRAMQuoted 2 lines
The PLL rate tables are from the kernel
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=43cdaa1567ad3931fbde438853947d45238cc040That patch is three years old.
That patch is for MX8M Mini clock, not for MX8M(Q).You can use the abbreviated commit ID instead:
43cdaa1567ad3("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place") But that seems to be the wrong commit.
Quoted 5 lines
Quoted 1 line
That's the commit where the imx8m PLL frequency table is moved to a common file for use by all of the imx8m variants. The imx8mq linux driver does not even use the frequency tables so there is not a specific commit for it.
Isn't large part of this driver coming from these tables ?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/clk/imx/clk-imx8mq.c
When I said tables I was referring to the PLL frequency tables.
The driver is modelled after the u-boot imx8mm u-boot driver with register and mux updates from the imx8mq reference manual. Very little comes from the imx8mq kernel driver. Mainly I just verified mux naming and register offsets against that driver.
That reminds me that I need to send a kernel patch for the monitor muxes.
Re: [PATCH v2 2/2] clk: imx8mq: Add a clock driver for the imx8mq
Quoted 27 lines · Angus Ainslie
Quoted 26 lines · Marek Vasut
Quoted 25 lines · Angus Ainslie
Quoted 23 lines · Marek Vasut
Quoted 12 lines · Angus Ainslie
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) DRAMQuoted 3 lines
The PLL rate tables are from the kernel
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=43cdaa1567ad3931fbde438853947d45238cc040That patch is three years old.
That patch is for MX8M Mini clock, not for MX8M(Q).You can use the abbreviated commit ID instead:
43cdaa1567ad3("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place") But that seems to be the wrong commit.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
That's the commit where the imx8m PLL frequency table is moved to a common file for use by all of the imx8m variants. The imx8mq linux driver does not even use the frequency tables so there is not a specific commit for it.
Isn't large part of this driver coming from these tables ?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/clk/imx/clk-imx8mq.c
When I said tables I was referring to the PLL frequency tables.
Ahh, hmmm, I see that we now have three copies of those PLL tables in each MX8M{M,N,P} driver and Linux instead has this in common code. Can you deduplicate the PLL tables before we add fourth copy ?
Quoted 1 line
The driver is modelled after the u-boot imx8mm u-boot driver with register and mux updates from the imx8mq reference manual. Very little comes from the imx8mq kernel driver. Mainly I just verified mux naming and register offsets against that driver.
Would it make sense to pick the Linux kernel tables instead then, instead of hand-writing them from scratch ? That seems error prone.
Quoted 1 line
That reminds me that I need to send a kernel patch for the monitor muxes.
[...]
Re: [PATCH v2 2/2] clk: imx8mq: Add a clock driver for the imx8mq
Quoted 31 lines · Marek Vasut
Quoted 30 lines · Angus Ainslie
Quoted 29 lines · Marek Vasut
Quoted 17 lines · Angus Ainslie
Quoted 16 lines · Marek Vasut
Quoted 14 lines · Angus Ainslie
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) DRAMThe PLL rate tables are from the kernel
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=43cdaa1567ad3931fbde438853947d45238cc040Quoted 8 lines
Quoted 6 lines
That patch is three years old.
That patch is for MX8M Mini clock, not for MX8M(Q).You can use the abbreviated commit ID instead:
43cdaa1567ad3("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place") But that seems to be the wrong commit.That's the commit where the imx8m PLL frequency table is moved to a common file for use by all of the imx8m variants. The imx8mq linux driver does not even use the frequency tables so there is not a specific commit for it.
Isn't large part of this driver coming from these tables ?
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/clk/imx/clk-imx8mq.c
When I said tables I was referring to the PLL frequency tables.
Ahh, hmmm, I see that we now have three copies of those PLL tables in each MX8M{M,N,P} driver and Linux instead has this in common code. Can you deduplicate the PLL tables before we add fourth copy ?
Ok I can do that for the imx8m* clock drivers.
Quoted 5 lines
Quoted 1 line
The driver is modelled after the u-boot imx8mm u-boot driver with register and mux updates from the imx8mq reference manual. Very little comes from the imx8mq kernel driver. Mainly I just verified mux naming and register offsets against that driver.
Would it make sense to pick the Linux kernel tables instead then, instead of hand-writing them from scratch ? That seems error prone.
It's a good thing I didn't just copy the kernel drivers because I found an error there. After this driver accepted there will very few if any updates to the mux tables as I think most if not all of the clocks you'll need in u-boot are defined. If there are any future updates those could be cut and pasted.
Re: [PATCH v2 2/2] clk: imx8mq: Add a clock driver for the imx8mq
Quoted 36 lines · Angus Ainslie
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Angus Ainslie
Quoted 32 lines · Marek Vasut
Quoted 18 lines · Angus Ainslie
Quoted 17 lines · Marek Vasut
Quoted 15 lines · Angus Ainslie
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) DRAMThe PLL rate tables are from the kernel
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=43cdaa1567ad3931fbde438853947d45238cc040Quoted 8 lines
Quoted 6 lines
That patch is three years old.
That patch is for MX8M Mini clock, not for MX8M(Q).You can use the abbreviated commit ID instead:
43cdaa1567ad3("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place") But that seems to be the wrong commit.That's the commit where the imx8m PLL frequency table is moved to a common file for use by all of the imx8m variants. The imx8mq linux driver does not even use the frequency tables so there is not a specific commit for it.
Isn't large part of this driver coming from these tables ?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/clk/imx/clk-imx8mq.c
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
When I said tables I was referring to the PLL frequency tables.
Ahh, hmmm, I see that we now have three copies of those PLL tables in each MX8M{M,N,P} driver and Linux instead has this in common code. Can you deduplicate the PLL tables before we add fourth copy ?
Ok I can do that for the imx8m* clock drivers.
You can do that as a separate patch too, possibly afterward as well. If something breaks, it would be easy to bisect.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
The driver is modelled after the u-boot imx8mm u-boot driver with register and mux updates from the imx8mq reference manual. Very little comes from the imx8mq kernel driver. Mainly I just verified mux naming and register offsets against that driver.
Would it make sense to pick the Linux kernel tables instead then, instead of hand-writing them from scratch ? That seems error prone.
It's a good thing I didn't just copy the kernel drivers because I found an error there. After this driver accepted there will very few if any updates to the mux tables as I think most if not all of the clocks you'll need in u-boot are defined. If there are any future updates those could be cut and pasted.
I had one more look at the kernel and u-boot drivers and now I finally see what you mean with the tables being disparate ... all right.