Skip to contentSkip to conversation

ADS5121: Fix NOR and CPLD ALE timing for rev 2 silicon

PATCH New John Rigby 2 participants 2 messages Aug 28, 2008 – Aug 31, 2008

lore
Share & tools
lore

John Rigby

author
#0 lore raw

PATCH 1/1 ADS5121: Fix NOR and CPLD ALE timing for rev 2 silicon

MPC5121 rev 2 silicon has a new register for controlling how long CS is asserted after deassertion of ALE in multiplexed mode.

The default is to assert CS together with ALE. The alternative is to assert CS (ALEN+1)*LPC_CLK clocks after deassertion of ALE.

The default is wrong for the NOR flash and CPLD on the ADS5121.

This patch turns on the alternative for CS0 (NOR) and CS2 (CPLD) it does so conditionally based on silicon rev 2.0 or greater.

---
 board/ads5121/ads5121.c   |    4 ++++
 include/configs/ads5121.h |    1 +
 include/mpc512x.h         |    1 +
 3 files changed, 6 insertions(+), 0 deletions(-)
board/ads5121/ads5121.c +4 -0
index ba3d7d2..deaa292 100644
@@ -25,6 +25,7 @@
 #include <mpc512x.h>
 #include <asm/bitops.h>
 #include <command.h>
+#include <asm/processor.h>
 #include <fdt_support.h>
 #ifdef CONFIG_MISC_INIT_R
 #include <i2c.h>
@@ -92,6 +93,9 @@ int board_early_init_f (void)
 	 * Configure Flash Speed
 	 */
 	*((volatile u32 *)(CFG_IMMR + LPC_OFFSET + CS0_CONFIG)) = CFG_CS0_CFG;
+	if (SVR_MJREV (im->sysconf.spridr) >= 2) {
+		*((volatile u32 *)(CFG_IMMR + LPC_OFFSET + CS_ALE_TIMING_CONFIG)) = CFG_CS_ALETIMING;
+	}
 	/*
 	 * Enable clocks
 	 */
include/configs/ads5121.h +1 -0
index 5f74afb..f516c46 100644
@@ -210,6 +210,7 @@
 
 #define CFG_CS0_CFG		0x05059310	/* ALE active low, data size 4bytes */
 #define CFG_CS2_CFG		0x05059010	/* ALE active low, data size 1byte */
+#define CFG_CS_ALETIMING	0x00000005	/* Use alternative CS timing for CS0 and CS2 */
 
 /* Use SRAM for initial stack */
 #define CFG_INIT_RAM_ADDR	CFG_SRAM_BASE		/* Initial RAM address */
include/mpc512x.h +1 -0
index a76b1ca..cb418d1 100644
@@ -58,6 +58,7 @@
 #define CS5_CONFIG		0x00014
 #define CS6_CONFIG		0x00018
 #define CS7_CONFIG		0x0001C
+#define CS_ALE_TIMING_CONFIG	0x00034
 
 #define CS_CTRL			0x00020
 #define CS_CTRL_ME		0x01000000	/* CS Master Enable bit */
Signature · 1 line
1.5.6.2.255.gbed62
#1 lore raw

PATCH 1/1 ADS5121: Fix NOR and CPLD ALE timing for rev 2 silicon

Dear John Rigby,

Quoted 32 lines · In message <[email protected]> you wrote:

MPC5121 rev 2 silicon has a new register for controlling how long CS is asserted after deassertion of ALE in multiplexed mode.

The default is to assert CS together with ALE. The alternative is to assert CS (ALEN+1)*LPC_CLK clocks after deassertion of ALE.

The default is wrong for the NOR flash and CPLD on the ADS5121.

This patch turns on the alternative for CS0 (NOR) and CS2 (CPLD) it does so conditionally based on silicon rev 2.0 or greater.

---
 board/ads5121/ads5121.c   |    4 ++++
 include/configs/ads5121.h |    1 +
 include/mpc512x.h         |    1 +
 3 files changed, 6 insertions(+), 0 deletions(-)
board/ads5121/ads5121.c +1 -0
index ba3d7d2..deaa292 100644
@@ -25,6 +25,7 @@
 #include <mpc512x.h>
 #include <asm/bitops.h>
 #include <command.h>
+#include <asm/processor.h>
 #include <fdt_support.h>
 #ifdef CONFIG_MISC_INIT_R
 #include <i2c.h>

board/ads5121/ads5121.c int board_early_init_f (void) · line 98

Quoted 6 lines
board/ads5121/ads5121.c +3 -0
@@ -92,6 +93,9 @@ int board_early_init_f (void)
 	 * Configure Flash Speed
 	 */
 	*((volatile u32 *)(CFG_IMMR + LPC_OFFSET + CS0_CONFIG)) = CFG_CS0_CFG;
+	if (SVR_MJREV (im->sysconf.spridr) >= 2) {
+		*((volatile u32 *)(CFG_IMMR + LPC_OFFSET + CS_ALE_TIMING_CONFIG)) = CFG_CS_ALETIMING;
+	}

We should stop using pointer accesses to registers and use the appropriate accessor functions / macros instead (and probably even convert oild, existing code before the next round of compiler optimizations bites us).

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Premature optimization is the root of all evil.         -- D.E. Knuth