Skip to contentSkip to conversation

mx6: peripheral clock from oscillator

PATCH Superseded Jorge Ramirez-Ortiz 3 participants 7 messages Oct 19, 2020 – Oct 23, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mx6: peripheral clock from oscillator

In order to be able to run the I2C bus at 400Khz, the chip errata[1] recommends that the peripheral clock runs out of the 24MHz oscillator.

[1] Rev 2, 10/2019, ERR007805

---
 arch/arm/mach-imx/mx6/soc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-imx/mx6/soc.c +3 -1
index e129286065..f498c93b00 100644
@@ -26,6 +26,8 @@
 #include <imx_thermal.h>
 #include <mmc.h>
 
+#define ERRATA_ERR007805 (is_mx6dl() || is_mx6solo() || is_mx6ull())
+
 struct scu_regs {
 	u32	ctrl;
 	u32	config;
@@ -469,7 +471,7 @@ int arch_cpu_init(void)
 	}
 
 	/* Set perclk to source from OSC 24MHz */
-	if (is_mx6sl())
+	if (is_mx6sl() || ERRATA_ERR007805)
 		setbits_le32(&ccm->cscmr1, MXC_CCM_CSCMR1_PER_CLK_SEL_MASK);
 
 	imx_wdog_disable_powerdown(); /* Disable PDE bit of WMCR register */
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 mx6: peripheral clock from oscillator

Quoted 24 lines · Jorge Ramirez-Ortiz

In order to be able to run the I2C bus at 400Khz, the chip errata[1] recommends that the peripheral clock runs out of the 24MHz oscillator.

[1] Rev 2, 10/2019, ERR007805

---
 arch/arm/mach-imx/mx6/soc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-imx/mx6/soc.c +2 -0
index e129286065..f498c93b00 100644
@@ -26,6 +26,8 @@
 #include <imx_thermal.h>
 #include <mmc.h>
 
+#define ERRATA_ERR007805 (is_mx6dl() || is_mx6solo() || is_mx6ull())
+
 struct scu_regs {
 	u32	ctrl;
 	u32	config;

arch/arm/mach-imx/mx6/soc.c int arch_cpu_init(void)

Quoted 9 lines
arch/arm/mach-imx/mx6/soc.c +1 -2
@@ -469,7 +471,7 @@ int arch_cpu_init(void)
 	}
 
 	/* Set perclk to source from OSC 24MHz */
-	if (is_mx6sl())
+	if (is_mx6sl() || ERRATA_ERR007805)
 		setbits_le32(&ccm->cscmr1, MXC_CCM_CSCMR1_PER_CLK_SEL_MASK);
 
 	imx_wdog_disable_powerdown(); /* Disable PDE bit of WMCR register */
--

all ok with this ?

Quoted 2 lines

2.17.1

reviewer
#2 lore raw

PATCH 1/1 mx6: peripheral clock from oscillator

In reply to Jorge Ramirez-Ortiz
Quoted 3 lines · Jorge Ramirez-Ortiz

In order to be able to run the I2C bus at 400Khz, the chip errata[1] recommends that the peripheral clock runs out of the 24MHz oscillator.

I would suggest adding the optee related motivation that you explained earlier here in the commit log too.

Quoted 1 line

[1] Rev 2, 10/2019, ERR007805

Not clear what document this refers to.

arch/arm/mach-imx/mx6/soc.c int arch_cpu_init(void) · line 474

Quoted 3 lines
        /* Set perclk to source from OSC 24MHz */
arch/arm/mach-imx/mx6/soc.c +1 -1
-       if (is_mx6sl())
+       if (is_mx6sl() || ERRATA_ERR007805)

This gives the impression that imx6sl is not affected by the erratum, but in fact it is:
https://www.nxp.com/docs/en/errata/IMX6SLCE.pdf

You could define it like this:

#define has_err007805() (is_mx6sl() || is_mx6dl() || is_mx6solo() || is_mx6ull())

#3 lore raw

PATCH 1/1 mx6: peripheral clock from oscillator

Quoted 7 lines · Fabio Estevam
Quoted 3 lines · Jorge Ramirez-Ortiz

In order to be able to run the I2C bus at 400Khz, the chip errata[1] recommends that the peripheral clock runs out of the 24MHz oscillator.

I would suggest adding the optee related motivation that you explained earlier here in the commit log too.

sure, will do.

Quoted 4 lines
Quoted 2 lines

[1] Rev 2, 10/2019, ERR007805

Not clear what document this refers to.

um, weird, I just googled "imx Rev 2, 10/2019, ERR007805" and it showed the document and a link to the errata.

how do you tipically do this otherwise? I didnt want to depend on links that migh break in the future.

Quoted 5 lines

arch/arm/mach-imx/mx6/soc.c int arch_cpu_init(void) · line 474

Quoted 4 lines
        /* Set perclk to source from OSC 24MHz */
arch/arm/mach-imx/mx6/soc.c +1 -1
-       if (is_mx6sl())
+       if (is_mx6sl() || ERRATA_ERR007805)
Quoted 8 lines

This gives the impression that imx6sl is not affected by the erratum, but in fact it is:
https://www.nxp.com/docs/en/errata/IMX6SLCE.pdf

You could define it like this:

#define has_err007805() (is_mx6sl() || is_mx6dl() || is_mx6solo() || is_mx6ull())

sounds good. will do (I didnt know the reason for the mx6sl configuring the clock was that same errata)

reviewer
#4 lore raw

PATCH 1/1 mx6: peripheral clock from oscillator

Quoted 2 lines · Foundries

um, weird, I just googled "imx Rev 2, 10/2019, ERR007805" and it showed the document and a link to the errata.

The errata document is specific for a SoC.

It does not help to add "Rev 2, 10/2019, ERR007805" in the commit log as we cannot know which SoC it refers to.

Just mention the SoC errata document. For example: IMX6SLCE Rev. 5, 02/2019

#5 lore raw

PATCH 1/1 mx6: peripheral clock from oscillator

Quoted 7 lines · Fabio Estevam
Quoted 2 lines · Foundries

um, weird, I just googled "imx Rev 2, 10/2019, ERR007805" and it showed the document and a link to the errata.

The errata document is specific for a SoC.

perfect. now you understand my point and why I was being generic.

Quoted 3 lines

It does not help to add "Rev 2, 10/2019, ERR007805" in the commit log as we cannot know which SoC it refers to.

um, weird....the patch indicates imx6 in the name. this should be enough no?

Quoted 2 lines

Just mention the SoC errata document. For example: IMX6SLCE Rev. 5, 02/2019

so you need the names and versions of the errata document for each SoC being affected? that being the case, should it be a patch per family or a patch per SoC?

reviewer
#6 lore raw

PATCH 1/1 mx6: peripheral clock from oscillator

Quoted 1 line · Foundries

um, weird....the patch indicates imx6 in the name. this should be enough no?

imx6 is too generic. Which imx6? imx6sx, imx6sl, imx6solo, imx6dl, imx6qp, imx6q, imx6ul, imx6ull, imx6ulz?

It is OK to keep mx6 in the Subject though.

Quoted 2 lines

so you need the names and versions of the errata document for each SoC being affected? that being the case, should it be a patch per family or a patch per SoC?

No, my point was just to replace:

[1] Rev 2, 10/2019, ERR007805 (this is not a doc reference)

by a real errata document reference. It can be imx6ull, imx6sl or any other SoC errata document like, for example:

IMX6SLCE Rev. 5, 02/2019