[parisc-linux-cvs] 2.4.17-pa27

Thomas Bogendoerfer tsbogend@alpha.franken.de
Fri, 15 Feb 2002 23:37:30 +0100


Hi,

USB works for me now, even if a keyboard is plugged during power up. Thanks
tausq for the ACPI part of the patch.

Thomas.

Index: arch/parisc/kernel/superio.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/superio.c,v
retrieving revision 1.18
diff -u -p -r1.18 superio.c
--- arch/parisc/kernel/superio.c	2002/02/09 07:47:52	1.18
+++ arch/parisc/kernel/superio.c	2002/02/15 21:41:07
@@ -179,9 +179,13 @@ superio_init(struct superio_device *sio)
 	pci_read_config_word (pdev, SIO_FDCBAR, &sio->fdc_base);
 	sio->fdc_base &= ~1;
 	printk (KERN_INFO "SuperIO: Floppy controller at 0x%x\n", sio->fdc_base);
+	pci_read_config_word (pdev, SIO_ACPIBAR, &sio->acpi_base);
+	sio->acpi_base &= ~1;
+	printk (KERN_INFO "SuperIO: ACPI at 0x%x\n", sio->acpi_base);
 
 	request_region (IC_PIC1, 0x1f, "pic1");
 	request_region (IC_PIC2, 0x1f, "pic2");
+	request_region (sio->acpi_base, 0x1f, "acpi");
 
 	/* Enable the legacy I/O function */
         pci_read_config_word (pdev, PCI_COMMAND, &word);
@@ -234,7 +238,14 @@ superio_init(struct superio_device *sio)
 	pci_write_config_byte (pdev, IR_IDE, 0x07); /* IDE1 on IRQ7 */
 	
 	/* Set USB and IDE to level triggered interrupts, rest to edge */
-	pci_write_config_byte (pdev, TRIGGER_1, 0x81); /* IRQ 1 and 7 */
+	pci_write_config_byte (pdev, TRIGGER_1, 0x82); /* IRQ 1 and 7 */
+
+	/* Setup USB power regulation */
+	outb(1, sio->acpi_base + USB_REG_CR);
+	if (inb(sio->acpi_base + USB_REG_CR) & 1 != 1)
+		printk(KERN_ERR "USB regulator not initialized!\n");
+	else
+		printk (KERN_INFO "SuperIO: USB regulator enabled\n");
 
 	pci_enable_device(pdev);
 
Index: drivers/usb/usb-ohci.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/usb/usb-ohci.c,v
retrieving revision 1.15
diff -u -p -r1.15 usb-ohci.c
--- drivers/usb/usb-ohci.c	2002/02/07 22:05:28	1.15
+++ drivers/usb/usb-ohci.c	2002/02/15 22:19:38
@@ -69,9 +69,7 @@
 #include <asm/system.h>
 #include <asm/unaligned.h>
 
-#ifndef CONFIG_SUPERIO		/* superio doesn't work with this */
 #define OHCI_USE_NPS		// force NoPowerSwitching mode
-#endif
 // #define OHCI_VERBOSE_DEBUG	/* not always helpful */
 
 #include "usb-ohci.h"
@@ -2215,9 +2213,15 @@ static int hc_start (ohci_t * ohci)
 	writel (mask, &ohci->regs->intrstatus);
 
 #ifdef	OHCI_USE_NPS
+#ifdef CONFIG_SUPERIO		/* superio needs a different setup */
+	writel ((roothub_a (ohci) | RH_A_NOCP) &
+		~(RH_A_OCPM | RH_A_POTPGT | RH_A_PSM | RH_A_NPS),
+		&ohci->regs->roothub.a);
+#else
 	/* required for AMD-756 and some Mac platforms */
 	writel ((roothub_a (ohci) | RH_A_NPS) & ~RH_A_PSM,
 		&ohci->regs->roothub.a);
+#endif
 	writel (RH_HS_LPSC, &ohci->regs->roothub.status);
 #endif	/* OHCI_USE_NPS */
 
Index: include/asm-parisc/superio.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/superio.h,v
retrieving revision 1.4
diff -u -p -r1.4 superio.h
--- include/asm-parisc/superio.h	2001/10/17 20:02:31	1.4
+++ include/asm-parisc/superio.h	2002/02/06 22:50:19
@@ -5,6 +5,7 @@
 #define IC_PIC1    0x20		/* PCI I/O address of master 8259 */
 #define IC_PIC2    0xA0		/* PCI I/O address of slave */
 #define SIO_CR     0x5A		/* Configuration Register */
+#define SIO_ACPIBAR 0x88		/* ACPI BAR */
 #define SIO_FDCBAR 0x90		/* Floppy Disk Controller BAR */
 #define SIO_SP1BAR 0x94		/* Serial 1 BAR */
 #define SIO_SP2BAR 0x98		/* Serial 2 BAR */
@@ -35,6 +36,9 @@
 #define FDC_IRQ    6		/* Floppy controller */
 #define IDE_IRQ    7		/* IDE (pri+sec) */
 
+/* ACPI registers */
+#define USB_REG_CR	0x1f	/* USB Regulator Control Register */
+
 #define SUPERIO_NIRQS   8
 
 struct superio_device {
@@ -42,6 +46,7 @@ struct superio_device {
 	u16 sp1_base;
 	u16 sp2_base;
 	u16 pp_base;
+	u16 acpi_base;
 	int iosapic_irq;
 	int iosapic_irq_enabled;
 	struct irq_region *irq_region;


-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                 [ Alexander Viro on linux-kernel ]