Skip to contentSkip to conversation

cpufreq: imx6q: check speed grades for i.MX6ULL

PATCH Superseded Sébastien Szymanski 2 participants 4 messages Apr 19, 2018 – May 22, 2018

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 cpufreq: imx6q: check speed grades for i.MX6ULL

Check the max speed supported from the fuses for i.MX6ULL and update the operating points table accordingly.

---

Changes for v2:
- none

 drivers/cpufreq/imx6q-cpufreq.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)
drivers/cpufreq/imx6q-cpufreq.c +23 -6
index 83cf631fc9bc..f094687cae52 100644
@@ -266,6 +266,8 @@ static void imx6q_opp_check_speed_grading(struct device *dev)
 }
 
 #define OCOTP_CFG3_6UL_SPEED_696MHZ	0x2
+#define OCOTP_CFG3_6ULL_SPEED_792MHZ	0x2
+#define OCOTP_CFG3_6ULL_SPEED_900MHZ	0x3
 
 static void imx6ul_opp_check_speed_grading(struct device *dev)
 {
@@ -287,16 +289,30 @@ static void imx6ul_opp_check_speed_grading(struct device *dev)
 	 * Speed GRADING[1:0] defines the max speed of ARM:
 	 * 2b'00: Reserved;
 	 * 2b'01: 528000000Hz;
-	 * 2b'10: 696000000Hz;
-	 * 2b'11: Reserved;
+	 * 2b'10: 696000000Hz on i.MX6UL, 792000000Hz on i.MX6ULL;
+	 * 2b'11: 900000000Hz on i.MX6ULL only;
 	 * We need to set the max speed of ARM according to fuse map.
 	 */
 	val = readl_relaxed(base + OCOTP_CFG3);
 	val >>= OCOTP_CFG3_SPEED_SHIFT;
 	val &= 0x3;
-	if (val != OCOTP_CFG3_6UL_SPEED_696MHZ)
-		if (dev_pm_opp_disable(dev, 696000000))
-			dev_warn(dev, "failed to disable 696MHz OPP\n");
+
+	if (of_machine_is_compatible("fsl,imx6ul")) {
+		if (val != OCOTP_CFG3_6UL_SPEED_696MHZ)
+			if (dev_pm_opp_disable(dev, 696000000))
+				dev_warn(dev, "failed to disable 696MHz OPP\n");
+	}
+
+	if (of_machine_is_compatible("fsl,imx6ull")) {
+		if (val != OCOTP_CFG3_6ULL_SPEED_792MHZ)
+			if (dev_pm_opp_disable(dev, 792000000))
+				dev_warn(dev, "failed to disable 792MHz OPP\n");
+
+		if (val != OCOTP_CFG3_6ULL_SPEED_900MHZ)
+			if (dev_pm_opp_disable(dev, 900000000))
+				dev_warn(dev, "failed to disable 900MHz OPP\n");
+	}
+
 	iounmap(base);
 put_node:
 	of_node_put(np);
@@ -356,7 +372,8 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 		goto put_reg;
 	}
 
-	if (of_machine_is_compatible("fsl,imx6ul"))
+	if (of_machine_is_compatible("fsl,imx6ul") ||
+	    of_machine_is_compatible("fsl,imx6ull"))
 		imx6ul_opp_check_speed_grading(cpu_dev);
 	else
 		imx6q_opp_check_speed_grading(cpu_dev);
Signature · 1 line
2.16.1
#1 lore raw

PATCH v2 2/2 ARM: dts: imx6ull: add operating points

i.MX6ULL has different operating ranges than i.MX6UL so add the operating points for the i.MX6ULL. A 25mV offset is added to the minimum allowed values like for the i.MX6UL.

---

Changes for v2:
- Fix soc-operating-points voltage for 792MHz and 900MHz

 arch/arm/boot/dts/imx6ull.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
arch/arm/boot/dts/imx6ull.dtsi +19 -0
index 571ddd71cdba..530d5526b890 100644
@@ -46,6 +46,25 @@
 /* Delete UART8 in AIPS-1 (i.MX6UL specific) */
 /delete-node/ &uart8;
 
