diff options
Diffstat (limited to 'drivers/usb/host/ehci-pci.c')
| -rw-r--r-- | drivers/usb/host/ehci-pci.c | 64 |
1 files changed, 3 insertions, 61 deletions
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 08ca0f849dab..3a6687df5594 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
| @@ -24,46 +24,11 @@ | |||
| 24 | 24 | ||
| 25 | /*-------------------------------------------------------------------------*/ | 25 | /*-------------------------------------------------------------------------*/ |
| 26 | 26 | ||
| 27 | /* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/... | ||
| 28 | * off the controller (maybe it can boot from highspeed USB disks). | ||
| 29 | */ | ||
| 30 | static int bios_handoff(struct ehci_hcd *ehci, int where, u32 cap) | ||
| 31 | { | ||
| 32 | struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller); | ||
| 33 | |||
| 34 | /* always say Linux will own the hardware */ | ||
| 35 | pci_write_config_byte(pdev, where + 3, 1); | ||
| 36 | |||
| 37 | /* maybe wait a while for BIOS to respond */ | ||
| 38 | if (cap & (1 << 16)) { | ||
| 39 | int msec = 5000; | ||
| 40 | |||
| 41 | do { | ||
| 42 | msleep(10); | ||
| 43 | msec -= 10; | ||
| 44 | pci_read_config_dword(pdev, where, &cap); | ||
| 45 | } while ((cap & (1 << 16)) && msec); | ||
| 46 | if (cap & (1 << 16)) { | ||
| 47 | ehci_err(ehci, "BIOS handoff failed (%d, %08x)\n", | ||
| 48 | where, cap); | ||
| 49 | // some BIOS versions seem buggy... | ||
| 50 | // return 1; | ||
| 51 | ehci_warn(ehci, "continuing after BIOS bug...\n"); | ||
| 52 | /* disable all SMIs, and clear "BIOS owns" flag */ | ||
| 53 | pci_write_config_dword(pdev, where + 4, 0); | ||
| 54 | pci_write_config_byte(pdev, where + 2, 0); | ||
| 55 | } else | ||
| 56 | ehci_dbg(ehci, "BIOS handoff succeeded\n"); | ||
| 57 | } | ||
| 58 | return 0; | ||
| 59 | } | ||
| 60 | |||
| 61 | /* called after powerup, by probe or system-pm "wakeup" */ | 27 | /* called after powerup, by probe or system-pm "wakeup" */ |
| 62 | static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) | 28 | static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) |
| 63 | { | 29 | { |
| 64 | u32 temp; | 30 | u32 temp; |
| 65 | int retval; | 31 | int retval; |
| 66 | unsigned count = 256/4; | ||
| 67 | 32 | ||
| 68 | /* optional debug port, normally in the first BAR */ | 33 | /* optional debug port, normally in the first BAR */ |
| 69 | temp = pci_find_capability(pdev, 0x0a); | 34 | temp = pci_find_capability(pdev, 0x0a); |
| @@ -84,32 +49,9 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) | |||
| 84 | } | 49 | } |
| 85 | } | 50 | } |
| 86 | 51 | ||
| 87 | temp = HCC_EXT_CAPS(readl(&ehci->caps->hcc_params)); | 52 | /* we expect static quirk code to handle the "extended capabilities" |
| 88 | 53 | * (currently just BIOS handoff) allowed starting with EHCI 0.96 | |
| 89 | /* EHCI 0.96 and later may have "extended capabilities" */ | 54 | */ |
| 90 | while (temp && count--) { | ||
| 91 | u32 cap; | ||
| 92 | |||
| 93 | pci_read_config_dword(pdev, temp, &cap); | ||
| 94 | ehci_dbg(ehci, "capability %04x at %02x\n", cap, temp); | ||
| 95 | switch (cap & 0xff) { | ||
| 96 | case 1: /* BIOS/SMM/... handoff */ | ||
| 97 | if (bios_handoff(ehci, temp, cap) != 0) | ||
| 98 | return -EOPNOTSUPP; | ||
| 99 | break; | ||
| 100 | case 0: /* illegal reserved capability */ | ||
| 101 | ehci_dbg(ehci, "illegal capability!\n"); | ||
| 102 | cap = 0; | ||
| 103 | /* FALLTHROUGH */ | ||
| 104 | default: /* unknown */ | ||
| 105 | break; | ||
| 106 | } | ||
| 107 | temp = (cap >> 8) & 0xff; | ||
| 108 | } | ||
| 109 | if (!count) { | ||
| 110 | ehci_err(ehci, "bogus capabilities ... PCI problems!\n"); | ||
| 111 | return -EIO; | ||
| 112 | } | ||
| 113 | 55 | ||
| 114 | /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ | 56 | /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ |
| 115 | retval = pci_set_mwi(pdev); | 57 | retval = pci_set_mwi(pdev); |
