xref: /linux/drivers/usb/host/ehci-pci.c (revision aff6d18f95bb81b2d07994372c8edcc2c2b41180)
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 
2718807521SDavid Brownell /* called after powerup, by probe or system-pm "wakeup" */
2818807521SDavid Brownell static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)
2918807521SDavid Brownell {
3018807521SDavid Brownell 	u32			temp;
3118807521SDavid Brownell 	int			retval;
3218807521SDavid Brownell 
3318807521SDavid Brownell 	/* optional debug port, normally in the first BAR */
3418807521SDavid Brownell 	temp = pci_find_capability(pdev, 0x0a);
3518807521SDavid Brownell 	if (temp) {
3618807521SDavid Brownell 		pci_read_config_dword(pdev, temp, &temp);
3718807521SDavid Brownell 		temp >>= 16;
3818807521SDavid Brownell 		if ((temp & (3 << 13)) == (1 << 13)) {
3918807521SDavid Brownell 			temp &= 0x1fff;
4018807521SDavid Brownell 			ehci->debug = ehci_to_hcd(ehci)->regs + temp;
41083522d7SBenjamin Herrenschmidt 			temp = ehci_readl(ehci, &ehci->debug->control);
4218807521SDavid Brownell 			ehci_info(ehci, "debug port %d%s\n",
4318807521SDavid Brownell 				HCS_DEBUG_PORT(ehci->hcs_params),
4418807521SDavid Brownell 				(temp & DBGP_ENABLED)
4518807521SDavid Brownell 					? " IN USE"
4618807521SDavid Brownell 					: "");
4718807521SDavid Brownell 			if (!(temp & DBGP_ENABLED))
4818807521SDavid Brownell 				ehci->debug = NULL;
4918807521SDavid Brownell 		}
5018807521SDavid Brownell 	}
5118807521SDavid Brownell 
52401feafaSDavid Brownell 	/* we expect static quirk code to handle the "extended capabilities"
53401feafaSDavid Brownell 	 * (currently just BIOS handoff) allowed starting with EHCI 0.96
54401feafaSDavid Brownell 	 */
5518807521SDavid Brownell 
5618807521SDavid Brownell 	/* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */
5718807521SDavid Brownell 	retval = pci_set_mwi(pdev);
5818807521SDavid Brownell 	if (!retval)
5918807521SDavid Brownell 		ehci_dbg(ehci, "MWI active\n");
6018807521SDavid Brownell 
6118807521SDavid Brownell 	return 0;
6218807521SDavid Brownell }
6318807521SDavid Brownell 
648926bfa7SDavid Brownell /* called during probe() after chip reset completes */
658926bfa7SDavid Brownell static int ehci_pci_setup(struct usb_hcd *hcd)
667ff71d6aSMatt Porter {
677ff71d6aSMatt Porter 	struct ehci_hcd		*ehci = hcd_to_ehci(hcd);
68abcc9448SDavid Brownell 	struct pci_dev		*pdev = to_pci_dev(hcd->self.controller);
697ff71d6aSMatt Porter 	u32			temp;
7018807521SDavid Brownell 	int			retval;
717ff71d6aSMatt Porter 
72083522d7SBenjamin Herrenschmidt 	switch (pdev->vendor) {
73083522d7SBenjamin Herrenschmidt 	case PCI_VENDOR_ID_TOSHIBA_2:
74083522d7SBenjamin Herrenschmidt 		/* celleb's companion chip */
75083522d7SBenjamin Herrenschmidt 		if (pdev->device == 0x01b5) {
76083522d7SBenjamin Herrenschmidt #ifdef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
77083522d7SBenjamin Herrenschmidt 			ehci->big_endian_mmio = 1;
78083522d7SBenjamin Herrenschmidt #else
79083522d7SBenjamin Herrenschmidt 			ehci_warn(ehci,
80083522d7SBenjamin Herrenschmidt 				  "unsupported big endian Toshiba quirk\n");
81083522d7SBenjamin Herrenschmidt #endif
82083522d7SBenjamin Herrenschmidt 		}
83083522d7SBenjamin Herrenschmidt 		break;
84083522d7SBenjamin Herrenschmidt 	}
85083522d7SBenjamin Herrenschmidt 
867ff71d6aSMatt Porter 	ehci->caps = hcd->regs;
87083522d7SBenjamin Herrenschmidt 	ehci->regs = hcd->regs +
88083522d7SBenjamin Herrenschmidt 		HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
89083522d7SBenjamin Herrenschmidt 
907ff71d6aSMatt Porter 	dbg_hcs_params(ehci, "reset");
917ff71d6aSMatt Porter 	dbg_hcc_params(ehci, "reset");
927ff71d6aSMatt Porter 
93c32ba30fSPaul Serice         /* ehci_init() causes memory for DMA transfers to be
94c32ba30fSPaul Serice          * allocated.  Thus, any vendor-specific workarounds based on
95c32ba30fSPaul Serice          * limiting the type of memory used for DMA transfers must
96c32ba30fSPaul Serice          * happen before ehci_init() is called. */
97c32ba30fSPaul Serice 	switch (pdev->vendor) {
98c32ba30fSPaul Serice 	case PCI_VENDOR_ID_NVIDIA:
99c32ba30fSPaul Serice 		/* NVidia reports that certain chips don't handle
100c32ba30fSPaul Serice 		 * QH, ITD, or SITD addresses above 2GB.  (But TD,
101c32ba30fSPaul Serice 		 * data buffer, and periodic schedule are normal.)
102c32ba30fSPaul Serice 		 */
103c32ba30fSPaul Serice 		switch (pdev->device) {
104c32ba30fSPaul Serice 		case 0x003c:	/* MCP04 */
105c32ba30fSPaul Serice 		case 0x005b:	/* CK804 */
106c32ba30fSPaul Serice 		case 0x00d8:	/* CK8 */
107c32ba30fSPaul Serice 		case 0x00e8:	/* CK8S */
108c32ba30fSPaul Serice 			if (pci_set_consistent_dma_mask(pdev,
109c32ba30fSPaul Serice 						DMA_31BIT_MASK) < 0)
110c32ba30fSPaul Serice 				ehci_warn(ehci, "can't enable NVidia "
111c32ba30fSPaul Serice 					"workaround for >2GB RAM\n");
112c32ba30fSPaul Serice 			break;
113c32ba30fSPaul Serice 		}
114c32ba30fSPaul Serice 		break;
115c32ba30fSPaul Serice 	}
116c32ba30fSPaul Serice 
1177ff71d6aSMatt Porter 	/* cache this readonly data; minimize chip reads */
118083522d7SBenjamin Herrenschmidt 	ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
1197ff71d6aSMatt Porter 
12018807521SDavid Brownell 	retval = ehci_halt(ehci);
12118807521SDavid Brownell 	if (retval)
12218807521SDavid Brownell 		return retval;
12318807521SDavid Brownell 
1248926bfa7SDavid Brownell 	/* data structure init */
1258926bfa7SDavid Brownell 	retval = ehci_init(hcd);
1268926bfa7SDavid Brownell 	if (retval)
1278926bfa7SDavid Brownell 		return retval;
1288926bfa7SDavid Brownell 
1297ff71d6aSMatt Porter 	switch (pdev->vendor) {
1307ff71d6aSMatt Porter 	case PCI_VENDOR_ID_TDI:
1317ff71d6aSMatt Porter 		if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
1327ff71d6aSMatt Porter 			ehci->is_tdi_rh_tt = 1;
1337329e211SAlan Stern 			hcd->has_tt = 1;
1347ff71d6aSMatt Porter 			tdi_reset(ehci);
1357ff71d6aSMatt Porter 		}
1367ff71d6aSMatt Porter 		break;
1377ff71d6aSMatt Porter 	case PCI_VENDOR_ID_AMD:
1387ff71d6aSMatt Porter 		/* AMD8111 EHCI doesn't work, according to AMD errata */
1397ff71d6aSMatt Porter 		if (pdev->device == 0x7463) {
1407ff71d6aSMatt Porter 			ehci_info(ehci, "ignoring AMD8111 (errata)\n");
1418926bfa7SDavid Brownell 			retval = -EIO;
1428926bfa7SDavid Brownell 			goto done;
1437ff71d6aSMatt Porter 		}
1447ff71d6aSMatt Porter 		break;
1457ff71d6aSMatt Porter 	case PCI_VENDOR_ID_NVIDIA:
146f8aeb3bbSDavid Brownell 		switch (pdev->device) {
147f8aeb3bbSDavid Brownell 		/* Some NForce2 chips have problems with selective suspend;
148f8aeb3bbSDavid Brownell 		 * fixed in newer silicon.
149f8aeb3bbSDavid Brownell 		 */
150f8aeb3bbSDavid Brownell 		case 0x0068:
15144c10138SAuke Kok 			if (pdev->revision < 0xa4)
152f8aeb3bbSDavid Brownell 				ehci->no_selective_suspend = 1;
153f8aeb3bbSDavid Brownell 			break;
1547ff71d6aSMatt Porter 		}
1557ff71d6aSMatt Porter 		break;
156055b93c9SRene Herman 	case PCI_VENDOR_ID_VIA:
157055b93c9SRene Herman 		if (pdev->device == 0x3104 && (pdev->revision & 0xf0) == 0x60) {
158055b93c9SRene Herman 			u8 tmp;
159055b93c9SRene Herman 
160055b93c9SRene Herman 			/* The VT6212 defaults to a 1 usec EHCI sleep time which
161055b93c9SRene Herman 			 * hogs the PCI bus *badly*. Setting bit 5 of 0x4B makes
162055b93c9SRene Herman 			 * that sleep time use the conventional 10 usec.
163055b93c9SRene Herman 			 */
164055b93c9SRene Herman 			pci_read_config_byte(pdev, 0x4b, &tmp);
165055b93c9SRene Herman 			if (tmp & 0x20)
166055b93c9SRene Herman 				break;
167055b93c9SRene Herman 			pci_write_config_byte(pdev, 0x4b, tmp | 0x20);
168055b93c9SRene Herman 		}
169055b93c9SRene Herman 		break;
1707ff71d6aSMatt Porter 	}
1717ff71d6aSMatt Porter 
1727ff71d6aSMatt Porter 	ehci_reset(ehci);
1737ff71d6aSMatt Porter 
1747ff71d6aSMatt Porter 	/* at least the Genesys GL880S needs fixup here */
1757ff71d6aSMatt Porter 	temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);
1767ff71d6aSMatt Porter 	temp &= 0x0f;
1777ff71d6aSMatt Porter 	if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) {
1787ff71d6aSMatt Porter 		ehci_dbg(ehci, "bogus port configuration: "
1797ff71d6aSMatt Porter 			"cc=%d x pcc=%d < ports=%d\n",
1807ff71d6aSMatt Porter 			HCS_N_CC(ehci->hcs_params),
1817ff71d6aSMatt Porter 			HCS_N_PCC(ehci->hcs_params),
1827ff71d6aSMatt Porter 			HCS_N_PORTS(ehci->hcs_params));
1837ff71d6aSMatt Porter 
1847ff71d6aSMatt Porter 		switch (pdev->vendor) {
1857ff71d6aSMatt Porter 		case 0x17a0:		/* GENESYS */
1867ff71d6aSMatt Porter 			/* GL880S: should be PORTS=2 */
1877ff71d6aSMatt Porter 			temp |= (ehci->hcs_params & ~0xf);
1887ff71d6aSMatt Porter 			ehci->hcs_params = temp;
1897ff71d6aSMatt Porter 			break;
1907ff71d6aSMatt Porter 		case PCI_VENDOR_ID_NVIDIA:
1917ff71d6aSMatt Porter 			/* NF4: should be PCC=10 */
1927ff71d6aSMatt Porter 			break;
1937ff71d6aSMatt Porter 		}
1947ff71d6aSMatt Porter 	}
1957ff71d6aSMatt Porter 
1967ff71d6aSMatt Porter 	/* Serial Bus Release Number is at PCI 0x60 offset */
1977ff71d6aSMatt Porter 	pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
1987ff71d6aSMatt Porter 
1992c1c3c4cSDavid Brownell 	/* Workaround current PCI init glitch:  wakeup bits aren't
2002c1c3c4cSDavid Brownell 	 * being set from PCI PM capability.
2012c1c3c4cSDavid Brownell 	 */
2022c1c3c4cSDavid Brownell 	if (!device_can_wakeup(&pdev->dev)) {
2032c1c3c4cSDavid Brownell 		u16	port_wake;
2042c1c3c4cSDavid Brownell 
2052c1c3c4cSDavid Brownell 		pci_read_config_word(pdev, 0x62, &port_wake);
2062c1c3c4cSDavid Brownell 		if (port_wake & 0x0001)
2072c1c3c4cSDavid Brownell 			device_init_wakeup(&pdev->dev, 1);
2082c1c3c4cSDavid Brownell 	}
2097ff71d6aSMatt Porter 
210f8aeb3bbSDavid Brownell #ifdef	CONFIG_USB_SUSPEND
211f8aeb3bbSDavid Brownell 	/* REVISIT: the controller works fine for wakeup iff the root hub
212f8aeb3bbSDavid Brownell 	 * itself is "globally" suspended, but usbcore currently doesn't
213f8aeb3bbSDavid Brownell 	 * understand such things.
214f8aeb3bbSDavid Brownell 	 *
215f8aeb3bbSDavid Brownell 	 * System suspend currently expects to be able to suspend the entire
216f8aeb3bbSDavid Brownell 	 * device tree, device-at-a-time.  If we failed selective suspend
217f8aeb3bbSDavid Brownell 	 * reports, system suspend would fail; so the root hub code must claim
218f8aeb3bbSDavid Brownell 	 * success.  That's lying to usbcore, and it matters for for runtime
219f8aeb3bbSDavid Brownell 	 * PM scenarios with selective suspend and remote wakeup...
220f8aeb3bbSDavid Brownell 	 */
221f8aeb3bbSDavid Brownell 	if (ehci->no_selective_suspend && device_can_wakeup(&pdev->dev))
222f8aeb3bbSDavid Brownell 		ehci_warn(ehci, "selective suspend/wakeup unavailable\n");
223f8aeb3bbSDavid Brownell #endif
224f8aeb3bbSDavid Brownell 
225*aff6d18fSAlan Stern 	ehci_port_power(ehci, 1);
22618807521SDavid Brownell 	retval = ehci_pci_reinit(ehci, pdev);
2278926bfa7SDavid Brownell done:
2288926bfa7SDavid Brownell 	return retval;
2297ff71d6aSMatt Porter }
2307ff71d6aSMatt Porter 
2317ff71d6aSMatt Porter /*-------------------------------------------------------------------------*/
2327ff71d6aSMatt Porter 
2337ff71d6aSMatt Porter #ifdef	CONFIG_PM
2347ff71d6aSMatt Porter 
2357ff71d6aSMatt Porter /* suspend/resume, section 4.3 */
2367ff71d6aSMatt Porter 
237f03c17fcSDavid Brownell /* These routines rely on the PCI bus glue
2387ff71d6aSMatt Porter  * to handle powerdown and wakeup, and currently also on
2397ff71d6aSMatt Porter  * transceivers that don't need any software attention to set up
2407ff71d6aSMatt Porter  * the right sort of wakeup.
241f03c17fcSDavid Brownell  * Also they depend on separate root hub suspend/resume.
2427ff71d6aSMatt Porter  */
2437ff71d6aSMatt Porter 
2447ff71d6aSMatt Porter static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message)
2457ff71d6aSMatt Porter {
2467ff71d6aSMatt Porter 	struct ehci_hcd		*ehci = hcd_to_ehci(hcd);
2478de98402SBenjamin Herrenschmidt 	unsigned long		flags;
2488de98402SBenjamin Herrenschmidt 	int			rc = 0;
2497ff71d6aSMatt Porter 
2507ff71d6aSMatt Porter 	if (time_before(jiffies, ehci->next_statechange))
251f03c17fcSDavid Brownell 		msleep(10);
2527ff71d6aSMatt Porter 
2538de98402SBenjamin Herrenschmidt 	/* Root hub was already suspended. Disable irq emission and
2548de98402SBenjamin Herrenschmidt 	 * mark HW unaccessible, bail out if RH has been resumed. Use
2558de98402SBenjamin Herrenschmidt 	 * the spinlock to properly synchronize with possible pending
2568de98402SBenjamin Herrenschmidt 	 * RH suspend or resume activity.
2578de98402SBenjamin Herrenschmidt 	 *
2588de98402SBenjamin Herrenschmidt 	 * This is still racy as hcd->state is manipulated outside of
2598de98402SBenjamin Herrenschmidt 	 * any locks =P But that will be a different fix.
2608de98402SBenjamin Herrenschmidt 	 */
2618de98402SBenjamin Herrenschmidt 	spin_lock_irqsave (&ehci->lock, flags);
2628de98402SBenjamin Herrenschmidt 	if (hcd->state != HC_STATE_SUSPENDED) {
2638de98402SBenjamin Herrenschmidt 		rc = -EINVAL;
2648de98402SBenjamin Herrenschmidt 		goto bail;
2658de98402SBenjamin Herrenschmidt 	}
266083522d7SBenjamin Herrenschmidt 	ehci_writel(ehci, 0, &ehci->regs->intr_enable);
267083522d7SBenjamin Herrenschmidt 	(void)ehci_readl(ehci, &ehci->regs->intr_enable);
2688de98402SBenjamin Herrenschmidt 
26918584999SDavid Brownell 	/* make sure snapshot being resumed re-enumerates everything */
27018584999SDavid Brownell 	if (message.event == PM_EVENT_PRETHAW) {
27118584999SDavid Brownell 		ehci_halt(ehci);
27218584999SDavid Brownell 		ehci_reset(ehci);
27318584999SDavid Brownell 	}
27418584999SDavid Brownell 
2758de98402SBenjamin Herrenschmidt 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
2768de98402SBenjamin Herrenschmidt  bail:
2778de98402SBenjamin Herrenschmidt 	spin_unlock_irqrestore (&ehci->lock, flags);
2788de98402SBenjamin Herrenschmidt 
279f03c17fcSDavid Brownell 	// could save FLADJ in case of Vaux power loss
2807ff71d6aSMatt Porter 	// ... we'd only use it to handle clock skew
2817ff71d6aSMatt Porter 
2828de98402SBenjamin Herrenschmidt 	return rc;
2837ff71d6aSMatt Porter }
2847ff71d6aSMatt Porter 
2857ff71d6aSMatt Porter static int ehci_pci_resume(struct usb_hcd *hcd)
2867ff71d6aSMatt Porter {
2877ff71d6aSMatt Porter 	struct ehci_hcd		*ehci = hcd_to_ehci(hcd);
28818807521SDavid Brownell 	struct pci_dev		*pdev = to_pci_dev(hcd->self.controller);
2897ff71d6aSMatt Porter 
290f03c17fcSDavid Brownell 	// maybe restore FLADJ
2917ff71d6aSMatt Porter 
2927ff71d6aSMatt Porter 	if (time_before(jiffies, ehci->next_statechange))
2937ff71d6aSMatt Porter 		msleep(100);
2947ff71d6aSMatt Porter 
2958de98402SBenjamin Herrenschmidt 	/* Mark hardware accessible again as we are out of D3 state by now */
2968de98402SBenjamin Herrenschmidt 	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
2978de98402SBenjamin Herrenschmidt 
2988c03356aSAlan Stern 	/* If CF is still set, we maintained PCI Vaux power.
2998c03356aSAlan Stern 	 * Just undo the effect of ehci_pci_suspend().
3007ff71d6aSMatt Porter 	 */
301083522d7SBenjamin Herrenschmidt 	if (ehci_readl(ehci, &ehci->regs->configured_flag) == FLAG_CF) {
3028c03356aSAlan Stern 		int	mask = INTR_MASK;
3038c03356aSAlan Stern 
30458a97ffeSAlan Stern 		if (!hcd->self.root_hub->do_remote_wakeup)
3058c03356aSAlan Stern 			mask &= ~STS_PCD;
306083522d7SBenjamin Herrenschmidt 		ehci_writel(ehci, mask, &ehci->regs->intr_enable);
307083522d7SBenjamin Herrenschmidt 		ehci_readl(ehci, &ehci->regs->intr_enable);
308f03c17fcSDavid Brownell 		return 0;
3097ff71d6aSMatt Porter 	}
310f03c17fcSDavid Brownell 
311f03c17fcSDavid Brownell 	ehci_dbg(ehci, "lost power, restarting\n");
3121c50c317SAlan Stern 	usb_root_hub_lost_power(hcd->self.root_hub);
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)
32407d29b63SAlan Stern 		end_unlink_async(ehci);
3257d12e780SDavid Howells 	ehci_work(ehci);
3267ff71d6aSMatt Porter 	spin_unlock_irq(&ehci->lock);
3277ff71d6aSMatt Porter 
328083522d7SBenjamin Herrenschmidt 	ehci_writel(ehci, ehci->command, &ehci->regs->command);
329083522d7SBenjamin Herrenschmidt 	ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);
330083522d7SBenjamin Herrenschmidt 	ehci_readl(ehci, &ehci->regs->command);	/* unblock posted writes */
3318c03356aSAlan Stern 
332383975d7SAlan Stern 	/* here we "know" root ports should always stay powered */
333383975d7SAlan Stern 	ehci_port_power(ehci, 1);
334383975d7SAlan Stern 
3358c03356aSAlan Stern 	hcd->state = HC_STATE_SUSPENDED;
3368c03356aSAlan Stern 	return 0;
3377ff71d6aSMatt Porter }
3387ff71d6aSMatt Porter #endif
3397ff71d6aSMatt Porter 
3407ff71d6aSMatt Porter static const struct hc_driver ehci_pci_hc_driver = {
3417ff71d6aSMatt Porter 	.description =		hcd_name,
3427ff71d6aSMatt Porter 	.product_desc =		"EHCI Host Controller",
3437ff71d6aSMatt Porter 	.hcd_priv_size =	sizeof(struct ehci_hcd),
3447ff71d6aSMatt Porter 
3457ff71d6aSMatt Porter 	/*
3467ff71d6aSMatt Porter 	 * generic hardware linkage
3477ff71d6aSMatt Porter 	 */
3487ff71d6aSMatt Porter 	.irq =			ehci_irq,
3497ff71d6aSMatt Porter 	.flags =		HCD_MEMORY | HCD_USB2,
3507ff71d6aSMatt Porter 
3517ff71d6aSMatt Porter 	/*
3527ff71d6aSMatt Porter 	 * basic lifecycle operations
3537ff71d6aSMatt Porter 	 */
3548926bfa7SDavid Brownell 	.reset =		ehci_pci_setup,
35518807521SDavid Brownell 	.start =		ehci_run,
3567ff71d6aSMatt Porter #ifdef	CONFIG_PM
3577be7d741SAlan Stern 	.pci_suspend =		ehci_pci_suspend,
3587be7d741SAlan Stern 	.pci_resume =		ehci_pci_resume,
3597ff71d6aSMatt Porter #endif
36018807521SDavid Brownell 	.stop =			ehci_stop,
36164a21d02SAleksey Gorelov 	.shutdown =		ehci_shutdown,
3627ff71d6aSMatt Porter 
3637ff71d6aSMatt Porter 	/*
3647ff71d6aSMatt Porter 	 * managing i/o requests and associated device resources
3657ff71d6aSMatt Porter 	 */
3667ff71d6aSMatt Porter 	.urb_enqueue =		ehci_urb_enqueue,
3677ff71d6aSMatt Porter 	.urb_dequeue =		ehci_urb_dequeue,
3687ff71d6aSMatt Porter 	.endpoint_disable =	ehci_endpoint_disable,
3697ff71d6aSMatt Porter 
3707ff71d6aSMatt Porter 	/*
3717ff71d6aSMatt Porter 	 * scheduling support
3727ff71d6aSMatt Porter 	 */
3737ff71d6aSMatt Porter 	.get_frame_number =	ehci_get_frame,
3747ff71d6aSMatt Porter 
3757ff71d6aSMatt Porter 	/*
3767ff71d6aSMatt Porter 	 * root hub support
3777ff71d6aSMatt Porter 	 */
3787ff71d6aSMatt Porter 	.hub_status_data =	ehci_hub_status_data,
3797ff71d6aSMatt Porter 	.hub_control =		ehci_hub_control,
3800c0382e3SAlan Stern 	.bus_suspend =		ehci_bus_suspend,
3810c0382e3SAlan Stern 	.bus_resume =		ehci_bus_resume,
38290da096eSBalaji Rao 	.relinquish_port = 	ehci_relinquish_port,
3837ff71d6aSMatt Porter };
3847ff71d6aSMatt Porter 
3857ff71d6aSMatt Porter /*-------------------------------------------------------------------------*/
3867ff71d6aSMatt Porter 
3877ff71d6aSMatt Porter /* PCI driver selection metadata; PCI hotplugging uses this */
3887ff71d6aSMatt Porter static const struct pci_device_id pci_ids [] = { {
3897ff71d6aSMatt Porter 	/* handle any USB 2.0 EHCI controller */
390c67808eeSJean Delvare 	PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_EHCI, ~0),
3917ff71d6aSMatt Porter 	.driver_data =	(unsigned long) &ehci_pci_hc_driver,
3927ff71d6aSMatt Porter 	},
3937ff71d6aSMatt Porter 	{ /* end: all zeroes */ }
3947ff71d6aSMatt Porter };
3957ff71d6aSMatt Porter MODULE_DEVICE_TABLE(pci, pci_ids);
3967ff71d6aSMatt Porter 
3977ff71d6aSMatt Porter /* pci driver glue; this is a "new style" PCI driver module */
3987ff71d6aSMatt Porter static struct pci_driver ehci_pci_driver = {
3997ff71d6aSMatt Porter 	.name =		(char *) hcd_name,
4007ff71d6aSMatt Porter 	.id_table =	pci_ids,
4017ff71d6aSMatt Porter 
4027ff71d6aSMatt Porter 	.probe =	usb_hcd_pci_probe,
4037ff71d6aSMatt Porter 	.remove =	usb_hcd_pci_remove,
4047ff71d6aSMatt Porter 
4057ff71d6aSMatt Porter #ifdef	CONFIG_PM
4067ff71d6aSMatt Porter 	.suspend =	usb_hcd_pci_suspend,
4077ff71d6aSMatt Porter 	.resume =	usb_hcd_pci_resume,
4087ff71d6aSMatt Porter #endif
40964a21d02SAleksey Gorelov 	.shutdown = 	usb_hcd_pci_shutdown,
4107ff71d6aSMatt Porter };
411