Fix support for PS/2 keyboard on TQM85xx boards

The PS/2 keyobard driver for the TQM85xx modules only supports the 
internal DUART of the MPC85xx CPU. Since the MPC8560 doesn't include a 
DUART, the TQM8560 modules can't be used with the PS/2 keyboard controller
on the STK85xx board.

The PS/2 keyboard driver should work with the modules TQM8540, TQM8541 and
TQM8555, but it only has been tested on a TQM8540, yet.

Make sure the PS/2 controller on the STK85xx is programmed. Jumper 
settings: X66 1-2, 9-10; X61 2-3

Signed-off-by: Martin.Krause <martin.krause@tqs.de>

---
commit 9133cdce8e291da1cf02a9c9e7e222f128d09ee1
tree 50e4d08ce973c796469b817264d2d6f49691b960
parent 8d352247ecf3638cdd1ef7df31a6ad700bb80574
author Martin Krause <mkr@tq-sewsrv-4.tq-net.de> Wed, 21 Jun 2006 15:41:06 +0200
committer Martin Krause <mkr@tq-sewsrv-4.tq-net.de> Wed, 21 Jun 2006 15:41:06 +0200

 board/tqm85xx/tqm85xx.c   |    8 +++-----
 drivers/keyboard.c        |    6 +++---
 drivers/ps2ser.c          |   26 +++++++++++++-------------
 include/configs/TQM85xx.h |    2 ++
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/board/tqm85xx/tqm85xx.c b/board/tqm85xx/tqm85xx.c
index befe8b7..be2dd64 100644
--- a/board/tqm85xx/tqm85xx.c
+++ b/board/tqm85xx/tqm85xx.c
@@ -27,10 +27,6 @@
  * MA 02111-1307 USA
  */
 
-#ifdef CONFIG_PS2MULT
-void ps2mult_early_init(void);
-#endif
-
 #include <common.h>
 #include <pci.h>
 #include <asm/processor.h>
@@ -46,6 +42,9 @@ extern flash_info_t flash_info[];	/* FLA
 void local_bus_init (void);
 long int fixed_sdram (void);
 ulong flash_get_size (ulong base, int banknum);
+#ifdef CONFIG_PS2MULT
+void ps2mult_early_init(void);
+#endif
 
 #ifdef CONFIG_CPM2
 /*
@@ -423,4 +422,3 @@ #endif /* CONFIG_PS2MULT */
 	return (0);
 }
 #endif /* CONFIG_BOARD_EARLY_INIT_R */
-
diff --git a/drivers/keyboard.c b/drivers/keyboard.c
index 41eccf2..9975202 100644
--- a/drivers/keyboard.c
+++ b/drivers/keyboard.c
@@ -33,7 +33,7 @@ #define	LED_NUM			0x02	/* num lock led *
 
 #define	KBD_BUFFER_LEN		0x20  /* size of the keyboardbuffer */
 
-#if defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC85xx)
+#if defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 int ps2ser_check(void);
 #endif
 
