[parisc-linux-cvs] [PATCH] Fixup serial mux so it works again.

Ryan Bradetich rbradetich@uswest.net
Thu, 09 Oct 2003 23:41:47 -0600


--=-Das1GKv7u8IaRYHUnRfC
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

This patch fixes up the serial mux so it works again.

Thanks,

- Ryan



--=-Das1GKv7u8IaRYHUnRfC
Content-Disposition: attachment; filename=mux.diff
Content-Type: text/x-patch; name=mux.diff; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: 7bit

Index: Makefile
===================================================================
RCS file: /var/cvs/linux-2.6/Makefile,v
retrieving revision 1.70
diff -u -p -r1.70 Makefile
--- Makefile	10 Oct 2003 02:15:32 -0000	1.70
+++ Makefile	10 Oct 2003 04:44:57 -0000
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 0
-EXTRAVERSION = -test7-pa3
+EXTRAVERSION = -test7-pa4
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
Index: arch/parisc/kernel/pdc_cons.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/pdc_cons.c,v
retrieving revision 1.1
diff -u -p -r1.1 pdc_cons.c
--- arch/parisc/kernel/pdc_cons.c	29 Jul 2003 17:00:41 -0000	1.1
+++ arch/parisc/kernel/pdc_cons.c	10 Oct 2003 04:44:57 -0000
@@ -61,16 +61,6 @@ static struct tty_driver * pdc_console_d
 	*index = c->index ? c->index-1 : fg_console;
 	return &console_driver;
 }
-
-#elif defined(CONFIG_SERIAL_MUX)
-#warning CONFIG_SERIAL_MUX
-#define PDC_CONSOLE_DEVICE pdc_console_device
-#warning "FIXME - should be: static struct tty_driver * pdc_console_device (struct console *c, int *index)"
-static kdev_t pdc_console_device (struct console *c, int *index)
-{
-        return mk_kdev(MUX_MAJOR, 0);
-}
-
 #else
 #define PDC_CONSOLE_DEVICE NULL
 #endif
@@ -105,7 +95,7 @@ static void pdc_console_init_force(void)
 
 void __init pdc_console_init(void)
 {
-#if defined(EARLY_BOOTUP_DEBUG) || defined(CONFIG_PDC_CONSOLE) || defined(CONFIG_SERIAL_MUX)
+#if defined(EARLY_BOOTUP_DEBUG) || defined(CONFIG_PDC_CONSOLE)
 	pdc_console_init_force();
 #endif
 #ifdef EARLY_BOOTUP_DEBUG
Index: drivers/serial/mux.c
===================================================================
RCS file: /var/cvs/linux-2.6/drivers/serial/mux.c,v
retrieving revision 1.1
diff -u -p -r1.1 mux.c
--- drivers/serial/mux.c	29 Jul 2003 17:01:31 -0000	1.1
+++ drivers/serial/mux.c	10 Oct 2003 04:44:57 -0000
@@ -24,6 +24,7 @@
 #include <linux/serial.h>
 #include <linux/console.h>
 #include <linux/slab.h>
+#include <linux/delay.h> /* for udelay */
 #include <asm/io.h>
 #include <asm/parisc-device.h>
 
@@ -181,7 +182,7 @@ static void mux_write(struct uart_port *
 		return;
 	}
 
-	count = (port->fifosize >> 1) - UART_GET_FIFO_CNT(port);
+	count = (port->fifosize) - UART_GET_FIFO_CNT(port);
 	do {
 		UART_PUT_CHAR(port, xmit->buf[xmit->tail]);
 		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
@@ -191,6 +192,9 @@ static void mux_write(struct uart_port *
 
 	} while(--count > 0);
 
+	while(UART_GET_FIFO_CNT(port)) 
+		udelay(1);
+
 	if(uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(port);
 
@@ -378,11 +382,34 @@ static void mux_poll(unsigned long unuse
 
 
 #ifdef CONFIG_SERIAL_MUX_CONSOLE
+static void mux_console_write(struct console *co, const char *s, unsigned count)
+{
+        while(count--)
+                pdc_iodc_putc(*s++);
+}
+
+static int mux_console_setup(struct console *co, char *options)
+{
+        return 0;
+}
+
+struct tty_driver *mux_console_device(struct console *co, int *index)
+{
+	struct mux_card *card = &mux_card_head;
+                                                                                                               
+        *index = co->index;
+	return card->drv.tty_driver;
+}
+
 static struct console mux_console = {
 	.name =		"ttyB",
-	.flags =	CON_PRINTBUFFER,
+	.write =	mux_console_write,
+	.device =	mux_console_device,
+	.setup =	mux_console_setup,
+	.flags =	CON_BOOT|CON_PRINTBUFFER|CON_ENABLED,
 	.index =	0,
 };
+
 #define MUX_CONSOLE	&mux_console
 #else
 #define MUX_CONSOLE	NULL
@@ -487,6 +514,10 @@ static int __init mux_probe(struct paris
 		}
 		port_cnt += UART_NR;
 	}
+
+#ifdef CONFIG_SERIAL_MUX_CONSOLE
+        register_console(&mux_console);
+#endif
 	return 0;
 }
 

--=-Das1GKv7u8IaRYHUnRfC--