Skip to contentSkip to conversation

ARM: MX51: PLL errata workaround

PATCH New David Jander 3 participants 6 messages Jul 14, 2011

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

PATCH 1/1 ARM: MX51: PLL errata workaround

This is a port of the official PLL errata workaround from Freescale to mainline u-boot.
The PLL's in the i.MX51 processor can go out of lock due to a metastable condition in an analog flip-flop when used at high frequencies. This workaround implements an undocumented feature in the PLL (dither mode), which causes the effect of this failure to be much lower (in terms of frequency deviation), avoiding system failure, or at least decreasing the likelihood of system failure.

---
 arch/arm/cpu/armv7/mx5/lowlevel_init.S   |   38 ++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mx5/imx-regs.h |    5 ++++
 doc/README.imx5                          |   18 ++++++++++++++
 3 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100644 doc/README.imx5
arch/arm/cpu/armv7/mx5/lowlevel_init.S +38 -0
index 96ebfe2..ee4150d 100644
@@ -117,6 +117,35 @@
 	beq 1b
 .endm
 
+.macro setup_pll_errata pll, freq
+	ldr r2, =\pll
+	mov r1, #0x0
+	str r1, [r2, #PLL_DP_CONFIG] /* Disable auto-restart AREN bit */
+	ldr r1, =0x00001236
+	str r1, [r2, #PLL_DP_CTL]    /* Restart PLL with PLM=1 */
+1:	ldr r1, [r2, #PLL_DP_CTL]    /* Wait for lock */
+	ands r1, r1, #0x1
+	beq 1b
+
+	ldr r5, \freq
+	str r5, [r2, #PLL_DP_MFN]    /* Modify MFN value */
+	str r5, [r2, #PLL_DP_HFS_MFN]
+
+	mov r1, #0x1
+	str r1, [r2, #PLL_DP_CONFIG] /* Reload MFN value */
+
+2:	ldr r1, [r2, #PLL_DP_CONFIG]
+	tst r1, #1
+	bne 2b
+
+	ldr r1, =100		     /* Wait at least 4 us */
+3:	subs r1, r1, #1
+	bge 3b
+
+	mov r1, #0x2
+	str r1, [r2, #PLL_DP_CONFIG] /* Enable auto-restart AREN bit */
+.endm
+
 .macro init_clock
 	ldr r0, =CCM_BASE_ADDR
 
@@ -153,7 +182,12 @@
 	mov r1, #0x4
 	str r1, [r0, #CLKCTL_CCSR]
 
+#if defined(CONFIG_MX51_PLL_ERRATA)
+	setup_pll PLL1_BASE_ADDR, 864
+	setup_pll_errata PLL1_BASE_ADDR, W_DP_MFN_800_DIT
+#else
 	setup_pll PLL1_BASE_ADDR, 800
+#endif
 
 #if defined(CONFIG_MX51)
 	setup_pll PLL3_BASE_ADDR, 665
@@ -283,6 +317,10 @@ lowlevel_init:
 	mov pc,lr
 
 /* Board level setting value */
+W_DP_OP_864:              .word DP_OP_864
+W_DP_MFD_864:             .word DP_MFD_864
+W_DP_MFN_864:             .word DP_MFN_864
+W_DP_MFN_800_DIT:         .word DP_MFN_800_DIT
 W_DP_OP_800:              .word DP_OP_800
 W_DP_MFD_800:             .word DP_MFD_800
 W_DP_MFN_800:             .word DP_MFN_800
arch/arm/include/asm/arch-mx5/imx-regs.h +5 -0
index d7f83c5..0b1caf0 100644
@@ -235,6 +235,11 @@
 
 /* Assuming 24MHz input clock with doubler ON */
 /*                            MFI         PDF */
+#define DP_OP_864	((8 << 4) + ((1 - 1)  << 0))
+#define DP_MFD_864	(180 - 1) /* PL Dither mode */
+#define DP_MFN_864	180
+#define DP_MFN_800_DIT	60 /* PL Dither mode */
+
 #define DP_OP_850	((8 << 4) + ((1 - 1)  << 0))
 #define DP_MFD_850	(48 - 1)
 #define DP_MFN_850	41
doc/README.imx5 new file +18 -0
new file mode 100644
index 0000000..e9b2c88
@@ -0,0 +1,18 @@
+U-Boot for Freescale i.MX5x
+
+This file contains information for the port of U-Boot to the Freescale
+i.MX5x SoCs.
+
+1. CONFIGURATION OPTIONS/SETTINGS
+---------------------------------
+
+1.1 CONFIG_MX51_PLL_ERRATA: Workaround for i.MX51 PLL errata.
+    This option should be enabled by all boards using the i.MX51 silicon
+    version up until (including) 3.0 running at 800MHz.
+    The PLL's in the i.MX51 processor can go out of lock due to a metastable
+    condition in an analog flip-flop when used at high frequencies.
+    This workaround implements an undocumented feature in the PLL (dither
+    mode), which causes the effect of this failure to be much lower (in terms
+    of frequency deviation), avoiding system failure, or@least decreasing
+    the likelihood of system failure.
+
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/1 ARM: MX51: PLL errata workaround

Quoted 10 lines · David Jander

This is a port of the official PLL errata workaround from Freescale to mainline u-boot.
The PLL's in the i.MX51 processor can go out of lock due to a metastable condition in an analog flip-flop when used at high frequencies. This workaround implements an undocumented feature in the PLL (dither mode), which causes the effect of this failure to be much lower (in terms of frequency deviation), avoiding system failure, or at least decreasing the likelihood of system failure.

Hi David,

do you have now also an official Errata number from Freescale to be added to your documentation ?

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#2 lore raw

PATCH 1/1 ARM: MX51: PLL errata workaround

Hi Stefano,

Quoted 10 lines · On Thu, 14 Jul 2011 10:30:11 +0200 Stefano Babic <[email protected]> wrote:
Quoted 9 lines · David Jander

This is a port of the official PLL errata workaround from Freescale to mainline u-boot.
The PLL's in the i.MX51 processor can go out of lock due to a metastable condition in an analog flip-flop when used at high frequencies. This workaround implements an undocumented feature in the PLL (dither mode), which causes the effect of this failure to be much lower (in terms of frequency deviation), avoiding system failure, or at least decreasing the likelihood of system failure.

Quoted 6 lines
Quoted 1 line

Hi David,

do you have now also an official Errata number from Freescale to be added to your documentation ?

Freescale promised an official errata a week ago, but released the errata just yesterday (hadn't seen it until now).
The number is ENGcm12051.
Do you mind including it in the commit yourself, or do you want me to re-post?

Best regards,

Signature · 2 lines
David Jander
Protonic Holland.
#3 lore raw

PATCH 1/1 ARM: MX51: PLL errata workaround

On 07/14/2011 12:13 PM, David Jander wrote:

Hi David,

Quoted 4 lines

Freescale promised an official errata a week ago, but released the errata just yesterday (hadn't seen it until now).
The number is ENGcm12051.
Do you mind including it in the commit yourself, or do you want me to re-post?

Well, it is enough - I can include it in the commit message, if there will be no further comments. From my point of view the patch is ok. The fact that the patch can be disabled will probably increase the number of testers.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#4 lore raw

PATCH 1/1 ARM: MX51: PLL errata workaround

In reply to Stefano Babic
Quoted 10 lines · On Thu, 14 Jul 2011 10:30:11 +0200 Stefano Babic <[email protected]> wrote:
Quoted 9 lines · David Jander

This is a port of the official PLL errata workaround from Freescale to mainline u-boot.
The PLL's in the i.MX51 processor can go out of lock due to a metastable condition in an analog flip-flop when used at high frequencies. This workaround implements an undocumented feature in the PLL (dither mode), which causes the effect of this failure to be much lower (in terms of frequency deviation), avoiding system failure, or at least decreasing the likelihood of system failure.

Quoted 6 lines
Quoted 1 line

Hi David,

do you have now also an official Errata number from Freescale to be added to your documentation ?

Needless to say that this supersedes my patch sent back in May, 26th... which btw did not help much, since _all_ PLL's are affected by this problem. Not only PLL1.

Best regards,

Signature · 2 lines
David Jander
Protonic Holland.
#5 lore raw

PATCH 1/1 ARM: MX51: PLL errata workaround

Quoted 8 lines · David Jander
Quoted 4 lines

Hi David,

do you have now also an official Errata number from Freescale to be added to your documentation ?

Needless to say that this supersedes my patch sent back in May, 26th... which btw did not help much, since _all_ PLL's are affected by this problem. Not only PLL1.

Yes. I have set the old patch as superseeded in patchwork

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================