All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] [patch] Get superio serial to work with 2.6
@ 2003-12-07  4:10 Randolph Chung
  2003-12-07  8:20 ` Grant Grundler
  0 siblings, 1 reply; 4+ messages in thread
From: Randolph Chung @ 2003-12-07  4:10 UTC (permalink / raw)
  To: parisc-linux

This patch is needed to get serial console to work on SuckyIO based
systems on 2.6. It was mostly done by Grant (and willy, I think)

Unfortunately it requires disabling some bits of code in inventory. What
do you guys think?

Can someone try this on a suckyio system that has USB running?

randolph


Index: arch/parisc/kernel/inventory.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/inventory.c,v
retrieving revision 1.2
diff -u -p -r1.2 inventory.c
--- arch/parisc/kernel/inventory.c	14 Sep 2003 06:37:40 -0000	1.2
+++ arch/parisc/kernel/inventory.c	7 Dec 2003 03:58:22 -0000
@@ -532,7 +532,12 @@ static void __init system_map_inventory(
 	 * Otherwise the machine might crash during iommu setup.
 	 */
 	pdc_io_reset();
-	pdc_io_reset_devices();
+
+	/*
+	 * Unfortunately if we reset devices here, serial console
+	 * stops working :-(
+	 */
+	/* pdc_io_reset_devices(); */
 #endif
 
 	for (i = 0; status != PDC_BAD_PROC && status != PDC_NE_MOD; i++) {
Index: drivers/parisc/superio.c
===================================================================
RCS file: /var/cvs/linux-2.6/drivers/parisc/superio.c,v
retrieving revision 1.3
diff -u -p -r1.3 superio.c
--- drivers/parisc/superio.c	28 Sep 2003 21:04:34 -0000	1.3
+++ drivers/parisc/superio.c	7 Dec 2003 03:58:22 -0000
@@ -65,7 +65,9 @@
 #include <linux/ioport.h>
 #include <linux/parport.h>
 #include <linux/parport_pc.h>
-#include <linux/serial_reg.h>
+#include <linux/termios.h>
+#include <linux/tty.h>
+#include <linux/serial_core.h>
 #include <asm/io.h>
 #include <asm/hardware.h>
 #include <asm/irq.h>
@@ -387,11 +389,27 @@ int superio_fixup_irq(struct pci_dev *pc
 	return(sio_dev.irq_region->data.irqbase + local_irq);
 }
 
+static struct uart_port serial[] = {
+	{
+		.iotype		= UPIO_PORT,
+		.line		= 0,
+		.type		= PORT_16550A,
+		.uartclk	= 115200*16,
+		.fifosize	= 16,
+	},
+	{
+		.iotype		= UPIO_PORT,
+		.line		= 1,
+		.type		= PORT_16550A,
+		.uartclk	= 115200*16,
+		.fifosize	= 16,
+	}
+};
+
 void __devinit
 superio_serial_init(void)
 {
 #ifdef CONFIG_SERIAL_8250
-	struct serial_struct *serial;
 	int retval;
 	
 	if (!sio_dev.irq_region)
@@ -400,47 +418,15 @@ superio_serial_init(void)
 	if (!sio_dev.iosapic_irq_enabled)
 		superio_init(&sio_dev);
 
-	serial = kmalloc(2 * sizeof (struct serial_struct), GFP_KERNEL);
-
-	if (!serial) {
-		printk(KERN_WARNING "SuperIO: Could not get memory for serial struct.\n");
-		return;
-	}
-
-	memset(serial, 0, 2 * sizeof (struct serial_struct));
-
-	serial->type = PORT_16550A;
-	serial->line = 0;
-	serial->port = sio_dev.sp1_base;
-	serial->port_high = 0;
-	serial->irq = sio_dev.irq_region->data.irqbase + SP1_IRQ;
-	serial->io_type = SERIAL_IO_PORT;
-	serial->flags = 0;
-	serial->xmit_fifo_size = 16;
-	serial->custom_divisor = 0;
-	serial->baud_base = 115200;
+	serial[0].iobase = sio_dev.sp1_base;
+	retval = early_serial_setup(&serial[0]);
 
-	retval = register_serial(serial);
-	if (retval < 0) {
+	if (retval < 0)
 		printk(KERN_WARNING "SuperIO: Register Serial #0 failed.\n");
-		kfree (serial);
-		return;
-	}
-
-	serial++;
 
-	serial->type = PORT_16550A;
-	serial->line = 1;
-	serial->port = sio_dev.sp2_base;
-	serial->port_high = 0;
-	serial->irq = sio_dev.irq_region->data.irqbase + SP2_IRQ;
-	serial->io_type = SERIAL_IO_PORT;
-	serial->flags = 0;
-	serial->xmit_fifo_size = 16;
-	serial->custom_divisor = 0;
-	serial->baud_base = 115200;
+	serial[1].iobase = sio_dev.sp2_base;
+	retval = early_serial_setup(&serial[1]);
 
-	retval = register_serial(serial);
 	if (retval < 0)
 		printk(KERN_WARNING "SuperIO: Register Serial #1 failed.\n");
 #endif /* CONFIG_SERIAL_8250 */
@@ -543,5 +529,5 @@ static void __exit superio_exit(void)
  *
  * FIXME: does this break the superio console?
  */
-late_initcall(superio_modinit);
+module_init(superio_modinit);
 module_exit(superio_exit);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [parisc-linux] [patch] Get superio serial to work with 2.6
  2003-12-07  4:10 [parisc-linux] [patch] Get superio serial to work with 2.6 Randolph Chung
@ 2003-12-07  8:20 ` Grant Grundler
  2003-12-07  8:44   ` Randolph Chung
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Grundler @ 2003-12-07  8:20 UTC (permalink / raw)
  To: Randolph Chung; +Cc: parisc-linux

On Sat, Dec 06, 2003 at 08:10:18PM -0800, Randolph Chung wrote:
> This patch is needed to get serial console to work on SuckyIO based
> systems on 2.6. It was mostly done by Grant (and willy, I think)
> 
> Unfortunately it requires disabling some bits of code in inventory. What
> do you guys think?

My preference right now is to move those PDC calls into sba_cdio.c.
Then add hueristics that call PDC_IO_RESET_AND_CLEAR if suckyio/USB
is active or the LAN active. If suckyio serial console, then add code
to save/restore suckyio config space around the reset.

So quite a bit of hackery that's really only needed when the
IO MMU is actually used.

> Can someone try this on a suckyio system that has USB running?

hrm...I don't have the serial console setup at the moment.
I suggest plugging in a USB mouse and moving the mouse around
during boot. Not sure that's sufficient but maybe.

The USB/DMA problem occurs when booting with USB Keyboard/mouse
and not a serial console. Ie, until 2.6.0 boots with STICON
enabled, I can't really test the USB/DMA stuff.

grant

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [parisc-linux] [patch] Get superio serial to work with 2.6
  2003-12-07  8:20 ` Grant Grundler
