[U-Boot] [PATCH] Adds WATCHDOG_RESET() function call to lib_m68k dtimer_interrupt.

2009-06-01 Thread Tsi-Chung Liew
From: Richard Retanubun richardretanu...@ruggedcom.com

Ported from lib_ppc/interrupts.c, this adds the ability for
the coldfire system timer to auto-reset the watchdog when
dtimer_interrupts is called.

Signed-off-by: Richard Retanubun richardretanu...@ruggedcom.com
---
 lib_m68k/time.c |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/lib_m68k/time.c b/lib_m68k/time.c
index 697d67e..29269f6 100644
--- a/lib_m68k/time.c
+++ b/lib_m68k/time.c
@@ -27,10 +27,15 @@
 
 #include asm/timer.h
 #include asm/immap.h
+#include watchdog.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static ulong timestamp;
+static volatile ulong timestamp = 0;
+
+#ifndef CONFIG_SYS_WATCHDOG_FREQ
+#define CONFIG_SYS_WATCHDOG_FREQ (CONFIG_SYS_HZ / 2)
+#endif
 
 #if defined(CONFIG_MCFTMR)
 #ifndef CONFIG_SYS_UDELAY_BASE
@@ -76,6 +81,12 @@ void dtimer_interrupt(void *not_used)
if ((CONFIG_SYS_TMRPND_REG  CONFIG_SYS_TMRINTR_MASK) == 
CONFIG_SYS_TMRINTR_PEND) {
timerp-ter = (DTIM_DTER_CAP | DTIM_DTER_REF);
timestamp++;
+
+   #if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG)
+   if ((timestamp % (CONFIG_SYS_WATCHDOG_FREQ)) == 0) {
+   WATCHDOG_RESET ();
+   }
+   #endif/* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */
return;
}
 }
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] Add I2C speed and divider formula for ColdFire

2009-04-09 Thread Tsi-Chung Liew
From: TsiChung Liew tsi-chung.l...@freescale.com

Implement formula to obtain I2C speed and internal bus
divider. This will provide accurate divider than fix table
divider value.

Signed-off-by: TsiChung Liew tsi-chung.l...@freescale.com
---
 drivers/i2c/fsl_i2c.c |   76 +
 1 files changed, 51 insertions(+), 25 deletions(-)

diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index 6ab7d3d..7f6d864 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -84,14 +84,12 @@ static const struct fsl_i2c *i2c_dev[2] = {
  * A different table is defined and are based on MCF5xxx user manual.
  *
  */
+#ifdef __PPC__
 static const struct {
unsigned short divider;
-#ifdef __PPC__
u8 dfsr;
-#endif
u8 fdr;
 } fsl_i2c_speed_map[] = {
-#ifdef __PPC__
{160, 1, 32}, {192, 1, 33}, {224, 1, 34}, {256, 1, 35},
{288, 1, 0}, {320, 1, 1}, {352, 6, 1}, {384, 1, 2}, {416, 6, 2},
{448, 1, 38}, {480, 1, 3}, {512, 1, 39}, {544, 11, 3}, {576, 1, 4},
@@ -108,26 +106,22 @@ static const struct {
{20480, 1, 25}, {24576, 1, 26}, {28672, 1, 62}, {30720, 1, 27},
{32768, 1, 63}, {36864, 1, 28}, {40960, 1, 29}, {49152, 1, 30},
{61440, 1, 31}, {-1, 1, 31}
+};
 #elif defined(__M68K__)
-   {20, 32}, {22, 33}, {24, 34}, {26, 35},
-   {28, 0}, {28, 36}, {30, 1}, {32, 37},
-   {34, 2}, {36, 38}, {40, 3}, {40, 39},
-   {44, 4}, {48, 5}, {48, 40}, {56, 6},
-   {56, 41}, {64, 42}, {68, 7}, {72, 43},
-   {80, 8}, {80, 44}, {88, 9}, {96, 41},
-   {104, 10}, {112, 42}, {128, 11}, {128, 43},
-   {144, 12}, {160, 13}, {160, 48}, {192, 14},
-   {192, 49}, {224, 50}, {240, 15}, {256, 51},
-   {288, 16}, {320, 17}, {320, 52}, {384, 18},
-   {384, 53}, {448, 54}, {480, 19}, {512, 55},
-   {576, 20}, {640, 21}, {640, 56}, {768, 22},
-   {768, 57}, {960, 23}, {896, 58}, {1024, 59},
-   {1152, 24}, {1280, 25}, {1280, 60}, {1536, 26},
-   {1536, 61}, {1792, 62}, {1920, 27}, {2048, 63},
-   {2304, 28}, {2560, 29}, {3072, 30}, {3840, 31},
-   {-1, 31}
-#endif
+struct coldfire_i2c_tap {
+   int scl2tap;
+   int tap2tap;
+} scltap[] = {
+   {4, 1},
+   {4, 2},
+   {6, 4},
+   {6, 8},
+   {14, 16},
+   {30, 32},
+   {62, 64},
+   {126, 128}
 };
+#endif
 
 /**
  * Set the I2C bus speed for a given I2C device
@@ -143,6 +137,7 @@ static const struct {
 static unsigned int set_i2c_bus_speed(const struct fsl_i2c *dev,
unsigned int i2c_clk, unsigned int speed)
 {
+#ifdef __PPC__
unsigned short divider = min(i2c_clk / speed, (unsigned short) -1);
unsigned int i;
 
@@ -156,20 +151,51 @@ static unsigned int set_i2c_bus_speed(const struct 
fsl_i2c *dev,
for (i = 0; i  ARRAY_SIZE(fsl_i2c_speed_map); i++)
if (fsl_i2c_speed_map[i].divider = divider) {
u8 fdr;
-#ifdef __PPC__
u8 dfsr;
dfsr = fsl_i2c_speed_map[i].dfsr;
-#endif
fdr = fsl_i2c_speed_map[i].fdr;
speed = i2c_clk / fsl_i2c_speed_map[i].divider;
writeb(fdr, dev-fdr); /* set bus speed */
-#ifdef __PPC__
writeb(dfsr, dev-dfsrr);  /* set default filter */
-#endif
break;
}
 
return speed;
+#elif defined(__M68K__)
+   int fdr = -1;
+   ulong best_speed = 0;
+   ulong divider;
+   ulong ipb, scl;
+   ulong bestmatch = 0xUL;
+   int best_i = 0, best_j = 0, i, j;
+   int SCL_Tap[] = { 9, 10, 12, 15, 5, 6, 7, 8 };
+
+   ipb = gd-bus_clk;
+   for (i = 7; i = 0; i--) {
+   for (j = 7; j = 0; j--) {
+   scl = 2 * (scltap[j].scl2tap +
+  (SCL_Tap[i] - 1) * scltap[j].tap2tap + 2);
+   if (ipb = speed * scl) {
+   if ((speed * scl - ipb)  bestmatch) {
+   bestmatch = speed * scl - ipb;
+   best_i = i;
+   best_j = j;
+   best_speed = ipb / scl;
+   }
+   }
+   }
+   }
+
+   divider = (best_i  3) | ((best_i  4)  3) | (best_j  2);
+   if (gd-flags  GD_FLG_RELOC)
+   fdr = divider;
+   else
+   printf(%ld kHz, , best_speed / 1000);
+
+   speed = best_speed;
+
+   return speed;
+#endif
 }
 
 void
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ColdFire: Fix M54451 serial boot dram setup

2009-03-17 Thread Tsi-Chung Liew
From: TsiChung Liew tsi-chung.l...@freescale.com

The serial boot dram extended/standard mode register was not
setup and was using default DRAM setup causing the U-boot was
unstable to boot up in serial mode.

Signed-off-by: TsiChung Liew tsi-chung.l...@freescale.com
---
 cpu/mcf5445x/start.S |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpu/mcf5445x/start.S b/cpu/mcf5445x/start.S
index d5a7f93..26fb2ce 100644
--- a/cpu/mcf5445x/start.S
+++ b/cpu/mcf5445x/start.S
@@ -243,9 +243,9 @@ wait1000:
nop
 #elif defined(CONFIG_M54451EVB)
/* Issue LEMR */
-   move.l  #(CONFIG_SYS_SDRAM_MODE), (%a2)
+   move.l  #(CONFIG_SYS_SDRAM_MODE), (%a1)
nop
-   move.l  #(CONFIG_SYS_SDRAM_EMOD), (%a2)
+   move.l  #(CONFIG_SYS_SDRAM_EMOD), (%a1)
nop
 #endif
 
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ColdFire: Provide gzip image size V2 V3 platforms

2009-03-17 Thread Tsi-Chung Liew
From: TsiChung Liew tsi-chung.l...@freescale.com

Default gzip bootm size is 8MB. Some platforms require
more than 8MB

Signed-off-by: TsiChung Liew tsi-chung.l...@freescale.com
---
 include/configs/M52277EVB.h |1 +
 include/configs/M5235EVB.h  |1 +
 include/configs/M5253DEMO.h |1 +
 include/configs/M5253EVBE.h |1 +
 include/configs/M5275EVB.h  |3 ++-
 include/configs/M53017EVB.h |1 +
 include/configs/M5329EVB.h  |1 +
 include/configs/M5373EVB.h  |1 +
 8 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/include/configs/M52277EVB.h b/include/configs/M52277EVB.h
index 5d5966f..053a914 100644
--- a/include/configs/M52277EVB.h
+++ b/include/configs/M52277EVB.h
@@ -246,6 +246,7 @@
 
 /* Initial Memory map for Linux */
 #define CONFIG_SYS_BOOTMAPSZ   (CONFIG_SYS_SDRAM_BASE + 
(CONFIG_SYS_SDRAM_SIZE  20))
+#define CONFIG_SYS_BOOTM_LEN   (CONFIG_SYS_SDRAM_SIZE  20)
 
 /*
  * Configuration for environment
diff --git a/include/configs/M5235EVB.h b/include/configs/M5235EVB.h
index 8c66f87..6b26c0b 100644
--- a/include/configs/M5235EVB.h
+++ b/include/configs/M5235EVB.h
@@ -197,6 +197,7 @@
  */
 /* Initial Memory map for Linux */
 #define CONFIG_SYS_BOOTMAPSZ   (CONFIG_SYS_SDRAM_BASE + 
(CONFIG_SYS_SDRAM_SIZE  20))
+#define CONFIG_SYS_BOOTM_LEN   (CONFIG_SYS_SDRAM_SIZE  20)
 
 /*---
  * FLASH organization
diff --git a/include/configs/M5253DEMO.h b/include/configs/M5253DEMO.h
index 378e45a..1fea6c3 100644
--- a/include/configs/M5253DEMO.h
+++ b/include/configs/M5253DEMO.h
@@ -200,6 +200,7 @@
  * the maximum mapped by the Linux kernel during initialization ??
  */
 #define CONFIG_SYS_BOOTMAPSZ   (CONFIG_SYS_SDRAM_BASE + 
(CONFIG_SYS_SDRAM_SIZE  20))
+#define CONFIG_SYS_BOOTM_LEN   (CONFIG_SYS_SDRAM_SIZE  20)
 
 /* FLASH organization */
 #define CONFIG_SYS_FLASH_BASE  (CONFIG_SYS_CS0_BASE)
diff --git a/include/configs/M5253EVBE.h b/include/configs/M5253EVBE.h
index 86de97d..cf8b773 100644
--- a/include/configs/M5253EVBE.h
+++ b/include/configs/M5253EVBE.h
@@ -164,6 +164,7 @@
  * the maximum mapped by the Linux kernel during initialization ??
  */
 #define CONFIG_SYS_BOOTMAPSZ   (CONFIG_SYS_SDRAM_BASE + 
(CONFIG_SYS_SDRAM_SIZE  20))
+#define CONFIG_SYS_BOOTM_LEN   (CONFIG_SYS_SDRAM_SIZE  20)
 
 /* FLASH organization */
 #define CONFIG_SYS_FLASH_BASE  CONFIG_SYS_CS0_BASE
diff --git a/include/configs/M5275EVB.h b/include/configs/M5275EVB.h
index db48d76..210bb2d 100644
--- a/include/configs/M5275EVB.h
+++ b/include/configs/M5275EVB.h
@@ -190,7 +190,8 @@
  * have to be in the first 8 MB of memory, since this is
  * the maximum mapped by the Linux kernel during initialization ??
  */
-#define CONFIG_SYS_BOOTMAPSZ   (8  20)   /* Initial mmap for 
Linux */
+#define CONFIG_SYS_BOOTMAPSZ   (CONFIG_SYS_SDRAM_BASE + 
(CONFIG_SYS_SDRAM_SIZE  20))
+#define CONFIG_SYS_BOOTM_LEN   (CONFIG_SYS_SDRAM_SIZE  20)
 
 /*---
  * FLASH organization
diff --git a/include/configs/M53017EVB.h b/include/configs/M53017EVB.h
index df54c60..07c85c4 100644
--- a/include/configs/M53017EVB.h
+++ b/include/configs/M53017EVB.h
@@ -196,6 +196,7 @@
  * the maximum mapped by the Linux kernel during initialization ??
  */
 #define CONFIG_SYS_BOOTMAPSZ   (CONFIG_SYS_SDRAM_BASE + 
(CONFIG_SYS_SDRAM_SIZE  20))
+#define CONFIG_SYS_BOOTM_LEN   (CONFIG_SYS_SDRAM_SIZE  20)
 
 /*---
  * FLASH organization
diff --git a/include/configs/M5329EVB.h b/include/configs/M5329EVB.h
index 1f1586a..a2d17c3 100644
--- a/include/configs/M5329EVB.h
+++ b/include/configs/M5329EVB.h
@@ -196,6 +196,7 @@
  * the maximum mapped by the Linux kernel during initialization ??
  */
 #define CONFIG_SYS_BOOTMAPSZ   (CONFIG_SYS_SDRAM_BASE + 
(CONFIG_SYS_SDRAM_SIZE  20))
+#define CONFIG_SYS_BOOTM_LEN   (CONFIG_SYS_SDRAM_SIZE  20)
 
 /*---
  * FLASH organization
diff --git a/include/configs/M5373EVB.h b/include/configs/M5373EVB.h
index 1991687..98d800f 100644
--- a/include/configs/M5373EVB.h
+++ b/include/configs/M5373EVB.h
@@ -196,6 +196,7 @@
  * the maximum mapped by the Linux kernel during initialization ??
  */
 #define CONFIG_SYS_BOOTMAPSZ   (CONFIG_SYS_SDRAM_BASE + 
(CONFIG_SYS_SDRAM_SIZE  20))
+#define CONFIG_SYS_BOOTM_LEN   (CONFIG_SYS_SDRAM_SIZE  20)
 
 /*---
  * FLASH organization
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ColdFire: Fix M5329EVB and M5373EVB nand issue

2009-03-17 Thread Tsi-Chung Liew
From: TsiChung Liew tsi-chung.l...@freescale.com

The Nand flash was unable to read and write properly
due to Nand Chip Select (nCE) setup was in reverse
order. Also, increase the Nand time out value to 60.

Signed-off-by: TsiChung Liew tsi-chung.l...@freescale.com
---
 board/freescale/m5329evb/nand.c |6 --
 board/freescale/m5373evb/nand.c |6 --
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/board/freescale/m5329evb/nand.c b/board/freescale/m5329evb/nand.c
index cf27dda..16025f9 100644
--- a/board/freescale/m5329evb/nand.c
+++ b/board/freescale/m5329evb/nand.c
@@ -47,10 +47,12 @@ static void nand_hwcontrol(struct mtd_info *mtdinfo, int 
cmd, unsigned int ctrl)
ulong IO_ADDR_W = (ulong) this-IO_ADDR_W;
 
IO_ADDR_W = ~(SET_ALE | SET_CLE);
-   *nCE = 0xFFFB;
 
if (ctrl  NAND_NCE)
+   *nCE = 0xFFFB;
+   else
*nCE |= 0x0004;
+
if (ctrl  NAND_CLE)
IO_ADDR_W |= SET_CLE;
if (ctrl  NAND_ALE)
@@ -78,7 +80,7 @@ int board_nand_init(struct nand_chip *nand)
gpio-pclrr_timer = 0;
gpio-podr_timer = 0;
 
-   nand-chip_delay = 50;
+   nand-chip_delay = 60;
nand-ecc.mode = NAND_ECC_SOFT;
nand-cmd_ctrl = nand_hwcontrol;
 
diff --git a/board/freescale/m5373evb/nand.c b/board/freescale/m5373evb/nand.c
index 3ebef05..df8c03b 100644
--- a/board/freescale/m5373evb/nand.c
+++ b/board/freescale/m5373evb/nand.c
@@ -47,10 +47,12 @@ static void nand_hwcontrol(struct mtd_info *mtdinfo, int 
cmd, unsigned int ctrl)
ulong IO_ADDR_W = (ulong) this-IO_ADDR_W;
 
IO_ADDR_W = ~(SET_ALE | SET_CLE);
-   *nCE = 0xFFFB;
 
if (ctrl  NAND_NCE)
+   *nCE = 0xFFFB;
+   else
*nCE |= 0x0004;
+
if (ctrl  NAND_CLE)
IO_ADDR_W |= SET_CLE;
if (ctrl  NAND_ALE)
@@ -82,7 +84,7 @@ int board_nand_init(struct nand_chip *nand)
gpio-pclrr_timer = 0;
gpio-podr_timer = 0;
 
-   nand-chip_delay = 50;
+   nand-chip_delay = 60;
nand-ecc.mode = NAND_ECC_SOFT;
nand-cmd_ctrl = nand_hwcontrol;
 
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ColdFire: Fix incorrect definition

2009-03-17 Thread Tsi-Chung Liew
From: TsiChung Liew tsi-chung.l...@freescale.com

Signed-off-by: TsiChung Liew tsi-chung.l...@freescale.com
---
 include/asm-m68k/m5301x.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/asm-m68k/m5301x.h b/include/asm-m68k/m5301x.h
index 52bbb87..80cefc4 100644
--- a/include/asm-m68k/m5301x.h
+++ b/include/asm-m68k/m5301x.h
@@ -601,4 +601,8 @@
 #define RTC_OCEN_OSCBYP(0x0010)
 #define RTC_OCEN_CLKEN (0x0008)
 
+/* SDRAM */
+#define SDRAMC_SDCR_CKE(0x4000)
+#define SDRAMC_SDCR_REF(0x1000)
+
 #endif /* m5301x_h */
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ColdFire: PLATFORM_CPPFLAGS updates for new compiler

2009-03-17 Thread Tsi-Chung Liew
From: TsiChung Liew tsi-chung.l...@freescale.com

Update PLATFORM_CPPFLAGS to accept 4.3.x version of
ColdFire compiler.

Signed-off-by: TsiChung Liew tsi-chung.l...@freescale.com
---
 cpu/mcf5227x/config.mk   |4 ++--
 cpu/mcf523x/config.mk|2 +-
 cpu/mcf52x2/config.mk|2 +-
 cpu/mcf532x/config.mk|2 +-
 cpu/mcf5445x/config.mk   |2 +-
 cpu/mcf547x_8x/config.mk |2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/cpu/mcf5227x/config.mk b/cpu/mcf5227x/config.mk
index 8d60fd6..8eab49d 100644
--- a/cpu/mcf5227x/config.mk
+++ b/cpu/mcf5227x/config.mk
@@ -24,8 +24,8 @@
 #
 
 PLATFORM_RELFLAGS += -ffixed-d7 -msep-data
-ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2)
-PLATFORM_CPPFLAGS += -mcpu=5208 -fPIC
+ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
+PLATFORM_CPPFLAGS += -mcpu=52277 -fPIC
 else
 PLATFORM_CPPFLAGS += -m5307 -fPIC
 endif
diff --git a/cpu/mcf523x/config.mk b/cpu/mcf523x/config.mk
index 93645a3..fc79454 100644
--- a/cpu/mcf523x/config.mk
+++ b/cpu/mcf523x/config.mk
@@ -24,7 +24,7 @@
 #
 
 PLATFORM_RELFLAGS += -ffixed-d7 -msep-data
-ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2)
+ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
 PLATFORM_CPPFLAGS += -mcpu=5235 -fPIC
 else
 PLATFORM_CPPFLAGS += -m5307 -fPIC
diff --git a/cpu/mcf52x2/config.mk b/cpu/mcf52x2/config.mk
index 650e340..8292736 100644
--- a/cpu/mcf52x2/config.mk
+++ b/cpu/mcf52x2/config.mk
@@ -34,7 +34,7 @@ is5275:=$(shell grep CONFIG_M5275 $(TOPDIR)/include/$(cfg))
 is5282:=$(shell grep CONFIG_M5282 $(TOPDIR)/include/$(cfg))
 
 
-ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2)
+ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
 
 ifneq (,$(findstring CONFIG_M5249,$(is5249)))
 PLATFORM_CPPFLAGS += -mcpu=5249
diff --git a/cpu/mcf532x/config.mk b/cpu/mcf532x/config.mk
index 16a0bc3..0cb90ac 100644
--- a/cpu/mcf532x/config.mk
+++ b/cpu/mcf532x/config.mk
@@ -24,7 +24,7 @@
 #
 
 PLATFORM_RELFLAGS += -ffixed-d7 -msep-data
-ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2)
+ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
 PLATFORM_CPPFLAGS += -mcpu=5329 -fPIC
 else
 PLATFORM_CPPFLAGS += -m5307 -fPIC
diff --git a/cpu/mcf5445x/config.mk b/cpu/mcf5445x/config.mk
index 67efa07..b0b49f7 100644
--- a/cpu/mcf5445x/config.mk
+++ b/cpu/mcf5445x/config.mk
@@ -24,7 +24,7 @@
 #
 
 PLATFORM_RELFLAGS += -ffixed-d7 -msep-data
-ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2)
+ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
 PLATFORM_CPPFLAGS += -mcpu=54455 -fPIC
 else
 PLATFORM_CPPFLAGS += -m5407 -fPIC
