[U-Boot-Users] [PATCH] ColdFire: Fix UART baudrate formula

2008-05-29 Thread Tsi-Chung.Liew
From: TsiChung Liew [EMAIL PROTECTED]

The formula counter = (u32) (gd-bus_clk / gd-baudrate) / 32
can generate the wrong divisor due to integer division truncation.
Round the calculated divisor value by adding 1/2 the baudrate
before dividing by the baudrate.

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
Acked-by: Gerald Van Baren [EMAIL PROTECTED]
---
 drivers/serial/mcfuart.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index 88f3eb1..75e85b7 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -63,8 +63,8 @@ int serial_init(void)
uart-umr = UART_UMR_SB_STOP_BITS_1;
 
/* Setting up BaudRate */
-   counter = (u32) (gd-bus_clk / (gd-baudrate));
-   counter = 5;
+   counter = (u32) (gd-bus_clk / 32) + (gd-baudrate / 2));
+   counter = counter / gd-baudrate;
 
/* write to CTUR: divide counter upper byte */
uart-ubg1 = (u8) ((counter  0xff00)  8);
-- 
1.5.4.1


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


[U-Boot-Users] [PATCH] ColdFire: Fix UART baudrate formula

2008-05-29 Thread Tsi-Chung.Liew
From: TsiChung Liew [EMAIL PROTECTED]

The formula counter = (u32) (gd-bus_clk / gd-baudrate) / 32
can generate the wrong divisor due to integer division truncation.
Round the calculated divisor value by adding 1/2 the baudrate
before dividing by the baudrate.

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
Acked-by: Gerald Van Baren [EMAIL PROTECTED]
---
 drivers/serial/mcfuart.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index 88f3eb1..5eb4f45 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -63,8 +63,8 @@ int serial_init(void)
uart-umr = UART_UMR_SB_STOP_BITS_1;
 
/* Setting up BaudRate */
-   counter = (u32) (gd-bus_clk / (gd-baudrate));
-   counter = 5;
+   counter = (u32) ((gd-bus_clk / 32) + (gd-baudrate / 2));
+   counter = counter / gd-baudrate;
 
/* write to CTUR: divide counter upper byte */
uart-ubg1 = (u8) ((counter  0xff00)  8);
-- 
1.5.4.1


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


[U-Boot-Users] [PATCH] ColdFire: Fix UART baudrate at 115200

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

If bus frequency is larger than 133MHz, the UART cannot
output baudrate at 115200 correctly.

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 drivers/serial/mcfuart.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index 88f3eb1..fca76bd 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -64,7 +64,10 @@ int serial_init(void)
 
/* Setting up BaudRate */
counter = (u32) (gd-bus_clk / (gd-baudrate));
-   counter = 5;
+   counter = (counter + 31)  5;
+
+   if ((gd-bus_clk  1)  (gd-baudrate = 115200))
+   counter++;
 
/* write to CTUR: divide counter upper byte */
uart-ubg1 = (u8) ((counter  0xff00)  8);
-- 
1.5.4.1


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


[U-Boot-Users] [PATCH] ColdFire: Add 10 base ethernet support for mcf5445x

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

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

diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index 5ab4726..8d4e248 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -125,11 +125,17 @@ void setFecDuplexSpeed(volatile fec_t * fecp, bd_t * bd, 
int dup_spd)
}
 
if ((dup_spd  0x) == _100BASET) {
+#ifdef CONFIG_MCF5445x
+   fecp-rcr = ~0x200;/* disabled 10T base */
+#endif
 #ifdef MII_DEBUG
printf(100Mbps\n);
 #endif
bd-bi_ethspeed = 100;
} else {
+#ifdef CONFIG_MCF5445x
+   fecp-rcr |= 0x200; /* enabled 10T base */
+#endif
 #ifdef MII_DEBUG
printf(10Mbps\n);
 #endif
-- 
1.5.4.1


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


[U-Boot-Users] [PATCH] ColdFire: Add M5253DEMO platform support for mcf5253

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

Signed-off-by: TsiChung Liew [EMAIL PROTECTED]
---
 Makefile  |3 +
 board/freescale/m5253demo/Makefile|   44 +++
 board/freescale/m5253demo/config.mk   |   25 ++
 board/freescale/m5253demo/flash.c |  467 +
 board/freescale/m5253demo/m5253demo.c |  140 ++
 board/freescale/m5253demo/u-boot.lds  |  144 ++
 drivers/net/dm9000x.c |4 +
 include/configs/M5253DEMO.h   |  250 ++
 8 files changed, 1077 insertions(+), 0 deletions(-)
 create mode 100644 board/freescale/m5253demo/Makefile
 create mode 100644 board/freescale/m5253demo/config.mk
 create mode 100644 board/freescale/m5253demo/flash.c
 create mode 100644 board/freescale/m5253demo/m5253demo.c
 create mode 100644 board/freescale/m5253demo/u-boot.lds
 create mode 100644 include/configs/M5253DEMO.h

diff --git a/Makefile b/Makefile
index 3401203..99b9f02 100644
--- a/Makefile
+++ b/Makefile
@@ -1821,6 +1821,9 @@ M5235EVB_Flash32_config:  unconfig
 M5249EVB_config :  unconfig
@$(MKCONFIG) $(@:_config=) m68k mcf52x2 m5249evb freescale
 
+M5253DEMO_config : unconfig
+   @$(MKCONFIG) $(@:_config=) m68k mcf52x2 m5253demo freescale
+
 M5253EVBE_config : unconfig
@$(MKCONFIG) $(@:_config=) m68k mcf52x2 m5253evbe freescale
 
diff --git a/board/freescale/m5253demo/Makefile 
b/board/freescale/m5253demo/Makefile
new file mode 100644
index 000..cf07cf4
--- /dev/null
+++ b/board/freescale/m5253demo/Makefile
@@ -0,0 +1,44 @@
+#
+# (C) Copyright 2000-2006
+# 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 flash.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/m5253demo/config.mk 
b/board/freescale/m5253demo/config.mk
new file mode 100644
index 000..fa66b75
--- /dev/null
+++ b/board/freescale/m5253demo/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 = 0xFF80
diff --git a/board/freescale/m5253demo/flash.c 
b/board/freescale/m5253demo/flash.c
new file mode 100644
index 000..1bf1e97
--- /dev/null
+++ b/board/freescale/m5253demo/flash.c
@@ -0,0 +1,467 @@
+/*
+ * (C) Copyright 2000-2003
+ * Wolfgang Denk, DENX Software Engineering, [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 

[U-Boot-Users] [PATCH] ColdFire: Fix warning messages by passing correct data type in board.c

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

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

diff --git a/lib_m68k/board.c b/lib_m68k/board.c
index ae942e5..d27c89c 100644
--- a/lib_m68k/board.c
+++ b/lib_m68k/board.c
@@ -176,7 +176,7 @@ typedef int (init_fnc_t) (void);
 
 static int init_baudrate (void)
 {
-   uchar tmp[64];  /* long enough for environment variables */
+   char tmp[64];   /* long enough for environment variables */
int i = getenv_r (baudrate, tmp, sizeof (tmp));
 
gd-baudrate = (i  0)
@@ -267,7 +267,7 @@ board_init_f (ulong bootflag)
 #ifdef CONFIG_PRAM
int i;
ulong reg;
-   uchar tmp[64];  /* long enough for environment variables */
+   char tmp[64];   /* long enough for environment variables */
 #endif
 
/* Pointer is writable since we allocated a register for it */
@@ -752,7 +752,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 */
{
ulong pram;
-   uchar memsz[32];
+   char memsz[32];
 #ifdef CONFIG_PRAM
char *s;
 
-- 
1.5.4.1


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users