@ 2003-12-07  8:44   ` Randolph Chung
  2003-12-07 18:15     ` Grant Grundler
  0 siblings, 1 reply; 4+ messages in thread
From: Randolph Chung @ 2003-12-07  8:44 UTC (permalink / raw)
  To: Grant Grundler; +Cc: parisc-linux

> My preference right now is to move those PDC calls into sba_cdio.c.

hmmm.. that looks like a hpux name ;-) sba_iommu.c? 

> Then add hueristics that call PDC_IO_RESET_AND_CLEAR if suckyio/USB
> is active or the LAN active. If suckyio serial console, then add code
> to save/restore suckyio config space around the reset.
> 
> So quite a bit of hackery that's really only needed when the
> IO MMU is actually used.

ok, so should i just keep this patch in my private tree for now? or
commit it and let you fix the rest of it? ;-)

> hrm...I don't have the serial console setup at the moment.
> I suggest plugging in a USB mouse and moving the mouse around
> during boot. Not sure that's sufficient but maybe.

i doubt that will make a difference. if the usb driver is not yet loaded
(i.e. during inventory) i don't thing any usb events will be happening,
right? anyway, i guess i can try this tomorrow.

randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [parisc-linux] [patch] Get superio serial to work with 2.6
  2003-12-07  8:44   ` Randolph Chung
@ 2003-12-07 18:15     ` Grant Grundler
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Grundler @ 2003-12-07 18:15 UTC (permalink / raw)
  To: Randolph Chung; +Cc: parisc-linux

On Sun, Dec 07, 2003 at 12:44:31AM -0800, Randolph Chung wrote:
> > My preference right now is to move those PDC calls into sba_cdio.c.
> 
> hmmm.. that looks like a hpux name ;-) sba_iommu.c? 

yeah...brainfart. I was up too late last night again...

> > Then add hueristics that call PDC_IO_RESET_AND_CLEAR if suckyio/USB
> > is active or the LAN active. If suckyio serial console, then add code
> > to save/restore suckyio config space around the reset.
> > 
> > So quite a bit of hackery that's really only needed when the
> > IO MMU is actually used.
> 
> ok, so should i just keep this patch in my private tree for now? or
> commit it and let you fix the rest of it? ;-)

commit and I'll fix the rest later.

> > hrm...I don't have the serial console setup at the moment.
> > I suggest plugging in a USB mouse and moving the mouse around
> > during boot. Not sure that's sufficient but maybe.
> 
> i doubt that will make a difference. if the usb driver is not yet loaded
> (i.e. during inventory) i don't thing any usb events will be happening,
> right? anyway, i guess i can try this tomorrow.

It does make a difference. The IODC left HW in an enabled and operational
state when it handed off to the OS. That's harmless for a serial console.
It's not harmless when the device can master DMA transactions and we
reprogram the IO MMU.

grant

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-12-07 18:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-07  4:10 [parisc-linux] [patch] Get superio serial to work with 2.6 Randolph Chung
2003-12-07  8:20 ` Grant Grundler
2003-12-07  8:44   ` Randolph Chung
2003-12-07 18:15     ` Grant Grundler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.