Linux PARISC architecture development
 help / color / mirror / Atom feed
* [parisc-linux] [PATCH] SuckyIO still doesn't work
@ 2003-10-15 14:10 Matthew Wilcox
  2003-10-22  6:39 ` Grant Grundler
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2003-10-15 14:10 UTC (permalink / raw)
  To: parisc-linux

This patch doesn't make suckyio serial work.  But I think it's along
the right lines.  Anybody else want to play with this, go ahead.

Without the 
+       serial8250_console_init();
line in superio.c, we get:

SuperIO: USB regulator enabled
parport0: PC-style at 0x378, irq 101 [PCSPP(,...)]
Registering serial 0
Registering serial 1
superio_probe(0000:00:0e.2) ven 0x100b dev 0x12 sv 0x0 sd 0x0 class 0xc0310
SuperIO: probe of 0000:00:0e.2 failed with error -1
Soft power switch enabled, polling @ 0xf0400804.
Console: switching to colour frame buffer device 128x48
pty: 256 Unix98 ptys configured
lp0: using parport0 (interrupt-driven).
Generic RTC Driver v1.07
Serial: 8250/16550 driver $Revision: 1.90 $ 13 ports, IRQ sharing enabled
ttyS0 at I/O 0x3f8 (irq = 99) is a 16550A
(garbage)

With it:

SuperIO: USB regulator enabled
parport0: PC-style at 0x378, irq 101 [PCSPP(,...)]
Registering serial 0
(garbage)

I wonder if possibly we're not unregistering the PDC console properly
so they're both trying to drive the serial port with awful consequences.

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	15 Oct 2003 12:59:05 -0000
@@ -526,7 +526,7 @@ static void __init system_map_inventory(
 	int i;
 	long status = PDC_OK;
     
-#if defined(CONFIG_IOMMU_SBA) && defined(CONFIG_SUPERIO)
+#if defined(CONFIG_IOMMU_SBA) && defined(CONFIG_SUPERIO) && 0
 	/*
 	 * Stop the suckyio usb controller on Astro based systems.
 	 * Otherwise the machine might crash during iommu setup.
Index: arch/parisc/kernel/pdc_cons.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/pdc_cons.c,v
retrieving revision 1.4
diff -u -p -r1.4 pdc_cons.c
--- arch/parisc/kernel/pdc_cons.c	14 Oct 2003 11:33:39 -0000	1.4
+++ arch/parisc/kernel/pdc_cons.c	15 Oct 2003 01:57:05 -0000
@@ -12,7 +12,7 @@
 
 /* Define EARLY_BOOTUP_DEBUG to debug kernel related boot problems. 
  * On production kernels EARLY_BOOTUP_DEBUG should be undefined. */
-#undef EARLY_BOOTUP_DEBUG
+#define EARLY_BOOTUP_DEBUG
 
 
 #include <linux/config.h>
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	15 Oct 2003 13:22:56 -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>
@@ -76,7 +78,7 @@ static struct superio_device sio_dev = {
 };
 
 
-#undef DEBUG_INIT
+#define DEBUG_INIT
 
 void
 superio_inform_irq(int irq)
@@ -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,
+		.fifosize	= 16,
+	},
+	{
+		.iotype		= UPIO_PORT,
+		.line		= 1,
+		.type		= PORT_16550A,
+		.uartclk	= 115200,
+		.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,26 @@ 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->iobase = sio_dev.sp1_base;
 	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;
 
-	retval = register_serial(serial);
+	printk("Registering serial 0\n");
+	retval = early_serial_setup(&serial[0]);
 	if (retval < 0) {
 		printk(KERN_WARNING "SuperIO: Register Serial #0 failed.\n");
-		kfree (serial);
 		return;
 	}
+	serial8250_console_init();
 
-	serial++;
-
-	serial->type = PORT_16550A;
-	serial->line = 1;
-	serial->port = sio_dev.sp2_base;
-	serial->port_high = 0;
+	serial->iobase = sio_dev.sp2_base;
 	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;
-
-	retval = register_serial(serial);
+	printk("Registering serial 1\n");
+	retval = early_serial_setup(&serial[1]);
 	if (retval < 0)
 		printk(KERN_WARNING "SuperIO: Register Serial #1 failed.\n");
 #endif /* CONFIG_SERIAL_8250 */
@@ -504,9 +501,7 @@ static int __devinit superio_probe(struc
 #ifdef CONFIG_PARPORT_PC
 		superio_parport_init();
 #endif
-#ifdef CONFIG_SERIAL_8250
 		superio_serial_init();
-#endif
 		/* REVISIT : superio_fdc_init() ? */
 		return 0;
 	} else {
@@ -538,10 +533,5 @@ static void __exit superio_exit(void)
 	pci_unregister_driver(&superio_driver);
 }
 
-/* Make late initcall to ensure the serial and tty layers are initialised
- * before we start superio.
- *
- * FIXME: does this break the superio console?
- */
-late_initcall(superio_modinit);
+module_init(superio_modinit);
 module_exit(superio_exit);

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

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

* Re: [parisc-linux] [PATCH] SuckyIO still doesn't work
  2003-10-15 14:10 [parisc-linux] [PATCH] SuckyIO still doesn't work Matthew Wilcox
@ 2003-10-22  6:39 ` Grant Grundler
  2003-11-03 14:50   ` Joel Soete
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Grundler @ 2003-10-22  6:39 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: parisc-linux

On Wed, Oct 15, 2003 at 03:10:18PM +0100, Matthew Wilcox wrote:
> This patch doesn't make suckyio serial work.  But I think it's along
> the right lines.  Anybody else want to play with this, go ahead.

I did. My resulting patch cleans up a few more things and still
needs yet more cleanup. But gets alot further now.
Problems are starting to look generic.
Current patch on ftp.p-l.o:patches/diff-2.6.0-suckyio-serial-03

I do like the static initializers much better.
And I've moved the pdc_io_reset() calls to sba driver where they belong.
I do need to add more code to:
	(1) determine when we need to reset (ie is USB active)
	(2a) unregister pdc_console (ie don't try to talk to it)
	(2b) resurrect serial config after reset (try to keep pdc_cons working)

Main problem I was seeing is a divide by zero trap
when setting up the baud rate.

> +static struct uart_port serial[] = {
> +	{
> +		.iotype		= UPIO_PORT,
> +		.line		= 0,
> +		.type		= PORT_16550A,
> +		.uartclk	= 115200,
> +		.fifosize	= 16,
> +	},

/me whacks willy's hand with a ruler...
(ok, not really called for, silly me didn't see the semi-obvious and
burned over 6 hours on Sunday+Monday night tracking this down)

Should read:
	.uartclk        = 115200*16,

uartclk/16 is used to determine the max baud rate.

        baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);

and since 9600 > 115200/16,  uart_get_baud_rate() returns 0...


My c3k now gets to:
....
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 364k freed
      _______________________________
     < Your System ate a SPARC! Gah! >
      -------------------------------
             \   ^__^
              \  (xx)\_______
                 (__)\       )\/\
                  U  ||----w |
                     ||     ||
swapper (pid 1): Breakpoint (code 0)

     YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
PSW: 00000000000001001111011100001111 Not tainted
r00-03  00000000 10339430 101f4044 00000003
r04-07  00000063 10212568 00000000 103062f0
r08-11  00000002 000f41fa 4e4da280 103d9404
r12-15  3ccbf700 1034e810 103d9010 f0400004
r16-19  f00008c4 f000017c f0000174 00000000
r20-23  00000003 00000000 101f3fec 103062f0
r24-27  000000d3 00000003 10355848 10330010
r28-31  00000060 10f0e940 4ffa8580 10104bfc
sr0-3   00000000 00000000 00000000 00000000
sr4-7   00000000 00000000 00000000 00000000

IASQ: 00000000 00000000 IAOQ: 1037c748 1037c74c
 IIR: 00000000    ISR: 00000000  IOR: 00000000
 CPU:        0   CR30: 4ffa8000 CR31: 10367000
 ORIG_R28: 00000034
<2><2><0>Kernel panic: Attempted to kill init!

IOAQ: 0x1037c748 superio_init+0
GR02: 0x101f4044 superio_enable_irq+58

...
superio_init(superio_device *sio)
{
        struct pci_dev *pdev = sio->lio_pdev;
...

Mystery #1: Don't understand why sio is invalid.

Commenting out the superio_init() call from superio_enable_irq()
lets the machine boot though.

...
md: ... autorun DONE.
kjournald starting.  Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 364k freed
superio_enable_irq(10355848, 3)
superio_enable_irq(10355848, 3)
superio_enable_irq(10355848, 3)
superio_enable_irq(10355848, 3)
superio_enable_irq(10355848, 3)
superio_enable_irq(10355848, 3)
Adding 263144k swap on /dev/sda1.  Priority:-1 extents:1
EXT3 FS on sda3, internal journal
ip_conntrack version 2.1 (8081 buckets, 64648 max) - 300 bytes per conntrack
kjournald starting.  Commit interval 5 seconds
EXT3 FS on sda4, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
drivers/usb/core/usb.c: registered new driver usbfs
drivers/usb/core/usb.c: registered new driver hub
drivers/usb/core/usb.c: deregistering driver usbfs
drivers/usb/core/usb.c: deregistering driver hub
ip_tables: (C) 2000-2002 Netfilter core team
...
drivers/usb/core/usb.c: deregistering driver usbfs                              
drivers/usb/core/usb.c: deregistering driver hub                                
ip_tables: (C) 2000-2002 Netfilter core team                                    
eth0: Setting full-duplex based on MII#1 link partner capability of 45e1.       
<end of output>


Mystery #2: why is superio_enable_irq() getting called so often?

Waiting patiently for login prompt...can ping the machine but
can't ssh into it (yet)...bedtime. Probably need to TOC the machine
to see what it's spinning on. Another day.

hth,
grant

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

* Re: [parisc-linux] [PATCH] SuckyIO still doesn't work
  2003-10-22  6:39 ` Grant Grundler
