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 22 Oct 2003 06:08:24 -0000 @@ -526,15 +526,6 @@ static void __init system_map_inventory( int i; long status = PDC_OK; -#if defined(CONFIG_IOMMU_SBA) && defined(CONFIG_SUPERIO) - /* - * Stop the suckyio usb controller on Astro based systems. - * Otherwise the machine might crash during iommu setup. - */ - pdc_io_reset(); - pdc_io_reset_devices(); -#endif - for (i = 0; status != PDC_BAD_PROC && status != PDC_NE_MOD; i++) { struct parisc_device *dev; struct pdc_system_map_mod_info module_result; 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 22 Oct 2003 06:08:24 -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 Index: drivers/parisc/Kconfig =================================================================== RCS file: /var/cvs/linux-2.6/drivers/parisc/Kconfig,v retrieving revision 1.3 diff -u -p -r1.3 Kconfig --- drivers/parisc/Kconfig 15 Oct 2003 14:01:11 -0000 1.3 +++ drivers/parisc/Kconfig 22 Oct 2003 06:08:26 -0000 @@ -106,6 +106,9 @@ config IOMMU_SBA #config PCI_EPIC # bool "EPIC/SAGA PCI support" # depends on PCI +# default y +# help +# Say Y here for V-class PCI, DMA/IOMMU, IRQ subsystem support. config SUPERIO bool "SuperIO (SuckyIO) support" Index: drivers/parisc/sba_iommu.c =================================================================== RCS file: /var/cvs/linux-2.6/drivers/parisc/sba_iommu.c,v retrieving revision 1.4 diff -u -p -r1.4 sba_iommu.c --- drivers/parisc/sba_iommu.c 8 Sep 2003 22:00:24 -0000 1.4 +++ drivers/parisc/sba_iommu.c 22 Oct 2003 06:08:26 -0000 @@ -1680,6 +1680,28 @@ sba_hw_init(struct sba_device *sba_dev) int num_ioc; u64 ioc_ctl; +#if 0 && defined(CONFIG_SUPERIO) + +figure out if we need to reset the IO channels or not. +pdc_pci.c:pci_Pdc_Config_Read(PdcRaddr_t r_addr[], hpa_t hpa, word config_reg, int size) + + { + /* + * Stop the suckyio usb controller. + * USB might DMA after IO PDIR setup and crash the box. + * + * Similarly, if network was used to load image+initrd, + * NIC will still be listening.... + */ + pdc_io_reset_devices(); + + /* But the above blows the serial console out of the water. + * Have PDC reconfigure. + */ + pdc_io_reset_and_clear(); + } +#endif + ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL); DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->", __FUNCTION__, sba_dev->sba_hpa, ioc_ctl); 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 22 Oct 2003 06:08:26 -0000 @@ -65,7 +65,9 @@ #include #include #include -#include +#include +#include +#include #include #include #include @@ -76,7 +78,13 @@ static struct superio_device sio_dev = { }; -#undef DEBUG_INIT +#define DEBUG_SUPERIO_INIT + +#ifdef DEBUG_SUPERIO_INIT +#define DBG_INIT(x...) printk(x) +#else +#define DBG_INIT(x...) +#endif void superio_inform_irq(int irq) @@ -153,6 +161,9 @@ superio_init(struct superio_device *sio) u16 word; u8 i; + if (sio->iosapic_irq_enabled) + return; + if (!pdev || sio->iosapic_irq == -1) { printk(KERN_ERR "All SuperIO functions not found!\n"); BUG(); @@ -257,9 +268,9 @@ superio_init(struct superio_device *sio) } sio->iosapic_irq_enabled = 1; - } + static void superio_disable_irq(void *dev, int local_irq) { @@ -294,12 +305,9 @@ superio_enable_irq(void *dev, int local_ * It's possible that we haven't initialized the legacy IO * function yet. If not, do it now. */ - - if (!sio->iosapic_irq_enabled) - superio_init(sio); + superio_init(sio); /* Unmask interrupt */ - r8 = inb(IC_PIC1+1); r8 &= ~(1 << local_irq); outb (r8,IC_PIC1+1); @@ -324,7 +332,7 @@ static struct irq_region_ops superio_irq .unmask_irq = superio_unmask_irq }; -#ifdef DEBUG_INIT +#ifdef DEBUG_SUPERIO_INIT static unsigned short expected_device[3] = { PCI_DEVICE_ID_NS_87415, PCI_DEVICE_ID_NS_87560_LIO, @@ -336,7 +344,7 @@ int superio_fixup_irq(struct pci_dev *pc { int local_irq; -#ifdef DEBUG_INIT +#ifdef DEBUG_SUPERIO_INIT int fn; fn = PCI_FUNC(pcidev->devfn); @@ -387,89 +395,74 @@ 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) return; /* superio not present */ - 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; } - serial++; +#if 0 + serial8250_console_init(); +#endif - 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 */ } -EXPORT_SYMBOL(superio_serial_init); - -#ifdef CONFIG_PARPORT_PC -void __devinit +static void __devinit superio_parport_init(void) { - if (!sio_dev.irq_region) - return; /* superio not present */ - - if (!sio_dev.iosapic_irq_enabled) - superio_init(&sio_dev); - - if (!parport_pc_probe_port(sio_dev.pp_base, - 0 /*base_hi*/, - sio_dev.irq_region->data.irqbase + PAR_IRQ, - PARPORT_DMA_NONE /* dma */, - NULL /*struct pci_dev* */)) +#ifdef CONFIG_PARPORT_PC + if (!parport_pc_probe_port(sio_dev.pp_base, + 0 /*base_hi*/, + sio_dev.irq_region->data.irqbase + PAR_IRQ, + PARPORT_DMA_NONE /* dma */, + NULL /*struct pci_dev* */) ) printk(KERN_WARNING "SuperIO: Probing parallel port failed.\n"); -} - -EXPORT_SYMBOL(superio_parport_init); #endif /* CONFIG_PARPORT_PC */ +} int @@ -485,35 +478,34 @@ EXPORT_SYMBOL(superio_get_ide_irq); static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_id *id) { -#ifdef DEBUG_INIT - printk("superio_probe(%s) ven 0x%x dev 0x%x sv 0x%x sd 0x%x class 0x%x\n", + + /* + ** superio_probe(00:0e.0) ven 0x100b dev 0x2 sv 0x0 sd 0x0 class 0x1018a + ** superio_probe(00:0e.1) ven 0x100b dev 0xe sv 0x0 sd 0x0 class 0x68000 + ** superio_probe(00:0e.2) ven 0x100b dev 0x12 sv 0x0 sd 0x0 class 0xc0310 + */ + DBG_INIT("superio_probe(%s) ven 0x%x dev 0x%x sv 0x%x sd 0x%x class 0x%x\n", pci_name(dev), dev->vendor, dev->device, dev->subsystem_vendor, dev->subsystem_device, dev->class); -/* -** superio_probe(00:0e.0) ven 0x100b dev 0x2 sv 0x0 sd 0x0 class 0x1018a -** superio_probe(00:0e.1) ven 0x100b dev 0xe sv 0x0 sd 0x0 class 0x68000 -** superio_probe(00:0e.2) ven 0x100b dev 0x12 sv 0x0 sd 0x0 class 0xc0310 -*/ -#endif - /* superio_fixup_irq(dev); */ + superio_init(&sio_dev); - if (dev->device == PCI_DEVICE_ID_NS_87560_LIO) { -#ifdef CONFIG_PARPORT_PC + if (dev->device == PCI_DEVICE_ID_NS_87415) { /* Function 0 */ + DBG_INIT("superio_probe: IDE 87415\n"); + return 0; + } else if (dev->device == PCI_DEVICE_ID_NS_87560_LIO) { /* Function 1 */ superio_parport_init(); -#endif -#ifdef CONFIG_SERIAL_8250 superio_serial_init(); -#endif - /* REVISIT : superio_fdc_init() ? */ + /* REVISIT XXX : superio_fdc_init() ? */ + return 0; + } else if (dev->device == PCI_DEVICE_ID_NS_87560_USB) { /* Function 2 */ + DBG_INIT("superio_probe: USB OHCI controller\n"); return 0; } else { - /* don't claim this device; let whatever either driver - * do it - */ - return -1; + /* Let appropriate other driver claim this device. */ + return 0; } } @@ -538,10 +530,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);