@@ -75,7 +75,7 @@ static void kbd_put_queue(char data)
 /* test if a character is in the queue */
 static int kbd_testc(void)
 {
-#if defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC85xx)
+#if defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 	/* no ISR is used, so received chars must be polled */
 	ps2ser_check();
 #endif
@@ -90,7 +90,7 @@ static int kbd_getc(void)
 {
 	char c;
 	while(in_pointer==out_pointer) {
-#if defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC85xx)
+#if defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 	/* no ISR is used, so received chars must be polled */
 	ps2ser_check();
 #endif
diff --git a/drivers/ps2ser.c b/drivers/ps2ser.c
index 8aea8fd..ec32ed2 100644
--- a/drivers/ps2ser.c
+++ b/drivers/ps2ser.c
@@ -49,7 +49,7 @@ #else
 #error CONFIG_PS2SERIAL must be in 1 ... 6
 #endif
 
-#elif defined(CONFIG_MPC85xx)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 
 #if CONFIG_PS2SERIAL == 1
 #define COM_BASE (CFG_CCSRBAR+0x4500)
@@ -59,13 +59,13 @@ #else
 #error CONFIG_PS2SERIAL must be in 1 ... 2
 #endif
 
-#endif /* CONFIG_MPC5xxx / CONFIG_MPC85xx */
+#endif /* CONFIG_MPC5xxx / CONFIG_MPC8540 / other */
 
 static int	ps2ser_getc_hw(void);
 static void	ps2ser_interrupt(void *dev_id);
 
 extern struct	serial_state rs_table[]; /* in serial.c */
-#if !defined(CONFIG_MPC5xxx) && !defined(CONFIG_MPC85xx)
+#if !defined(CONFIG_MPC5xxx) && !defined(CONFIG_MPC8540) && !defined(CONFIG_MPC8541) && !defined(CONFIG_MPC8555)
 static struct	serial_state *state;
 #endif
 
@@ -120,7 +120,7 @@ #endif
 	return (0);
 }
 
-#elif defined(CONFIG_MPC85xx)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 int ps2ser_init(void)
 {
 	NS16550_t com_port = (NS16550_t)COM_BASE;
@@ -136,7 +136,7 @@ int ps2ser_init(void)
 	return (0);
 }
 
-#else /* !CONFIG_MPC5xxx && !CONFIG_MPC85xx */
+#else /* !CONFIG_MPC5xxx && !CONFIG_MPC8540 / other */
 
 static inline unsigned int ps2ser_in(int offset)
 {
@@ -180,13 +180,13 @@ int ps2ser_init(void)
 
 	return 0;
 }
-#endif /* CONFIG_MPC5xxx / CONFIG_MPC85xx / other */
+#endif /* CONFIG_MPC5xxx / CONFIG_MPC8540 / other */
 
 void ps2ser_putc(int chr)
 {
 #ifdef CONFIG_MPC5xxx
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#elif defined(CONFIG_MPC85xx)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 	NS16550_t com_port = (NS16550_t)COM_BASE;
 #endif
 #ifdef DEBUG
@@ -197,7 +197,7 @@ #ifdef CONFIG_MPC5xxx
 	while (!(psc->psc_status & PSC_SR_TXRDY));
 
 	psc->psc_buffer_8 = chr;
-#elif defined(CONFIG_MPC85xx)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 	while ((com_port->lsr & LSR_THRE) == 0);
 	com_port->thr = chr;
 #else
@@ -211,7 +211,7 @@ static int ps2ser_getc_hw(void)
 {
 #ifdef CONFIG_MPC5xxx
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#elif defined(CONFIG_MPC85xx)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 	NS16550_t com_port = (NS16550_t)COM_BASE;
 #endif
 	int res = -1;
@@ -220,7 +220,7 @@ #ifdef CONFIG_MPC5xxx
 	if (psc->psc_status & PSC_SR_RXRDY) {
 		res = (psc->psc_buffer_8);
 	}
-#elif defined(CONFIG_MPC85xx)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 	if (com_port->lsr & LSR_DR) {
 		res = com_port->rbr;
 	}
@@ -279,7 +279,7 @@ static void ps2ser_interrupt(void *dev_i
 {
 #ifdef CONFIG_MPC5xxx
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#elif defined(CONFIG_MPC85xx)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 	NS16550_t com_port = (NS16550_t)COM_BASE;
 #endif
 	int chr;
@@ -289,7 +289,7 @@ #endif
 		chr = ps2ser_getc_hw();
 #ifdef CONFIG_MPC5xxx
 		status = psc->psc_status;
-#elif defined(CONFIG_MPC85xx)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 		status = com_port->lsr;
 #else
 		status = ps2ser_in(UART_IIR);
@@ -305,7 +305,7 @@ #endif
 		}
 #ifdef CONFIG_MPC5xxx
 	} while (status & PSC_SR_RXRDY);
-#elif defined(CONFIG_MPC85xx)
+#elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
 	} while (status & LSR_DR);
 #else
 	} while (status & UART_IIR_RDI);
diff --git a/include/configs/TQM85xx.h b/include/configs/TQM85xx.h
old mode 100644
new mode 100755
index da6946b..bda85e0
--- a/include/configs/TQM85xx.h
+++ b/include/configs/TQM85xx.h
@@ -178,11 +178,13 @@ #define CFG_BAUDRATE_TABLE  \
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400,115200}
 
 /* PS/2 Keyboard */
+#if !defined(CONFIG_TQM8560)
 #define CONFIG_PS2KBD			/* AT-PS/2 Keyboard		*/
 #define CONFIG_PS2MULT			/* .. on PS/2 Multiplexer	*/
 #define CONFIG_PS2SERIAL	2	/* .. on DUART2			*/
 #define CONFIG_PS2MULT_DELAY	(CFG_HZ/2)	/* Initial delay	*/
 #define CONFIG_BOARD_EARLY_INIT_R	1
+#endif /* !CONFIG_TQM8560 */
 
 /* Use the HUSH parser */
 #define CFG_HUSH_PARSER
