public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] mx6: peripheral clock from oscillator
@ 2020-10-14 13:07 Jorge Ramirez-Ortiz
  2020-10-16 12:41 ` Jorge
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Jorge Ramirez-Ortiz @ 2020-10-14 13:07 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
---
 arch/arm/mach-imx/mx6/soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
index e129286065..1da250bbcd 100644
--- a/arch/arm/mach-imx/mx6/soc.c
+++ b/arch/arm/mach-imx/mx6/soc.c
@@ -469,7 +469,7 @@ int arch_cpu_init(void)
 	}
 
 	/* Set perclk to source from OSC 24MHz */
-	if (is_mx6sl())
+	if (is_mx6sl() || is_mx6ull())
 		setbits_le32(&ccm->cscmr1, MXC_CCM_CSCMR1_PER_CLK_SEL_MASK);
 
 	imx_wdog_disable_powerdown(); /* Disable PDE bit of WMCR register */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
  2020-10-14 13:07 [PATCH] mx6: peripheral clock from oscillator Jorge Ramirez-Ortiz
@ 2020-10-16 12:41 ` Jorge
  2020-10-19  6:40 ` Peng Fan
  2020-10-19 12:32 ` Fabio Estevam
  2 siblings, 0 replies; 13+ messages in thread
From: Jorge @ 2020-10-16 12:41 UTC (permalink / raw)
  To: u-boot


any thoughts?

On 14/10/20, Jorge Ramirez-Ortiz wrote:
> 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
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
> ---
>  arch/arm/mach-imx/mx6/soc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
> index e129286065..1da250bbcd 100644
> --- a/arch/arm/mach-imx/mx6/soc.c
> +++ b/arch/arm/mach-imx/mx6/soc.c
> @@ -469,7 +469,7 @@ int arch_cpu_init(void)
>  	}
>  
>  	/* Set perclk to source from OSC 24MHz */
> -	if (is_mx6sl())
> +	if (is_mx6sl() || is_mx6ull())
>  		setbits_le32(&ccm->cscmr1, MXC_CCM_CSCMR1_PER_CLK_SEL_MASK);
>  
>  	imx_wdog_disable_powerdown(); /* Disable PDE bit of WMCR register */
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
  2020-10-14 13:07 [PATCH] mx6: peripheral clock from oscillator Jorge Ramirez-Ortiz
  2020-10-16 12:41 ` Jorge
@ 2020-10-19  6:40 ` Peng Fan
  2020-10-19 12:32 ` Fabio Estevam
  2 siblings, 0 replies; 13+ messages in thread
From: Peng Fan @ 2020-10-19  6:40 UTC (permalink / raw)
  To: u-boot

> Subject: [PATCH] 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
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
> ---
>  arch/arm/mach-imx/mx6/soc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
> index e129286065..1da250bbcd 100644
> --- a/arch/arm/mach-imx/mx6/soc.c
> +++ b/arch/arm/mach-imx/mx6/soc.c
> @@ -469,7 +469,7 @@ int arch_cpu_init(void)
>  	}
> 
>  	/* Set perclk to source from OSC 24MHz */
> -	if (is_mx6sl())
> +	if (is_mx6sl() || is_mx6ull())
>  		setbits_le32(&ccm->cscmr1,
> MXC_CCM_CSCMR1_PER_CLK_SEL_MASK);
> 
>  	imx_wdog_disable_powerdown(); /* Disable PDE bit of WMCR register
> */
> --

Reviewed-by: Peng Fan <peng.fan@nxp.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
  2020-10-14 13:07 [PATCH] mx6: peripheral clock from oscillator Jorge Ramirez-Ortiz
  2020-10-16 12:41 ` Jorge
  2020-10-19  6:40 ` Peng Fan
@ 2020-10-19 12:32 ` Fabio Estevam
  2020-10-19 12:57   ` Jorge
  2 siblings, 1 reply; 13+ messages in thread
From: Fabio Estevam @ 2020-10-19 12:32 UTC (permalink / raw)
  To: u-boot

Hi Jorge,

On Wed, Oct 14, 2020 at 10:07 AM Jorge Ramirez-Ortiz <jorge@foundries.io> wrote:
>
> 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
>
> Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
> ---
>  arch/arm/mach-imx/mx6/soc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
> index e129286065..1da250bbcd 100644
> --- a/arch/arm/mach-imx/mx6/soc.c
> +++ b/arch/arm/mach-imx/mx6/soc.c
> @@ -469,7 +469,7 @@ int arch_cpu_init(void)
>         }
>
>         /* Set perclk to source from OSC 24MHz */
> -       if (is_mx6sl())
> +       if (is_mx6sl() || is_mx6ull())

According to https://www.nxp.com/docs/en/errata/IMX6SDLCE.pdf the
mx6solo and mx6dl are also affected by ERR007805.

These variants should be handled too.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
  2020-10-19 12:32 ` Fabio Estevam