diff --git a/cpu/mcf547x_8x/config.mk b/cpu/mcf547x_8x/config.mk
index 567b281..83102ab 100644
--- a/cpu/mcf547x_8x/config.mk
+++ b/cpu/mcf547x_8x/config.mk
@@ -24,7 +24,7 @@
 #
 
 PLATFORM_RELFLAGS += -ffixed-d7 -msep-data
-ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2)
+ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
 PLATFORM_CPPFLAGS += -mcpu=5485 -fPIC
 else
 PLATFORM_CPPFLAGS += -m5407 -fPIC
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ColdFire: Fix M5329EVB and M5373EVB nand issue

2008-10-27 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Fix compilation issue caused by a few mismatches.
Provide proper nand chip select enable/disable in
nand_hwcontrol() rather than in board_nand_init()
just enable once. Remove redundant local nand driver
functions - nand_read_byte(), nand_write_byte() and
nand_dev_ready() to use common nand driver.

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 board/freescale/m5329evb/nand.c |   57 +-
 board/freescale/m5373evb/nand.c |   17 +++
 2 files changed, 31 insertions(+), 43 deletions(-)

diff --git a/board/freescale/m5329evb/nand.c b/board/freescale/m5329evb/nand.c
index 82492f6..cf27dda 100644
--- a/board/freescale/m5329evb/nand.c
+++ b/board/freescale/m5329evb/nand.c
@@ -36,56 +36,42 @@ DECLARE_GLOBAL_DATA_PTR;
 #include linux/mtd/mtd.h
 
 #define SET_CLE0x10
-#define CLR_CLE~SET_CLE
 #define SET_ALE0x08
-#define CLR_ALE~SET_ALE
 
-static void nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
+static void nand_hwcontrol(struct mtd_info *mtdinfo, int cmd, unsigned int 
ctrl)
 {
struct nand_chip *this = mtdinfo-priv;
-/* volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; TODO: handle wp */
-   u32 nand_baseaddr = (u32) this-IO_ADDR_W;
+   volatile u16 *nCE = (u16 *) CONFIG_SYS_LATCH_ADDR;
 
if (ctrl  NAND_CTRL_CHANGE) {
-   if ( ctrl  NAND_CLE )
-   nand_baseaddr |= SET_CLE;
-   else
-   nand_baseaddr = CLR_CLE;
-   if ( ctrl  NAND_ALE )
-   nand_baseaddr |= SET_ALE;
-   else
-   nand_baseaddr = CLR_ALE;
-   }
-   this-IO_ADDR_W = (void __iomem *)(nand_baseaddr);
+   ulong IO_ADDR_W = (ulong) this-IO_ADDR_W;
 
-   if (cmd != NAND_CMD_NONE)
-   writeb(cmd, this-IO_ADDR_W);
-}
+   IO_ADDR_W = ~(SET_ALE | SET_CLE);
+   *nCE = 0xFFFB;
 
-static void nand_write_byte(struct mtd_info *mtdinfo, u_char byte)
-{
-   struct nand_chip *this = mtdinfo-priv;
-   *((volatile u8 *)(this-IO_ADDR_W)) = byte;
-}
+   if (ctrl  NAND_NCE)
+   *nCE |= 0x0004;
+   if (ctrl  NAND_CLE)
+   IO_ADDR_W |= SET_CLE;
+   if (ctrl  NAND_ALE)
+   IO_ADDR_W |= SET_ALE;
 
-static u8 nand_read_byte(struct mtd_info *mtdinfo)
-{
-   struct nand_chip *this = mtdinfo-priv;
-   return (u8) (*((volatile u8 *)this-IO_ADDR_R));
-}
+   this-IO_ADDR_W = (void *)IO_ADDR_W;
+   }
 
-static int nand_dev_ready(struct mtd_info *mtdinfo)
-{
-   return 1;
+   if (cmd != NAND_CMD_NONE)
+   writeb(cmd, this-IO_ADDR_W);
 }
 
 int board_nand_init(struct nand_chip *nand)
 {
volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
 
-   *((volatile u16 *)CONFIG_SYS_LATCH_ADDR) |= 0x0004;
-
-   /* set up pin configuration */
+   /*
+* set up pin configuration - enabled 2nd output buffer's signals
+* (nand_ngpio - nCE USB1/2_PWR_EN, LATCH_GPIOs, LCD_VEEEN, etc)
+* to use nCE signal
+*/
gpio-par_timer = ~GPIO_PAR_TIN3_TIN3;
gpio-pddr_timer |= 0x08;
gpio-ppd_timer |= 0x08;
@@ -95,9 +81,6 @@ int board_nand_init(struct nand_chip *nand)
nand-chip_delay = 50;
nand-ecc.mode = NAND_ECC_SOFT;
nand-cmd_ctrl = nand_hwcontrol;
-   nand-read_byte = nand_read_byte;
-   nand-write_byte = nand_write_byte;
-   nand-dev_ready = nand_dev_ready;
 
return 0;
 }
diff --git a/board/freescale/m5373evb/nand.c b/board/freescale/m5373evb/nand.c
index d01b819..3ebef05 100644
--- a/board/freescale/m5373evb/nand.c
+++ b/board/freescale/m5373evb/nand.c
@@ -41,19 +41,21 @@ DECLARE_GLOBAL_DATA_PTR;
 static void nand_hwcontrol(struct mtd_info *mtdinfo, int cmd, unsigned int 
ctrl)
 {
struct nand_chip *this = mtdinfo-priv;
-   volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS;
-   u32 nand_baseaddr = (u32) this-IO_ADDR_W;
+   volatile u16 *nCE = (u16 *) CONFIG_SYS_LATCH_ADDR;
 
if (ctrl  NAND_CTRL_CHANGE) {
ulong IO_ADDR_W = (ulong) this-IO_ADDR_W;
-   IO_ADDR_W = ~(SET_ALE | SE_CLE);
 
+   IO_ADDR_W = ~(SET_ALE | SET_CLE);
+   *nCE = 0xFFFB;
+
+   if (ctrl  NAND_NCE)
+   *nCE |= 0x0004;
if (ctrl  NAND_CLE)
IO_ADDR_W |= SET_CLE;
if (ctrl  NAND_ALE)
IO_ADDR_W |= SET_ALE;
 
-   at91_set_gpio_value(AT91_PIN_PD15, !(ctrl  NAND_NCE));
this-IO_ADDR_W = (void *)IO_ADDR_W;
 
}
@@ -67,10 +69,13 @@ int board_nand_init(struct nand_chip *nand)
volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS;
 
-   *((volatile u16 

[U-Boot] [PATCH v2 1/9] ColdFire: Remove linker file

2008-10-23 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Each different build for M54455EVB and M5235EVB will
create a u-boot.lds linker file. It is redundant to
keep the u-boot.lds

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 board/freescale/m5235evb/u-boot.lds  |  144 --
 board/freescale/m54455evb/u-boot.lds |  143 -
 2 files changed, 0 insertions(+), 287 deletions(-)
 delete mode 100644 board/freescale/m5235evb/u-boot.lds
 delete mode 100644 board/freescale/m54455evb/u-boot.lds

diff --git a/board/freescale/m5235evb/u-boot.lds 
b/board/freescale/m5235evb/u-boot.lds
deleted file mode 100644
index c0611b9..000
--- a/board/freescale/m5235evb/u-boot.lds
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-OUTPUT_ARCH(m68k)
-/* Do we need any of these for elf?
-   __DYNAMIC = 0;*/
-SECTIONS
-{
-  /* Read-only sections, merged into text segment: */
-  . = + SIZEOF_HEADERS;
-  .interp : { *(.interp) }
-  .hash  : { *(.hash)  }
-  .dynsym: { *(.dynsym)}
-  .dynstr: { *(.dynstr)}
-  .rel.text  : { *(.rel.text)  }
-  .rela.text : { *(.rela.text) }
-  .rel.data  : { *(.rel.data)  }
-  .rela.data : { *(.rela.data) }
-  .rel.rodata: { *(.rel.rodata)}
-  .rela.rodata   : { *(.rela.rodata)   }
-  .rel.got   : { *(.rel.got)   }
-  .rela.got  : { *(.rela.got)  }
-  .rel.ctors : { *(.rel.ctors) }
-  .rela.ctors: { *(.rela.ctors)}
-  .rel.dtors : { *(.rel.dtors) }
-  .rela.dtors: { *(.rela.dtors)}
-  .rel.bss   : { *(.rel.bss)   }
-  .rela.bss  : { *(.rela.bss)  }
-  .rel.plt   : { *(.rel.plt)   }
-  .rela.plt  : { *(.rela.plt)  }
-  .init  : { *(.init)  }
-  .plt : { *(.plt) }
-  .text  :
-  {
-/* WARNING - the following is hand-optimized to fit within */
-/* the sector layout of our flash chips!   XXX FIXME XXX   */
-
-cpu/mcf523x/start.o(.text)
-cpu/mcf523x/cpu_init.o (.text)
-lib_m68k/traps.o   (.text)
-lib_m68k/interrupts.o  (.text)
-common/dlmalloc.o  (.text)
-lib_generic/zlib.o (.text)
-
-. = DEFINED(env_offset) ? env_offset : .;
-common/env_embedded.o  (.text)
-
-*(.text)
-*(.fixup)
-*(.got1)
-  }
-  _etext = .;
-  PROVIDE (etext = .);
-  .rodata:
-  {
-*(.rodata)
-*(.rodata1)
-  }
-  .fini  : { *(.fini)} =0
-  .ctors : { *(.ctors)   }
-  .dtors : { *(.dtors)   }
-
-  /* Read-write section, merged into data segment: */
-  . = (. + 0x00FF)  0xFF00;
-  _erotext = .;
-  PROVIDE (erotext = .);
-
-  .reloc   :
-  {
-__got_start = .;
-*(.got)
-__got_end = .;
-_GOT2_TABLE_ = .;
-*(.got2)
-_FIXUP_TABLE_ = .;
-*(.fixup)
-  }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) 2;
-  __fixup_entries = (. - _FIXUP_TABLE_)2;
-
-  .data:
-  {
-*(.data)
-*(.data1)
-*(.sdata)
-*(.sdata2)
-*(.dynamic)
-CONSTRUCTORS
-  }
-  _edata  =  .;
-  PROVIDE (edata = .);
-
-  . = .;
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-
-  . = .;
-  __start___ex_table = .;
-  __ex_table : { *(__ex_table) }
-  __stop___ex_table = .;
-
-  . = ALIGN(256);
-  __init_begin = .;
-  .text.init : { *(.text.init) }
-  .data.init : { *(.data.init) }
-  . = ALIGN(256);
-  __init_end = .;
-
-  __bss_start = .;
-  .bss (NOLOAD)   :
-  {
-   _sbss = .;
-   *(.sbss) *(.scommon)
-   *(.dynbss)
-   *(.bss)
-   *(COMMON)
-   . = ALIGN(4);
-   _ebss = .;
-  }
-  _end = . ;
-  PROVIDE (end = .);
-}
diff --git a/board/freescale/m54455evb/u-boot.lds 
b/board/freescale/m54455evb/u-boot.lds
deleted file mode 100644
index bcf30c3..000
--- a/board/freescale/m54455evb/u-boot.lds
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
- *
- * See file CREDITS for list of people who 

[U-Boot] [PATCH v2 4/9] ColdFire: Relocate FEC's GPIO and mii functions protocols

2008-10-23 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Place FEC pin assignments in cpu_init.c from platform's
mii.c

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 cpu/mcf523x/cpu_init.c  |   24 +++-
 cpu/mcf52x2/cpu_init.c  |   78 +++
 cpu/mcf532x/cpu_init.c  |   25 -
 cpu/mcf5445x/cpu_init.c |   34 -
 cpu/mcf547x_8x/cpu_init.c   |   27 +
 include/asm-m68k/fec.h  |   12 ++
 include/asm-m68k/fsl_mcdmafec.h |9 
 7 files changed, 197 insertions(+), 12 deletions(-)

diff --git a/cpu/mcf523x/cpu_init.c b/cpu/mcf523x/cpu_init.c
index 6520944..3c04fd4 100644
--- a/cpu/mcf523x/cpu_init.c
+++ b/cpu/mcf523x/cpu_init.c
@@ -27,9 +27,14 @@
 
 #include common.h
 #include watchdog.h
-
 #include asm/immap.h
 
+#if defined(CONFIG_CMD_NET)
+#include config.h
+#include net.h
+#include asm/fec.h
+#endif
+
 /*
  * Breath some life into the CPU...
  *
@@ -143,3 +148,20 @@ void uart_port_conf(void)
break;
}
 }
+
+#if defined(CONFIG_CMD_NET)
+int fecpin_setclear(struct eth_device *dev, int setclear)
+{
+   volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
+
+   if (setclear) {
+   gpio-par_feci2c |=
+   (GPIO_PAR_FECI2C_EMDC_FECEMDC | 
GPIO_PAR_FECI2C_EMDIO_FECEMDIO);
+   } else {
+   gpio-par_feci2c =
+   ~(GPIO_PAR_FECI2C_EMDC_MASK | GPIO_PAR_FECI2C_EMDIO_MASK);
+   }
+
+   return 0;
+}
+#endif
diff --git a/cpu/mcf52x2/cpu_init.c b/cpu/mcf52x2/cpu_init.c
index 32ad6cd..18308c8 100644
--- a/cpu/mcf52x2/cpu_init.c
+++ b/cpu/mcf52x2/cpu_init.c
@@ -36,6 +36,12 @@
 #include watchdog.h
 #include asm/immap.h
 
+#if defined(CONFIG_CMD_NET)
+#include config.h
+#include net.h
+#include asm/fec.h
+#endif
+
 #ifndef CONFIG_M5272
 /* Only 5272 Flexbus chipselect is different from the rest */
 void init_fbcs(void)
@@ -207,6 +213,19 @@ void uart_port_conf(void)
break;
}
 }
+
+#if defined(CONFIG_CMD_NET)
+int fecpin_setclear(struct eth_device *dev, int setclear)
+{
+   if (setclear) {
+   /* Enable Ethernet pins */
+   mbar_writeByte(MCF_GPIO_PAR_FECI2C, CONFIG_SYS_FECI2C);
+   } else {
+   }
+
+   return 0;
+}
+#endif /* CONFIG_CMD_NET */
 #endif
 
 #if defined(CONFIG_M5272)
@@ -309,6 +328,22 @@ void uart_port_conf(void)
break;
}
 }
+
+#if defined(CONFIG_CMD_NET)
+int fecpin_setclear(struct eth_device *dev, int setclear)
+{
+   volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
+
+   if (setclear) {
+   gpio-gpio_pbcnt |= GPIO_PBCNT_E_MDC | GPIO_PBCNT_E_RXER |
+   GPIO_PBCNT_E_RXD1 | GPIO_PBCNT_E_RXD2 |
+   GPIO_PBCNT_E_RXD3 | GPIO_PBCNT_E_TXD1 |
+   GPIO_PBCNT_E_TXD2 | GPIO_PBCNT_E_TXD3;
+   } else {
+   }
+   return 0;
+}
+#endif /* CONFIG_CMD_NET */
 #endif /* #if defined(CONFIG_M5272) */
 
 #if defined(CONFIG_M5275)
@@ -372,6 +407,35 @@ void uart_port_conf(void)
break;
}
 }
+
+#if defined(CONFIG_CMD_NET)
+int fecpin_setclear(struct eth_device *dev, int setclear)
+{
+   struct fec_info_s *info = (struct fec_info_s *) dev-priv;
+   volatile gpio_t *gpio = (gpio_t *)MMAP_GPIO;
+
+   if (setclear) {
+   /* Enable Ethernet pins */
+   if (info-iobase == CONFIG_SYS_FEC0_IOBASE) {
+   gpio-par_feci2c |= 0x0F00;
+   gpio-par_fec0hl |= 0xC0;
+   } else {
+   gpio-par_feci2c |= 0x00A0;
+   gpio-par_fec1hl |= 0xC0;
+   }
+   } else {
+   if (info-iobase == CONFIG_SYS_FEC0_IOBASE) {
+   gpio-par_feci2c = ~0x0F00;
+   gpio-par_fec0hl = ~0xC0;
+   } else {
+   gpio-par_feci2c = ~0x00A0;
+   gpio-par_fec1hl = ~0xC0;
+   }
+   }
+
+   return 0;
+}
+#endif /* CONFIG_CMD_NET */
 #endif /* #if defined(CONFIG_M5275) */
 
 #if defined(CONFIG_M5282)
@@ -469,6 +533,20 @@ void uart_port_conf(void)
break;
}
 }
+
+#if defined(CONFIG_CMD_NET)
+int fecpin_setclear(struct eth_device *dev, int setclear)
+{
+   if (setclear) {
+   MCFGPIO_PASPAR |= 0x0F00;
+   MCFGPIO_PEHLPAR = CONFIG_SYS_PEHLPAR;
+   } else {
+   MCFGPIO_PASPAR = 0xF0FF;
+   MCFGPIO_PEHLPAR = ~CONFIG_SYS_PEHLPAR;
+   }
+   return 0;
+}
+#endif /* CONFIG_CMD_NET */
 #endif
 
 #if defined(CONFIG_M5249)
diff --git a/cpu/mcf532x/cpu_init.c b/cpu/mcf532x/cpu_init.c
index d348e29..39be11f 100644
--- a/cpu/mcf532x/cpu_init.c
+++ b/cpu/mcf532x/cpu_init.c
@@ -27,9 +27,14 @@

[U-Boot] [PATCH v2 6/9] ColdFire: Use CFI driver for M5272C3

2008-10-23 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 board/freescale/m5272c3/Makefile |2 +-
 board/freescale/m5272c3/flash.c  |  378 --
 include/configs/M5272C3.h|   14 +-
 3 files changed, 11 insertions(+), 383 deletions(-)
 delete mode 100644 board/freescale/m5272c3/flash.c

diff --git a/board/freescale/m5272c3/Makefile b/board/freescale/m5272c3/Makefile
index cf07cf4..424ab1c 100644
--- a/board/freescale/m5272c3/Makefile
+++ b/board/freescale/m5272c3/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).a
 
-COBJS  = $(BOARD).o flash.o
+COBJS  = $(BOARD).o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/freescale/m5272c3/flash.c b/board/freescale/m5272c3/flash.c
deleted file mode 100644
index 586a2cf..000
--- a/board/freescale/m5272c3/flash.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * (C) Copyright 2000-2003
- * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include common.h
-
-#define PHYS_FLASH_1 CONFIG_SYS_FLASH_BASE
-#define FLASH_BANK_SIZE 0x20
-
-flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
-
-void flash_print_info (flash_info_t * info)
-{
-   int i;
-
-   switch (info-flash_id  FLASH_VENDMASK) {
-   case (AMD_MANUFACT  FLASH_VENDMASK):
-   printf (AMD: );
-   break;
-   default:
-   printf (Unknown Vendor );
-   break;
-   }
-
-   switch (info-flash_id  FLASH_TYPEMASK) {
-   case (AMD_ID_PL160CB  FLASH_TYPEMASK):
-   printf (AM29PL160CB (16Mbit)\n);
-   break;
-   default:
-   printf (Unknown Chip Type\n);
-   goto Done;
-   break;
-   }
-
-   printf (  Size: %ld MB in %d Sectors\n,
-   info-size  20, info-sector_count);
-
-   printf (  Sector Start Addresses:);
-   for (i = 0; i  info-sector_count; i++) {
-   if ((i % 5) == 0) {
-   printf (\n   );
-   }
-   printf ( %08lX%s, info-start[i],
-   info-protect[i] ?  (RO) :  );
-   }
-   printf (\n);
-
-  Done:
-   return;
-}
-
-
-unsigned long flash_init (void)
-{
-   int i, j;
-   ulong size = 0;
-
-   for (i = 0; i  CONFIG_SYS_MAX_FLASH_BANKS; i++) {
-   ulong flashbase = 0;
-
-   flash_info[i].flash_id =
-   (AMD_MANUFACT  FLASH_VENDMASK) |
-   (AMD_ID_PL160CB  FLASH_TYPEMASK);
-   flash_info[i].size = FLASH_BANK_SIZE;
-   flash_info[i].sector_count = CONFIG_SYS_MAX_FLASH_SECT;
-   memset (flash_info[i].protect, 0, CONFIG_SYS_MAX_FLASH_SECT);
-   if (i == 0)
-   flashbase = PHYS_FLASH_1;
-   else
-   panic (configured to many flash banks!\n);
-
-   for (j = 0; j  flash_info[i].sector_count; j++) {
-   if (j == 0) {
-   /* 1st is 16 KiB */
-   flash_info[i].start[j] = flashbase;
-   }
-   if ((j = 1)  (j = 2)) {
-   /* 2nd and 3rd are 8 KiB */
-   flash_info[i].start[j] =
-   flashbase + 0x4000 + 0x2000 * (j - 1);
-   }
-   if (j == 3) {
-   /* 4th is 224 KiB */
-   flash_info[i].start[j] = flashbase + 0x8000;
-   }
-   if ((j = 4)  (j = 10)) {
-   /* rest is 256 KiB */
-   flash_info[i].start[j] =
-   flashbase + 0x4 + 0x4 * (j -
-4);
-   }
-   }
-   size += flash_info[i].size;
-   }
-
-   flash_protect (FLAG_PROTECT_SET,
-  

[U-Boot] [PATCH v2 9/9] ColdFire: Fix compilation error

2008-10-23 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

The error was caused by the change for strmhz() in cpu.c.
A few of them were one extra close parenthesis.

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 cpu/mcf5227x/cpu.c |   10 +-
 cpu/mcf523x/cpu.c  |4 ++--
 cpu/mcf532x/cpu.c  |4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/cpu/mcf5227x/cpu.c b/cpu/mcf5227x/cpu.c
index 765aec6..d9f5f43 100644
--- a/cpu/mcf5227x/cpu.c
+++ b/cpu/mcf5227x/cpu.c
@@ -65,12 +65,12 @@ int checkcpu(void)
printf(Freescale MCF%d (Mask:%01x Version:%x)\n, id, msk,
   ver);
printf(   CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n,
-  strmhz(buf1, gd-cpu_clk)),
-  strmhz(buf2, gd-bus_clk)),
-  strmhz(buf3, gd-flb_clk)));
+  strmhz(buf1, gd-cpu_clk),
+  strmhz(buf2, gd-bus_clk),
+  strmhz(buf3, gd-flb_clk));
printf(   INP CLK %s MHz VCO CLK %s MHz\n,
-  strmhz(buf1, gd-inp_clk)),
-  strmhz(buf2, gd-vco_clk)));
+  strmhz(buf1, gd-inp_clk),
+  strmhz(buf2, gd-vco_clk));
}
 
return 0;
diff --git a/cpu/mcf523x/cpu.c b/cpu/mcf523x/cpu.c
index b9e48aa..a1a5133 100644
--- a/cpu/mcf523x/cpu.c
+++ b/cpu/mcf523x/cpu.c
@@ -65,8 +65,8 @@ int checkcpu(void)
printf(Freescale MCF%d (Mask:%01x Version:%x)\n, id, msk,
   ver);
printf(   CPU CLK %s MHz BUS CLK %s MHz\n,
-  strmhz(buf1, gd-cpu_clk)),
-  strmhz(buf2, gd-bus_clk)));
+  strmhz(buf1, gd-cpu_clk),
+  strmhz(buf2, gd-bus_clk));
}
 
return 0;
diff --git a/cpu/mcf532x/cpu.c b/cpu/mcf532x/cpu.c
index bcb092d..331cc15 100644
--- a/cpu/mcf532x/cpu.c
+++ b/cpu/mcf532x/cpu.c
@@ -104,8 +104,8 @@ int checkcpu(void)
printf(Freescale MCF%d (Mask:%01x Version:%x)\n, id, msk,
   ver);
printf(   CPU CLK %s MHz BUS CLK %s MHz\n,
-  strmhz(buf1, gd-cpu_clk)),
-  strmhz(buf2, gd-bus_clk)));
+  strmhz(buf1, gd-cpu_clk),
+  strmhz(buf2, gd-bus_clk));
}
 
return 0;
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 5/9] ColdFire: Add mii driver in drivers/net

2008-10-23 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

All CF platforms' mii.c are consolidated into one

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 drivers/net/Makefile |4 +-
 drivers/net/mcffec.c |   18 +---
 drivers/net/mcfmii.c |  321 ++
 3 files changed, 326 insertions(+), 17 deletions(-)
 create mode 100644 drivers/net/mcfmii.c

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 439c354..7e53136 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -35,13 +35,13 @@ COBJS-$(CONFIG_DRIVER_DM9000) += dm9000x.o
 COBJS-$(CONFIG_E1000) += e1000.o
 COBJS-$(CONFIG_EEPRO100) += eepro100.o
 COBJS-$(CONFIG_ENC28J60) += enc28j60.o
-COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o
+COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o
 COBJS-$(CONFIG_GRETH) += greth.o
 COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
 COBJS-$(CONFIG_DRIVER_KS8695ETH) += ks8695eth.o
 COBJS-$(CONFIG_DRIVER_LAN91C96) += lan91c96.o
 COBJS-$(CONFIG_MACB) += macb.o
-COBJS-$(CONFIG_MCFFEC) += mcffec.o
+COBJS-$(CONFIG_MCFFEC) += mcffec.o mcfmii.o
 COBJS-$(CONFIG_MPC5xxx_FEC) += mpc5xxx_fec.o
 COBJS-$(CONFIG_MPC512x_FEC) += mpc512x_fec.o
 COBJS-$(CONFIG_NATSEMI) += natsemi.o
diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index c00474e..18240a8 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -27,14 +27,14 @@
 #include common.h
 #include malloc.h
 
-#include asm/fec.h
-#include asm/immap.h
-
 #include command.h
 #include net.h
 #include netdev.h
 #include miiphy.h
 
+#include asm/fec.h
+#include asm/immap.h
+
 #undef ET_DEBUG
 #undef MII_DEBUG
 
@@ -101,18 +101,6 @@ int fec_init(struct eth_device *dev, bd_t * bd);
 void fec_halt(struct eth_device *dev);
 void fec_reset(struct eth_device *dev);
 