+&cpu0 {
+	operating-points = <
+		/* kHz	uV */
+		900000	1275000
+		792000	1225000
+		528000	1175000
+		396000	1025000
+		198000	950000
+	>;
+	fsl,soc-operating-points = <
+		/* KHz	uV */
+		900000	1175000
+		792000	1175000
+		528000	1175000
+		396000	1175000
+		198000	1175000
+	>;
+};
+
 / {
 	soc {
 		aips3: aips-bus at 2200000 {
Signature · 1 line
2.16.1
maintainer
#2 lore raw

PATCH v2 1/2 cpufreq: imx6q: check speed grades for i.MX6ULL

In reply to Sébastien Szymanski
Quoted 8 lines · S?bastien Szymanski

Check the max speed supported from the fuses for i.MX6ULL and update the operating points table accordingly.

---

Changes for v2:
- none

Please cc all the maintainers present in MAINTAINERS file. You missed cc'ing me and I missed V1 earlier.

drivers/cpufreq/imx6q-cpufreq.c static void imx6q_opp_check_speed_grading(struct device *dev) · line 270

Quoted 13 lines
 drivers/cpufreq/imx6q-cpufreq.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)
drivers/cpufreq/imx6q-cpufreq.c +2 -0
index 83cf631fc9bc..f094687cae52 100644
@@ -266,6 +266,8 @@ static void imx6q_opp_check_speed_grading(struct device *dev)
 }
 
 #define OCOTP_CFG3_6UL_SPEED_696MHZ    0x2
+#define OCOTP_CFG3_6ULL_SPEED_792MHZ   0x2
+#define OCOTP_CFG3_6ULL_SPEED_900MHZ   0x3

Looking at the wording everywhere, this represents the maximum supported frequency ?
In that case ...

Quoted 24 lines
drivers/cpufreq/imx6q-cpufreq.c +7 -5
 static void imx6ul_opp_check_speed_grading(struct device *dev)
 {
@@ -287,16 +289,30 @@ static void imx6ul_opp_check_speed_grading(struct device *dev)
         * Speed GRADING[1:0] defines the max speed of ARM:
         * 2b'00: Reserved;
         * 2b'01: 528000000Hz;
-        * 2b'10: 696000000Hz;
-        * 2b'11: Reserved;
+        * 2b'10: 696000000Hz on i.MX6UL, 792000000Hz on i.MX6ULL;
+        * 2b'11: 900000000Hz on i.MX6ULL only;
         * We need to set the max speed of ARM according to fuse map.
         */
        val = readl_relaxed(base + OCOTP_CFG3);
        val >>= OCOTP_CFG3_SPEED_SHIFT;
        val &= 0x3;
-       if (val != OCOTP_CFG3_6UL_SPEED_696MHZ)
-               if (dev_pm_opp_disable(dev, 696000000))
-                       dev_warn(dev, "failed to disable 696MHz OPP\n");
+
+       if (of_machine_is_compatible("fsl,imx6ul")) {
+               if (val != OCOTP_CFG3_6UL_SPEED_696MHZ)
+                       if (dev_pm_opp_disable(dev, 696000000))
+                               dev_warn(dev, "failed to disable 696MHz OPP\n");

drivers/cpufreq/imx6q-cpufreq.c static void imx6ul_opp_check_speed_grading(struct device *dev) · line 313

Quoted 10 lines
drivers/cpufreq/imx6q-cpufreq.c +10 -0
+       }
+
+       if (of_machine_is_compatible("fsl,imx6ull")) {
+               if (val != OCOTP_CFG3_6ULL_SPEED_792MHZ)
+                       if (dev_pm_opp_disable(dev, 792000000))
+                               dev_warn(dev, "failed to disable 792MHz OPP\n");
+
+               if (val != OCOTP_CFG3_6ULL_SPEED_900MHZ)
+                       if (dev_pm_opp_disable(dev, 900000000))
+                               dev_warn(dev, "failed to disable 900MHz OPP\n");

... this looks wrong to me as you will end up disabling 792 MHz if max speed is 900 MHz.

Quoted 18 lines
drivers/cpufreq/imx6q-cpufreq.c +4 -2
+       }
+
        iounmap(base);
 put_node:
        of_node_put(np);
@@ -356,7 +372,8 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
                goto put_reg;
        }
 
-       if (of_machine_is_compatible("fsl,imx6ul"))
+       if (of_machine_is_compatible("fsl,imx6ul") ||
+           of_machine_is_compatible("fsl,imx6ull"))
                imx6ul_opp_check_speed_grading(cpu_dev);
        else
                imx6q_opp_check_speed_grading(cpu_dev);
--

2.16.1

#3 lore raw

PATCH v2 1/2 cpufreq: imx6q: check speed grades for i.MX6ULL

Quoted 5 lines · Viresh Kumar
Quoted 3 lines · S?bastien Szymanski

Check the max speed supported from the fuses for i.MX6ULL and update the operating points table accordingly.

Quoted 8 lines
Quoted 5 lines

---

Changes for v2:
- none

Please cc all the maintainers present in MAINTAINERS file. You missed cc'ing me and I missed V1 earlier.

Ok.

Quoted 11 lines
Quoted 11 lines
 drivers/cpufreq/imx6q-cpufreq.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)
