Skip to contentSkip to conversation

TQM8xx: Fix CFI flash driver support for all TQM8xx based boards

PATCH New Wolfgang Denk 2 participants 3 messages Sep 16, 2008 – Sep 17, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 TQM8xx: Fix CFI flash driver support for all TQM8xx based boards

After switching to using the CFI flash driver, the correct remapping of the flash banks was forgotten.

Also, some boards were not adapted, and the old legacy flash driver was not removed yet.

---
 board/tqc/tqm8xx/Makefile  |    2 +-
 board/tqc/tqm8xx/flash.c   |  834 --------------------------------------------
 board/tqc/tqm8xx/tqm8xx.c  |  123 +++++--
 include/configs/FPS850L.h  |    2 +
 include/configs/FPS860L.h  |    2 +
 include/configs/HMI10.h    |    2 +-
 include/configs/SM850.h    |   17 +-
 include/configs/TQM823L.h  |    2 +
 include/configs/TQM823M.h  |    2 +
 include/configs/TQM850L.h  |    2 +
 include/configs/TQM850M.h  |    2 +
 include/configs/TQM855L.h  |    2 +
 include/configs/TQM855M.h  |    2 +
 include/configs/TQM860L.h  |    2 +
 include/configs/TQM860M.h  |    4 +-
 include/configs/TQM862L.h  |    2 +
 include/configs/TQM862M.h  |    4 +-
 include/configs/TQM866M.h  |    4 +-
 include/configs/virtlab2.h |    2 +
 19 files changed, 136 insertions(+), 876 deletions(-)
 delete mode 100644 board/tqc/tqm8xx/flash.c
board/tqc/tqm8xx/Makefile +1 -1
index b48934b..280982d 100644
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	= $(BOARD).o flash.o load_sernum_ethaddr.o
+COBJS	= $(BOARD).o load_sernum_ethaddr.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/tqc/tqm8xx/flash.c deleted +0 -834

834 lines not on this page · raw message

board/tqc/tqm8xx/tqm8xx.c +92 -31

163 lines not on this page · raw message

include/configs/FPS850L.h +2 -0
index dd8051d..c9d6c91 100644
@@ -211,6 +211,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/FPS860L.h +2 -0
index 1af28b3..bf20a0d 100644
@@ -211,6 +211,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/HMI10.h +1 -1
index 807781c..c58cb8c 100644
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2000-2005
+ * (C) Copyright 2000-2008
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  *
  * See file CREDITS for list of people who contributed to this
include/configs/SM850.h +11 -6
index d30c7bc..c896b58 100644
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2000
+ * (C) Copyright 2000-2008
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -157,16 +157,21 @@
 /*-----------------------------------------------------------------------
  * FLASH organization
  */
+/* use CFI flash driver */
+#define CFG_FLASH_CFI		1	/* Flash is CFI conformant */
+#define CONFIG_FLASH_CFI_DRIVER	1	/* Use the common driver */
+#define CFG_FLASH_BANKS_LIST	{ CFG_FLASH_BASE, CFG_FLASH_BASE+flash_info[0].size }
+#define CFG_FLASH_EMPTY_INFO
+#define CFG_FLASH_USE_BUFFER_WRITE	1
 #define CFG_MAX_FLASH_BANKS	2	/* max number of memory banks		*/
-#define CFG_MAX_FLASH_SECT	67	/* max number of sectors on one chip	*/
-
-#define CFG_FLASH_ERASE_TOUT	120000	/* Timeout for Flash Erase (in ms)	*/
-#define CFG_FLASH_WRITE_TOUT	500	/* Timeout for Flash Write (in ms)	*/
+#define CFG_MAX_FLASH_SECT	71	/* max number of sectors on one chip */
 
 #define	CONFIG_ENV_IS_IN_FLASH	1
-#define	CONFIG_ENV_OFFSET		0x8000	/*   Offset   of Environment Sector	*/
+#define	CONFIG_ENV_OFFSET	0x8000	/*   Offset   of Environment Sector	*/
 #define	CONFIG_ENV_SIZE		0x4000	/* Total Size of Environment Sector	*/
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Hardware Information Block
  */
include/configs/TQM823L.h +2 -0
index 6311902..dc4582f 100644
@@ -225,6 +225,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/TQM823M.h +2 -0
index 53272e1..7ea7342 100644
@@ -221,6 +221,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/TQM850L.h +2 -0
index 812cea1..473c390 100644
@@ -210,6 +210,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/TQM850M.h +2 -0
index 512c55d..4de5a33 100644
@@ -210,6 +210,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/TQM855L.h +2 -0
index 36e2fbf..2ba94c8 100644
@@ -215,6 +215,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/TQM855M.h +2 -0
index 2da1f3a..7699d51 100644
@@ -250,6 +250,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/TQM860L.h +2 -0
index 87462a5..23d0dd6 100644
@@ -214,6 +214,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/TQM860M.h +3 -1
index 9dc8745..e8d2ec4 100644
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2000-2005
+ * (C) Copyright 2000-2008
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -215,6 +215,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/TQM862L.h +2 -0
index c039e9d..74c815b 100644
@@ -218,6 +218,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/TQM862M.h +3 -1
index cc5ee6d..a5fc38d 100644
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2000-2005
+ * (C) Copyright 2000-2008
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -219,6 +219,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/TQM866M.h +3 -1
index bf3bbb2..9e14d99 100644
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2000-2005
+ * (C) Copyright 2000-2008
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -259,6 +259,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
include/configs/virtlab2.h +2 -0
index 10dbed9..f3f43c3 100644
@@ -219,6 +219,8 @@
 
 #define	CFG_USE_PPCENV			/* Environment embedded in sect .ppcenv */
 