@ 2020-10-19 12:57   ` Jorge
  2020-10-19 14:24     ` Jorge
  0 siblings, 1 reply; 13+ messages in thread
From: Jorge @ 2020-10-19 12:57 UTC (permalink / raw)
  To: u-boot

On 19/10/20, Fabio Estevam wrote:
> Hi Jorge,
> 
> On Wed, Oct 14, 2020 at 10:07 AM Jorge Ramirez-Ortiz <jorge@foundries.io> wrote:
> >
> > 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
> >
> > Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
> > ---
> >  arch/arm/mach-imx/mx6/soc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
> > index e129286065..1da250bbcd 100644
> > --- a/arch/arm/mach-imx/mx6/soc.c
> > +++ b/arch/arm/mach-imx/mx6/soc.c
> > @@ -469,7 +469,7 @@ int arch_cpu_init(void)
> >         }
> >
> >         /* Set perclk to source from OSC 24MHz */
> > -       if (is_mx6sl())
> > +       if (is_mx6sl() || is_mx6ull())
> 
> According to https://www.nxp.com/docs/en/errata/IMX6SDLCE.pdf the
> mx6solo and mx6dl are also affected by ERR007805.

ah ok, I'll repost.

just as background info, this is needed in order for OP-TEE to access
the EdgeLock SE050 secure element at a decent speed. I couldnt merge
the support for the imx6ul i2c driver during the last OP-TEE release
but will try again when I find some time (surely before their next
release)


> 
> These variants should be handled too.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
@ 2020-10-19 14:23 Jorge Ramirez-Ortiz
  2020-10-22 15:18 ` Jorge
  2020-10-22 20:51 ` Fabio Estevam
  0 siblings, 2 replies; 13+ messages in thread
From: Jorge Ramirez-Ortiz @ 2020-10-19 14:23 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
---
 arch/arm/mach-imx/mx6/soc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
index e129286065..f498c93b00 100644
--- a/arch/arm/mach-imx/mx6/soc.c
+++ b/arch/arm/mach-imx/mx6/soc.c
@@ -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 */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
  2020-10-19 12:57   ` Jorge
@ 2020-10-19 14:24     ` Jorge
  0 siblings, 0 replies; 13+ messages in thread
From: Jorge @ 2020-10-19 14:24 UTC (permalink / raw)
  To: u-boot

On 19/10/20, Jorge Ramirez-Ortiz, Foundries wrote:
> On 19/10/20, Fabio Estevam wrote:
> > Hi Jorge,
> > 
> > On Wed, Oct 14, 2020 at 10:07 AM Jorge Ramirez-Ortiz <jorge@foundries.io> wrote:
> > >
> > > 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
> > >
> > > Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
> > > ---
> > >  arch/arm/mach-imx/mx6/soc.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
> > > index e129286065..1da250bbcd 100644
> > > --- a/arch/arm/mach-imx/mx6/soc.c
> > > +++ b/arch/arm/mach-imx/mx6/soc.c
> > > @@ -469,7 +469,7 @@ int arch_cpu_init(void)
> > >         }
> > >
> > >         /* Set perclk to source from OSC 24MHz */
> > > -       if (is_mx6sl())
> > > +       if (is_mx6sl() || is_mx6ull())
> > 
> > According to https://www.nxp.com/docs/en/errata/IMX6SDLCE.pdf the
> > mx6solo and mx6dl are also affected by ERR007805.
> 
> ah ok, I'll repost.
> 
> just as background info, this is needed in order for OP-TEE to access
> the EdgeLock SE050 secure element at a decent speed. I couldnt merge
> the support for the imx6ul i2c driver during the last OP-TEE release
> but will try again when I find some time (surely before their next
> release)
> 
> 
> > 
> > These variants should be handled too.

I just reposted but realized I forgot to ammend the patch version. let
me know if you would like me to repost with that corrected or if that
is ok.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
  2020-10-19 14:23 Jorge Ramirez-Ortiz