drivers/cpufreq/imx6q-cpufreq.c +0 -0
index 83cf631fc9bc..f094687cae52 100644
@@ -266,6 +266,8 @@ static void imx6q_opp_check_speed_grading(struct device *dev)
 }
 
Quoted 6 lines

drivers/cpufreq/imx6q-cpufreq.c static void imx6q_opp_check_speed_grading(struct device *dev) · line 270

Quoted 3 lines
drivers/cpufreq/imx6q-cpufreq.c +2 -0
 #define OCOTP_CFG3_6UL_SPEED_696MHZ    0x2
+#define OCOTP_CFG3_6ULL_SPEED_792MHZ   0x2
+#define OCOTP_CFG3_6ULL_SPEED_900MHZ   0x3

Looking at the wording everywhere, this represents the maximum supported frequency ?

Yes.

Quoted 31 lines

In that case ...

Quoted 29 lines
drivers/cpufreq/imx6q-cpufreq.c +12 -5
 static void imx6ul_opp_check_speed_grading(struct device *dev)
 {
@@ -287,16 +289,30 @@ static void imx6ul_opp_check_speed_grading(struct device *dev)
         * Speed GRADING[1:0] defines the max speed of ARM:
         * 2b'00: Reserved;
         * 2b'01: 528000000Hz;
-        * 2b'10: 696000000Hz;
-        * 2b'11: Reserved;
+        * 2b'10: 696000000Hz on i.MX6UL, 792000000Hz on i.MX6ULL;
+        * 2b'11: 900000000Hz on i.MX6ULL only;
         * We need to set the max speed of ARM according to fuse map.
         */
        val = readl_relaxed(base + OCOTP_CFG3);
        val >>= OCOTP_CFG3_SPEED_SHIFT;
        val &= 0x3;
-       if (val != OCOTP_CFG3_6UL_SPEED_696MHZ)
-               if (dev_pm_opp_disable(dev, 696000000))
-                       dev_warn(dev, "failed to disable 696MHz OPP\n");
+
+       if (of_machine_is_compatible("fsl,imx6ul")) {
+               if (val != OCOTP_CFG3_6UL_SPEED_696MHZ)
+                       if (dev_pm_opp_disable(dev, 696000000))
+                               dev_warn(dev, "failed to disable 696MHz OPP\n");
+       }
+
+       if (of_machine_is_compatible("fsl,imx6ull")) {
+               if (val != OCOTP_CFG3_6ULL_SPEED_792MHZ)
+                       if (dev_pm_opp_disable(dev, 792000000))
Quoted 8 lines

drivers/cpufreq/imx6q-cpufreq.c static void imx6ul_opp_check_speed_grading(struct device *dev) · line 313

Quoted 5 lines
drivers/cpufreq/imx6q-cpufreq.c +5 -0
+                               dev_warn(dev, "failed to disable 792MHz OPP\n");
+
+               if (val != OCOTP_CFG3_6ULL_SPEED_900MHZ)
+                       if (dev_pm_opp_disable(dev, 900000000))
+                               dev_warn(dev, "failed to disable 900MHz OPP\n");

... this looks wrong to me as you will end up disabling 792 MHz if max speed is 900 MHz.

The datasheet of the 900 MHz i.MX6ULL version [1] does not list 792 MHz as an operating range, that's why 792 MHz is disabled when max speed is 900 MHz.

[1] https://www.nxp.com/docs/en/data-sheet/IMX6ULLCEC.pdf (page 24, table 10. "Operating Ranges")

Regards,

Quoted 19 lines
Quoted 19 lines
drivers/cpufreq/imx6q-cpufreq.c +4 -2
+       }
+
        iounmap(base);
 put_node:
        of_node_put(np);
@@ -356,7 +372,8 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
                goto put_reg;
        }
 
-       if (of_machine_is_compatible("fsl,imx6ul"))
+       if (of_machine_is_compatible("fsl,imx6ul") ||
+           of_machine_is_compatible("fsl,imx6ull"))
                imx6ul_opp_check_speed_grading(cpu_dev);
        else
                imx6q_opp_check_speed_grading(cpu_dev);
--

2.16.1

Signature · 4 lines
S?bastien Szymanski
Software engineer, Armadeus Systems
Tel: +33 (0)9 72 29 41 44
Fax: +33 (0)9 72 28 79 26