+#define CONFIG_MISC_INIT_R		/* Make sure to remap flashes correctly */
+
 /*-----------------------------------------------------------------------
  * Dynamic MTD partition support
  */
Signature · 1 line
1.5.6.1
#1 lore raw

PATCH 1/1 TQM8xx: Fix CFI flash driver support for all TQM8xx based boards

Hi Wolfgang,

Quoted 5 lines · Wolfgang Denk

After switching to using the CFI flash driver, the correct remapping of the flash banks was forgotten.

Also, some boards were not adapted, and the old legacy flash driver was not removed yet.

Please find some nitpicking comments below.

<snip>

Quoted 54 lines
board/tqc/tqm8xx/tqm8xx.c +12 -13
index 96b6103..59bbdbc 100644
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2000-2006
+ * (C) Copyright 2000-2008
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -21,16 +21,14 @@
  * MA 02111-1307 USA
  */
 
-#if 0
-#define DEBUG
-#endif
-
 #include <common.h>
 #include <mpc8xx.h>
 #ifdef CONFIG_PS2MULT
 #include <ps2mult.h>
 #endif
 
+extern flash_info_t flash_info[];	/* FLASH chips info */
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static long int dram_size (long int, long int *, long int);
@@ -451,24 +449,107 @@ int board_early_init_r (void)
 
 #endif /* CONFIG_PS2MULT */
 
-/*
---------------------------------------------------------------------------
- */ -/* HMI10 specific stuff								*/
-/*
---------------------------------------------------------------------------
- */ -#ifdef CONFIG_HMI10
 
+#ifdef CONFIG_MISC_INIT_R
 int misc_init_r (void)
 {
-# ifdef CONFIG_IDE_LED
-	volatile immap_t *immap = (immap_t *) CFG_IMMR;
+	volatile immap_t     *immap  = (immap_t *)CFG_IMMR;
+	volatile memctl8xx_t *memctl = &immap->im_memctl;
+
+#ifdef	CFG_OR_TIMING_FLASH_AT_50MHZ
+	int scy, trlx, flash_or_timing, clk_diff;
+
+	scy = (CFG_OR_TIMING_FLASH_AT_50MHZ & OR_SCY_MSK) >> 4;
+	if (CFG_OR_TIMING_FLASH_AT_50MHZ & OR_TRLX) {

board/tqc/tqm8xx/tqm8xx.c int board_early_init_r (void) · line 473

Quoted 10 lines
board/tqc/tqm8xx/tqm8xx.c +10 -0
+		trlx = OR_TRLX;
+		scy *= 2;
+	} else
+		trlx = 0;
+
+		/*
+		 * We assume that each 10MHz of bus clock require 1-clk SCY
+		 * adjustment.
+		 */
+	clk_diff = (gd->bus_clk / 1000000) - 50;

Indentation looks wrong here.

board/tqc/tqm8xx/tqm8xx.c int board_early_init_r (void) · line 482

Quoted 9 lines
board/tqc/tqm8xx/tqm8xx.c +9 -0
+
+		/*
+		 * We need proper rounding here. This is what the "+5" and "-5"
+		 * are here for.
+		 */
+	if (clk_diff >= 0)
+		scy += (clk_diff + 5) / 10;
+	else
+		scy += (clk_diff - 5) / 10;

And here. And other places below too.

Best regards,
Stefan

=====================================================================
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 TQM8xx: Fix CFI flash driver support for all TQM8xx based boards

Dear Stefan Roese,

In message <[email protected]> you wrote:
...

Quoted 7 lines

board/tqc/tqm8xx/tqm8xx.c int board_early_init_r (void) · line 473

Quoted 5 lines
board/tqc/tqm8xx/tqm8xx.c +5 -0
+		/*
+		 * We assume that each 10MHz of bus clock require 1-clk SCY
+		 * adjustment.
+		 */
+	clk_diff = (gd->bus_clk / 1000000) - 50;

Indentation looks wrong here.

...

Quoted 1 line

And here. And other places below too.

Indeed. I didn't see this when copy&pasting the code from the code from the old flash.c driver. Will send a separate cleanup patch.

Thanks for pointing out.

Best regards,

Wolfgang Denk

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-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All he had was nothing, but that was something, and now it  had  been
taken away.                             - Terry Pratchett, _Sourcery_