@ 2020-10-22 15:18 ` Jorge
  2020-10-22 20:51 ` Fabio Estevam
  1 sibling, 0 replies; 13+ messages in thread
From: Jorge @ 2020-10-22 15:18 UTC (permalink / raw)
  To: u-boot

On 19/10/20, Jorge Ramirez-Ortiz wrote:
> 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
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
> ---
>  arch/arm/mach-imx/mx6/soc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
> index e129286065..f498c93b00 100644
> --- a/arch/arm/mach-imx/mx6/soc.c
> +++ b/arch/arm/mach-imx/mx6/soc.c
> @@ -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 */
> --


all ok with this ?

> 2.17.1
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
  2020-10-19 14:23 Jorge Ramirez-Ortiz
  2020-10-22 15:18 ` Jorge
@ 2020-10-22 20:51 ` Fabio Estevam
  2020-10-22 21:24   ` Jorge
  1 sibling, 1 reply; 13+ messages in thread
From: Fabio Estevam @ 2020-10-22 20:51 UTC (permalink / raw)
  To: u-boot

On Mon, Oct 19, 2020 at 11:23 AM Jorge Ramirez-Ortiz <jorge@foundries.io> wrote:
>
> 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.

> [1] Rev 2, 10/2019, ERR007805

Not clear what document this refers to.

>         /* Set perclk to source from OSC 24MHz */
> -       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())

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
  2020-10-22 20:51 ` Fabio Estevam
@ 2020-10-22 21:24   ` Jorge
  2020-10-22 21:30     ` Fabio Estevam
  0 siblings, 1 reply; 13+ messages in thread
From: Jorge @ 2020-10-22 21:24 UTC (permalink / raw)
  To: u-boot

On 22/10/20, Fabio Estevam wrote:
> On Mon, Oct 19, 2020 at 11:23 AM Jorge Ramirez-Ortiz <jorge@foundries.io> wrote:
> >
> > 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.

> 
> > [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.

> 
> >         /* Set perclk to source from OSC 24MHz */
> > -       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())


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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
  2020-10-22 21:24   ` Jorge
@ 2020-10-22 21:30     ` Fabio Estevam
  2020-10-23  6:35       ` Jorge
  0 siblings, 1 reply; 13+ messages in thread
From: Fabio Estevam @ 2020-10-22 21:30 UTC (permalink / raw)
  To: u-boot

On Thu, Oct 22, 2020 at 6:24 PM Jorge Ramirez-Ortiz, Foundries
<jorge@foundries.io> wrote:

> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
  2020-10-22 21:30     ` Fabio Estevam
@ 2020-10-23  6:35       ` Jorge
  2020-10-23 12:13         ` Fabio Estevam
  0 siblings, 1 reply; 13+ messages in thread
From: Jorge @ 2020-10-23  6:35 UTC (permalink / raw)
  To: u-boot

On 22/10/20, Fabio Estevam wrote:
> On Thu, Oct 22, 2020 at 6:24 PM Jorge Ramirez-Ortiz, Foundries
> <jorge@foundries.io> wrote:
> 
> > 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.

> 
> 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?

> 
> 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?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] mx6: peripheral clock from oscillator
  2020-10-23  6:35       ` Jorge
@ 2020-10-23 12:13         ` Fabio Estevam
  0 siblings, 0 replies; 13+ messages in thread
From: Fabio Estevam @ 2020-10-23 12:13 UTC (permalink / raw)
  To: u-boot

On Fri, Oct 23, 2020 at 3:35 AM Jorge Ramirez-Ortiz, Foundries
<jorge@foundries.io> wrote:

> 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.

> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-10-23 12:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-14 13:07 [PATCH] mx6: peripheral clock from oscillator Jorge Ramirez-Ortiz
2020-10-16 12:41 ` Jorge
2020-10-19  6:40 ` Peng Fan
2020-10-19 12:32 ` Fabio Estevam
2020-10-19 12:57   ` Jorge
2020-10-19 14:24     ` Jorge
  -- strict thread matches above, loose matches on Subject: below --
2020-10-19 14:23 Jorge Ramirez-Ortiz
2020-10-22 15:18 ` Jorge
2020-10-22 20:51 ` Fabio Estevam
2020-10-22 21:24   ` Jorge
2020-10-22 21:30     ` Fabio Estevam
2020-10-23  6:35       ` Jorge
2020-10-23 12:13         ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox