Patchwork [1/1] Fix broken EHCI on MacbookAir3,1 and 3,2

login
register
mail settings
Submitter gimli
Date Nov. 18, 2010, 7:59 a.m.
Message ID <ab0700a6dccc811536a199377f38fa26@mognix.dark-green.com>
Download mbox | patch
Permalink /patch/335321/
State New, archived
Headers show

Comments

Patch

diff -uNr linux-2.6.36/drivers/usb/host/ehci.h linux-2.6.36-patched/drivers/usb/host/ehci.h
--- linux-2.6.36/drivers/usb/host/ehci.h	2010-10-20 22:30:22.000000000 +0200
+++ linux-2.6.36-patched/drivers/usb/host/ehci.h	2010-11-18 08:22:25.846666802 +0100
@@ -142,6 +142,7 @@ 
 	__hc32			*ohci_hcctrl_reg;
 	unsigned		has_hostpc:1;
 	unsigned		has_lpm:1;  /* support link power management */
+	unsigned		use_ppcd:1; /* enable autosupport per-port change bits */
 	unsigned		has_ppcd:1; /* support per-port change bits */
 	u8			sbrn;		/* packed release number */
 
diff -uNr linux-2.6.36/drivers/usb/host/ehci-hcd.c linux-2.6.36-patched/drivers/usb/host/ehci-hcd.c
--- linux-2.6.36/drivers/usb/host/ehci-hcd.c	2010-10-20 22:30:22.000000000 +0200
+++ linux-2.6.36-patched/drivers/usb/host/ehci-hcd.c	2010-11-18 08:21:51.013333468 +0100
@@ -590,7 +590,7 @@ 
 	if (log2_irq_thresh < 0 || log2_irq_thresh > 6)
 		log2_irq_thresh = 0;
 	temp = 1 << (16 + log2_irq_thresh);
-	if (HCC_PER_PORT_CHANGE_EVENT(hcc_params)) {
+	if (HCC_PER_PORT_CHANGE_EVENT(hcc_params) && ehci->use_ppcd) {
 		ehci->has_ppcd = 1;
 		ehci_dbg(ehci, "enable per-port change event\n");
 		temp |= CMD_PPCEE;
diff -uNr linux-2.6.36/drivers/usb/host/ehci-pci.c linux-2.6.36-patched/drivers/usb/host/ehci-pci.c
--- linux-2.6.36/drivers/usb/host/ehci-pci.c	2010-10-20 22:30:22.000000000 +0200
+++ linux-2.6.36-patched/drivers/usb/host/ehci-pci.c	2010-11-18 08:35:11.226666803 +0100
@@ -22,6 +22,16 @@ 
 #error "This file is PCI bus glue.  CONFIG_PCI must be defined."
 #endif
 
+/* disable per-port change bits */
+static unsigned int disable_ppcd = 0;
+module_param(disable_ppcd, int, S_IRUGO);
+MODULE_PARM_DESC(disable_ppcd, "explicit disable per-port change bits. set to 1 to disable\n");
+
+/* disable link power management */
+static unsigned int disable_lpm = 0;
+module_param(disable_lpm, int, S_IRUGO);
+MODULE_PARM_DESC(disable_lpm, "explicit force to disable link power management. set to 1 to disable\n");
+
 /*-------------------------------------------------------------------------*/
 
 /* called after powerup, by probe or system-pm "wakeup" */
@@ -148,6 +158,13 @@ 
 			if (pdev->revision < 0xa4)
 				ehci->no_selective_suspend = 1;
 			break;
+    /* MacBookAir3,1(2) 
+     * ppcd and lpm does not work */
+    case 0x0d9c:
+    case 0x0d9d:
+	    ehci->use_ppcd = 0;
+	    ehci->has_lpm = 0;
+      break;
 		}
 		break;
 	case PCI_VENDOR_ID_VIA:
@@ -249,6 +266,16 @@ 
 		}
 	}
 
+  /* explicit disable per-port change bits */
+  if(ehci->use_ppcd && disable_ppcd) {
+    ehci->use_ppcd = 0;
+  }
+
+  /* explicit disable per-port change bits */
+  if(ehci->has_lpm && disable_lpm) {
+    ehci->has_lpm = 0;
+  }
+
 #ifdef	CONFIG_USB_SUSPEND
 	/* REVISIT: the controller works fine for wakeup iff the root hub
 	 * itself is "globally" suspended, but usbcore currently doesn't