-extern int fecpin_setclear(struct eth_device *dev, int setclear);
-
-#ifdef CONFIG_SYS_DISCOVER_PHY
-extern void __mii_init(void);
-extern uint mii_send(uint mii_cmd);
-extern int mii_discover_phy(struct eth_device *dev);
-extern int mcffec_miiphy_read(char *devname, unsigned char addr,
- unsigned char reg, unsigned short *value);
-extern int mcffec_miiphy_write(char *devname, unsigned char addr,
-  unsigned char reg, unsigned short value);
-#endif
-
 void setFecDuplexSpeed(volatile fec_t * fecp, bd_t * bd, int dup_spd)
 {
if ((dup_spd  16) == FULL) {
diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c
new file mode 100644
index 000..2b733c6
--- /dev/null
+++ b/drivers/net/mcfmii.c
@@ -0,0 +1,321 @@
+/*
+ * Copyright (C) 2004-2008 Freescale Semiconductor, Inc.
+ * TsiChung Liew ([EMAIL PROTECTED])
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include config.h
+#include net.h
+#include netdev.h
+
+#ifdef CONFIG_MCF547x_8x
+#include asm/fsl_mcdmafec.h
+#else
+#include asm/fec.h
+#endif
+#include asm/immap.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if defined(CONFIG_CMD_NET)  defined(CONFIG_NET_MULTI)
+#undef MII_DEBUG
+#undef ET_DEBUG
+
+/*extern int fecpin_setclear(struct eth_device *dev, int setclear);*/
+
+#if defined(CONFIG_SYS_DISCOVER_PHY) || defined(CONFIG_CMD_MII)
+#include miiphy.h
+
+/* Make MII read/write commands for the FEC. */
+#define mk_mii_read(ADDR, REG) (0x6002 | ((ADDR  23) | \
+(REG  0x1f)  18))
+#define mk_mii_write(ADDR, REG, VAL)   (0x5002 | ((ADDR  23) | \
+(REG  0x1f)  18) | (VAL  0x))
+
+#ifndef CONFIG_SYS_UNSPEC_PHYID
+#  define CONFIG_SYS_UNSPEC_PHYID  0
+#endif
+#ifndef CONFIG_SYS_UNSPEC_STRID
+#  define CONFIG_SYS_UNSPEC_STRID  0
+#endif
+
+#ifdef CONFIG_MCF547x_8x
+typedef struct fec_info_dma FEC_INFO_T;
+#define FEC_T fecdma_t
+#else
+typedef struct fec_info_s FEC_INFO_T;
+#define FEC_T fec_t
+#endif
+
+typedef struct phy_info_struct {
+   u32 phyid;
+   char *strid;
+} phy_info_t;
+
+phy_info_t phyinfo[] = {
+   {0x0022561B, AMD79C784VC},/* AMD 79C784VC */
+   {0x00406322, BCM5222},/* Broadcom 5222 */
+   {0x02a80150, Intel82555}, /* Intel 82555 */
+   {0x0016f870, LSI80225},   /* LSI 80225 */
+   {0x0016f880, 

[U-Boot] [PATCH 01/19] ColdFire: Remove linker file

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Each different build for M54455EVB and M5235EVB will
create a u-boot.lds linker file. It is redundant to
keep the u-boot.lds

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 board/freescale/m5235evb/u-boot.lds  |  144 --
 board/freescale/m54455evb/u-boot.lds |  143 -
 2 files changed, 0 insertions(+), 287 deletions(-)
 delete mode 100644 board/freescale/m5235evb/u-boot.lds
 delete mode 100644 board/freescale/m54455evb/u-boot.lds

diff --git a/board/freescale/m5235evb/u-boot.lds 
b/board/freescale/m5235evb/u-boot.lds
deleted file mode 100644
index c0611b9..000
--- a/board/freescale/m5235evb/u-boot.lds
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-OUTPUT_ARCH(m68k)
-/* Do we need any of these for elf?
-   __DYNAMIC = 0;*/
-SECTIONS
-{
-  /* Read-only sections, merged into text segment: */
-  . = + SIZEOF_HEADERS;
-  .interp : { *(.interp) }
-  .hash  : { *(.hash)  }
-  .dynsym: { *(.dynsym)}
-  .dynstr: { *(.dynstr)}
-  .rel.text  : { *(.rel.text)  }
-  .rela.text : { *(.rela.text) }
-  .rel.data  : { *(.rel.data)  }
-  .rela.data : { *(.rela.data) }
-  .rel.rodata: { *(.rel.rodata)}
-  .rela.rodata   : { *(.rela.rodata)   }
-  .rel.got   : { *(.rel.got)   }
-  .rela.got  : { *(.rela.got)  }
-  .rel.ctors : { *(.rel.ctors) }
-  .rela.ctors: { *(.rela.ctors)}
-  .rel.dtors : { *(.rel.dtors) }
-  .rela.dtors: { *(.rela.dtors)}
-  .rel.bss   : { *(.rel.bss)   }
-  .rela.bss  : { *(.rela.bss)  }
-  .rel.plt   : { *(.rel.plt)   }
-  .rela.plt  : { *(.rela.plt)  }
-  .init  : { *(.init)  }
-  .plt : { *(.plt) }
-  .text  :
-  {
-/* WARNING - the following is hand-optimized to fit within */
-/* the sector layout of our flash chips!   XXX FIXME XXX   */
-
-cpu/mcf523x/start.o(.text)
-cpu/mcf523x/cpu_init.o (.text)
-lib_m68k/traps.o   (.text)
-lib_m68k/interrupts.o  (.text)
-common/dlmalloc.o  (.text)
-lib_generic/zlib.o (.text)
-
-. = DEFINED(env_offset) ? env_offset : .;
-common/env_embedded.o  (.text)
-
-*(.text)
-*(.fixup)
-*(.got1)
-  }
-  _etext = .;
-  PROVIDE (etext = .);
-  .rodata:
-  {
-*(.rodata)
-*(.rodata1)
-  }
-  .fini  : { *(.fini)} =0
-  .ctors : { *(.ctors)   }
-  .dtors : { *(.dtors)   }
-
-  /* Read-write section, merged into data segment: */
-  . = (. + 0x00FF)  0xFF00;
-  _erotext = .;
-  PROVIDE (erotext = .);
-
-  .reloc   :
-  {
-__got_start = .;
-*(.got)
-__got_end = .;
-_GOT2_TABLE_ = .;
-*(.got2)
-_FIXUP_TABLE_ = .;
-*(.fixup)
-  }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) 2;
-  __fixup_entries = (. - _FIXUP_TABLE_)2;
-
-  .data:
-  {
-*(.data)
-*(.data1)
-*(.sdata)
-*(.sdata2)
-*(.dynamic)
-CONSTRUCTORS
-  }
-  _edata  =  .;
-  PROVIDE (edata = .);
-
-  . = .;
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-
-  . = .;
-  __start___ex_table = .;
-  __ex_table : { *(__ex_table) }
-  __stop___ex_table = .;
-
-  . = ALIGN(256);
-  __init_begin = .;
-  .text.init : { *(.text.init) }
-  .data.init : { *(.data.init) }
-  . = ALIGN(256);
-  __init_end = .;
-
-  __bss_start = .;
-  .bss (NOLOAD)   :
-  {
-   _sbss = .;
-   *(.sbss) *(.scommon)
-   *(.dynbss)
-   *(.bss)
-   *(COMMON)
-   . = ALIGN(4);
-   _ebss = .;
-  }
-  _end = . ;
-  PROVIDE (end = .);
-}
diff --git a/board/freescale/m54455evb/u-boot.lds 
b/board/freescale/m54455evb/u-boot.lds
deleted file mode 100644
index bcf30c3..000
--- a/board/freescale/m54455evb/u-boot.lds
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
- *
- * See file CREDITS for list of people who 

[U-Boot] [PATCH 02/19] ColdFire: Modules header files cleanup - 1

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Consolidate ATA, ePORT and QSPI structures and
definitions in immap_5xxx.h to more unify modules
header files. Append DSPI support for m547x_8x.

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 include/asm-m68k/coldfire/ata.h   |   79 +
 include/asm-m68k/coldfire/dspi.h  |   15 ++--
 include/asm-m68k/coldfire/eport.h |  139 +
 include/asm-m68k/coldfire/qspi.h  |  111 +
 include/asm-m68k/immap_5227x.h|   11 +---
 include/asm-m68k/immap_5235.h |   19 +
 include/asm-m68k/immap_5249.h |2 +
 include/asm-m68k/immap_5253.h |   54 +--
 include/asm-m68k/immap_5271.h |3 +
 include/asm-m68k/immap_5272.h |   16 
 include/asm-m68k/immap_5275.h |   20 +-
 include/asm-m68k/immap_5282.h |3 +
 include/asm-m68k/immap_5329.h |   29 +---
 include/asm-m68k/immap_5445x.h|   62 +
 include/asm-m68k/immap_547x_8x.h  |2 +
 include/asm-m68k/m5235.h  |   91 
 include/asm-m68k/m5329.h  |   51 --
 include/asm-m68k/m5445x.h |   90 
 18 files changed, 359 insertions(+), 438 deletions(-)
 create mode 100644 include/asm-m68k/coldfire/ata.h
 create mode 100644 include/asm-m68k/coldfire/eport.h
 create mode 100644 include/asm-m68k/coldfire/qspi.h

diff --git a/include/asm-m68k/coldfire/ata.h b/include/asm-m68k/coldfire/ata.h
new file mode 100644
index 000..3efd03a
--- /dev/null
+++ b/include/asm-m68k/coldfire/ata.h
@@ -0,0 +1,79 @@
+/*
+ * ATA Internal Memory Map
+ *
+ * Copyright (C) 2004-2008 Freescale Semiconductor, Inc.
+ * TsiChung Liew ([EMAIL PROTECTED])
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ATA_H__
+#define __ATA_H__
+
+/* ATA */
+typedef struct atac {
+   /* PIO */
+   u8 toff;/* 0x00 */
+   u8 ton; /* 0x01 */
+   u8 t1;  /* 0x02 */
+   u8 t2w; /* 0x03 */
+   u8 t2r; /* 0x04 */
+   u8 ta;  /* 0x05 */
+   u8 trd; /* 0x06 */
+   u8 t4;  /* 0x07 */
+   u8 t9;  /* 0x08 */
+
+   /* DMA */
+   u8 tm;  /* 0x09 */
+   u8 tn;  /* 0x0A */
+   u8 td;  /* 0x0B */
+   u8 tk;  /* 0x0C */
+   u8 tack;/* 0x0D */
+   u8 tenv;/* 0x0E */
+   u8 trp; /* 0x0F */
+   u8 tzah;/* 0x10 */
+   u8 tmli;/* 0x11 */
+   u8 tdvh;/* 0x12 */
+   u8 tdzfs;   /* 0x13 */
+   u8 tdvs;/* 0x14 */
+   u8 tcvh;/* 0x15 */
+   u8 tss; /* 0x16 */
+   u8 tcyc;/* 0x17 */
+
+   /* FIFO */
+   u32 fifo32; /* 0x18 */
+   u16 fifo16; /* 0x1C */
+   u8 rsvd0[2];
+   u8 ffill;   /* 0x20 */
+   u8 rsvd1[3];
+
+   /* ATA */
+   u8 cr;  /* 0x24 */
+   u8 rsvd2[3];
+   u8 isr; /* 0x28 */
+   u8 rsvd3[3];
+   u8 ier; /* 0x2C */
+   u8 rsvd4[3];
+   u8 icr; /* 0x30 */
+   u8 rsvd5[3];
+   u8 falarm;  /* 0x34 */
+   u8 rsvd6[106];
+} atac_t;
+
+#endif /* __ATA_H__ */
diff --git a/include/asm-m68k/coldfire/dspi.h b/include/asm-m68k/coldfire/dspi.h
index 8327e1b..4b7d61e 100644
--- a/include/asm-m68k/coldfire/dspi.h
+++ b/include/asm-m68k/coldfire/dspi.h
@@ -46,15 +46,14 @@ typedef struct dspi {
u32 dirsr;
u32 dtfr;
u32 drfr;
-   u32 dtfdr0;
-   u32 dtfdr1;
-   u32 dtfdr2;
-   u32 dtfdr3;
+#ifdef CONFIG_MCF547x_8x
+   u32 dtfdr[4];
u8 resv1[0x30];
-   u32 drfdr0;
-   u32 drfdr1;
-   u32 drfdr2;
-   u32 drfdr3;
+   u32 drfdr[4];
+#else
+   u32 dtfdr[16];
+   u32 drfdr[16];
+#endif
 } dspi_t;
 
 /* Bit definitions and macros for DMCR */
diff --git 

[U-Boot] [PATCH 04/19] ColdFire: Modules header files cleanup - 3

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Consolidate RNG, MDHA and SKHA structures and
definitions in immap_5xxx.h and m5xxx.h to more
unify modules header files. SSI cleanup. Remove
USB Host structure from immap_5329.h

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 include/asm-m68k/coldfire/mdha.h |  102 
 include/asm-m68k/coldfire/rng.h  |   52 
 include/asm-m68k/coldfire/skha.h |  121 ++
 include/asm-m68k/coldfire/ssi.h  |   66 +---
 include/asm-m68k/immap_5235.h|3 +
 include/asm-m68k/immap_5271.h|3 +
 include/asm-m68k/immap_5275.h|3 +
 include/asm-m68k/immap_5329.h|  116 +---
 include/asm-m68k/immap_5445x.h   |8 ---
 include/asm-m68k/m5445x.h|   18 --
 10 files changed, 316 insertions(+), 176 deletions(-)
 create mode 100644 include/asm-m68k/coldfire/mdha.h
 create mode 100644 include/asm-m68k/coldfire/rng.h
 create mode 100644 include/asm-m68k/coldfire/skha.h

diff --git a/include/asm-m68k/coldfire/mdha.h b/include/asm-m68k/coldfire/mdha.h
new file mode 100644
index 000..b698136
--- /dev/null
+++ b/include/asm-m68k/coldfire/mdha.h
@@ -0,0 +1,102 @@
+/*
+ * Message Digest Hardware Accelerator Memory Map
+ *
+ * Copyright (C) 2004-2008 Freescale Semiconductor, Inc.
+ * TsiChung Liew ([EMAIL PROTECTED])
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __MDHA_H__
+#define __MDHA_H__
+
+/* Message Digest Hardware Accelerator */
+typedef struct mdha_ctrl {
+   u32 mr; /* 0x00 MDHA Mode */
+   u32 cr; /* 0x04 Control */
+   u32 cmd;/* 0x08 Command */
+   u32 sr; /* 0x0C Status */
+   u32 isr;/* 0x10 Interrupt Status */
+   u32 imr;/* 0x14 Interrupt Mask */
+   u32 dsz;/* 0x1C Data Size */
+   u32 inp;/* 0x20 Input FIFO */
+   u32 res1[3];/* 0x24 - 0x2F */
+   u32 mda0;   /* 0x30 Message Digest AO */
+   u32 mdb0;   /* 0x34 Message Digest BO */
+   u32 mdc0;   /* 0x38 Message Digest CO */
+   u32 mdd0;   /* 0x3C Message Digest DO */
+   u32 mde0;   /* 0x40 Message Digest EO */
+   u32 mdsz;   /* 0x44 Message Data Size */
+   u32 res[10];/* 0x48 - 0x6F */
+   u32 mda1;   /* 0x70 Message Digest A1 */
+   u32 mdb1;   /* 0x74 Message Digest B1 */
+   u32 mdc1;   /* 0x78 Message Digest C1 */
+   u32 mdd1;   /* 0x7C Message Digest D1 */
+   u32 mde1;   /* 0x80 Message Digest E1 */
+} mdha_t;
+
+#define MDHA_MR_SSL(0x0400)
+#define MDHA_MR_MACFUL (0x0200)
+#define MDHA_MR_SWAP   (0x0100)
+#define MDHA_MR_OPAD   (0x0080)
+#define MDHA_MR_IPAD   (0x0040)
+#define MDHA_MR_INIT   (0x0020)
+#define MDHA_MR_MAC(x) (((x)  0x03)  3)
+#define MDHA_MR_MAC_MASK   (0xFFE7)
+#define MDHA_MR_MAC_EHMAC  (0x0010)
+#define MDHA_MR_MAC_HMAC   (0x0008)
+#define MDHA_MR_MAC_NONE   (0x)
+#define MDHA_MR_PDATA  (0x0004)
+#define MDHA_MR_ALG(0x0001)
+
+#define MDHA_CR_DMAL(x)(((x)  0x1F)  16)/* 532x */
+#define MDHA_CR_DMAL_MASK  (0xFFE0)/* 532x */
+#define MDHA_CR_END(0x0004)/* 532x */
+#define MDHA_CR_DMA(0x0002)/* 532x */
+#define MDHA_CR_IE (0x0001)
+
+#define MDHA_CMD_GO(0x0008)
+#define MDHA_CMD_CI(0x0004)
+#define MDHA_CMD_RI(0x0001)
+#define MDHA_CMD_SWR   (0x0001)
+
+#define MDHA_SR_IFL(x) (((x)  0xFF)  16)
+#define MDHA_SR_IFL_MASK   (0xFF00)
+#define MDHA_SR_APD(x) (((x)  0x7)  13)
+#define MDHA_SR_APD_MASK   (0x1FFF)
+#define MDHA_SR_FS(x)  (((x)  0x7)  8)
+#define MDHA_SR_FS_MASK(0xF8FF)
+#define MDHA_SR_GNW(0x0080)
+#define 

[U-Boot] [PATCH 03/19] ColdFire: Modules header files cleanup - 2

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Consolidate FlexCan and PWM structures and
definitions in immap_5xxx.h and m5xxx.h to more
unify modules header files

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 include/asm-m68k/coldfire/flexcan.h |  219 +++
 include/asm-m68k/coldfire/pwm.h |  115 ++
 include/asm-m68k/immap_5227x.h  |8 ++
 include/asm-m68k/immap_5235.h   |   24 +---
 include/asm-m68k/immap_5253.h   |   11 ++-
 include/asm-m68k/immap_5272.h   |   18 +---
 include/asm-m68k/immap_5275.h   |   18 +---
 include/asm-m68k/immap_5282.h   |5 +
 include/asm-m68k/immap_5329.h   |   64 +-
 include/asm-m68k/immap_547x_8x.h|6 +
 include/asm-m68k/m5235.h|   93 ---
 include/asm-m68k/m5329.h|  142 --
 12 files changed, 375 insertions(+), 348 deletions(-)
 create mode 100644 include/asm-m68k/coldfire/flexcan.h
 create mode 100644 include/asm-m68k/coldfire/pwm.h

diff --git a/include/asm-m68k/coldfire/flexcan.h 
b/include/asm-m68k/coldfire/flexcan.h
new file mode 100644
index 000..cafd44f
--- /dev/null
+++ b/include/asm-m68k/coldfire/flexcan.h
@@ -0,0 +1,219 @@
+/*
+ * Flex CAN Memory Map
+ *
+ * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
+ * TsiChung Liew ([EMAIL PROTECTED])
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __FLEXCAN_H__
+#define __FLEXCAN_H__
+
+/* FlexCan Message Buffer */
+typedef struct can_msgbuf_ctrl {
+#ifdef CONFIG_M5282
+   u8 tmstamp; /* 0x00 Timestamp */
+   u8 ctrl;/* 0x01 Control */
+   u16 idh;/* 0x02 ID High */
+   u16 idl;/* 0x04 ID High */
+   u8 data[8]; /* 0x06 8 Byte Data Field */
+   u16 res;/* 0x0E */
+#else
+   u16 ctrl;   /* 0x00 Control/Status */
+   u16 tmstamp;/* 0x02 Timestamp */
+   u32 id; /* 0x04 Identifier */
+   u8 data[8]; /* 0x08 8 Byte Data Field */
+#endif
+} can_msg_t;
+
+#ifdef CONFIG_M5282
+/* MSGBUF CTRL */
+#define CAN_MSGBUF_CTRL_CODE(x)(((x)  0x0F)  4)
+#define CAN_MSGBUF_CTRL_CODE_MASK  (0x0F)
+#define CAN_MSGBUF_CTRL_LEN(x) ((x)  0x0F)
+#define CAN_MSGBUF_CTRL_LEN_MASK   (0xF0)
+
+/* MSGBUF ID */
+#define CAN_MSGBUF_IDH_STD(x)  (((x)  0x07FF)  5)
+#define CAN_MSGBUF_IDH_STD_MASK(0xE003)
+#define CAN_MSGBUF_IDH_SRR (0x0010)
+#define CAN_MSGBUF_IDH_IDE (0x0080)
+#define CAN_MSGBUF_IDH_EXTH(x) ((x)  0x07)
+#define CAN_MSGBUF_IDH_EXTH_MASK   (0xFFF8)
+#define CAN_MSGBUF_IDL_EXTL(x) (((x)  0x7FFF)  1)
+#define CAN_MSGBUF_IDL_EXTL_MASK   (0xFFFE)
+#define CAN_MSGBUF_IDL_RTR (0x0001)
+#else
+/* MSGBUF CTRL */
+#define CAN_MSGBUF_CTRL_CODE(x)(((x)  0x000F)  8)
+#define CAN_MSGBUF_CTRL_CODE_MASK  (0xF0FF)
+#define CAN_MSGBUF_CTRL_SRR(0x0040)
+#define CAN_MSGBUF_CTRL_IDE(0x0020)
+#define CAN_MSGBUF_CTRL_RTR(0x0010)
+#define CAN_MSGBUF_CTRL_LEN(x) ((x)  0x000F)
+#define CAN_MSGBUF_CTRL_LEN_MASK   (0xFFF0)
+
+/* MSGBUF ID */
+#define CAN_MSGBUF_ID_STD(x)   (((x)  0x07FF)  18)
+#define CAN_MSGBUF_ID_STD_MASK (0xE003)
+#define CAN_MSGBUF_ID_EXT(x)   ((x)  0x0003)
+#define CAN_MSGBUF_ID_EXT_MASK (0xFFFC)
+#endif
+
+/* FlexCan module */
+typedef struct can_ctrl {
+   u32 mcr;/* 0x00 Module Configuration */
+   u32 ctrl;   /* 0x04 Control */
+   u32 timer;  /* 0x08 Free Running Timer */
+   u32 res1;   /* 0x0C */
+   u32 rxgmsk; /* 0x10 Rx Global Mask */
+   u32 rx14msk;/* 0x14 RxBuffer 14 Mask */
+   u32 rx15msk;/* 0x18 RxBuffer 15 Mask */
+#ifdef CONFIG_M5282
+   u32 res2;   /* 0x1C */
+   u16 errstat;/* 0x20 Error and status */
+   u16 imsk;   /* 0x22 Interrupt Mask */
+   u16 iflag;  /* 0x24 Interrupt Flag */
+   u16 errcnt;

[U-Boot] [PATCH 05/19] ColdFire: Modules header files cleanup - 4

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Consolidate interrupt control structures and
definitions in immap_5xxx.h and m5xxx.h to more
unify module header file - 1

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 include/asm-m68k/coldfire/intctrl.h |  246 +++
 include/asm-m68k/immap_5227x.h  |   90 +-
 include/asm-m68k/immap_5235.h   |   70 +--
 include/asm-m68k/immap_5271.h   |   32 +-
 include/asm-m68k/immap_5275.h   |   33 +-
 include/asm-m68k/immap_5282.h   |   33 +-
 include/asm-m68k/immap_5329.h   |   77 +---
 include/asm-m68k/immap_5445x.h  |   90 +-
 include/asm-m68k/immap_547x_8x.h|   32 +-
 9 files changed, 254 insertions(+), 449 deletions(-)
 create mode 100644 include/asm-m68k/coldfire/intctrl.h

diff --git a/include/asm-m68k/coldfire/intctrl.h 
b/include/asm-m68k/coldfire/intctrl.h
new file mode 100644
index 000..ae82b29
--- /dev/null
+++ b/include/asm-m68k/coldfire/intctrl.h
@@ -0,0 +1,246 @@
+/*
+ * Interrupt Controller Memory Map
+ *
+ * Copyright (C) 2004-2008 Freescale Semiconductor, Inc.
+ * TsiChung Liew ([EMAIL PROTECTED])
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __INTCTRL_H__
+#define __INTCTRL_H__
+
+#if defined(CONFIG_M5235) || defined(CONFIG_M5271) || \
+defined(CONFIG_M5275) || defined(CONFIG_M5282) || \
+defined(CONFIG_M547x) || defined(CONFIG_M548x)
+#  define  CONFIG_SYS_CF_INTC_REG1
+#endif
+
+typedef struct int0_ctrl {
+   /* Interrupt Controller 0 */
+   u32 iprh0;  /* 0x00 Pending High */
+   u32 iprl0;  /* 0x04 Pending Low */
+   u32 imrh0;  /* 0x08 Mask High */
+   u32 imrl0;  /* 0x0C Mask Low */
+   u32 frch0;  /* 0x10 Force High */
+   u32 frcl0;  /* 0x14 Force Low */
+#if defined(CONFIG_SYS_CF_INTC_REG1)
+   u8 irlr;/* 0x18 */
+   u8 iacklpr; /* 0x19 */
+   u16 res1[19];   /* 0x1a - 0x3c */
+#else
+   u16 res1;   /* 0x18 - 0x19 */
+   u16 icfg0;  /* 0x1A Configuration */
+   u8 simr0;   /* 0x1C Set Interrupt Mask */
+   u8 cimr0;   /* 0x1D Clear Interrupt Mask */
+   u8 clmask0; /* 0x1E Current Level Mask */
+   u8 slmask;  /* 0x1F Saved Level Mask */
+   u32 res2[8];/* 0x20 - 0x3F */
+#endif
+   u8 icr0[64];/* 0x40 - 0x7F Control registers */
+   u32 res3[24];   /* 0x80 - 0xDF */
+   u8 swiack0; /* 0xE0 Software Interrupt ack */
+   u8 res4[3]; /* 0xE1 - 0xE3 */
+   u8 L1iack0; /* 0xE4 Level n interrupt ack */
+   u8 res5[3]; /* 0xE5 - 0xE7 */
+   u8 L2iack0; /* 0xE8 Level n interrupt ack */
+   u8 res6[3]; /* 0xE9 - 0xEB */
+   u8 L3iack0; /* 0xEC Level n interrupt ack */
+   u8 res7[3]; /* 0xED - 0xEF */
+   u8 L4iack0; /* 0xF0 Level n interrupt ack */
+   u8 res8[3]; /* 0xF1 - 0xF3 */
+   u8 L5iack0; /* 0xF4 Level n interrupt ack */
+   u8 res9[3]; /* 0xF5 - 0xF7 */
+   u8 L6iack0; /* 0xF8 Level n interrupt ack */
+   u8 resa[3]; /* 0xF9 - 0xFB */
+   u8 L7iack0; /* 0xFC Level n interrupt ack */
+   u8 resb[3]; /* 0xFD - 0xFF */
+} int0_t;
+
+typedef struct int1_ctrl {
+   /* Interrupt Controller 1 */
+   u32 iprh1;  /* 0x00 Pending High */
+   u32 iprl1;  /* 0x04 Pending Low */
+   u32 imrh1;  /* 0x08 Mask High */
+   u32 imrl1;  /* 0x0C Mask Low */
+   u32 frch1;  /* 0x10 Force High */
+   u32 frcl1;  /* 0x14 Force Low */
+#if defined(CONFIG_SYS_CF_INTC_REG1)
+   u8 irlr;/* 0x18 */
+   u8 iacklpr; /* 0x19 */
+   u16 res1[19];   /* 0x1a - 0x3c */
+#else
+   u16 res1;   /* 0x18 */
+   u16 icfg1;  /* 0x1A Configuration */
+   u8 simr1;  

[U-Boot] [PATCH 06/19] ColdFire: Modules header files cleanup - 5

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Consolidate interrupt control structures and
definitions in immap_5xxx.h and m5xxx.h to more
unify module header file - 2

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 include/asm-m68k/m5227x.h   |  233 +--
 include/asm-m68k/m5235.h|   79 ---
 include/asm-m68k/m5271.h|   38 +---
 include/asm-m68k/m5275.h|   46 -
 include/asm-m68k/m5329.h|   95 --
 include/asm-m68k/m5445x.h   |  229 --
 include/asm-m68k/m547x_8x.h |   68 -
 7 files changed, 2 insertions(+), 786 deletions(-)

diff --git a/include/asm-m68k/m5227x.h b/include/asm-m68k/m5227x.h
index afd31ba..61bc0ad 100644
--- a/include/asm-m68k/m5227x.h
+++ b/include/asm-m68k/m5227x.h
@@ -26,9 +26,7 @@
 #ifndef __MCF5227X__
 #define __MCF5227X__
 
-/*
-* Interrupt Controller (INTC)
-*/
+/* Interrupt Controller (INTC) */
 #define INT0_LO_RSVD0  (0)
 #define INT0_LO_EPORT1 (1)
 #define INT0_LO_EPORT4 (4)
@@ -98,235 +96,6 @@
 #define INT1_HI_TOUCH_ADC  (61)
 #define INT1_HI_PLL_LOCKS  (62)
 
-/* Bit definitions and macros for IPRH */
-#define INTC_IPRH_INT32(0x0001)
-#define INTC_IPRH_INT33(0x0002)
-#define INTC_IPRH_INT34(0x0004)
-#define INTC_IPRH_INT35(0x0008)
-#define INTC_IPRH_INT36(0x0010)
-#define INTC_IPRH_INT37(0x0020)
-#define INTC_IPRH_INT38(0x0040)
-#define INTC_IPRH_INT39(0x0080)
-#define INTC_IPRH_INT40(0x0100)
-#define INTC_IPRH_INT41(0x0200)
-#define INTC_IPRH_INT42(0x0400)
-#define INTC_IPRH_INT43(0x0800)
-#define INTC_IPRH_INT44(0x1000)
-#define INTC_IPRH_INT45(0x2000)
-#define INTC_IPRH_INT46(0x4000)
-#define INTC_IPRH_INT47(0x8000)
-#define INTC_IPRH_INT48(0x0001)
-#define INTC_IPRH_INT49(0x0002)
-#define INTC_IPRH_INT50(0x0004)
-#define INTC_IPRH_INT51(0x0008)
-#define INTC_IPRH_INT52(0x0010)
-#define INTC_IPRH_INT53(0x0020)
-#define INTC_IPRH_INT54(0x0040)
-#define INTC_IPRH_INT55(0x0080)
-#define INTC_IPRH_INT56(0x0100)
-#define INTC_IPRH_INT57(0x0200)
-#define INTC_IPRH_INT58(0x0400)
-#define INTC_IPRH_INT59(0x0800)
-#define INTC_IPRH_INT60(0x1000)
-#define INTC_IPRH_INT61(0x2000)
-#define INTC_IPRH_INT62(0x4000)
-#define INTC_IPRH_INT63(0x8000)
-
-/* Bit definitions and macros for IPRL */
-#define INTC_IPRL_INT0 (0x0001)
-#define INTC_IPRL_INT1 (0x0002)
-#define INTC_IPRL_INT2 (0x0004)
-#define INTC_IPRL_INT3 (0x0008)
-#define INTC_IPRL_INT4 (0x0010)
-#define INTC_IPRL_INT5 (0x0020)
-#define INTC_IPRL_INT6 (0x0040)
-#define INTC_IPRL_INT7 (0x0080)
-#define INTC_IPRL_INT8 (0x0100)
-#define INTC_IPRL_INT9 (0x0200)
-#define INTC_IPRL_INT10(0x0400)
-#define INTC_IPRL_INT11(0x0800)
-#define INTC_IPRL_INT12(0x1000)
-#define INTC_IPRL_INT13(0x2000)
-#define INTC_IPRL_INT14(0x4000)
-#define INTC_IPRL_INT15(0x8000)
-#define INTC_IPRL_INT16(0x0001)
-#define INTC_IPRL_INT17(0x0002)
-#define INTC_IPRL_INT18(0x0004)
-#define INTC_IPRL_INT19(0x0008)
-#define INTC_IPRL_INT20(0x0010)
-#define INTC_IPRL_INT21(0x0020)
-#define INTC_IPRL_INT22(0x0040)
-#define INTC_IPRL_INT23(0x0080)
-#define INTC_IPRL_INT24(0x0100)
-#define INTC_IPRL_INT25(0x0200)
-#define INTC_IPRL_INT26(0x0400)
-#define INTC_IPRL_INT27

[U-Boot] [PATCH 07/19] ColdFire: Modules header files cleanup - 6

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Consolidate FlexBus structures and definitions
in immap_5xxx.h and m5xxx.h to more unify modules
header files. Apply changes to mcf52x2's cpu_init.c

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 cpu/mcf52x2/cpu_init.c  |  271 ++
 include/asm-m68k/coldfire/flexbus.h |   96 -
 include/asm-m68k/immap_5235.h   |   52 +---
 include/asm-m68k/immap_5249.h   |2 +
 include/asm-m68k/immap_5253.h   |2 +
 include/asm-m68k/immap_5271.h   |1 +
 include/asm-m68k/immap_5275.h   |   46 +--
 include/asm-m68k/immap_5282.h   |   52 +---
 include/asm-m68k/m5235.h|   40 -
 include/asm-m68k/m5249.h|   13 --
 include/asm-m68k/m5282.h|   23 ---
 include/asm-m68k/m5329.h|   59 
 include/configs/EB+MCF-EV123.h  |   16 +--
 include/configs/M5235EVB.h  |   10 +-
 include/configs/M5249EVB.h  |   14 +-
 include/configs/M5253DEMO.h |   24 +--
 include/configs/M5253EVBE.h |   20 +--
 include/configs/M5275EVB.h  |   14 +-
 include/configs/M5282EVB.h  |   18 +--
 include/configs/TASREG.h|   14 +-
 20 files changed, 196 insertions(+), 591 deletions(-)

diff --git a/cpu/mcf52x2/cpu_init.c b/cpu/mcf52x2/cpu_init.c
index 7bb358e..32ad6cd 100644
--- a/cpu/mcf52x2/cpu_init.c
+++ b/cpu/mcf52x2/cpu_init.c
@@ -36,6 +36,65 @@
 #include watchdog.h
 #include asm/immap.h
 
+#ifndef CONFIG_M5272
+/* Only 5272 Flexbus chipselect is different from the rest */
+void init_fbcs(void)
+{
+   volatile fbcs_t *fbcs = (fbcs_t *) (MMAP_FBCS);
+
+#if (defined(CONFIG_SYS_CS0_BASE)  defined(CONFIG_SYS_CS0_MASK) \
+  defined(CONFIG_SYS_CS0_CTRL))
+   fbcs-csar0 = CONFIG_SYS_CS0_BASE;
+   fbcs-cscr0 = CONFIG_SYS_CS0_CTRL;
+   fbcs-csmr0 = CONFIG_SYS_CS0_MASK;
+#else
+#warning Chip Select 0 are not initialized/used
+#endif
+#if (defined(CONFIG_SYS_CS1_BASE)  defined(CONFIG_SYS_CS1_MASK) \
+  defined(CONFIG_SYS_CS1_CTRL))
+   fbcs-csar1 = CONFIG_SYS_CS1_BASE;
+   fbcs-cscr1 = CONFIG_SYS_CS1_CTRL;
+   fbcs-csmr1 = CONFIG_SYS_CS1_MASK;
+#endif
+#if (defined(CONFIG_SYS_CS2_BASE)  defined(CONFIG_SYS_CS2_MASK) \
+  defined(CONFIG_SYS_CS2_CTRL))
+   fbcs-csar2 = CONFIG_SYS_CS2_BASE;
+   fbcs-cscr2 = CONFIG_SYS_CS2_CTRL;
+   fbcs-csmr2 = CONFIG_SYS_CS2_MASK;
+#endif
+#if (defined(CONFIG_SYS_CS3_BASE)  defined(CONFIG_SYS_CS3_MASK) \
+  defined(CONFIG_SYS_CS3_CTRL))
+   fbcs-csar3 = CONFIG_SYS_CS3_BASE;
+   fbcs-cscr3 = CONFIG_SYS_CS3_CTRL;
+   fbcs-csmr3 = CONFIG_SYS_CS3_MASK;
+#endif
+#if (defined(CONFIG_SYS_CS4_BASE)  defined(CONFIG_SYS_CS4_MASK) \
+  defined(CONFIG_SYS_CS4_CTRL))
+   fbcs-csar4 = CONFIG_SYS_CS4_BASE;
+   fbcs-cscr4 = CONFIG_SYS_CS4_CTRL;
+   fbcs-csmr4 = CONFIG_SYS_CS4_MASK;
+#endif
+#if (defined(CONFIG_SYS_CS5_BASE)  defined(CONFIG_SYS_CS5_MASK) \
+  defined(CONFIG_SYS_CS5_CTRL))
+   fbcs-csar5 = CONFIG_SYS_CS5_BASE;
+   fbcs-cscr5 = CONFIG_SYS_CS5_CTRL;
+   fbcs-csmr5 = CONFIG_SYS_CS5_MASK;
+#endif
+#if (defined(CONFIG_SYS_CS6_BASE)  defined(CONFIG_SYS_CS6_MASK) \
+  defined(CONFIG_SYS_CS6_CTRL))
+   fbcs-csar6 = CONFIG_SYS_CS6_BASE;
+   fbcs-cscr6 = CONFIG_SYS_CS6_CTRL;
+   fbcs-csmr6 = CONFIG_SYS_CS6_MASK;
+#endif
+#if (defined(CONFIG_SYS_CS7_BASE)  defined(CONFIG_SYS_CS7_MASK) \
+  defined(CONFIG_SYS_CS7_CTRL))
+   fbcs-csar7 = CONFIG_SYS_CS7_BASE;
+   fbcs-cscr7 = CONFIG_SYS_CS7_CTRL;
+   fbcs-csmr7 = CONFIG_SYS_CS7_MASK;
+#endif
+}
+#endif
+
 #if defined(CONFIG_M5253)
 /*
  * Breath some life into the CPU...
@@ -66,22 +125,14 @@ void cpu_init_f(void)
mbar2_writeByte(MCFSIM_INTBASE, 0x40);  /* Base interrupts at 64 */
mbar2_writeByte(MCFSIM_SPURVEC, 0x00);
 
-   /*mbar2_writeLong(MCFSIM_IDECONFIG1, 0x0020); */ /* Enable a 1 
cycle pre-drive cycle on CS1 */
-
-   /*
-*  Setup chip selects...
-*/
-
-   mbar_writeShort(MCFSIM_CSAR1, CONFIG_SYS_CSAR1);
-   mbar_writeShort(MCFSIM_CSCR1, CONFIG_SYS_CSCR1);
-   mbar_writeLong(MCFSIM_CSMR1, CONFIG_SYS_CSMR1);
+   /*mbar2_writeLong(MCFSIM_IDECONFIG1, 0x0020); *//* Enable a 1 cycle 
pre-drive cycle on CS1 */
 
-   mbar_writeShort(MCFSIM_CSAR0, CONFIG_SYS_CSAR0);
-   mbar_writeShort(MCFSIM_CSCR0, CONFIG_SYS_CSCR0);
-   mbar_writeLong(MCFSIM_CSMR0, CONFIG_SYS_CSMR0);
+   /* FlexBus Chipselect */
+   init_fbcs();
 
 #ifdef CONFIG_FSL_I2C
