17ff71d6aSMatt Porter /* 27ff71d6aSMatt Porter * EHCI HCD (Host Controller Driver) PCI Bus Glue. 37ff71d6aSMatt Porter * 47ff71d6aSMatt Porter * Copyright (c) 2000-2004 by David Brownell 57ff71d6aSMatt Porter * 67ff71d6aSMatt Porter * This program is free software; you can redistribute it and/or modify it 77ff71d6aSMatt Porter * under the terms of the GNU General Public License as published by the 87ff71d6aSMatt Porter * Free Software Foundation; either version 2 of the License, or (at your 97ff71d6aSMatt Porter * option) any later version. 107ff71d6aSMatt Porter * 117ff71d6aSMatt Porter * This program is distributed in the hope that it will be useful, but 127ff71d6aSMatt Porter * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 137ff71d6aSMatt Porter * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 147ff71d6aSMatt Porter * for more details. 157ff71d6aSMatt Porter * 167ff71d6aSMatt Porter * You should have received a copy of the GNU General Public License 177ff71d6aSMatt Porter * along with this program; if not, write to the Free Software Foundation, 187ff71d6aSMatt Porter * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 197ff71d6aSMatt Porter */ 207ff71d6aSMatt Porter 217ff71d6aSMatt Porter #ifndef CONFIG_PCI 227ff71d6aSMatt Porter #error "This file is PCI bus glue. CONFIG_PCI must be defined." 237ff71d6aSMatt Porter #endif 247ff71d6aSMatt Porter 257ff71d6aSMatt Porter /*-------------------------------------------------------------------------*/ 267ff71d6aSMatt Porter 277ff71d6aSMatt Porter /* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/... 287ff71d6aSMatt Porter * off the controller (maybe it can boot from highspeed USB disks). 297ff71d6aSMatt Porter */ 307ff71d6aSMatt Porter static int bios_handoff(struct ehci_hcd *ehci, int where, u32 cap) 317ff71d6aSMatt Porter { 327ff71d6aSMatt Porter struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller); 337ff71d6aSMatt Porter 347ff71d6aSMatt Porter /* always say Linux will own the hardware */ 357ff71d6aSMatt Porter pci_write_config_byte(pdev, where + 3, 1); 367ff71d6aSMatt Porter 377ff71d6aSMatt Porter /* maybe wait a while for BIOS to respond */ 387ff71d6aSMatt Porter if (cap & (1 << 16)) { 397ff71d6aSMatt Porter int msec = 5000; 407ff71d6aSMatt Porter 417ff71d6aSMatt Porter do { 427ff71d6aSMatt Porter msleep(10); 437ff71d6aSMatt Porter msec -= 10; 447ff71d6aSMatt Porter pci_read_config_dword(pdev, where, &cap); 457ff71d6aSMatt Porter } while ((cap & (1 << 16)) && msec); 467ff71d6aSMatt Porter if (cap & (1 << 16)) { 477ff71d6aSMatt Porter ehci_err(ehci, "BIOS handoff failed (%d, %08x)\n", 487ff71d6aSMatt Porter where, cap); 497ff71d6aSMatt Porter // some BIOS versions seem buggy... 507ff71d6aSMatt Porter // return 1; 517ff71d6aSMatt Porter ehci_warn(ehci, "continuing after BIOS bug...\n"); 527ff71d6aSMatt Porter /* disable all SMIs, and clear "BIOS owns" flag */ 537ff71d6aSMatt Porter pci_write_config_dword(pdev, where + 4, 0); 547ff71d6aSMatt Porter pci_write_config_byte(pdev, where + 2, 0); 557ff71d6aSMatt Porter } else 567ff71d6aSMatt Porter ehci_dbg(ehci, "BIOS handoff succeeded\n"); 577ff71d6aSMatt Porter } 587ff71d6aSMatt Porter return 0; 597ff71d6aSMatt Porter } 607ff71d6aSMatt Porter 6118807521SDavid Brownell /* called after powerup, by probe or system-pm "wakeup" */ 6218807521SDavid Brownell static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) 6318807521SDavid Brownell { 6418807521SDavid Brownell u32 temp; 6518807521SDavid Brownell int retval; 6618807521SDavid Brownell unsigned count = 256/4; 6718807521SDavid Brownell 6818807521SDavid Brownell /* optional debug port, normally in the first BAR */ 6918807521SDavid Brownell temp = pci_find_capability(pdev, 0x0a); 7018807521SDavid Brownell if (temp) { 7118807521SDavid Brownell pci_read_config_dword(pdev, temp, &temp); 7218807521SDavid Brownell temp >>= 16; 7318807521SDavid Brownell if ((temp & (3 << 13)) == (1 << 13)) { 7418807521SDavid Brownell temp &= 0x1fff; 7518807521SDavid Brownell ehci->debug = ehci_to_hcd(ehci)->regs + temp; 7618807521SDavid Brownell temp = readl(&ehci->debug->control); 7718807521SDavid Brownell ehci_info(ehci, "debug port %d%s\n", 7818807521SDavid Brownell HCS_DEBUG_PORT(ehci->hcs_params), 7918807521SDavid Brownell (temp & DBGP_ENABLED) 8018807521SDavid Brownell ? " IN USE" 8118807521SDavid Brownell : ""); 8218807521SDavid Brownell if (!(temp & DBGP_ENABLED)) 8318807521SDavid Brownell ehci->debug = NULL; 8418807521SDavid Brownell } 8518807521SDavid Brownell } 8618807521SDavid Brownell 8718807521SDavid Brownell temp = HCC_EXT_CAPS(readl(&ehci->caps->hcc_params)); 8818807521SDavid Brownell 8918807521SDavid Brownell /* EHCI 0.96 and later may have "extended capabilities" */ 9018807521SDavid Brownell while (temp && count--) { 9118807521SDavid Brownell u32 cap; 9218807521SDavid Brownell 9318807521SDavid Brownell pci_read_config_dword(pdev, temp, &cap); 9418807521SDavid Brownell ehci_dbg(ehci, "capability %04x at %02x\n", cap, temp); 9518807521SDavid Brownell switch (cap & 0xff) { 9618807521SDavid Brownell case 1: /* BIOS/SMM/... handoff */ 9718807521SDavid Brownell if (bios_handoff(ehci, temp, cap) != 0) 9818807521SDavid Brownell return -EOPNOTSUPP; 9918807521SDavid Brownell break; 10018807521SDavid Brownell case 0: /* illegal reserved capability */ 10118807521SDavid Brownell ehci_dbg(ehci, "illegal capability!\n"); 10218807521SDavid Brownell cap = 0; 10318807521SDavid Brownell /* FALLTHROUGH */ 10418807521SDavid Brownell default: /* unknown */ 10518807521SDavid Brownell break; 10618807521SDavid Brownell } 10718807521SDavid Brownell temp = (cap >> 8) & 0xff; 10818807521SDavid Brownell } 10918807521SDavid Brownell if (!count) { 11018807521SDavid Brownell ehci_err(ehci, "bogus capabilities ... PCI problems!\n"); 11118807521SDavid Brownell return -EIO; 11218807521SDavid Brownell } 11318807521SDavid Brownell 11418807521SDavid Brownell /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ 11518807521SDavid Brownell retval = pci_set_mwi(pdev); 11618807521SDavid Brownell if (!retval) 11718807521SDavid Brownell ehci_dbg(ehci, "MWI active\n"); 11818807521SDavid Brownell 11918807521SDavid Brownell ehci_port_power(ehci, 0); 12018807521SDavid Brownell 12118807521SDavid Brownell return 0; 12218807521SDavid Brownell } 12318807521SDavid Brownell 124*8926bfa7SDavid Brownell /* called during probe() after chip reset completes */ 125*8926bfa7SDavid Brownell static int ehci_pci_setup(struct usb_hcd *hcd) 1267ff71d6aSMatt Porter { 1277ff71d6aSMatt Porter struct ehci_hcd *ehci = hcd_to_ehci(hcd); 128abcc9448SDavid Brownell struct pci_dev *pdev = to_pci_dev(hcd->self.controller); 1297ff71d6aSMatt Porter u32 temp; 13018807521SDavid Brownell int retval; 1317ff71d6aSMatt Porter 1327ff71d6aSMatt Porter ehci->caps = hcd->regs; 1337ff71d6aSMatt Porter ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase)); 1347ff71d6aSMatt Porter dbg_hcs_params(ehci, "reset"); 1357ff71d6aSMatt Porter dbg_hcc_params(ehci, "reset"); 1367ff71d6aSMatt Porter 1377ff71d6aSMatt Porter /* cache this readonly data; minimize chip reads */ 1387ff71d6aSMatt Porter ehci->hcs_params = readl(&ehci->caps->hcs_params); 1397ff71d6aSMatt Porter 14018807521SDavid Brownell retval = ehci_halt(ehci); 14118807521SDavid Brownell if (retval) 14218807521SDavid Brownell return retval; 14318807521SDavid Brownell 144*8926bfa7SDavid Brownell /* data structure init */ 145*8926bfa7SDavid Brownell retval = ehci_init(hcd); 146*8926bfa7SDavid Brownell if (retval) 147*8926bfa7SDavid Brownell return retval; 148*8926bfa7SDavid Brownell 149abcc9448SDavid Brownell /* NOTE: only the parts below this line are PCI-specific */ 1507ff71d6aSMatt Porter 1517ff71d6aSMatt Porter switch (pdev->vendor) { 1527ff71d6aSMatt Porter case PCI_VENDOR_ID_TDI: 1537ff71d6aSMatt Porter if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { 1547ff71d6aSMatt Porter ehci->is_tdi_rh_tt = 1; 1557ff71d6aSMatt Porter tdi_reset(ehci); 1567ff71d6aSMatt Porter } 1577ff71d6aSMatt Porter break; 1587ff71d6aSMatt Porter case PCI_VENDOR_ID_AMD: 1597ff71d6aSMatt Porter /* AMD8111 EHCI doesn't work, according to AMD errata */ 1607ff71d6aSMatt Porter if (pdev->device == 0x7463) { 1617ff71d6aSMatt Porter ehci_info(ehci, "ignoring AMD8111 (errata)\n"); 162*8926bfa7SDavid Brownell retval = -EIO; 163*8926bfa7SDavid Brownell goto done; 1647ff71d6aSMatt Porter } 1657ff71d6aSMatt Porter break; 1667ff71d6aSMatt Porter case PCI_VENDOR_ID_NVIDIA: 1677ff71d6aSMatt Porter /* NVidia reports that certain chips don't handle 1687ff71d6aSMatt Porter * QH, ITD, or SITD addresses above 2GB. (But TD, 1697ff71d6aSMatt Porter * data buffer, and periodic schedule are normal.) 1707ff71d6aSMatt Porter */ 1717ff71d6aSMatt Porter switch (pdev->device) { 1727ff71d6aSMatt Porter case 0x003c: /* MCP04 */ 1737ff71d6aSMatt Porter case 0x005b: /* CK804 */ 1747ff71d6aSMatt Porter case 0x00d8: /* CK8 */ 1757ff71d6aSMatt Porter case 0x00e8: /* CK8S */ 1767ff71d6aSMatt Porter if (pci_set_consistent_dma_mask(pdev, 1777ff71d6aSMatt Porter DMA_31BIT_MASK) < 0) 1787ff71d6aSMatt Porter ehci_warn(ehci, "can't enable NVidia " 1797ff71d6aSMatt Porter "workaround for >2GB RAM\n"); 1807ff71d6aSMatt Porter break; 1817ff71d6aSMatt Porter } 1827ff71d6aSMatt Porter break; 1837ff71d6aSMatt Porter } 1847ff71d6aSMatt Porter 1857ff71d6aSMatt Porter if (ehci_is_TDI(ehci)) 1867ff71d6aSMatt Porter ehci_reset(ehci); 1877ff71d6aSMatt Porter 1887ff71d6aSMatt Porter /* at least the Genesys GL880S needs fixup here */ 1897ff71d6aSMatt Porter temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); 1907ff71d6aSMatt Porter temp &= 0x0f; 1917ff71d6aSMatt Porter if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) { 1927ff71d6aSMatt Porter ehci_dbg(ehci, "bogus port configuration: " 1937ff71d6aSMatt Porter "cc=%d x pcc=%d < ports=%d\n", 1947ff71d6aSMatt Porter HCS_N_CC(ehci->hcs_params), 1957ff71d6aSMatt Porter HCS_N_PCC(ehci->hcs_params), 1967ff71d6aSMatt Porter HCS_N_PORTS(ehci->hcs_params)); 1977ff71d6aSMatt Porter 1987ff71d6aSMatt Porter switch (pdev->vendor) { 1997ff71d6aSMatt Porter case 0x17a0: /* GENESYS */ 2007ff71d6aSMatt Porter /* GL880S: should be PORTS=2 */ 2017ff71d6aSMatt Porter temp |= (ehci->hcs_params & ~0xf); 2027ff71d6aSMatt Porter ehci->hcs_params = temp; 2037ff71d6aSMatt Porter break; 2047ff71d6aSMatt Porter case PCI_VENDOR_ID_NVIDIA: 2057ff71d6aSMatt Porter /* NF4: should be PCC=10 */ 2067ff71d6aSMatt Porter break; 2077ff71d6aSMatt Porter } 2087ff71d6aSMatt Porter } 2097ff71d6aSMatt Porter 2107ff71d6aSMatt Porter /* Serial Bus Release Number is at PCI 0x60 offset */ 2117ff71d6aSMatt Porter pci_read_config_byte(pdev, 0x60, &ehci->sbrn); 2127ff71d6aSMatt Porter 21318807521SDavid Brownell /* REVISIT: per-port wake capability (PCI 0x62) currently unused */ 2147ff71d6aSMatt Porter 21518807521SDavid Brownell retval = ehci_pci_reinit(ehci, pdev); 216*8926bfa7SDavid Brownell done: 217*8926bfa7SDavid Brownell return retval; 2187ff71d6aSMatt Porter } 2197ff71d6aSMatt Porter 2207ff71d6aSMatt Porter /*-------------------------------------------------------------------------*/ 2217ff71d6aSMatt Porter 2227ff71d6aSMatt Porter #ifdef CONFIG_PM 2237ff71d6aSMatt Porter 2247ff71d6aSMatt Porter /* suspend/resume, section 4.3 */ 2257ff71d6aSMatt Porter 226f03c17fcSDavid Brownell /* These routines rely on the PCI bus glue 2277ff71d6aSMatt Porter * to handle powerdown and wakeup, and currently also on 2287ff71d6aSMatt Porter * transceivers that don't need any software attention to set up 2297ff71d6aSMatt Porter * the right sort of wakeup. 230f03c17fcSDavid Brownell * Also they depend on separate root hub suspend/resume. 2317ff71d6aSMatt Porter */ 2327ff71d6aSMatt Porter 2337ff71d6aSMatt Porter static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message) 2347ff71d6aSMatt Porter { 2357ff71d6aSMatt Porter struct ehci_hcd *ehci = hcd_to_ehci(hcd); 2368de98402SBenjamin Herrenschmidt unsigned long flags; 2378de98402SBenjamin Herrenschmidt int rc = 0; 2387ff71d6aSMatt Porter 2397ff71d6aSMatt Porter if (time_before(jiffies, ehci->next_statechange)) 240f03c17fcSDavid Brownell msleep(10); 2417ff71d6aSMatt Porter 2428de98402SBenjamin Herrenschmidt /* Root hub was already suspended. Disable irq emission and 2438de98402SBenjamin Herrenschmidt * mark HW unaccessible, bail out if RH has been resumed. Use 2448de98402SBenjamin Herrenschmidt * the spinlock to properly synchronize with possible pending 2458de98402SBenjamin Herrenschmidt * RH suspend or resume activity. 2468de98402SBenjamin Herrenschmidt * 2478de98402SBenjamin Herrenschmidt * This is still racy as hcd->state is manipulated outside of 2488de98402SBenjamin Herrenschmidt * any locks =P But that will be a different fix. 2498de98402SBenjamin Herrenschmidt */ 2508de98402SBenjamin Herrenschmidt spin_lock_irqsave (&ehci->lock, flags); 2518de98402SBenjamin Herrenschmidt if (hcd->state != HC_STATE_SUSPENDED) { 2528de98402SBenjamin Herrenschmidt rc = -EINVAL; 2538de98402SBenjamin Herrenschmidt goto bail; 2548de98402SBenjamin Herrenschmidt } 2558de98402SBenjamin Herrenschmidt writel (0, &ehci->regs->intr_enable); 2568de98402SBenjamin Herrenschmidt (void)readl(&ehci->regs->intr_enable); 2578de98402SBenjamin Herrenschmidt 2588de98402SBenjamin Herrenschmidt clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 2598de98402SBenjamin Herrenschmidt bail: 2608de98402SBenjamin Herrenschmidt spin_unlock_irqrestore (&ehci->lock, flags); 2618de98402SBenjamin Herrenschmidt 262f03c17fcSDavid Brownell // could save FLADJ in case of Vaux power loss 2637ff71d6aSMatt Porter // ... we'd only use it to handle clock skew 2647ff71d6aSMatt Porter 2658de98402SBenjamin Herrenschmidt return rc; 2667ff71d6aSMatt Porter } 2677ff71d6aSMatt Porter 2687ff71d6aSMatt Porter static int ehci_pci_resume(struct usb_hcd *hcd) 2697ff71d6aSMatt Porter { 2707ff71d6aSMatt Porter struct ehci_hcd *ehci = hcd_to_ehci(hcd); 2717ff71d6aSMatt Porter unsigned port; 2727ff71d6aSMatt Porter struct usb_device *root = hcd->self.root_hub; 27318807521SDavid Brownell struct pci_dev *pdev = to_pci_dev(hcd->self.controller); 2747ff71d6aSMatt Porter int retval = -EINVAL; 2757ff71d6aSMatt Porter 276f03c17fcSDavid Brownell // maybe restore FLADJ 2777ff71d6aSMatt Porter 2787ff71d6aSMatt Porter if (time_before(jiffies, ehci->next_statechange)) 2797ff71d6aSMatt Porter msleep(100); 2807ff71d6aSMatt Porter 2818de98402SBenjamin Herrenschmidt /* Mark hardware accessible again as we are out of D3 state by now */ 2828de98402SBenjamin Herrenschmidt set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 2838de98402SBenjamin Herrenschmidt 284f03c17fcSDavid Brownell /* If CF is clear, we lost PCI Vaux power and need to restart. */ 28518807521SDavid Brownell if (readl(&ehci->regs->configured_flag) != FLAG_CF) 286f03c17fcSDavid Brownell goto restart; 287f03c17fcSDavid Brownell 2887ff71d6aSMatt Porter /* If any port is suspended (or owned by the companion), 2897ff71d6aSMatt Porter * we know we can/must resume the HC (and mustn't reset it). 290f03c17fcSDavid Brownell * We just defer that to the root hub code. 2917ff71d6aSMatt Porter */ 2927ff71d6aSMatt Porter for (port = HCS_N_PORTS(ehci->hcs_params); port > 0; ) { 2937ff71d6aSMatt Porter u32 status; 2947ff71d6aSMatt Porter port--; 2957ff71d6aSMatt Porter status = readl(&ehci->regs->port_status [port]); 2967ff71d6aSMatt Porter if (!(status & PORT_POWER)) 2977ff71d6aSMatt Porter continue; 298f03c17fcSDavid Brownell if (status & (PORT_SUSPEND | PORT_RESUME | PORT_OWNER)) { 299f03c17fcSDavid Brownell usb_hcd_resume_root_hub(hcd); 300f03c17fcSDavid Brownell return 0; 3017ff71d6aSMatt Porter } 302f03c17fcSDavid Brownell } 303f03c17fcSDavid Brownell 304f03c17fcSDavid Brownell restart: 305f03c17fcSDavid Brownell ehci_dbg(ehci, "lost power, restarting\n"); 306f03c17fcSDavid Brownell for (port = HCS_N_PORTS(ehci->hcs_params); port > 0; ) { 307f03c17fcSDavid Brownell port--; 3087ff71d6aSMatt Porter if (!root->children [port]) 3097ff71d6aSMatt Porter continue; 3107ff71d6aSMatt Porter usb_set_device_state(root->children[port], 3117ff71d6aSMatt Porter USB_STATE_NOTATTACHED); 3127ff71d6aSMatt Porter } 3137ff71d6aSMatt Porter 3147ff71d6aSMatt Porter /* Else reset, to cope with power loss or flush-to-storage 315f03c17fcSDavid Brownell * style "resume" having let BIOS kick in during reboot. 3167ff71d6aSMatt Porter */ 3177ff71d6aSMatt Porter (void) ehci_halt(ehci); 3187ff71d6aSMatt Porter (void) ehci_reset(ehci); 31918807521SDavid Brownell (void) ehci_pci_reinit(ehci, pdev); 3207ff71d6aSMatt Porter 3217ff71d6aSMatt Porter /* emptying the schedule aborts any urbs */ 3227ff71d6aSMatt Porter spin_lock_irq(&ehci->lock); 3237ff71d6aSMatt Porter if (ehci->reclaim) 3247ff71d6aSMatt Porter ehci->reclaim_ready = 1; 3257ff71d6aSMatt Porter ehci_work(ehci, NULL); 3267ff71d6aSMatt Porter spin_unlock_irq(&ehci->lock); 3277ff71d6aSMatt Porter 3287ff71d6aSMatt Porter /* restart; khubd will disconnect devices */ 3297ff71d6aSMatt Porter retval = ehci_run(hcd); 3307ff71d6aSMatt Porter 33118807521SDavid Brownell /* here we "know" root ports should always stay powered */ 3327ff71d6aSMatt Porter ehci_port_power(ehci, 1); 3337ff71d6aSMatt Porter 3347ff71d6aSMatt Porter return retval; 3357ff71d6aSMatt Porter } 3367ff71d6aSMatt Porter #endif 3377ff71d6aSMatt Porter 3387ff71d6aSMatt Porter static const struct hc_driver ehci_pci_hc_driver = { 3397ff71d6aSMatt Porter .description = hcd_name, 3407ff71d6aSMatt Porter .product_desc = "EHCI Host Controller", 3417ff71d6aSMatt Porter .hcd_priv_size = sizeof(struct ehci_hcd), 3427ff71d6aSMatt Porter 3437ff71d6aSMatt Porter /* 3447ff71d6aSMatt Porter * generic hardware linkage 3457ff71d6aSMatt Porter */ 3467ff71d6aSMatt Porter .irq = ehci_irq, 3477ff71d6aSMatt Porter .flags = HCD_MEMORY | HCD_USB2, 3487ff71d6aSMatt Porter 3497ff71d6aSMatt Porter /* 3507ff71d6aSMatt Porter * basic lifecycle operations 3517ff71d6aSMatt Porter */ 352*8926bfa7SDavid Brownell .reset = ehci_pci_setup, 35318807521SDavid Brownell .start = ehci_run, 3547ff71d6aSMatt Porter #ifdef CONFIG_PM 3557ff71d6aSMatt Porter .suspend = ehci_pci_suspend, 3567ff71d6aSMatt Porter .resume = ehci_pci_resume, 3577ff71d6aSMatt Porter #endif 35818807521SDavid Brownell .stop = ehci_stop, 3597ff71d6aSMatt Porter 3607ff71d6aSMatt Porter /* 3617ff71d6aSMatt Porter * managing i/o requests and associated device resources 3627ff71d6aSMatt Porter */ 3637ff71d6aSMatt Porter .urb_enqueue = ehci_urb_enqueue, 3647ff71d6aSMatt Porter .urb_dequeue = ehci_urb_dequeue, 3657ff71d6aSMatt Porter .endpoint_disable = ehci_endpoint_disable, 3667ff71d6aSMatt Porter 3677ff71d6aSMatt Porter /* 3687ff71d6aSMatt Porter * scheduling support 3697ff71d6aSMatt Porter */ 3707ff71d6aSMatt Porter .get_frame_number = ehci_get_frame, 3717ff71d6aSMatt Porter 3727ff71d6aSMatt Porter /* 3737ff71d6aSMatt Porter * root hub support 3747ff71d6aSMatt Porter */ 3757ff71d6aSMatt Porter .hub_status_data = ehci_hub_status_data, 3767ff71d6aSMatt Porter .hub_control = ehci_hub_control, 3770c0382e3SAlan Stern .bus_suspend = ehci_bus_suspend, 3780c0382e3SAlan Stern .bus_resume = ehci_bus_resume, 3797ff71d6aSMatt Porter }; 3807ff71d6aSMatt Porter 3817ff71d6aSMatt Porter /*-------------------------------------------------------------------------*/ 3827ff71d6aSMatt Porter 3837ff71d6aSMatt Porter /* PCI driver selection metadata; PCI hotplugging uses this */ 3847ff71d6aSMatt Porter static const struct pci_device_id pci_ids [] = { { 3857ff71d6aSMatt Porter /* handle any USB 2.0 EHCI controller */ 3867ff71d6aSMatt Porter PCI_DEVICE_CLASS(((PCI_CLASS_SERIAL_USB << 8) | 0x20), ~0), 3877ff71d6aSMatt Porter .driver_data = (unsigned long) &ehci_pci_hc_driver, 3887ff71d6aSMatt Porter }, 3897ff71d6aSMatt Porter { /* end: all zeroes */ } 3907ff71d6aSMatt Porter }; 3917ff71d6aSMatt Porter MODULE_DEVICE_TABLE(pci, pci_ids); 3927ff71d6aSMatt Porter 3937ff71d6aSMatt Porter /* pci driver glue; this is a "new style" PCI driver module */ 3947ff71d6aSMatt Porter static struct pci_driver ehci_pci_driver = { 3957ff71d6aSMatt Porter .name = (char *) hcd_name, 3967ff71d6aSMatt Porter .id_table = pci_ids, 3977ff71d6aSMatt Porter 3987ff71d6aSMatt Porter .probe = usb_hcd_pci_probe, 3997ff71d6aSMatt Porter .remove = usb_hcd_pci_remove, 4007ff71d6aSMatt Porter 4017ff71d6aSMatt Porter #ifdef CONFIG_PM 4027ff71d6aSMatt Porter .suspend = usb_hcd_pci_suspend, 4037ff71d6aSMatt Porter .resume = usb_hcd_pci_resume, 4047ff71d6aSMatt Porter #endif 4057ff71d6aSMatt Porter }; 4067ff71d6aSMatt Porter 4077ff71d6aSMatt Porter static int __init ehci_hcd_pci_init(void) 4087ff71d6aSMatt Porter { 4097ff71d6aSMatt Porter if (usb_disabled()) 4107ff71d6aSMatt Porter return -ENODEV; 4117ff71d6aSMatt Porter 4127ff71d6aSMatt Porter pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", 4137ff71d6aSMatt Porter hcd_name, 4147ff71d6aSMatt Porter sizeof(struct ehci_qh), sizeof(struct ehci_qtd), 4157ff71d6aSMatt Porter sizeof(struct ehci_itd), sizeof(struct ehci_sitd)); 4167ff71d6aSMatt Porter 4177ff71d6aSMatt Porter return pci_register_driver(&ehci_pci_driver); 4187ff71d6aSMatt Porter } 4197ff71d6aSMatt Porter module_init(ehci_hcd_pci_init); 4207ff71d6aSMatt Porter 4217ff71d6aSMatt Porter static void __exit ehci_hcd_pci_cleanup(void) 4227ff71d6aSMatt Porter { 4237ff71d6aSMatt Porter pci_unregister_driver(&ehci_pci_driver); 4247ff71d6aSMatt Porter } 4257ff71d6aSMatt Porter module_exit(ehci_hcd_pci_cleanup); 426