Skip to contentSkip to conversation

clock_imx8mq: Added 66 MHz support for QSPI

PATCH In review Kwon Tae-young 2 participants 4 messages Jun 24, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clock_imx8mq: Added 66 MHz support for QSPI

At the current clock setting, the maximum clock for QSPI is 25 MHz. In my case I use M-RAM which supports up to 100 MHz for QSPI, and with this change the QSPI can be clocked up to 66 MHz.

---
 arch/arm/mach-imx/imx8m/clock_imx8mq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx8m/clock_imx8mq.c +2 -2
index 8fecc60ecb..47b4a8f01f 100644
@@ -473,11 +473,11 @@ int set_clk_qspi(void)
 {
 	/*
 	 * set qspi root
-	 * sys pll1 100M
+	 * sys pll1 266M
 	 */
 	clock_enable(CCGR_QSPI, 0);
 	clock_set_target_val(QSPI_CLK_ROOT, CLK_ROOT_ON |
-			     CLK_ROOT_SOURCE_SEL(7));
+			     CLK_ROOT_SOURCE_SEL(5));
 	clock_enable(CCGR_QSPI, 1);
 
 	return 0;
Signature · 1 line
2.17.1
reviewer
#1 lore raw

Hi Kwon,

Quoted 15 lines · Kwon Tae-young

At the current clock setting, the maximum clock for QSPI is 25 MHz. In my case I use M-RAM which supports up to 100 MHz for QSPI, and with this change the QSPI can be clocked up to 66 MHz.

---
 arch/arm/mach-imx/imx8m/clock_imx8mq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx8m/clock_imx8mq.c +0 -0
index 8fecc60ecb..47b4a8f01f 100644

arch/arm/mach-imx/imx8m/clock_imx8mq.c int set_clk_qspi(void) · line 480

Quoted 10 lines
arch/arm/mach-imx/imx8m/clock_imx8mq.c +2 -2
@@ -473,11 +473,11 @@ int set_clk_qspi(void)
 {
        /*
         * set qspi root
-        * sys pll1 100M
+        * sys pll1 266M
         */
        clock_enable(CCGR_QSPI, 0);
        clock_set_target_val(QSPI_CLK_ROOT, CLK_ROOT_ON |
-                            CLK_ROOT_SOURCE_SEL(7));
+                            CLK_ROOT_SOURCE_SEL(5));

It seems there is 'divide-by 4' being set somewhere.

What if you use CLK_ROOT_SOURCE_SEL(1) instead?

This selects SYS_PLL1_400MHz as the QSPI parent clock and should give you the 100MHz QSPI clock
that you need.

author
#2 lore raw
Quoted 31 lines

Hi Kwon,

Quoted 16 lines · Kwon Tae-young

At the current clock setting, the maximum clock for QSPI is 25 MHz. In my case I use M-RAM which supports up to 100 MHz for QSPI, and with this change the QSPI can be clocked up to 66 MHz.

---
 arch/arm/mach-imx/imx8m/clock_imx8mq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx8m/clock_imx8mq.c +0 -0
index 8fecc60ecb..47b4a8f01f 100644

arch/arm/mach-imx/imx8m/clock_imx8mq.c int set_clk_qspi(void) { · line 479

Quoted 9 lines
arch/arm/mach-imx/imx8m/clock_imx8mq.c +2 -2
@@ -473,11 +473,11 @@ int set_clk_qspi(void)  {
        /*
         * set qspi root
-        * sys pll1 100M
+        * sys pll1 266M
         */
        clock_enable(CCGR_QSPI, 0);
        clock_set_target_val(QSPI_CLK_ROOT, CLK_ROOT_ON |
-                            CLK_ROOT_SOURCE_SEL(7));
+                            CLK_ROOT_SOURCE_SEL(5));

It seems there is 'divide-by 4' being set somewhere.

Quoted 3 lines

What if you use CLK_ROOT_SOURCE_SEL(1) instead?

This selects SYS_PLL1_400MHz as the QSPI parent clock and should give you the 100MHz QSPI clock that you need.

The clocks I tested are as follows.
CLK_ROOT_SOURCE_SEL(0): 6.25 Mhz
CLK_ROOT_SOURCE_SEL(1): 100 Mhz
CLK_ROOT_SOURCE_SEL(2): 100 Mhz
CLK_ROOT_SOURCE_SEL(3): 125 Mhz
CLK_ROOT_SOURCE_SEL(4): 90.36 Mhz
CLK_ROOT_SOURCE_SEL(5): 66.69 Mhz
CLK_ROOT_SOURCE_SEL(6): 6.25 Mhz
CLK_ROOT_SOURCE_SEL(7): 25 Mhz

However, my board only passed the load test up to 66MHz. Should I change it to CLK_ROOT_SOURCE_SEL(1) and submit the patch?

reviewer
#3 lore raw
Quoted 10 lines · 권태영

The clocks I tested are as follows.
CLK_ROOT_SOURCE_SEL(0): 6.25 Mhz
CLK_ROOT_SOURCE_SEL(1): 100 Mhz
CLK_ROOT_SOURCE_SEL(2): 100 Mhz
CLK_ROOT_SOURCE_SEL(3): 125 Mhz
CLK_ROOT_SOURCE_SEL(4): 90.36 Mhz
CLK_ROOT_SOURCE_SEL(5): 66.69 Mhz
CLK_ROOT_SOURCE_SEL(6): 6.25 Mhz
CLK_ROOT_SOURCE_SEL(7): 25 Mhz

Quoted 2 lines

However, my board only passed the load test up to 66MHz. Should I change it to CLK_ROOT_SOURCE_SEL(1) and submit the patch?

Ok, thanks for confirming.

Your original patch looks good.