public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] psmouse/usb interaction fix
@ 2004-05-31 17:40 Pokey the Penguin
  2004-05-31 18:03 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Pokey the Penguin @ 2004-05-31 17:40 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 759 bytes --]

This patch fixes the case where certain laptop touchpads (ALPS) 
are disabled if the machine boots with a usb mouse plugged in.

Without it, users have to choose between using either a usb mouse 
or the touchpad. With it, any combination is possible and the usb 
mouse can be attached/removed at runtime without breaking the 
touchpad.

The patch is ported from a SuSE kernel to 2.6.7-rc2. It's been
around for at least two minor releases. The maintainer was
contacted regarding merging but failed to respond.

Patch vital to certain laptop users. Please apply.
-- 
______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze

[-- Attachment #2: psmouse-usb-fix-2.6.7-rc2.diff --]
[-- Type: application/octet-stream, Size: 2484 bytes --]

--- linux-2.6.7-rc2-base/drivers/pci/quirks.c	2004-05-31 18:08:55.310606000 +0100
+++ linux-2.6.7-rc2/drivers/pci/quirks.c	2004-05-31 18:18:48.648404952 +0100
@@ -875,6 +875,66 @@ static void __devinit quirk_pciehp_msi(s
 	pciehp_msi_quirk = 1;
 }
 
+
+#define UHCI_USBLEGSUP		0xc0		/* legacy support */
+#define UHCI_USBCMD		0		/* command register */
+#define UHCI_USBINTR		4		/* interrupt register */
+#define UHCI_USBLEGSUP_DEFAULT	0x2000		/* only PIRQ enable set */
+#define UHCI_USBCMD_GRESET	0x0004		/* Global reset */
+
+#define OHCI_CONTROL		0x04
+#define OHCI_CMDSTATUS		0x08
+#define OHCI_INTRENABLE		0x10
+#define OHCI_OCR		(1 << 3)	/* ownership change request */
+#define OHCI_CTRL_IR		(1 << 8)	/* interrupt routing */
+#define OHCI_INTR_OC		(1 << 30)	/* ownership change */
+
+static void __init quirk_usb_disable_smm_bios(struct pci_dev *pdev)
+{
+
+	if (pdev->class == ((PCI_CLASS_SERIAL_USB << 8) | 0x00)) { /* UHCI */
+		int i;
+		unsigned long base = 0;;
+
+		for (i = 0; i < PCI_ROM_RESOURCE; i++) 
+			if ((pci_resource_flags(pdev, i) & IORESOURCE_IO)) {
+				base = pci_resource_start(pdev, i);
+				break;
+			}
+
+		if (!base)
+			return;
+
+		outw(0, base + UHCI_USBINTR);
+		outw(UHCI_USBCMD_GRESET, base + UHCI_USBCMD);
+		set_current_state(TASK_UNINTERRUPTIBLE);
+       		schedule_timeout((HZ*50+999) / 1000);
+		outw(0, base + UHCI_USBCMD);
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout((HZ*10+999) / 1000);
+
+		pci_write_config_word(pdev, UHCI_USBLEGSUP, UHCI_USBLEGSUP_DEFAULT);
+	}
+
+	if (pdev->class == ((PCI_CLASS_SERIAL_USB << 8) | 0x10)) { /* OHCI */
+		char *base = ioremap_nocache(pci_resource_start(pdev, 0),
+							pci_resource_len(pdev, 0));
+		if (base == NULL) return;
+
+		if (readl(base + OHCI_CONTROL) & OHCI_CTRL_IR) {
+			int temp = 500;     /* arbitrary: five seconds */
+			writel(OHCI_INTR_OC, base + OHCI_INTRENABLE);
+			writel(OHCI_OCR, base + OHCI_CMDSTATUS);
+			while (temp && readl(base + OHCI_CONTROL) & OHCI_CTRL_IR) {
+				temp--;
+				set_current_state(TASK_UNINTERRUPTIBLE);
+				schedule_timeout( HZ / 100);
+			}
+		}
+		iounmap(base);
+	}
+}
+
 /*
  *  The main table of quirks.
  *
@@ -1002,6 +1062,8 @@ static struct pci_fixup pci_fixups[] __d
 	  quirk_intel_ide_combined },
 #endif /* CONFIG_SCSI_SATA */
 
+	{ PCI_FIXUP_FINAL,	PCI_ANY_ID,		PCI_ANY_ID,			quirk_usb_disable_smm_bios },
+
 	{ PCI_FIXUP_FINAL,      PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_SMCH,	quirk_pciehp_msi },
 
 	{ 0 }

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

end of thread, other threads:[~2004-06-05  9:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-31 17:40 [PATCH] psmouse/usb interaction fix Pokey the Penguin
2004-05-31 18:03 ` Greg KH
2004-05-31 20:01   ` Vojtech Pavlik
2004-06-04 20:30     ` Greg KH
2004-06-05  9:18       ` Vojtech Pavlik

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