-   CONFIG_SYS_I2C_PINMUX_REG = CONFIG_SYS_I2C_PINMUX_REG  
CONFIG_SYS_I2C_PINMUX_CLR;
+   CONFIG_SYS_I2C_PINMUX_REG =
+   CONFIG_SYS_I2C_PINMUX_REG  CONFIG_SYS_I2C_PINMUX_CLR;
CONFIG_SYS_I2C_PINMUX_REG |= CONFIG_SYS_I2C_PINMUX_SET;
 #ifdef CONFIG_SYS_I2C2_OFFSET
CONFIG_SYS_I2C2_PINMUX_REG = CONFIG_SYS_I2C2_PINMUX_CLR;
@@ -121,6 +172,9 @@ void cpu_init_f(void)

[U-Boot] [PATCH 08/19] ColdFire: Remove platforms mii.c file - 1

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Will use mcfmii.c driver in drivers/net rather than
keep creating new mii.c for each future platform.
Remove EB+MCF-EV123, cobra5272, idmr and M5235EVB's mii.c

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 board/BuS/EB+MCF-EV123/Makefile   |2 +-
 board/BuS/EB+MCF-EV123/mii.c  |  304 
 board/cobra5272/Makefile  |2 +-
 board/cobra5272/mii.c |  303 
 board/freescale/m5235evb/Makefile |2 +-
 board/freescale/m5235evb/mii.c|  307 -
 board/idmr/Makefile   |2 +-
 board/idmr/mii.c  |  303 
 8 files changed, 4 insertions(+), 1221 deletions(-)
 delete mode 100644 board/BuS/EB+MCF-EV123/mii.c
 delete mode 100644 board/cobra5272/mii.c
 delete mode 100644 board/freescale/m5235evb/mii.c
 delete mode 100644 board/idmr/mii.c

diff --git a/board/BuS/EB+MCF-EV123/Makefile b/board/BuS/EB+MCF-EV123/Makefile
index ceeffa7..ed3ac07 100644
--- a/board/BuS/EB+MCF-EV123/Makefile
+++ b/board/BuS/EB+MCF-EV123/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).a
 
-COBJS  = $(BOARD).o cfm_flash.o flash.o VCxK.o mii.o
+COBJS  = $(BOARD).o cfm_flash.o flash.o VCxK.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/BuS/EB+MCF-EV123/mii.c b/board/BuS/EB+MCF-EV123/mii.c
deleted file mode 100644
index 7f92514..000
--- a/board/BuS/EB+MCF-EV123/mii.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
- * TsiChung Liew ([EMAIL PROTECTED])
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include common.h
-#include asm/fec.h
-#include asm/immap.h
-
-#include config.h
-#include net.h
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if defined(CONFIG_CMD_NET)  defined(CONFIG_NET_MULTI)
-#undef MII_DEBUG
-#undef ET_DEBUG
-
-int fecpin_setclear(struct eth_device *dev, int setclear)
-{
-   if (setclear) {
-   MCFGPIO_PASPAR |= 0x0F00;
-   MCFGPIO_PEHLPAR = CONFIG_SYS_PEHLPAR;
-   } else {
-   MCFGPIO_PASPAR = 0xF0FF;
-   MCFGPIO_PEHLPAR = ~CONFIG_SYS_PEHLPAR;
-   }
-   return 0;
-}
-
-#if defined(CONFIG_SYS_DISCOVER_PHY) || defined(CONFIG_CMD_MII)
-#include miiphy.h
-
-/* Make MII read/write commands for the FEC. */
-#define mk_mii_read(ADDR, REG) (0x6002 | ((ADDR  23) | (REG  0x1f)  
18))
-
-#define mk_mii_write(ADDR, REG, VAL)   (0x5002 | ((ADDR  23) | (REG  
0x1f)  18) | (VAL  0x))
-
-/* PHY identification */
-#define PHY_ID_LXT970  0x7810  /* LXT970 */
-#define PHY_ID_LXT971  0x001378e0  /* LXT971 and 972 */
-#define PHY_ID_82555   0x02a80150  /* Intel 82555 */
-#define PHY_ID_QS6612  0x01814400  /* QS6612 */
-#define PHY_ID_AMD79C784   0x00225610  /* AMD 79C784 */
-#define PHY_ID_AMD79C874VC 0x0022561B  /* AMD 79C874 */
-#define PHY_ID_LSI802250x0016f870  /* LSI 80225 */
-#define PHY_ID_LSI80225B   0x0016f880  /* LSI 80225/B */
-#define PHY_ID_DP83848VV   0x20005C90  /* National 83848 */
-#define PHY_ID_DP83849 0x20005CA2  /* National 82849 */
-
-#define STR_ID_LXT970  LXT970
-#define STR_ID_LXT971  LXT971
-#define STR_ID_82555   Intel82555
-#define STR_ID_QS6612  QS6612
-#define STR_ID_AMD79C784   AMD79C784
-#define STR_ID_AMD79C874VC AMD79C874VC
-#define STR_ID_LSI80225LSI80225
-#define STR_ID_LSI80225B   LSI80225/B
-#define STR_ID_DP83848VV   N83848
-#define STR_ID_DP83849 N83849
-
-/
- * mii_init -- Initialize the MII for MII command without ethernet
- * This function is a subset of eth_init
- 
- */
-void mii_reset(struct fec_info_s *info)
-{
-   volatile fec_t *fecp = (fec_t *) (info-miibase);
-   int i;
-
-   fecp-ecr = FEC_ECR_RESET;
-   for (i = 0; (fecp-ecr  FEC_ECR_RESET)  (i  

[U-Boot] [PATCH 09/19] ColdFire: Remove platforms mii.c file - 2

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Will use mcfmii.c driver in drivers/net rather than
keep creating new mii.c for each future platform.
Remove M5271EVB, M5272C3, M5275EVB and M5282EVB's mii.c

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 board/freescale/m5271evb/Makefile |2 +-
 board/freescale/m5271evb/mii.c|  303 ---
 board/freescale/m5272c3/Makefile  |2 +-
 board/freescale/m5272c3/mii.c |  303 ---
 board/freescale/m5275evb/Makefile |2 +-
 board/freescale/m5275evb/mii.c|  319 -
 board/freescale/m5282evb/Makefile |2 +-
 board/freescale/m5282evb/mii.c|  304 ---
 8 files changed, 4 insertions(+), 1233 deletions(-)
 delete mode 100644 board/freescale/m5271evb/mii.c
 delete mode 100644 board/freescale/m5272c3/mii.c
 delete mode 100644 board/freescale/m5275evb/mii.c
 delete mode 100644 board/freescale/m5282evb/mii.c

diff --git a/board/freescale/m5271evb/Makefile 
b/board/freescale/m5271evb/Makefile
index 2ec71ee..424ab1c 100644
--- a/board/freescale/m5271evb/Makefile
+++ b/board/freescale/m5271evb/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).a
 
-COBJS  = $(BOARD).o mii.o
+COBJS  = $(BOARD).o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/freescale/m5271evb/mii.c b/board/freescale/m5271evb/mii.c
deleted file mode 100644
index e79fa19..000
--- a/board/freescale/m5271evb/mii.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
- * TsiChung Liew ([EMAIL PROTECTED])
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include common.h
-#include asm/fec.h
-#include asm/immap.h
-
-#include config.h
-#include net.h
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if defined(CONFIG_CMD_NET)  defined(CONFIG_NET_MULTI)
-#undef MII_DEBUG
-#undef ET_DEBUG
-
-int fecpin_setclear(struct eth_device *dev, int setclear)
-{
-   if (setclear) {
-   /* Enable Ethernet pins */
-   mbar_writeByte(MCF_GPIO_PAR_FECI2C, CONFIG_SYS_FECI2C);
-   } else {
-   }
-
-   return 0;
-}
-
-#if defined(CONFIG_SYS_DISCOVER_PHY) || defined(CONFIG_CMD_MII)
-#include miiphy.h
-
-/* Make MII read/write commands for the FEC. */
-#define mk_mii_read(ADDR, REG) (0x6002 | ((ADDR  23) | (REG  0x1f)  
18))
-
-#define mk_mii_write(ADDR, REG, VAL)   (0x5002 | ((ADDR  23) | (REG  
0x1f)  18) | (VAL  0x))
-
-/* PHY identification */
-#define PHY_ID_LXT970  0x7810  /* LXT970 */
-#define PHY_ID_LXT971  0x001378e0  /* LXT971 and 972 */
-#define PHY_ID_82555   0x02a80150  /* Intel 82555 */
-#define PHY_ID_QS6612  0x01814400  /* QS6612 */
-#define PHY_ID_AMD79C784   0x00225610  /* AMD 79C784 */
-#define PHY_ID_LSI802250x0016f870  /* LSI 80225 */
-#define PHY_ID_LSI80225B   0x0016f880  /* LSI 80225/B */
-#define PHY_ID_DP83848VV   0x20005C90  /* National 83848 */
-#define PHY_ID_DP83849 0x20005CA2  /* National 82849 */
-#define PHY_ID_KS8721BL0x00221619  /* Micrel KS8721BL/SL */
-
-#define STR_ID_LXT970  LXT970
-#define STR_ID_LXT971  LXT971
-#define STR_ID_82555   Intel82555
-#define STR_ID_QS6612  QS6612
-#define STR_ID_AMD79C784   AMD79C784
-#define STR_ID_LSI80225LSI80225
-#define STR_ID_LSI80225B   LSI80225/B
-#define STR_ID_DP83848VV   N83848
-#define STR_ID_DP83849 N83849
-#define STR_ID_KS8721BLKS8721BL
-
-/
- * mii_init -- Initialize the MII for MII command without ethernet
- * This function is a subset of eth_init
- 
- */
-void mii_reset(struct fec_info_s *info)
-{
-   volatile fec_t *fecp = (fec_t *) (info-miibase);
-   int i;
-
-   fecp-ecr = FEC_ECR_RESET;
-   for (i = 0; (fecp-ecr  FEC_ECR_RESET)  (i  FEC_RESET_DELAY); ++i) {
-   udelay(1);
-   }
-   if (i == 

[U-Boot] [PATCH 10/19] ColdFire: Remove platforms mii.c file - 3

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Will use mcfmii.c driver in drivers/net rather than
keep creating new mii.c for each future platform.
Remove M5329EVB, M5373EVB, M54451EVB  M54455EVB's mii.c

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 board/freescale/m5329evb/Makefile  |2 +-
 board/freescale/m5329evb/mii.c |  306 --
 board/freescale/m5373evb/Makefile  |2 +-
 board/freescale/m5373evb/mii.c |  306 --
 board/freescale/m54451evb/Makefile |2 +-
 board/freescale/m54451evb/mii.c|  303 -
 board/freescale/m54455evb/Makefile |2 +-
 board/freescale/m54455evb/mii.c|  324 
 8 files changed, 4 insertions(+), 1243 deletions(-)
 delete mode 100644 board/freescale/m5329evb/mii.c
 delete mode 100644 board/freescale/m5373evb/mii.c
 delete mode 100644 board/freescale/m54451evb/mii.c
 delete mode 100644 board/freescale/m54455evb/mii.c

diff --git a/board/freescale/m5329evb/Makefile 
b/board/freescale/m5329evb/Makefile
index ab0f11e..07b693c 100644
--- a/board/freescale/m5329evb/Makefile
+++ b/board/freescale/m5329evb/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).a
 
-COBJS  = $(BOARD).o mii.o nand.o
+COBJS  = $(BOARD).o nand.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/freescale/m5329evb/mii.c b/board/freescale/m5329evb/mii.c
deleted file mode 100644
index c0f5817..000
--- a/board/freescale/m5329evb/mii.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
- * TsiChung Liew ([EMAIL PROTECTED])
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include common.h
-#include asm/fec.h
-#include asm/immap.h
-
-#include config.h
-#include net.h
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if defined(CONFIG_CMD_NET)  defined(CONFIG_NET_MULTI)
-#undef MII_DEBUG
-#undef ET_DEBUG
-
-int fecpin_setclear(struct eth_device *dev, int setclear)
-{
-   volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
-
-   if (setclear) {
-   gpio-par_fec |= GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC;
-   gpio-par_feci2c |=
-   GPIO_PAR_FECI2C_MDC_EMDC | GPIO_PAR_FECI2C_MDIO_EMDIO;
-   } else {
-   gpio-par_fec = ~(GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC);
-   gpio-par_feci2c =
-   ~(GPIO_PAR_FECI2C_MDC_EMDC | GPIO_PAR_FECI2C_MDIO_EMDIO);
-   }
-   return 0;
-}
-
-#if defined(CONFIG_SYS_DISCOVER_PHY) || defined(CONFIG_CMD_MII)
-#include miiphy.h
-
-/* Make MII read/write commands for the FEC. */
-#define mk_mii_read(ADDR, REG) (0x6002 | ((ADDR  23) | (REG  0x1f)  
18))
-
-#define mk_mii_write(ADDR, REG, VAL)   (0x5002 | ((ADDR  23) | (REG  
0x1f)  18) | (VAL  0x))
-
-/* PHY identification */
-#define PHY_ID_LXT970  0x7810  /* LXT970 */
-#define PHY_ID_LXT971  0x001378e0  /* LXT971 and 972 */
-#define PHY_ID_82555   0x02a80150  /* Intel 82555 */
-#define PHY_ID_QS6612  0x01814400  /* QS6612 */
-#define PHY_ID_AMD79C784   0x00225610  /* AMD 79C784 */
-#define PHY_ID_LSI802250x0016f870  /* LSI 80225 */
-#define PHY_ID_LSI80225B   0x0016f880  /* LSI 80225/B */
-#define PHY_ID_DP83848VV   0x20005C90  /* National 83848 */
-#define PHY_ID_DP83849 0x20005CA2  /* National 82849 */
-
-#define STR_ID_LXT970  LXT970
-#define STR_ID_LXT971  LXT971
-#define STR_ID_82555   Intel82555
-#define STR_ID_QS6612  QS6612
-#define STR_ID_AMD79C784   AMD79C784
-#define STR_ID_LSI80225LSI80225
-#define STR_ID_LSI80225B   LSI80225/B
-#define STR_ID_DP83848VV   N83848
-#define STR_ID_DP83849 N83849
-
-/
- * mii_init -- Initialize the MII for MII command without ethernet
- * This function is a subset of eth_init
- 
- */
-void mii_reset(struct fec_info_s *info)
-{
-   volatile fec_t *fecp = 

[U-Boot] [PATCH 12/19] ColdFire: Relocate FEC's GPIO and mii functions protocols

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Place FEC pin assignments in cpu_init.c from platform's
mii.c

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 cpu/mcf523x/cpu_init.c  |   24 +++-
 cpu/mcf52x2/cpu_init.c  |   78 +++
 cpu/mcf532x/cpu_init.c  |   25 -
 cpu/mcf5445x/cpu_init.c |   34 -
 cpu/mcf547x_8x/cpu_init.c   |   27 +
 include/asm-m68k/fec.h  |   12 ++
 include/asm-m68k/fsl_mcdmafec.h |9 
 7 files changed, 197 insertions(+), 12 deletions(-)

diff --git a/cpu/mcf523x/cpu_init.c b/cpu/mcf523x/cpu_init.c
index 6520944..3c04fd4 100644
--- a/cpu/mcf523x/cpu_init.c
+++ b/cpu/mcf523x/cpu_init.c
@@ -27,9 +27,14 @@
 
 #include common.h
 #include watchdog.h
-
 #include asm/immap.h
 
+#if defined(CONFIG_CMD_NET)
+#include config.h
+#include net.h
+#include asm/fec.h
+#endif
+
 /*
  * Breath some life into the CPU...
  *
@@ -143,3 +148,20 @@ void uart_port_conf(void)
break;
}
 }
+
+#if defined(CONFIG_CMD_NET)
+int fecpin_setclear(struct eth_device *dev, int setclear)
+{
+   volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
+
+   if (setclear) {
+   gpio-par_feci2c |=
+   (GPIO_PAR_FECI2C_EMDC_FECEMDC | 
GPIO_PAR_FECI2C_EMDIO_FECEMDIO);
+   } else {
+   gpio-par_feci2c =
+   ~(GPIO_PAR_FECI2C_EMDC_MASK | GPIO_PAR_FECI2C_EMDIO_MASK);
+   }
+
+   return 0;
+}
+#endif
diff --git a/cpu/mcf52x2/cpu_init.c b/cpu/mcf52x2/cpu_init.c
index 32ad6cd..18308c8 100644
--- a/cpu/mcf52x2/cpu_init.c
+++ b/cpu/mcf52x2/cpu_init.c
@@ -36,6 +36,12 @@
 #include watchdog.h
 #include asm/immap.h
 
+#if defined(CONFIG_CMD_NET)
+#include config.h
+#include net.h
+#include asm/fec.h
+#endif
+
 #ifndef CONFIG_M5272
 /* Only 5272 Flexbus chipselect is different from the rest */
 void init_fbcs(void)
@@ -207,6 +213,19 @@ void uart_port_conf(void)
break;
}
 }
+
+#if defined(CONFIG_CMD_NET)
+int fecpin_setclear(struct eth_device *dev, int setclear)
+{
+   if (setclear) {
+   /* Enable Ethernet pins */
+   mbar_writeByte(MCF_GPIO_PAR_FECI2C, CONFIG_SYS_FECI2C);
+   } else {
+   }
+
+   return 0;
+}
+#endif /* CONFIG_CMD_NET */
 #endif
 
 #if defined(CONFIG_M5272)
@@ -309,6 +328,22 @@ void uart_port_conf(void)
break;
}
 }
+
+#if defined(CONFIG_CMD_NET)
+int fecpin_setclear(struct eth_device *dev, int setclear)
+{
+   volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
+
+   if (setclear) {
+   gpio-gpio_pbcnt |= GPIO_PBCNT_E_MDC | GPIO_PBCNT_E_RXER |
+   GPIO_PBCNT_E_RXD1 | GPIO_PBCNT_E_RXD2 |
+   GPIO_PBCNT_E_RXD3 | GPIO_PBCNT_E_TXD1 |
+   GPIO_PBCNT_E_TXD2 | GPIO_PBCNT_E_TXD3;
+   } else {
+   }
+   return 0;
+}
+#endif /* CONFIG_CMD_NET */
 #endif /* #if defined(CONFIG_M5272) */
 
 #if defined(CONFIG_M5275)
@@ -372,6 +407,35 @@ void uart_port_conf(void)
break;
}
 }
+
+#if defined(CONFIG_CMD_NET)
+int fecpin_setclear(struct eth_device *dev, int setclear)
+{
+   struct fec_info_s *info = (struct fec_info_s *) dev-priv;
+   volatile gpio_t *gpio = (gpio_t *)MMAP_GPIO;
+
+   if (setclear) {
+   /* Enable Ethernet pins */
+   if (info-iobase == CONFIG_SYS_FEC0_IOBASE) {
+   gpio-par_feci2c |= 0x0F00;
+   gpio-par_fec0hl |= 0xC0;
+   } else {
+   gpio-par_feci2c |= 0x00A0;
+   gpio-par_fec1hl |= 0xC0;
+   }
+   } else {
+   if (info-iobase == CONFIG_SYS_FEC0_IOBASE) {
+   gpio-par_feci2c = ~0x0F00;
+   gpio-par_fec0hl = ~0xC0;
+   } else {
+   gpio-par_feci2c = ~0x00A0;
+   gpio-par_fec1hl = ~0xC0;
+   }
+   }
+
+   return 0;
+}
+#endif /* CONFIG_CMD_NET */
 #endif /* #if defined(CONFIG_M5275) */
 
 #if defined(CONFIG_M5282)
@@ -469,6 +533,20 @@ void uart_port_conf(void)
break;
}
 }
+
+#if defined(CONFIG_CMD_NET)
+int fecpin_setclear(struct eth_device *dev, int setclear)
+{
+   if (setclear) {
+   MCFGPIO_PASPAR |= 0x0F00;
+   MCFGPIO_PEHLPAR = CONFIG_SYS_PEHLPAR;
+   } else {
+   MCFGPIO_PASPAR = 0xF0FF;
+   MCFGPIO_PEHLPAR = ~CONFIG_SYS_PEHLPAR;
+   }
+   return 0;
+}
+#endif /* CONFIG_CMD_NET */
 #endif
 
 #if defined(CONFIG_M5249)
diff --git a/cpu/mcf532x/cpu_init.c b/cpu/mcf532x/cpu_init.c
index d348e29..39be11f 100644
--- a/cpu/mcf532x/cpu_init.c
+++ b/cpu/mcf532x/cpu_init.c
@@ -27,9 +27,14 @@

[U-Boot] [PATCH 13/19] ColdFire: Add mii driver in drivers/net

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

All CF platforms' mii.c are consolidated into one

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 drivers/net/Makefile |4 +-
 drivers/net/mcffec.c |   18 +---
 drivers/net/mcfmii.c |  321 ++
 3 files changed, 326 insertions(+), 17 deletions(-)
 create mode 100644 drivers/net/mcfmii.c

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 439c354..7e53136 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -35,13 +35,13 @@ COBJS-$(CONFIG_DRIVER_DM9000) += dm9000x.o
 COBJS-$(CONFIG_E1000) += e1000.o
 COBJS-$(CONFIG_EEPRO100) += eepro100.o
 COBJS-$(CONFIG_ENC28J60) += enc28j60.o
-COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o
+COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o
 COBJS-$(CONFIG_GRETH) += greth.o
 COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
 COBJS-$(CONFIG_DRIVER_KS8695ETH) += ks8695eth.o
 COBJS-$(CONFIG_DRIVER_LAN91C96) += lan91c96.o
 COBJS-$(CONFIG_MACB) += macb.o
-COBJS-$(CONFIG_MCFFEC) += mcffec.o
+COBJS-$(CONFIG_MCFFEC) += mcffec.o mcfmii.o
 COBJS-$(CONFIG_MPC5xxx_FEC) += mpc5xxx_fec.o
 COBJS-$(CONFIG_MPC512x_FEC) += mpc512x_fec.o
 COBJS-$(CONFIG_NATSEMI) += natsemi.o
diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index c00474e..18240a8 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -27,14 +27,14 @@
 #include common.h
 #include malloc.h
 
-#include asm/fec.h
-#include asm/immap.h
-
 #include command.h
 #include net.h
 #include netdev.h
 #include miiphy.h
 
+#include asm/fec.h
+#include asm/immap.h
+
 #undef ET_DEBUG
 #undef MII_DEBUG
 
@@ -101,18 +101,6 @@ int fec_init(struct eth_device *dev, bd_t * bd);
 void fec_halt(struct eth_device *dev);
 void fec_reset(struct eth_device *dev);
 
-extern int fecpin_setclear(struct eth_device *dev, int setclear);
-
-#ifdef CONFIG_SYS_DISCOVER_PHY
-extern void __mii_init(void);
-extern uint mii_send(uint mii_cmd);
-extern int mii_discover_phy(struct eth_device *dev);
-extern int mcffec_miiphy_read(char *devname, unsigned char addr,
- unsigned char reg, unsigned short *value);
-extern int mcffec_miiphy_write(char *devname, unsigned char addr,
-  unsigned char reg, unsigned short value);
-#endif
-
 void setFecDuplexSpeed(volatile fec_t * fecp, bd_t * bd, int dup_spd)
 {
if ((dup_spd  16) == FULL) {
diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c
new file mode 100644
index 000..2b733c6
--- /dev/null
+++ b/drivers/net/mcfmii.c
@@ -0,0 +1,321 @@
+/*
+ * Copyright (C) 2004-2008 Freescale Semiconductor, Inc.
+ * TsiChung Liew ([EMAIL PROTECTED])
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include config.h
+#include net.h
+#include netdev.h
+
+#ifdef CONFIG_MCF547x_8x
+#include asm/fsl_mcdmafec.h
+#else
+#include asm/fec.h
+#endif
+#include asm/immap.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if defined(CONFIG_CMD_NET)  defined(CONFIG_NET_MULTI)
+#undef MII_DEBUG
+#undef ET_DEBUG
+
+/*extern int fecpin_setclear(struct eth_device *dev, int setclear);*/
+
+#if defined(CONFIG_SYS_DISCOVER_PHY) || defined(CONFIG_CMD_MII)
+#include miiphy.h
+
+/* Make MII read/write commands for the FEC. */
+#define mk_mii_read(ADDR, REG) (0x6002 | ((ADDR  23) | \
+(REG  0x1f)  18))
+#define mk_mii_write(ADDR, REG, VAL)   (0x5002 | ((ADDR  23) | \
+(REG  0x1f)  18) | (VAL  0x))
+
+#ifndef CONFIG_SYS_UNSPEC_PHYID
+#  define CONFIG_SYS_UNSPEC_PHYID  0
+#endif
+#ifndef CONFIG_SYS_UNSPEC_STRID
+#  define CONFIG_SYS_UNSPEC_STRID  0
+#endif
+
+#ifdef CONFIG_MCF547x_8x
+typedef struct fec_info_dma FEC_INFO_T;
+#define FEC_T fecdma_t
+#else
+typedef struct fec_info_s FEC_INFO_T;
+#define FEC_T fec_t
+#endif
+
+typedef struct phy_info_struct {
+   u32 phyid;
+   char *strid;
+} phy_info_t;
+
+phy_info_t phyinfo[] = {
+   {0x0022561B, AMD79C784VC},/* AMD 79C784VC */
+   {0x00406322, BCM5222},/* Broadcom 5222 */
+   {0x02a80150, Intel82555}, /* Intel 82555 */
+   {0x0016f870, LSI80225},   /* LSI 80225 */
+   {0x0016f880, 

[U-Boot] [PATCH 14/19] ColdFire: Use CFI driver for M5272C3

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 board/freescale/m5272c3/Makefile |2 +-
 board/freescale/m5272c3/flash.c  |  378 --
 include/configs/M5272C3.h|   14 +-
 3 files changed, 11 insertions(+), 383 deletions(-)
 delete mode 100644 board/freescale/m5272c3/flash.c

diff --git a/board/freescale/m5272c3/Makefile b/board/freescale/m5272c3/Makefile
index cf07cf4..424ab1c 100644
--- a/board/freescale/m5272c3/Makefile
+++ b/board/freescale/m5272c3/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).a
 
-COBJS  = $(BOARD).o flash.o
+COBJS  = $(BOARD).o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/freescale/m5272c3/flash.c b/board/freescale/m5272c3/flash.c
deleted file mode 100644
index 586a2cf..000
--- a/board/freescale/m5272c3/flash.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * (C) Copyright 2000-2003
- * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include common.h
-
-#define PHYS_FLASH_1 CONFIG_SYS_FLASH_BASE
-#define FLASH_BANK_SIZE 0x20
-
-flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
-
-void flash_print_info (flash_info_t * info)
-{
-   int i;
-
-   switch (info-flash_id  FLASH_VENDMASK) {
-   case (AMD_MANUFACT  FLASH_VENDMASK):
-   printf (AMD: );
-   break;
-   default:
-   printf (Unknown Vendor );
-   break;
-   }
-
-   switch (info-flash_id  FLASH_TYPEMASK) {
-   case (AMD_ID_PL160CB  FLASH_TYPEMASK):
-   printf (AM29PL160CB (16Mbit)\n);
-   break;
-   default:
-   printf (Unknown Chip Type\n);
-   goto Done;
-   break;
-   }
-
-   printf (  Size: %ld MB in %d Sectors\n,
-   info-size  20, info-sector_count);
-
-   printf (  Sector Start Addresses:);
-   for (i = 0; i  info-sector_count; i++) {
-   if ((i % 5) == 0) {
-   printf (\n   );
-   }
-   printf ( %08lX%s, info-start[i],
-   info-protect[i] ?  (RO) :  );
-   }
-   printf (\n);
-
-  Done:
-   return;
-}
-
-
-unsigned long flash_init (void)
-{
-   int i, j;
-   ulong size = 0;
-
-   for (i = 0; i  CONFIG_SYS_MAX_FLASH_BANKS; i++) {
-   ulong flashbase = 0;
-
-   flash_info[i].flash_id =
-   (AMD_MANUFACT  FLASH_VENDMASK) |
-   (AMD_ID_PL160CB  FLASH_TYPEMASK);
-   flash_info[i].size = FLASH_BANK_SIZE;
-   flash_info[i].sector_count = CONFIG_SYS_MAX_FLASH_SECT;
-   memset (flash_info[i].protect, 0, CONFIG_SYS_MAX_FLASH_SECT);
-   if (i == 0)
-   flashbase = PHYS_FLASH_1;
-   else
-   panic (configured to many flash banks!\n);
-
-   for (j = 0; j  flash_info[i].sector_count; j++) {
-   if (j == 0) {
-   /* 1st is 16 KiB */
-   flash_info[i].start[j] = flashbase;
-   }
-   if ((j = 1)  (j = 2)) {
-   /* 2nd and 3rd are 8 KiB */
-   flash_info[i].start[j] =
-   flashbase + 0x4000 + 0x2000 * (j - 1);
-   }
-   if (j == 3) {
-   /* 4th is 224 KiB */
-   flash_info[i].start[j] = flashbase + 0x8000;
-   }
-   if ((j = 4)  (j = 10)) {
-   /* rest is 256 KiB */
-   flash_info[i].start[j] =
-   flashbase + 0x4 + 0x4 * (j -
-4);
-   }
-   }
-   size += flash_info[i].size;
-   }
-
-   flash_protect (FLAG_PROTECT_SET,
-  

[U-Boot] [PATCH 15/19] ColdFire: Add SBF support for M52277EVB

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Add serial boot support

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 Makefile  |   22 +++-
 board/freescale/m52277evb/config.mk   |4 +-
 board/freescale/m52277evb/m52277evb.c |   26 +++-
 board/freescale/m52277evb/u-boot.lds  |  144 --
 board/freescale/m52277evb/u-boot.spa  |  144 ++
 board/freescale/m52277evb/u-boot.stm  |  136 +
 cpu/mcf5227x/Makefile |2 +-
 cpu/mcf5227x/cpu_init.c   |   20 ++-
 cpu/mcf5227x/dspi.c   |  261 +
 cpu/mcf5227x/speed.c  |   30 +++-
 cpu/mcf5227x/start.S  |  245 ++-
 include/asm-m68k/m5227x.h |4 +-
 include/configs/M52277EVB.h   |  155 +++-
 13 files changed, 987 insertions(+), 206 deletions(-)
 delete mode 100644 board/freescale/m52277evb/u-boot.lds
 create mode 100644 board/freescale/m52277evb/u-boot.spa
 create mode 100644 board/freescale/m52277evb/u-boot.stm
 create mode 100644 cpu/mcf5227x/dspi.c

diff --git a/Makefile b/Makefile
index fceb8a2..7a35676 100644
--- a/Makefile
+++ b/Makefile
@@ -1898,7 +1898,27 @@ ZPC1900_config: unconfig
 ## Coldfire
 #
 
-M52277EVB_config:  unconfig
+M52277EVB_config \
+M52277EVB_spansion_config \
+M52277EVB_stmicro_config : unconfig
+   @case $@ in \
+   M52277EVB_config)   FLASH=SPANSION;; \
+   M52277EVB_spansion_config)  FLASH=SPANSION;; \
+   M52277EVB_stmicro_config)   FLASH=STMICRO;; \
+   esac; \
+   if [ $${FLASH} = SPANSION ] ; then \
+   echo #define CONFIG_SYS_SPANSION_BOOT  
$(obj)include/config.h ; \
+   echo TEXT_BASE = 0x  
$(obj)board/freescale/m52277evb/config.tmp ; \
+   cp $(obj)board/freescale/m52277evb/u-boot.spa 
$(obj)board/freescale/m52277evb/u-boot.lds ; \
+   $(XECHO) ... with SPANSION boot... ; \
+   fi; \
+   if [ $${FLASH} = STMICRO ] ; then \
+   echo #define CONFIG_CF_SBF $(obj)include/config.h ; \
+   echo #define CONFIG_SYS_STMICRO_BOOT   
$(obj)include/config.h ; \
+   echo TEXT_BASE = 0x43E0  
$(obj)board/freescale/m52277evb/config.tmp ; \
+   cp $(obj)board/freescale/m52277evb/u-boot.stm 
$(obj)board/freescale/m52277evb/u-boot.lds ; \
+   $(XECHO) ... with ST Micro boot... ; \
+   fi
@$(MKCONFIG) -a M52277EVB m68k mcf5227x m52277evb freescale
 
 M5235EVB_config \
diff --git a/board/freescale/m52277evb/config.mk 
b/board/freescale/m52277evb/config.mk
index ce014ed..b42fcc9 100644
--- a/board/freescale/m52277evb/config.mk
+++ b/board/freescale/m52277evb/config.mk
@@ -22,4 +22,6 @@
 # MA 02111-1307 USA
 #
 
-TEXT_BASE = 0
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+
+PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
diff --git a/board/freescale/m52277evb/m52277evb.c 
b/board/freescale/m52277evb/m52277evb.c
index 838a6de..9109edb 100644
--- a/board/freescale/m52277evb/m52277evb.c
+++ b/board/freescale/m52277evb/m52277evb.c
@@ -38,8 +38,18 @@ int checkboard(void)
 
 phys_size_t initdram(int board_type)
 {
+   u32 dramsize;
+
+#ifdef CONFIG_CF_SBF
+   /*
+* Serial Boot: The dram is already initialized in start.S
+* only require to return DRAM size
+*/
+   dramsize = CONFIG_SYS_SDRAM_SIZE * 0x10;
+#else
volatile sdramc_t *sdram = (volatile sdramc_t *)(MMAP_SDRAM);
-   u32 dramsize, i;
+   volatile gpio_t *gpio = (volatile gpio_t *)(MMAP_GPIO);
+   u32 i;
 
dramsize = CONFIG_SYS_SDRAM_SIZE * 0x10;
 
@@ -49,6 +59,8 @@ phys_size_t initdram(int board_type)
}
i--;
 
+   gpio-mscr_sdram = CONFIG_SYS_SDRAM_DRV_STRENGTH;
+
sdram-sdcs0 = (CONFIG_SYS_SDRAM_BASE | i);
 
sdram-sdcfg1 = CONFIG_SYS_SDRAM_CFG1;
@@ -56,24 +68,30 @@ phys_size_t initdram(int board_type)
 
/* Issue PALL */
sdram-sdcr = CONFIG_SYS_SDRAM_CTRL | 2;
+   __asm__(nop);
 
/* Issue LEMR */
-   /*sdram-sdmr = CONFIG_SYS_SDRAM_EMOD; */
sdram-sdmr = CONFIG_SYS_SDRAM_MODE;
+   __asm__(nop);
+   sdram-sdmr = CONFIG_SYS_SDRAM_EMOD;
+   __asm__(nop);
 
udelay(1000);
 
/* Issue PALL */
sdram-sdcr = CONFIG_SYS_SDRAM_CTRL | 2;
+   __asm__(nop);
 
/* Perform two refresh cycles */
sdram-sdcr = CONFIG_SYS_SDRAM_CTRL | 4;
+   __asm__(nop);
sdram-sdcr = CONFIG_SYS_SDRAM_CTRL | 4;
+   __asm__(nop);
 
-   sdram-sdcr = (CONFIG_SYS_SDRAM_CTRL  ~0x8000) | 0x1c00;
+   sdram-sdcr = (CONFIG_SYS_SDRAM_CTRL  ~0x8000) | 0x1C00;
 
udelay(100);
-
+#endif
return (dramsize);
 };
 
diff --git a/board/freescale/m52277evb/u-boot.lds 

[U-Boot] [PATCH 16/19] ColdFire: Add MCF5301x CPU support

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 cpu/mcf532x/cpu.c  |   21 +-
 cpu/mcf532x/cpu_init.c |  202 
 cpu/mcf532x/speed.c|  119 
 cpu/mcf532x/start.S|   11 +++
 4 files changed, 304 insertions(+), 49 deletions(-)

diff --git a/cpu/mcf532x/cpu.c b/cpu/mcf532x/cpu.c
index fd77939..bcb092d 100644
--- a/cpu/mcf532x/cpu.c
+++ b/cpu/mcf532x/cpu.c
@@ -3,7 +3,7 @@
  * (C) Copyright 2000-2003
  * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
  *
- * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
+ * Copyright (C) 2004-2008 Freescale Semiconductor, Inc.
  * TsiChung Liew ([EMAIL PROTECTED])
  *
  * See file CREDITS for list of people who contributed to this
@@ -56,6 +56,24 @@ int checkcpu(void)
msk = (ccm-cir  6);
ver = (ccm-cir  0x003f);
switch (msk) {
+#ifdef CONFIG_MCF5301x
+   case 0x78:
+   id = 53010;
+   break;
+   case 0x77:
+   id = 53012;
+   break;
+   case 0x76:
+   id = 53015;
+   break;
+   case 0x74:
+   id = 53011;
+   break;
+   case 0x73:
+   id = 53013;
+   break;
+#endif
+#ifdef CONFIG_MCF532x
case 0x54:
id = 5329;
break;
@@ -77,6 +95,7 @@ int checkcpu(void)
case 0x6B:
id = 5372;
break;
+#endif
}
 
if (id) {
diff --git a/cpu/mcf532x/cpu_init.c b/cpu/mcf532x/cpu_init.c
index 39be11f..687c7e4 100644
--- a/cpu/mcf532x/cpu_init.c
+++ b/cpu/mcf532x/cpu_init.c
@@ -3,7 +3,7 @@
  * (C) Copyright 2000-2003
  * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
  *
- * (C) Copyright 2007 Freescale Semiconductor, Inc.
+ * (C) Copyright 2004-2008 Freescale Semiconductor, Inc.
  * TsiChung Liew ([EMAIL PROTECTED])
  *
  * See file CREDITS for list of people who contributed to this
@@ -35,13 +35,180 @@
 #include asm/fec.h
 #endif
 
-/*
- * Breath some life into the CPU...
- *
- * Set up the memory map,
- * initialize a bunch of registers,
- * initialize the UPM's
- */
+#ifdef CONFIG_MCF5301x
+void cpu_init_f(void)
+{
+   volatile scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
+   volatile scm2_t *scm2 = (scm2_t *) MMAP_SCM2;
+   volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
+   volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS;
+
+   /* watchdog is enabled by default - disable the watchdog */
+#ifndef CONFIG_WATCHDOG
+   /*wdog-cr = 0; */
+#endif
+
+   scm1-mpr = 0x;
+   scm1-pacra = 0;
+   scm1-pacrb = 0;
+   scm1-pacrc = 0;
+   scm1-pacrd = 0;
+   scm1-pacre = 0;
+   scm1-pacrf = 0;
+   scm1-pacrg = 0;
+
+#if (defined(CONFIG_SYS_CS0_BASE)  defined(CONFIG_SYS_CS0_MASK) \
+  defined(CONFIG_SYS_CS0_CTRL))
+   gpio-par_cs |= GPIO_PAR_CS0_CS0;
+   fbcs-csar0 = CONFIG_SYS_CS0_BASE;
+   fbcs-cscr0 = CONFIG_SYS_CS0_CTRL;
+   fbcs-csmr0 = CONFIG_SYS_CS0_MASK;
+#endif
+
+#if (defined(CONFIG_SYS_CS1_BASE)  defined(CONFIG_SYS_CS1_MASK) \
+  defined(CONFIG_SYS_CS1_CTRL))
+   gpio-par_cs |= GPIO_PAR_CS1_CS1;
+   fbcs-csar1 = CONFIG_SYS_CS1_BASE;
+   fbcs-cscr1 = CONFIG_SYS_CS1_CTRL;
+   fbcs-csmr1 = CONFIG_SYS_CS1_MASK;
+#endif
+
+#if (defined(CONFIG_SYS_CS2_BASE)  defined(CONFIG_SYS_CS2_MASK) \
+  defined(CONFIG_SYS_CS2_CTRL))
+   fbcs-csar2 = CONFIG_SYS_CS2_BASE;
+   fbcs-cscr2 = CONFIG_SYS_CS2_CTRL;
+   fbcs-csmr2 = CONFIG_SYS_CS2_MASK;
+#endif
+
+#if (defined(CONFIG_SYS_CS3_BASE)  defined(CONFIG_SYS_CS3_MASK) \
+  defined(CONFIG_SYS_CS3_CTRL))
+   fbcs-csar3 = CONFIG_SYS_CS3_BASE;
+   fbcs-cscr3 = CONFIG_SYS_CS3_CTRL;
+   fbcs-csmr3 = CONFIG_SYS_CS3_MASK;
+#endif
+
+#if (defined(CONFIG_SYS_CS4_BASE)  defined(CONFIG_SYS_CS4_MASK) \
+  defined(CONFIG_SYS_CS4_CTRL))
+   gpio-par_cs |= GPIO_PAR_CS4;
+   fbcs-csar4 = CONFIG_SYS_CS4_BASE;
+   fbcs-cscr4 = CONFIG_SYS_CS4_CTRL;
+   fbcs-csmr4 = CONFIG_SYS_CS4_MASK;
+#endif
+
+#if (defined(CONFIG_SYS_CS5_BASE)  defined(CONFIG_SYS_CS5_MASK) \
+  defined(CONFIG_SYS_CS5_CTRL))
+   gpio-par_cs |= GPIO_PAR_CS5;
+   fbcs-csar5 = CONFIG_SYS_CS5_BASE;
+   fbcs-cscr5 = CONFIG_SYS_CS5_CTRL;
+   fbcs-csmr5 = CONFIG_SYS_CS5_MASK;
+#endif
+
+#ifdef CONFIG_FSL_I2C
+   gpio-par_feci2c = GPIO_PAR_FECI2C_SDA_SDA | GPIO_PAR_FECI2C_SCL_SCL;
+#endif
+
+   icache_enable();
+}
+
+/* initialize higher level parts of CPU like timers */
+int cpu_init_r(void)
+{
+#ifdef CONFIG_MCFFEC
+   volatile ccm_t *ccm = (ccm_t *) MMAP_CCM;
+#endif
+#ifdef CONFIG_MCFRTC
+   volatile rtc_t *rtc = (rtc_t *) (CONFIG_SYS_MCFRTC_BASE);
+   volatile rtcex_t *rtcex = (rtcex_t *)  rtc-extended;
+
+   rtcex-gocu = CONFIG_SYS_RTC_CNT;
+   rtcex-gocl = CONFIG_SYS_RTC_SETUP;
+
+#endif
+#ifdef CONFIG_MCFFEC
+   

[U-Boot] [PATCH 19/19] ColdFire: Fix compilation error

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

The error was caused by the change for strmhz() in cpu.c.
A few of them were one extra close parenthesis.

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 cpu/mcf5227x/cpu.c |   10 +-
 cpu/mcf523x/cpu.c  |4 ++--
 cpu/mcf532x/cpu.c  |4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/cpu/mcf5227x/cpu.c b/cpu/mcf5227x/cpu.c
index 765aec6..d9f5f43 100644
--- a/cpu/mcf5227x/cpu.c
+++ b/cpu/mcf5227x/cpu.c
@@ -65,12 +65,12 @@ int checkcpu(void)
printf(Freescale MCF%d (Mask:%01x Version:%x)\n, id, msk,
   ver);
printf(   CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n,
-  strmhz(buf1, gd-cpu_clk)),
-  strmhz(buf2, gd-bus_clk)),
-  strmhz(buf3, gd-flb_clk)));
+  strmhz(buf1, gd-cpu_clk),
+  strmhz(buf2, gd-bus_clk),
+  strmhz(buf3, gd-flb_clk));
printf(   INP CLK %s MHz VCO CLK %s MHz\n,
-  strmhz(buf1, gd-inp_clk)),
-  strmhz(buf2, gd-vco_clk)));
+  strmhz(buf1, gd-inp_clk),
+  strmhz(buf2, gd-vco_clk));
}
 
return 0;
diff --git a/cpu/mcf523x/cpu.c b/cpu/mcf523x/cpu.c
index b9e48aa..a1a5133 100644
--- a/cpu/mcf523x/cpu.c
+++ b/cpu/mcf523x/cpu.c
@@ -65,8 +65,8 @@ int checkcpu(void)
printf(Freescale MCF%d (Mask:%01x Version:%x)\n, id, msk,
   ver);
printf(   CPU CLK %s MHz BUS CLK %s MHz\n,
-  strmhz(buf1, gd-cpu_clk)),
-  strmhz(buf2, gd-bus_clk)));
+  strmhz(buf1, gd-cpu_clk),
+  strmhz(buf2, gd-bus_clk));
}
 
return 0;
diff --git a/cpu/mcf532x/cpu.c b/cpu/mcf532x/cpu.c
index bcb092d..331cc15 100644
--- a/cpu/mcf532x/cpu.c
+++ b/cpu/mcf532x/cpu.c
@@ -104,8 +104,8 @@ int checkcpu(void)
printf(Freescale MCF%d (Mask:%01x Version:%x)\n, id, msk,
   ver);
printf(   CPU CLK %s MHz BUS CLK %s MHz\n,
-  strmhz(buf1, gd-cpu_clk)),
-  strmhz(buf2, gd-bus_clk)));
+  strmhz(buf1, gd-cpu_clk),
+  strmhz(buf2, gd-bus_clk));
}
 
return 0;
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 18/19] ColdFire: Add M53017EVB Platform

2008-10-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 MAINTAINERS   |1 +
 MAKEALL   |1 +
 Makefile  |3 +
 board/freescale/m53017evb/Makefile|   44 ++
 board/freescale/m53017evb/config.mk   |   25 
 board/freescale/m53017evb/m53017evb.c |   94 +
 board/freescale/m53017evb/u-boot.lds  |  143 +++
 doc/README.m53017evb  |  181 
 include/configs/M53017EVB.h   |  247 +
 9 files changed, 739 insertions(+), 0 deletions(-)
 create mode 100644 board/freescale/m53017evb/Makefile
 create mode 100644 board/freescale/m53017evb/config.mk
 create mode 100644 board/freescale/m53017evb/m53017evb.c
 create mode 100644 board/freescale/m53017evb/u-boot.lds
 create mode 100644 doc/README.m53017evb
 create mode 100644 include/configs/M53017EVB.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 60cb6a6..8ef6bab 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -717,6 +717,7 @@ TsiChung Liew [EMAIL PROTECTED]
M52277EVB   mcf5227x
M5235EVBmcf52x2
M5253DEMO   mcf52x2
+   M53017EVB   mcf532x
M5329EVBmcf532x
M5373EVBmcf532x
M54455EVB   mcf5445x
diff --git a/MAKEALL b/MAKEALL
index aa602b7..26217fd 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -708,6 +708,7 @@ LIST_coldfire= \
M5272C3 \
M5275EVB\
M5282EVB\
+   M53017EVB   \
M5329AFEE   \
M5373EVB\
M54451EVB   \
diff --git a/Makefile b/Makefile
index 7a35676..3c74fd2 100644
--- a/Makefile
+++ b/Makefile
@@ -1978,6 +1978,9 @@ M5275EVB_config : unconfig
 M5282EVB_config :  unconfig
@$(MKCONFIG) $(@:_config=) m68k mcf52x2 m5282evb freescale
 
+M53017EVB_config : unconfig
+   @$(MKCONFIG) $(@:_config=) m68k mcf532x m53017evb freescale
+
 M5329AFEE_config \
 M5329BFEE_config : unconfig
@case $@ in \
diff --git a/board/freescale/m53017evb/Makefile 
b/board/freescale/m53017evb/Makefile
new file mode 100644
index 000..981763d
--- /dev/null
+++ b/board/freescale/m53017evb/Makefile
@@ -0,0 +1,44 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  = $(BOARD).o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS)
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/m53017evb/config.mk 
b/board/freescale/m53017evb/config.mk
new file mode 100644
index 000..ce014ed
--- /dev/null
+++ b/board/freescale/m53017evb/config.mk
@@ -0,0 +1,25 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
+# Coldfire contribution by Bernhard Kuhn [EMAIL PROTECTED]
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+TEXT_BASE = 0
diff 

[U-Boot] [PATCH] mtd: SPI Flash: Support the STMicro Flash

2008-08-28 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Add MTD SPI Flash support for M25P16, M25P20, M25P32,
M25P40, M25P64, M25P80, M25P128.

Signed-off-by: Jason McMullan [EMAIL PROTECTED]
Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 drivers/mtd/spi/Makefile |1 +
 drivers/mtd/spi/spi_flash.c  |5 +
 drivers/mtd/spi/spi_flash_internal.h |1 +
 drivers/mtd/spi/stmicro.c|  356 ++
 4 files changed, 363 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/stmicro.c

diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
index af6af97..3d4f892 100644
--- a/drivers/mtd/spi/Makefile
+++ b/drivers/mtd/spi/Makefile
@@ -27,6 +27,7 @@ LIB   := $(obj)libspi_flash.a
 
 COBJS-$(CONFIG_SPI_FLASH)  += spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)+= atmel.o
+COBJS-$(CONFIG_SPI_FLASH_STMICRO)  += stmicro.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index d581cb3..d1d81af 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -134,6 +134,11 @@ struct spi_flash *spi_flash_probe(unsigned int bus, 
unsigned int cs,
flash = spi_flash_probe_atmel(spi, idcode);
break;
 #endif
+#ifdef CONFIG_SPI_FLASH_STMICRO
+   case 0x20:
+   flash = spi_flash_probe_stmicro(spi, idcode);
+   break;
+#endif
default:
debug(SF: Unsupported manufacturer %02X\n, idcode[0]);
flash = NULL;
diff --git a/drivers/mtd/spi/spi_flash_internal.h 
b/drivers/mtd/spi/spi_flash_internal.h
index 1438050..e5f758e 100644
--- a/drivers/mtd/spi/spi_flash_internal.h
+++ b/drivers/mtd/spi/spi_flash_internal.h
@@ -43,3 +43,4 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 
*cmd,
 /* Manufacturer-specific probe functions */
 struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode);
 struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode);
+struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 *idcode);
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
new file mode 100644
index 000..c999b12
--- /dev/null
+++ b/drivers/mtd/spi/stmicro.c
@@ -0,0 +1,356 @@
+/*
+ * (C) Copyright 2000-2002
+ * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
+ *
+ * Copyright 2008, Network Appliance Inc.
+ * Jason McMullan [EMAIL PROTECTED]
+ *
+ * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
+ * TsiChung Liew ([EMAIL PROTECTED])
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include malloc.h
+#include spi_flash.h
+
+#include spi_flash_internal.h
+
+/* M25Pxx-specific commands */
+#define CMD_M25PXX_WREN0x06/* Write Enable */
+#define CMD_M25PXX_WRDI0x04/* Write Disable */
+#define CMD_M25PXX_RDSR0x05/* Read Status Register */
+#define CMD_M25PXX_WRSR0x01/* Write Status Register */
+#define CMD_M25PXX_READ0x03/* Read Data Bytes */
+#define CMD_M25PXX_FAST_READ   0x0b/* Read Data Bytes at Higher Speed */
+#define CMD_M25PXX_PP  0x02/* Page Program */
+#define CMD_M25PXX_SE  0xd8/* Sector Erase */
+#define CMD_M25PXX_BE  0xc7/* Bulk Erase */
+#define CMD_M25PXX_DP  0xb9/* Deep Power-down */
+#define CMD_M25PXX_RES 0xab/* Release from DP, and Read Signature 
*/
+
+#define STM_ID_M25P16  0x15
+#define STM_ID_M25P20  0x12
+#define STM_ID_M25P32  0x16
+#define STM_ID_M25P40  0x13
+#define STM_ID_M25P64  0x17
+#define STM_ID_M25P80  0x14
+#define STM_ID_M25P128 0x18
+
+#define STMICRO_SR_WIP (1  0)/* Write-in-Progress */
+
+struct stmicro_spi_flash_params {
+   u8 idcode1;
+   u16 page_size;
+   u16 pages_per_sector;
+   u16 nr_sectors;
+   const char *name;
+};
+
+struct stmicro_spi_flash {
+   const struct stmicro_spi_flash_params *params;
+   struct spi_flash flash;
+};
+
+static inline struct stmicro_spi_flash *to_stmicro_spi_flash(struct 

[U-Boot] [PATCH] mtd: SPI Flash: Support the STMicro Flash

2008-08-22 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Add MTD SPI Flash support for M25P16, M25P20, M25P32,
M25P40, M25P64, M25P80, M25P128.

Signed-off-by: Jason McMullan [EMAIL PROTECTED]
Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 drivers/mtd/spi/Makefile |1 +
 drivers/mtd/spi/spi_flash.c  |5 +
 drivers/mtd/spi/spi_flash_internal.h |1 +
 drivers/mtd/spi/stmicro.c|  355 ++
 4 files changed, 362 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/stmicro.c

diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
index af6af97..3d4f892 100644
--- a/drivers/mtd/spi/Makefile
+++ b/drivers/mtd/spi/Makefile
@@ -27,6 +27,7 @@ LIB   := $(obj)libspi_flash.a
 
 COBJS-$(CONFIG_SPI_FLASH)  += spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)+= atmel.o
+COBJS-$(CONFIG_SPI_FLASH_STMICRO)  += stmicro.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index d581cb3..d1d81af 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -134,6 +134,11 @@ struct spi_flash *spi_flash_probe(unsigned int bus, 
unsigned int cs,
flash = spi_flash_probe_atmel(spi, idcode);
break;
 #endif
+#ifdef CONFIG_SPI_FLASH_STMICRO
+   case 0x20:
+   flash = spi_flash_probe_stmicro(spi, idcode);
+   break;
+#endif
default:
debug(SF: Unsupported manufacturer %02X\n, idcode[0]);
flash = NULL;
diff --git a/drivers/mtd/spi/spi_flash_internal.h 
b/drivers/mtd/spi/spi_flash_internal.h
index 1438050..e5f758e 100644
--- a/drivers/mtd/spi/spi_flash_internal.h
+++ b/drivers/mtd/spi/spi_flash_internal.h
@@ -43,3 +43,4 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 
*cmd,
 /* Manufacturer-specific probe functions */
 struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode);
 struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode);
+struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 *idcode);
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
new file mode 100644
index 000..846b105
--- /dev/null
+++ b/drivers/mtd/spi/stmicro.c
@@ -0,0 +1,355 @@
+/*
+ * (C) Copyright 2000-2002
+ * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
+ *
+ * Copyright 2008, Network Appliance Inc.
+ * Jason McMullan [EMAIL PROTECTED]
+ *
+ * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
+ * TsiChung Liew ([EMAIL PROTECTED])
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include malloc.h
+#include spi_flash.h
+
+#include spi_flash_internal.h
+
+/* M25Pxx-specific commands */
+#define CMD_M25PXX_WREN0x06/* Write Enable */
+#define CMD_M25PXX_WRDI0x04/* Write Disable */
+#define CMD_M25PXX_RDSR0x05/* Read Status Register */
+#define CMD_M25PXX_WRSR0x01/* Write Status Register */
+#define CMD_M25PXX_READ0x03/* Read Data Bytes */
+#define CMD_M25PXX_FAST_READ   0x0b/* Read Data Bytes at Higher Speed */
+#define CMD_M25PXX_PP  0x02/* Page Program */
+#define CMD_M25PXX_SE  0xd8/* Sector Erase */
+#define CMD_M25PXX_BE  0xc7/* Bulk Erase */
+#define CMD_M25PXX_DP  0xb9/* Deep Power-down */
+#define CMD_M25PXX_RES 0xab/* Release from DP, and Read Signature 
*/
+
+#define STM_ID_M25P16  0x15
+#define STM_ID_M25P20  0x12
+#define STM_ID_M25P32  0x16
+#define STM_ID_M25P40  0x13
+#define STM_ID_M25P64  0x17
+#define STM_ID_M25P80  0x14
+#define STM_ID_M25P128 0x18
+
+#define STMICRO_SR_WIP (1  0)/* Write-in-Progress */
+
+struct stmicro_spi_flash_params {
+   u8 idcode1;
+   u16 page_size;
+   u16 pages_per_sector;
+   u16 nr_sectors;
+   const char *name;
+};
+
+struct stmicro_spi_flash {
+   const struct stmicro_spi_flash_params *params;
+   struct spi_flash flash;
+};
+
+static inline struct stmicro_spi_flash *to_stmicro_spi_flash(struct 

[U-Boot] [PATCH] mtd: SPI Flash: Support the STMicro Flash

2008-08-21 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Add MTD SPI Flash support for M25P16, M25P40,
M25P64, and M25P80.

Signed-off-by: Jason McMullan [EMAIL PROTECTED]
Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 drivers/mtd/spi/stmicro.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index 3854cbe..6e5ce7a 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -2,7 +2,7 @@
  * (C) Copyright 2000-2002
  * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
  *
- * Copyright 2008, Network Appliance Inc.
+ * Network Appliance Inc.
  * Jason McMullan [EMAIL PROTECTED]
  *
  * See file CREDITS for list of people who contributed to this
@@ -129,7 +129,7 @@ static int stmicro_wait_ready(struct spi_flash *flash, 
unsigned long timeout)
if ((status  STMICRO_SR_WIP) == 0)
break;
 
-   } while (1 || get_timer(timebase)  timeout);
+   } while (get_timer(timebase)  timeout);
 
spi_xfer(spi, 0, NULL, NULL, SPI_XFER_END);
 
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/8] ColdFire: Fix board.c warning message

2008-08-21 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Implicit declaration of nand_init() warning message

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 lib_m68k/board.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib_m68k/board.c b/lib_m68k/board.c
index e59c6b0..9f4442e 100644
--- a/lib_m68k/board.c
+++ b/lib_m68k/board.c
@@ -63,6 +63,10 @@
 #include spi.h
 #endif
 
+#ifdef CONFIG_CMD_NAND
+#include nand.h
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static char *failed = *** failed ***\n;
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 7/8] ColdFire: Add CONFIG_MII_INIT for M5272C3

2008-08-21 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 include/configs/M5272C3.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/configs/M5272C3.h b/include/configs/M5272C3.h
index 9f1585e..fc457e3 100644
--- a/include/configs/M5272C3.h
+++ b/include/configs/M5272C3.h
@@ -91,6 +91,7 @@
 #ifdef CONFIG_MCFFEC
 #  define CONFIG_NET_MULTI 1
 #  define CONFIG_MII   1
+#  define CONFIG_MII_INIT  1
 #  define CFG_DISCOVER_PHY
 #  define CFG_RX_ETH_BUFFER8
 #  define CFG_FAULT_ECHO_LINK_DOWN
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 5/8] ColdFire: Fix compiling error

2008-08-21 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Caused by typo and non-related function

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 board/freescale/m5329evb/nand.c |4 ++--
 board/freescale/m5373evb/nand.c |4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/board/freescale/m5329evb/nand.c b/board/freescale/m5329evb/nand.c
index f84912e..f46b936 100644
--- a/board/freescale/m5329evb/nand.c
+++ b/board/freescale/m5329evb/nand.c
@@ -40,7 +40,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define SET_ALE0x08
 #define CLR_ALE~SET_ALE
 
-static void nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
+static void nand_hwcontrol(struct mtd_info *mtdinfo, int cmd, unsigned int 
ctrl)
 {
struct nand_chip *this = mtdinfo-priv;
 /* volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; TODO: handle wp */
@@ -96,7 +96,7 @@ int board_nand_init(struct nand_chip *nand)
nand-ecc.mode = NAND_ECC_SOFT;
nand-cmd_ctrl = nand_hwcontrol;
nand-read_byte = nand_read_byte;
-   nand-write_byte = nand_write_byte;
+   nand-write_buf = nand_write_byte;
nand-dev_ready = nand_dev_ready;
 
return 0;
diff --git a/board/freescale/m5373evb/nand.c b/board/freescale/m5373evb/nand.c
index 404a9c3..bce8679 100644
--- a/board/freescale/m5373evb/nand.c
+++ b/board/freescale/m5373evb/nand.c
@@ -46,16 +46,14 @@ static void nand_hwcontrol(struct mtd_info *mtdinfo, int 
cmd, unsigned int ctrl)
 
if (ctrl  NAND_CTRL_CHANGE) {
ulong IO_ADDR_W = (ulong) this-IO_ADDR_W;
-   IO_ADDR_W = ~(SET_ALE | SE_CLE);
+   IO_ADDR_W = ~(SET_ALE | SET_CLE);
 
if (ctrl  NAND_CLE)
IO_ADDR_W |= SET_CLE;
if (ctrl  NAND_ALE)
IO_ADDR_W |= SET_ALE;
 
-   at91_set_gpio_value(AT91_PIN_PD15, !(ctrl  NAND_NCE));
this-IO_ADDR_W = (void *)IO_ADDR_W;
-
}
 
if (cmd != NAND_CMD_NONE)
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ColdFire: Add FEC Buffer descriptors in SRAM

2008-08-19 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Add FEC Buffer descriptors and data buffer in SRAM for
faster execution and access.

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 drivers/net/mcffec.c |   42 --
 1 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index 6929716..c1349ac 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -66,6 +66,7 @@ struct fec_info_s fec_info[] = {
 0, /* tx Index */
 0, /* tx buffer */
 0, /* initialized flag */
+(struct fec_info_s *)-1,
 },
 #endif
 #ifdef CFG_FEC1_IOBASE
@@ -78,12 +79,17 @@ struct fec_info_s fec_info[] = {
 0, /* duplex and speed */
 0, /* phy name */
 0, /* phy name init */
+#ifdef CFG_FEC_BUF_USE_SRAM
+(cbd_t *)DBUF_LENGTH,  /* RX BD */
+#else
 0, /* RX BD */
+#endif
 0, /* TX BD */
 0, /* rx Index */
 0, /* tx Index */
 0, /* tx buffer */
 0, /* initialized flag */
+(struct fec_info_s *)-1,
 }
 #endif
 };
@@ -106,10 +112,6 @@ extern int mcffec_miiphy_write(char *devname, unsigned 
char addr,
   unsigned char reg, unsigned short value);
 #endif
 