@ 2003-11-03 14:50   ` Joel Soete
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Soete @ 2003-11-03 14:50 UTC (permalink / raw)
  To: Grant Grundler, Matthew Wilcox; +Cc: parisc-linux

Hi Grant,


> Current patch on ftp.p-l.o:patches/diff-2.6.0-suckyio-serial-03

I apply your patch against 2.6.0-test9-pa4 but not yet boot on the b2k  :(
I stopped at another place now and not any more on a div by zero:
[...]
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
Initializing Cryptographic API
superio_probe(0000:00:0e.0) ven 0x100b dev 0x2 sv 0x0 sd 0x0 class 0x1018a
SuperIO: Found NS87560 Legacy I/O device at 0000:00:0e.1 (IRQ 64) 
SuperIO: Serial port 1 at 0x3f8
SuperIO: Serial port 2 at 0x2f8
SuperIO: Parallel port at 0x378
SuperIO: Floppy controller at 0x3f0
SuperIO: ACPI at 0x7e0
SuperIO: USB regulator enabled
superio_probe: IDE 87415
superio_probe(0000:00:0e.1) ven 0x100b dev 0xe sv 0x0 sd 0x0 class 0x68000
parport0: PC-style at 0x378, irq 101 [PCSPP(,...)]
Registering serial 0
Registering serial 1
superio_probe(0000:00:0e.2) ven 0x100b dev 0x12 sv 0x0 sd 0x0 class 0xc0310
superio_probe: USB OHCI controller
Soft power switch enabled, polling @ 0xf0400804.
pty: 256 Unix98 ptys configured
lp0: using parport0 (interrupt-driven).
Generic RTC Driver v1.07
Serial: 8250/16550 driver $Revision: 1.90 $ 13 ports, IRQ sharing enabled
ttyS0 at I/O 0x3f8 (irq = 99) is a 16550A
flags= 0 (uart_get_baud_rate() ).
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
[...]
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused kernel memory: 504k freed
      _______________________________ 
     < Your System ate a SPARC! Gah! >
      ------------------------------- 
             \   ^__^
              \  (xx)\_______
                 (__)\       )\/\
                  U  ||----w |
                     ||     ||
swapper (pid 1): Breakpoint (code 0)

     YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
PSW: 00000000000001001111111100001111 Not tainted
r00-03  00000000 103eb800 101f83d8 0000001c
r04-07  00000063 10216a60 00000000 1034e4a4
r08-11  00000002 0098963a 4df21500 10461844
r12-15  3b9aca00 1038f810 10461810 f0400004
r16-19  f00008c4 f000017c f0000174 00000000
r20-23  00000003 00000000 101f8380 1034e4a4
r24-27  000000d3 00000003 10396d28 10378010
r28-31  00000060 1fe5f940 10718580 10107014
sr0-3   00000000 00000000 00000000 00000000
sr4-7   00000000 00000000 00000000 00000000

IASQ: 00000000 00000000 IAOQ: 103ebdbc 103ebdc0
 IIR: 00000000    ISR: 00000000  IOR: 00000000
 CPU:        0   CR30: 10718000 CR31: 103d1000
 ORIG_R28: 1fe9a48c
 IAOQ[0]: superio_init+0x0/0x410
 IAOQ[1]: superio_init+0x4/0x410
 RP(r2): superio_enable_irq+0x58/0x84
Kernel panic: Attempted to kill init!
 
But I never encounter such do_page_fault().

Thanks in advance for additional help,
    Joel


-------------------------------------------------------------------------
Tiscali ADSL: 3 mois GRATUITS! L'Internet rapide, c'est pour tout le monde.

http://reg.tiscali.be/default.asp?lg=fr

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

end of thread, other threads:[~2003-11-03 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-15 14:10 [parisc-linux] [PATCH] SuckyIO still doesn't work Matthew Wilcox
2003-10-22  6:39 ` Grant Grundler
2003-11-03 14:50   ` Joel Soete

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox