From ef978730dcb3e7e398fe9b57633f3f67260c1bbc Mon Sep 17 00:00:00 2001
From: wdenk <wdenk>
Date: Wed, 21 Jan 2004 20:46:28 +0000
Subject: [PATCH] * Fix PS/2 keyboard problem caused by statically initialized
 variable   pointing to a location in flash

* Fix INCA-IP clock calculation: 400/3 = 133.3 MHz, not 130.
---
 CHANGELOG                 |  5 +++++
 cpu/mips/incaip_clock.c   |  6 +++---
 drivers/keyboard.c        |  2 +-
 drivers/ps2ser.c          | 11 ++++++++---
 include/configs/bms2003.h |  2 +-
 5 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 65608598e5..32110df1f2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,11 @@
 Changes since U-Boot 1.0.1:
 ======================================================================
 
+* Fix PS/2 keyboard problem caused by statically initialized variable
+  pointing to a location in flash
+
+* Fix INCA-IP clock calculation: 400/3 = 133.3 MHz, not 130.
+
 * The PS/2 mux on the BMS2003 board needs 450 ms after power on
   before we can access it; add delay in case we are faster (with no
   CF card inserted)
diff --git a/cpu/mips/incaip_clock.c b/cpu/mips/incaip_clock.c
index a042b8a6f7..9f327594f4 100644
--- a/cpu/mips/incaip_clock.c
+++ b/cpu/mips/incaip_clock.c
@@ -33,8 +33,8 @@
 *
 * RETURNS:
 *          150.000.000 for 150 MHz
-*          130.000.000. for 130 Mhz
-*          100.000.000. for 100 Mhz
+*          133.333.333 for 133 Mhz (= 400MHz/3)
+*          100.000.000 for 100 Mhz (= 400MHz/4)
 * NOTE:
 *   This functions should be used by the hardware driver to get the correct
 *   frequency of the CPU. Don't use the macros, which are set to init the CPU
@@ -55,7 +55,7 @@ uint incaip_get_cpuclk (void)
 		if (*((volatile ulong *) INCA_IP_CGU_CGU_DIVCR) & 0x40) {
 			/* Division value is 1/3, maximum CPU operating */
 			/* frequency is 133.3 MHz                       */
-			return 130000000;
+			return 133333333;
 		} else {
 			/* Division value is 1/4, maximum CPU operating */
 			/* frequency is 100 MHz                         */
diff --git a/drivers/keyboard.c b/drivers/keyboard.c
index 738ff9f15b..a42468f0c6 100644
--- a/drivers/keyboard.c
+++ b/drivers/keyboard.c
@@ -194,7 +194,7 @@ void handle_scancode(unsigned char scancode)
 	case 0xBA: /* caps lock released */
 		return; /* just swallow */
 	}
-#if 0
+#if 1
 	if((scancode&0x80)==0x80) /* key released */
 		return;
 #else
diff --git a/drivers/ps2ser.c b/drivers/ps2ser.c
index 71658d7ca0..52f1db9ad9 100644
--- a/drivers/ps2ser.c
+++ b/drivers/ps2ser.c
@@ -29,7 +29,7 @@ static int	ps2ser_getc_hw(void);
 static void	ps2ser_interrupt(void *dev_id);
 
 extern struct	serial_state rs_table[]; /* in serial.c */
-static struct	serial_state *state = rs_table + CONFIG_PS2SERIAL;
+static struct	serial_state *state;
 
 static u_char	ps2buf[PS2BUF_SIZE];
 static atomic_t	ps2buf_cnt;
@@ -49,8 +49,13 @@ static inline void ps2ser_out(int offset, int value)
 
 int ps2ser_init(void)
 {
-	int quot = state->baud_base / PS2SER_BAUD;
-	unsigned cval = 0x3; /* 8N1 - 8 data bits, no parity bits, 1 stop bit */
+	int quot;
+	unsigned cval;
+
+	state = rs_table + CONFIG_PS2SERIAL;
+
+	quot = state->baud_base / PS2SER_BAUD;
+	cval = 0x3; /* 8N1 - 8 data bits, no parity bits, 1 stop bit */
 
 	  /* Set speed, enable interrupts, enable FIFO
 	   */
diff --git a/include/configs/bms2003.h b/include/configs/bms2003.h
index 40baad0fd3..18170d4438 100644
--- a/include/configs/bms2003.h
+++ b/include/configs/bms2003.h
@@ -78,7 +78,7 @@
 		"bootm $(kernel_addr) $(ramdisk_addr)\0"		\
 	"net_nfs=tftp 200000 $(bootfile);run nfsargs addip;bootm\0"	\
 	"rootpath=/opt/eldk/ppc_8xx\0"					\
-	"bootfile=/tftpboot/TQM860L/uImage\0"				\
+	"bootfile=/tftpboot/BMS/uImage\0"				\
 	"kernel_addr=40040000\0"					\
 	"ramdisk_addr=40100000\0"					\
 	""
-- 
2.39.5