-#ifdef CFG_UNIFY_CACHE
-extern void icache_invalid(void);
-#endif
-
 void setFecDuplexSpeed(volatile fec_t * fecp, bd_t * bd, int dup_spd)
 {
if ((dup_spd  16) == FULL) {
@@ -172,16 +174,22 @@ int fec_send(struct eth_device *dev, volatile void 
*packet, int length)
/* Activate transmit Buffer Descriptor polling */
fecp-tdar = 0x0100;/* Descriptor polling active*/
 
-   /* FEC fix for MCF5275, FEC unable to initial transmit data packet.
+#ifndef CFG_FEC_BUF_USE_SRAM
+   /*
+* FEC unable to initial transmit data packet.
 * A nop will ensure the descriptor polling active completed.
+* CF Internal RAM has shorter cycle access than DRAM. If use
+* DRAM as Buffer descriptor and data, a nop is a must.
+* Affect only V2 and V3.
 */
-#ifdef CONFIG_M5275
__asm__ (nop);
+
 #endif
 
 #ifdef CFG_UNIFY_CACHE
icache_invalid();
 #endif
+
j = 0;
while ((info-txbd[info-txIdx].cbd_sc  BD_ENET_TX_READY) 
   (j  MCFFEC_TOUT_LOOP)) {
@@ -213,6 +221,8 @@ int fec_recv(struct eth_device *dev)
int length;
 
for (;;) {
+#ifndef CFG_FEC_BUF_USE_SRAM
+#endif
 #ifdef CFG_UNIFY_CACHE
icache_invalid();
 #endif
@@ -557,6 +567,9 @@ int mcffec_initialize(bd_t * bis)
 {
struct eth_device *dev;
int i;
+#ifdef CFG_FEC_BUF_USE_SRAM
+   u32 tmp = CFG_INIT_RAM_ADDR + 0x1000;
+#endif
 
for (i = 0; i  sizeof(fec_info) / sizeof(fec_info[0]); i++) {
 
@@ -577,6 +590,18 @@ int mcffec_initialize(bd_t * bis)
dev-recv = fec_recv;
 
/* setup Receive and Transmit buffer descriptor */
+#ifdef CFG_FEC_BUF_USE_SRAM
+   fec_info[i].rxbd = (cbd_t *)((u32)fec_info[i].rxbd + tmp);
+   tmp = (u32)fec_info[i].rxbd;
+   fec_info[i].txbd =
+   (cbd_t *)((u32)fec_info[i].txbd + tmp +
+   (PKTBUFSRX * sizeof(cbd_t)));
+   tmp = (u32)fec_info[i].txbd;
+   fec_info[i].txbuf =
+   (char *)((u32)fec_info[i].txbuf + tmp +
+   (CFG_TX_ETH_BUFFER * sizeof(cbd_t)));
+   tmp = (u32)fec_info[i].txbuf;
+#else
fec_info[i].rxbd =
(cbd_t *) memalign(CFG_CACHELINE_SIZE,
   (PKTBUFSRX * sizeof(cbd_t)));
@@ -585,6 +610,8 @@ int mcffec_initialize(bd_t * bis)
   (TX_BUF_CNT * sizeof(cbd_t)));
fec_info[i].txbuf =
(char *)memalign(CFG_CACHELINE_SIZE, DBUF_LENGTH);
+#endif
+
 #ifdef ET_DEBUG
printf(rxbd %x txbd %x\n,
   (int)fec_info[i].rxbd, (int)fec_info[i].txbd);
@@ -598,7 +625,10 @@ int mcffec_initialize(bd_t * bis)
miiphy_register(dev-name,
mcffec_miiphy_read, mcffec_miiphy_write);
 #endif
+   if (i  0)
+   fec_info[i - 1].next = fec_info[i];
}
+   fec_info[i - 1].next = fec_info[0];
 
/* default speed */
bis-bi_ethspeed = 10;
-- 
1.5.6.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] Change CFG_ENV_SIZE to CFG_ENV_SECT_SIZE for SPI sector erase

2008-08-12 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

The CFG_ENV_SIZE is not suitable used for SPI flash erase
sector size if CFG_ENV_SIZE is less than CFG_ENV_SECT_SIZE.
Add condition check if CFG_ENV_SIZE is larger than
CFG_ENV_SECT_SIZE, calculate the right number of sectors for
erasing.

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 common/env_sf.c |   10 +-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/common/env_sf.c b/common/env_sf.c
index d641a9a..9077d78 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -63,13 +63,21 @@ uchar env_get_char_spec(int index)
 
 int saveenv(void)
 {
+   u32 sector = 1;
+
if (!env_flash) {
puts(Environment SPI flash not initialized\n);
return 1;
}
 
+   if (CFG_ENV_SIZE  CFG_ENV_SECT_SIZE) {
+   sector = CFG_ENV_SIZE / CFG_ENV_SECT_SIZE;
+   if (CFG_ENV_SIZE % CFG_ENV_SECT_SIZE)
+   sector++;
+   }
+
puts(Erasing SPI flash...);
-   if (spi_flash_erase(env_flash, CFG_ENV_OFFSET, CFG_ENV_SIZE))
+   if (spi_flash_erase(env_flash, CFG_ENV_OFFSET, sector * 
CFG_ENV_SECT_SIZE))
return 1;
 
puts(Writing to SPI flash...);
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ColdFire: Add SSPI feature for MCF5445x

2008-08-12 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 cpu/mcf5445x/dspi.c |  178 +--
 include/configs/M54455EVB.h |   16 -
 lib_m68k/board.c|   17 
 3 files changed, 204 insertions(+), 7 deletions(-)

diff --git a/cpu/mcf5445x/dspi.c b/cpu/mcf5445x/dspi.c
index 44d8505..959d6bd 100644
--- a/cpu/mcf5445x/dspi.c
+++ b/cpu/mcf5445x/dspi.c
@@ -27,9 +27,11 @@
 
 #include common.h
 #include spi.h
+#include malloc.h
 
 #if defined(CONFIG_CF_DSPI)
 #include asm/immap.h
+
 void dspi_init(void)
 {
volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
@@ -45,11 +47,30 @@ void dspi_init(void)
DSPI_DMCR_CSIS2 | DSPI_DMCR_CSIS1 | DSPI_DMCR_CSIS0 |
DSPI_DMCR_CRXF | DSPI_DMCR_CTXF;
 
-   dspi-dctar0 = DSPI_DCTAR_TRSZ(7) | DSPI_DCTAR_CPOL | DSPI_DCTAR_CPHA |
-   DSPI_DCTAR_PCSSCK_1CLK | DSPI_DCTAR_PASC(0) |
-   DSPI_DCTAR_PDT(0) | DSPI_DCTAR_CSSCK(0) |
-   DSPI_DCTAR_ASC(0) | DSPI_DCTAR_PBR(0) |
-   DSPI_DCTAR_DT(1) | DSPI_DCTAR_BR(1);
+#ifdef CFG_DSPI_DCTAR0
+   dspi-dctar0 = CFG_DSPI_DCTAR0;
+#endif
+#ifdef CFG_DSPI_DCTAR1
+   dspi-dctar1 = CFG_DSPI_DCTAR1;
+#endif
+#ifdef CFG_DSPI_DCTAR2
+   dspi-dctar2 = CFG_DSPI_DCTAR2;
+#endif
+#ifdef CFG_DSPI_DCTAR3
+   dspi-dctar3 = CFG_DSPI_DCTAR3;
+#endif
+#ifdef CFG_DSPI_DCTAR4
+   dspi-dctar4 = CFG_DSPI_DCTAR4;
+#endif
+#ifdef CFG_DSPI_DCTAR5
+   dspi-dctar5 = CFG_DSPI_DCTAR5;
+#endif
+#ifdef CFG_DSPI_DCTAR6
+   dspi-dctar6 = CFG_DSPI_DCTAR6;
+#endif
+#ifdef CFG_DSPI_DCTAR7
+   dspi-dctar7 = CFG_DSPI_DCTAR7;
+#endif
 }
 
 void dspi_tx(int chipsel, u8 attrib, u16 data)
@@ -70,4 +91,149 @@ u16 dspi_rx(void)
return (dspi-drfr  0x);
 }
 
-#endif /* CONFIG_HARD_SPI */
+#if defined(CONFIG_CMD_SPI)
+void spi_init_f(void)
+{
+}
+
+void spi_init_r(void)
+{
+}
+
+void spi_init(void)
+{
+   dspi_init();
+}
+
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+ unsigned int max_hz, unsigned int mode)
+{
+   struct spi_slave *slave;
+
+   slave = malloc(sizeof(struct spi_slave));
+   if (!slave)
+   return NULL;
+
+   slave-bus = bus;
+   slave-cs = cs;
+
+   return slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+   free(slave);
+}
+
+int spi_claim_bus(struct spi_slave *slave)
+{
+   return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave)
+{
+}
+
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+void *din, unsigned long flags)
+{
+   static int bWrite = 0;
+   u8 *spi_rd, *spi_wr;
+   int len = bitlen  3;
+
+   spi_rd = (u8 *) din;
+   spi_wr = (u8 *) dout;
+
+   /* command handling */
+   if (((len == 4) || (len == 1) || (len == 5))  (dout != NULL)) {
+   switch (*spi_wr) {
+   case 0x02:  /* Page Prog */
+   bWrite = 1;
+   dspi_tx(slave-cs, 0x80, spi_wr[0]);
+   dspi_rx();
+   dspi_tx(slave-cs, 0x80, spi_wr[1]);
+   dspi_rx();
+   dspi_tx(slave-cs, 0x80, spi_wr[2]);
+   dspi_rx();
+   dspi_tx(slave-cs, 0x80, spi_wr[3]);
+   dspi_rx();
+   return 0;
+   case 0x05:  /* Read Status */
+   if (len == 4)
+   if ((spi_wr[1] == 0xFF)  (spi_wr[2] == 0xFF)
+(spi_wr[3] == 0xFF)) {
+   dspi_tx(slave-cs, 0x80, *spi_wr);
+   dspi_rx();
+   }
+   return 0;
+   case 0x06:  /* WREN */
+   dspi_tx(slave-cs, 0x00, *spi_wr);
+   dspi_rx();
+   return 0;
+   case 0x0B:  /* Fast read */
+   if ((len == 5)  (spi_wr[4] == 0)) {
+   dspi_tx(slave-cs, 0x80, spi_wr[0]);
+   dspi_rx();
+   dspi_tx(slave-cs, 0x80, spi_wr[1]);
+   dspi_rx();
+   dspi_tx(slave-cs, 0x80, spi_wr[2]);
+   dspi_rx();
+   dspi_tx(slave-cs, 0x80, spi_wr[3]);
+   dspi_rx();
+   dspi_tx(slave-cs, 0x80, spi_wr[4]);
+   dspi_rx();
+   }
+   return 0;
+   case 0x9F:  /* RDID */
+   dspi_tx(slave-cs, 0x80, *spi_wr);
+   dspi_rx();
+   return 0;
+   case 0xD8:  /* Sector erase */

[U-Boot] [PATCH] ColdFire: Implement SBF feature for M5445EVB

2008-08-12 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 Makefile  |   16 ++-
 board/freescale/m54455evb/m54455evb.c |   14 ++-
 board/freescale/m54455evb/u-boot.stm  |  136 +
 cpu/mcf5445x/cpu_init.c   |2 +
 cpu/mcf5445x/speed.c  |   67 ++---
 cpu/mcf5445x/start.S  |  258 -
 include/configs/M54455EVB.h   |   92 ++--
 7 files changed, 539 insertions(+), 46 deletions(-)
 create mode 100644 board/freescale/m54455evb/u-boot.stm

diff --git a/Makefile b/Makefile
index 89746a2..4fa235e 100644
--- a/Makefile
+++ b/Makefile
@@ -1898,7 +1898,8 @@ M54455EVB_intel_config \
 M54455EVB_a33_config \
 M54455EVB_a66_config \
 M54455EVB_i33_config \
-M54455EVB_i66_config : unconfig
+M54455EVB_i66_config \
+M54455EVB_stm33_config :   unconfig
@case $@ in \
M54455EVB_config)   FLASH=ATMEL; FREQ=;; \
M54455EVB_atmel_config) FLASH=ATMEL; FREQ=;; \
@@ -1907,18 +1908,27 @@ M54455EVB_i66_config :  unconfig
M54455EVB_a66_config)   FLASH=ATMEL; FREQ=;; \
M54455EVB_i33_config)   FLASH=INTEL; FREQ=;; \
M54455EVB_i66_config)   FLASH=INTEL; FREQ=;; \
+   M54455EVB_stm33_config) FLASH=STMICRO; FREQ=;; \
esac; \
if [ $${FLASH} = INTEL ] ; then \
-   echo #undef CFG_ATMEL_BOOT  $(obj)include/config.h ; \
+   echo #define CFG_INTEL_BOOT  $(obj)include/config.h ; \
echo TEXT_BASE = 0x  
$(obj)board/freescale/m54455evb/config.tmp ; \
cp $(obj)board/freescale/m54455evb/u-boot.int 
$(obj)board/freescale/m54455evb/u-boot.lds ; \
$(XECHO) ... with INTEL boot... ; \
-   else \
+   fi; \
+   if [ $${FLASH} = ATMEL ] ; then \
echo #define CFG_ATMEL_BOOT$(obj)include/config.h ; \
echo TEXT_BASE = 0x0400  
$(obj)board/freescale/m54455evb/config.tmp ; \
cp $(obj)board/freescale/m54455evb/u-boot.atm 
$(obj)board/freescale/m54455evb/u-boot.lds ; \
$(XECHO) ... with ATMEL boot... ; \
fi; \
+   if [ $${FLASH} = STMICRO ] ; then \
+   echo #define CONFIG_CF_SBF $(obj)include/config.h ; \
+   echo #define CFG_STMICRO_BOOT  $(obj)include/config.h ; \
+   echo TEXT_BASE = 0x4FE0  
$(obj)board/freescale/m54455evb/config.tmp ; \
+   cp $(obj)board/freescale/m54455evb/u-boot.stm 
$(obj)board/freescale/m54455evb/u-boot.lds ; \
+   $(XECHO) ... with ST Micro boot... ; \
+   fi; \
echo #define CFG_INPUT_CLKSRC $${FREQ}  $(obj)include/config.h ; \
$(XECHO) ... with $${FREQ}Hz input clock
@$(MKCONFIG) -a M54455EVB m68k mcf5445x m54455evb freescale
diff --git a/board/freescale/m54455evb/m54455evb.c 
b/board/freescale/m54455evb/m54455evb.c
index 3c7b350..4f02121 100644
--- a/board/freescale/m54455evb/m54455evb.c
+++ b/board/freescale/m54455evb/m54455evb.c
@@ -39,9 +39,17 @@ int checkboard(void)
 
 phys_size_t initdram(int board_type)
 {
+   u32 dramsize;
+#ifdef CONFIG_CF_SBF
+   /*
+* Serial Boot: The dram is already initialized in start.S
+* only require to return DRAM size
+*/
+   dramsize = CFG_SDRAM_SIZE * 0x10  1;
+#else
volatile sdramc_t *sdram = (volatile sdramc_t *)(MMAP_SDRAM);
volatile gpio_t *gpio = (volatile gpio_t *)(MMAP_GPIO);
-   u32 dramsize, i;
+   u32 i;
 
dramsize = CFG_SDRAM_SIZE * 0x10  1;
 
@@ -51,7 +59,7 @@ phys_size_t initdram(int board_type)
}
i--;
 
-   gpio-mscr_sdram = 0xAA;
+   gpio-mscr_sdram = CFG_SDRAM_DRV_STRENGTH;
 
sdram-sdcs0 = (CFG_SDRAM_BASE | i);
sdram-sdcs1 = (CFG_SDRAM_BASE1 | i);
@@ -80,7 +88,7 @@ phys_size_t initdram(int board_type)
sdram-sdcr = (CFG_SDRAM_CTRL  ~0x8000) | 0x1c00;
 
udelay(100);
-
+#endif
return (dramsize  1);
 };
 
diff --git a/board/freescale/m54455evb/u-boot.stm 
b/board/freescale/m54455evb/u-boot.stm
new file mode 100644
index 000..3dd9a6b
--- /dev/null
+++ b/board/freescale/m54455evb/u-boot.stm
@@ -0,0 +1,136 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * 

[U-Boot] [PATCH] ColdFire: Multiple fixes for M5282EVB

2008-08-12 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Incorrect CFG_HZ value, change 100 to 1000.
Rename #waring to #warning. RAMBAR1 uses twice
in start.S, rename the later to FLASHBAR. Insert
nop for DRAM setup. And, env_offset in linker file.

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 board/freescale/m5282evb/m5282evb.c |7 +++
 board/freescale/m5282evb/u-boot.lds |3 +--
 cpu/mcf52x2/cpu_init.c  |2 +-
 cpu/mcf52x2/start.S |2 +-
 include/configs/M5282EVB.h  |4 ++--
 5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/board/freescale/m5282evb/m5282evb.c 
b/board/freescale/m5282evb/m5282evb.c
index 50e5e77..31d6923 100644
--- a/board/freescale/m5282evb/m5282evb.c
+++ b/board/freescale/m5282evb/m5282evb.c
@@ -51,6 +51,7 @@ phys_size_t initdram (int board_type)
MCFSDRAMC_DCR = (0
| MCFSDRAMC_DCR_RTIM_6
| MCFSDRAMC_DCR_RC((15 * dramclk)4));
+   asm(nop);
 
/* Initialize DACR0 */
MCFSDRAMC_DACR0 = (0
@@ -58,14 +59,17 @@ phys_size_t initdram (int board_type)
| MCFSDRAMC_DACR_CASL(1)
| MCFSDRAMC_DACR_CBM(3)
| MCFSDRAMC_DACR_PS_32);
+   asm(nop);
 
/* Initialize DMR0 */
MCFSDRAMC_DMR0 = (0
| ((dramsize - 1)  0xFFFC)
| MCFSDRAMC_DMR_V);
+   asm(nop);
 
/* Set IP (bit 3) in DACR */
MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_IP;
+   asm(nop);
 
/* Wait 30ns to allow banks to precharge */
for (i = 0; i  5; i++) {
@@ -74,9 +78,11 @@ phys_size_t initdram (int board_type)
 
/* Write to this block to initiate precharge */
*(u32 *)(CFG_SDRAM_BASE) = 0xA5A59696;
+   asm(nop);
 
/* Set RE (bit 15) in DACR */
MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_RE;
+   asm(nop);
 
/* Wait for at least 8 auto refresh cycles to occur */
for (i = 0; i  2000; i++) {
@@ -85,6 +91,7 @@ phys_size_t initdram (int board_type)
 
/* Finish the configuration by issuing the IMRS. */
MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_IMRS;
+   asm(nop);
 
/* Write to the SDRAM Mode Register */
*(u32 *)(CFG_SDRAM_BASE + 0x400) = 0xA5A59696;
diff --git a/board/freescale/m5282evb/u-boot.lds 
b/board/freescale/m5282evb/u-boot.lds
index dd2666b..96fde65 100644
--- a/board/freescale/m5282evb/u-boot.lds
+++ b/board/freescale/m5282evb/u-boot.lds
@@ -60,9 +60,8 @@ SECTIONS
 lib_generic/string.o   (.text)
 lib_generic/vsprintf.o (.text)
 lib_generic/crc32.o(.text)
-lib_generic/zlib.o (.text)
 
-/*. = env_offset; */
+. = env_offset;
 common/environment.o(.text)
 
 *(.text)
diff --git a/cpu/mcf52x2/cpu_init.c b/cpu/mcf52x2/cpu_init.c
index 344bcee..3cacb55 100644
--- a/cpu/mcf52x2/cpu_init.c
+++ b/cpu/mcf52x2/cpu_init.c
@@ -442,7 +442,7 @@ void cpu_init_f(void)
MCFCSM_CSMR0 = MCFCSM_CSMR_BAM(CFG_CS0_SIZE - 1) | MCFCSM_CSMR_V;
 #endif
 #else
-#waring Chip Select 0 are not initialized/used
+#warning Chip Select 0 are not initialized/used
 #endif
 
 #if defined(CFG_CS1_BASE)  defined(CFG_CS1_SIZE)  \
diff --git a/cpu/mcf52x2/start.S b/cpu/mcf52x2/start.S
index a054904..2e8ecfb 100644
--- a/cpu/mcf52x2/start.S
+++ b/cpu/mcf52x2/start.S
@@ -166,7 +166,7 @@ _after_flashbar_copy:
 #else
/* Setup code to initialize FLASHBAR, if start from external Memory */
move.l  #(CFG_INT_FLASH_BASE + CFG_INT_FLASH_ENABLE), %d0
-   movec   %d0, %RAMBAR1
+   movec   %d0, %FLASHBAR
 #endif /* (TEXT_BASE == CFG_INT_FLASH_BASE) */
 
 #endif
diff --git a/include/configs/M5282EVB.h b/include/configs/M5282EVB.h
index df46ee4..d05bc70 100644
--- a/include/configs/M5282EVB.h
+++ b/include/configs/M5282EVB.h
@@ -104,7 +104,7 @@
 #  define CONFIG_OVERWRITE_ETHADDR_ONCE
 #endif /* CONFIG_MCFFEC */
 
-#define CONFIG_HOSTNAMEM5272C3
+#define CONFIG_HOSTNAMEM5282EVB
 #define CONFIG_EXTRA_ENV_SETTINGS  \
netdev=eth0\0 \
loadaddr=1\0  \
@@ -134,7 +134,7 @@
 #define CFG_MEMTEST_START  0x400
 #define CFG_MEMTEST_END0x38
 
-#define CFG_HZ 100
+#define CFG_HZ 1000
 #defineCFG_CLK 6400
 
 /* PLL Configuration: Ext Clock * 6 (see table 9-4 of MCF user manual) */
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ColdFire: Fix M5253EVB dram bring up issue

2008-08-12 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 board/freescale/m5253evbe/m5253evbe.c |   13 +
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/board/freescale/m5253evbe/m5253evbe.c 
b/board/freescale/m5253evbe/m5253evbe.c
index f80a47c..f3b1efd 100644
--- a/board/freescale/m5253evbe/m5253evbe.c
+++ b/board/freescale/m5253evbe/m5253evbe.c
@@ -36,8 +36,6 @@ int checkboard(void)
 
 phys_size_t initdram(int board_type)
 {
-   int i;
-
/*
 * Check to see if the SDRAM has already been initialized
 * by a run control tool
@@ -50,21 +48,27 @@ phys_size_t initdram(int board_type)
 
/* Initialize DRAM Control Register: DCR */
mbar_writeShort(MCFSIM_DCR, (0x8400 | RC));
+   asm(nop);
 
-   mbar_writeLong(MCFSIM_DACR0, 0x3224);
+   mbar_writeLong(MCFSIM_DACR0, 0x2320);
+   asm(nop);
 
/* Initialize DMR0 */
dramsize = ((CFG_SDRAM_SIZE  20) - 1)  0xFFFC;
mbar_writeLong(MCFSIM_DMR0, dramsize | 1);
+   asm(nop);
 
-   mbar_writeLong(MCFSIM_DACR0, 0x322c);
+   mbar_writeLong(MCFSIM_DACR0, 0x2328);
+   asm(nop);
 
/* Write to this block to initiate precharge */
*(u32 *) (CFG_SDRAM_BASE) = 0xa5a5a5a5;
+   asm(nop);
 
/* Set RE bit in DACR */
mbar_writeLong(MCFSIM_DACR0,
   mbar_readLong(MCFSIM_DACR0) | 0x8000);
+   asm(nop);
 
/* Wait for at least 8 auto refresh cycles to occur */
udelay(500);
@@ -72,6 +76,7 @@ phys_size_t initdram(int board_type)
/* Finish the configuration by issuing the MRS */
mbar_writeLong(MCFSIM_DACR0,
   mbar_readLong(MCFSIM_DACR0) | 0x0040);
+   asm(nop);
 
*(u32 *) (CFG_SDRAM_BASE + 0x800) = 0xa5a5a5a5;
}
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ColdFire: Raise M5253EVBE uart baudrate to 115200 bps

2008-08-12 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 include/configs/M5253EVBE.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/configs/M5253EVBE.h b/include/configs/M5253EVBE.h
index f5e1b64..5653a39 100644
--- a/include/configs/M5253EVBE.h
+++ b/include/configs/M5253EVBE.h
@@ -32,7 +32,7 @@
 
 #define CONFIG_MCFUART
 #define CFG_UART_PORT  (0)
-#define CONFIG_BAUDRATE19200
+#define CONFIG_BAUDRATE115200
 #define CFG_BAUDRATE_TABLE { 9600 , 19200 , 38400 , 57600, 115200 }
 
 #undef CONFIG_WATCHDOG /* disable watchdog */
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] Change CFG_ENV_SIZE to CFG_ENV_SECT_SIZE for SPI sector erase

2008-08-12 Thread Tsi-Chung Liew
From: TsiChung Liew [EMAIL PROTECTED]

The CFG_ENV_SIZE is not suitable used for SPI flash erase
sector size.

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 common/env_sf.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/env_sf.c b/common/env_sf.c
index d641a9a..0a0626e 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -69,7 +69,7 @@ int saveenv(void)
}
 
puts(Erasing SPI flash...);
-   if (spi_flash_erase(env_flash, CFG_ENV_OFFSET, CFG_ENV_SIZE))
+   if (spi_flash_erase(env_flash, CFG_ENV_OFFSET, CFG_ENV_SECT_SIZE))
return 1;
 
puts(Writing to SPI flash...);
-- 
1.5.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot