xref: /linux/drivers/usb/host/ehci-pci.c (revision f8aeb3bb8657b207895aa10f75e63f2c48d08985)
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;
4118807521SDavid Brownell 			temp = readl(&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 	ehci_port_power(ehci, 0);
6218807521SDavid Brownell 
6318807521SDavid Brownell 	return 0;
6418807521SDavid Brownell }
6518807521SDavid Brownell 
668926bfa7SDavid Brownell /* called during probe() after chip reset completes */
678926bfa7SDavid Brownell static int ehci_pci_setup(struct usb_hcd *hcd)
687ff71d6aSMatt Porter {
697ff71d6aSMatt Porter 	struct ehci_hcd		*ehci = hcd_to_ehci(hcd);
70abcc9448SDavid Brownell 	struct pci_dev		*pdev = to_pci_dev(hcd->self.controller);
717ff71d6aSMatt Porter 	u32			temp;
7218807521SDavid Brownell 	int			retval;
737ff71d6aSMatt Porter 
747ff71d6aSMatt Porter 	ehci->caps = hcd->regs;
757ff71d6aSMatt Porter 	ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase));
767ff71d6aSMatt Porter 	dbg_hcs_params(ehci, "reset");
777ff71d6aSMatt Porter 	dbg_hcc_params(ehci, "reset");
787ff71d6aSMatt Porter 
797ff71d6aSMatt Porter 	/* cache this readonly data; minimize chip reads */
807ff71d6aSMatt Porter 	ehci->hcs_params = readl(&ehci->caps->hcs_params);
817ff71d6aSMatt Porter 
8218807521SDavid Brownell 	retval = ehci_halt(ehci);
8318807521SDavid Brownell 	if (retval)
8418807521SDavid Brownell 		return retval;
8518807521SDavid Brownell 
868926bfa7SDavid Brownell 	/* data structure init */
878926bfa7SDavid Brownell 	retval = ehci_init(hcd);
888926bfa7SDavid Brownell 	if (retval)
898926bfa7SDavid Brownell 		return retval;
908926bfa7SDavid Brownell 
91abcc9448SDavid Brownell 	/* NOTE:  only the parts below this line are PCI-specific */
927ff71d6aSMatt Porter 
937ff71d6aSMatt Porter 	switch (pdev->vendor) {
947ff71d6aSMatt Porter 	case PCI_VENDOR_ID_TDI:
957ff71d6aSMatt Porter 		if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
967ff71d6aSMatt Porter 			ehci->is_tdi_rh_tt = 1;
977ff71d6aSMatt Porter 			tdi_reset(ehci);
987ff71d6aSMatt Porter 		}
997ff71d6aSMatt Porter 		break;
1007ff71d6aSMatt Porter 	case PCI_VENDOR_ID_AMD:
1017ff71d6aSMatt Porter 		/* AMD8111 EHCI doesn't work, according to AMD errata */
1027ff71d6aSMatt Porter 		if (pdev->device == 0x7463) {
1037ff71d6aSMatt Porter 			ehci_info(ehci, "ignoring AMD8111 (errata)\n");
1048926bfa7SDavid Brownell 			retval = -EIO;
1058926bfa7SDavid Brownell 			goto done;
1067ff71d6aSMatt Porter 		}
1077ff71d6aSMatt Porter 		break;
1087ff71d6aSMatt Porter 	case PCI_VENDOR_ID_NVIDIA:
109*f8aeb3bbSDavid Brownell 		switch (pdev->device) {
1107ff71d6aSMatt Porter 		/* NVidia reports that certain chips don't handle
1117ff71d6aSMatt Porter 		 * QH, ITD, or SITD addresses above 2GB.  (But TD,
1127ff71d6aSMatt Porter 		 * data buffer, and periodic schedule are normal.)
1137ff71d6aSMatt Porter 		 */
1147ff71d6aSMatt Porter 		case 0x003c:	/* MCP04 */
1157ff71d6aSMatt Porter 		case 0x005b:	/* CK804 */
1167ff71d6aSMatt Porter 		case 0x00d8:	/* CK8 */
1177ff71d6aSMatt Porter 		case 0x00e8:	/* CK8S */
1187ff71d6aSMatt Porter 			if (pci_set_consistent_dma_mask(pdev,
1197ff71d6aSMatt Porter 						DMA_31BIT_MASK) < 0)
1207ff71d6aSMatt Porter 				ehci_warn(ehci, "can't enable NVidia "
1217ff71d6aSMatt Porter 					"workaround for >2GB RAM\n");
1227ff71d6aSMatt Porter 			break;
123*f8aeb3bbSDavid Brownell 		/* Some NForce2 chips have problems with selective suspend;
124*f8aeb3bbSDavid Brownell 		 * fixed in newer silicon.
125*f8aeb3bbSDavid Brownell 		 */
126*f8aeb3bbSDavid Brownell 		case 0x0068:
127*f8aeb3bbSDavid Brownell 			pci_read_config_dword(pdev, PCI_REVISION_ID, &temp);
128*f8aeb3bbSDavid Brownell 			if ((temp & 0xff) < 0xa4)
129*f8aeb3bbSDavid Brownell 				ehci->no_selective_suspend = 1;
130*f8aeb3bbSDavid Brownell 			break;
1317ff71d6aSMatt Porter 		}
1327ff71d6aSMatt Porter 		break;
1337ff71d6aSMatt Porter 	}
1347ff71d6aSMatt Porter 
1357ff71d6aSMatt Porter 	if (ehci_is_TDI(ehci))
1367ff71d6aSMatt Porter 		ehci_reset(ehci);
1377ff71d6aSMatt Porter 
1387ff71d6aSMatt Porter 	/* at least the Genesys GL880S needs fixup here */
1397ff71d6aSMatt Porter 	temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);
1407ff71d6aSMatt Porter 	temp &= 0x0f;
1417ff71d6aSMatt Porter 	if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) {
1427ff71d6aSMatt Porter 		ehci_dbg(ehci, "bogus port configuration: "
1437ff71d6aSMatt Porter 			"cc=%d x pcc=%d < ports=%d\n",
1447ff71d6aSMatt Porter 			HCS_N_CC(ehci->hcs_params),
1457ff71d6aSMatt Porter 			HCS_N_PCC(ehci->hcs_params),
1467ff71d6aSMatt Porter 			HCS_N_PORTS(ehci->hcs_params));
1477ff71d6aSMatt Porter 
1487ff71d6aSMatt Porter 		switch (pdev->vendor) {
1497ff71d6aSMatt Porter 		case 0x17a0:		/* GENESYS */
1507ff71d6aSMatt Porter 			/* GL880S: should be PORTS=2 */
1517ff71d6aSMatt Porter 			temp |= (ehci->hcs_params & ~0xf);
1527ff71d6aSMatt Porter 			ehci->hcs_params = temp;
1537ff71d6aSMatt Porter 			break;
1547ff71d6aSMatt Porter 		case PCI_VENDOR_ID_NVIDIA:
1557ff71d6aSMatt Porter 			/* NF4: should be PCC=10 */
1567ff71d6aSMatt Porter 			break;
1577ff71d6aSMatt Porter 		}
1587ff71d6aSMatt Porter 	}
1597ff71d6aSMatt Porter 
1607ff71d6aSMatt Porter 	/* Serial Bus Release Number is at PCI 0x60 offset */
1617ff71d6aSMatt Porter 	pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
1627ff71d6aSMatt Porter 
1632c1c3c4cSDavid Brownell 	/* Workaround current PCI init glitch:  wakeup bits aren't
1642c1c3c4cSDavid Brownell 	 * being set from PCI PM capability.
1652c1c3c4cSDavid Brownell 	 */
1662c1c3c4cSDavid Brownell 	if (!device_can_wakeup(&pdev->dev)) {
1672c1c3c4cSDavid Brownell 		u16	port_wake;
1682c1c3c4cSDavid Brownell 
1692c1c3c4cSDavid Brownell 		pci_read_config_word(pdev, 0x62, &port_wake);
1702c1c3c4cSDavid Brownell 		if (port_wake & 0x0001)
1712c1c3c4cSDavid Brownell 			device_init_wakeup(&pdev->dev, 1);
1722c1c3c4cSDavid Brownell 	}
1737ff71d6aSMatt Porter 
174*f8aeb3bbSDavid Brownell #ifdef	CONFIG_USB_SUSPEND
175*f8aeb3bbSDavid Brownell 	/* REVISIT: the controller works fine for wakeup iff the root hub
176*f8aeb3bbSDavid Brownell 	 * itself is "globally" suspended, but usbcore currently doesn't
177*f8aeb3bbSDavid Brownell 	 * understand such things.
178*f8aeb3bbSDavid Brownell 	 *
179*f8aeb3bbSDavid Brownell 	 * System suspend currently expects to be able to suspend the entire
180*f8aeb3bbSDavid Brownell 	 * device tree, device-at-a-time.  If we failed selective suspend
181*f8aeb3bbSDavid Brownell 	 * reports, system suspend would fail; so the root hub code must claim
182*f8aeb3bbSDavid Brownell 	 * success.  That's lying to usbcore, and it matters for for runtime
183*f8aeb3bbSDavid Brownell 	 * PM scenarios with selective suspend and remote wakeup...
184*f8aeb3bbSDavid Brownell 	 */
185*f8aeb3bbSDavid Brownell 	if (ehci->no_selective_suspend && device_can_wakeup(&pdev->dev))
186*f8aeb3bbSDavid Brownell 		ehci_warn(ehci, "selective suspend/wakeup unavailable\n");
187*f8aeb3bbSDavid Brownell #endif
188*f8aeb3bbSDavid Brownell 
18918807521SDavid Brownell 	retval = ehci_pci_reinit(ehci, pdev);
1908926bfa7SDavid Brownell done:
1918926bfa7SDavid Brownell 	return retval;
1927ff71d6aSMatt Porter }
1937ff71d6aSMatt Porter 
1947ff71d6aSMatt Porter /*-------------------------------------------------------------------------*/
1957ff71d6aSMatt Porter 
1967ff71d6aSMatt Porter #ifdef	CONFIG_PM
1977ff71d6aSMatt Porter 
1987ff71d6aSMatt Porter /* suspend/resume, section 4.3 */
1997ff71d6aSMatt Porter 
200f03c17fcSDavid Brownell /* These routines rely on the PCI bus glue
2017ff71d6aSMatt Porter  * to handle powerdown and wakeup, and currently also on
2027ff71d6aSMatt Porter  * transceivers that don't need any software attention to set up
2037ff71d6aSMatt Porter  * the right sort of wakeup.
204f03c17fcSDavid Brownell  * Also they depend on separate root hub suspend/resume.
2057ff71d6aSMatt Porter  */
2067ff71d6aSMatt Porter 
2077ff71d6aSMatt Porter static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message)
2087ff71d6aSMatt Porter {
2097ff71d6aSMatt Porter 	struct ehci_hcd		*ehci = hcd_to_ehci(hcd);
2108de98402SBenjamin Herrenschmidt 	unsigned long		flags;
2118de98402SBenjamin Herrenschmidt 	int			rc = 0;
2127ff71d6aSMatt Porter 
2137ff71d6aSMatt Porter 	if (time_before(jiffies, ehci->next_statechange))
214f03c17fcSDavid Brownell 		msleep(10);
2157ff71d6aSMatt Porter 
2168de98402SBenjamin Herrenschmidt 	/* Root hub was already suspended. Disable irq emission and
2178de98402SBenjamin Herrenschmidt 	 * mark HW unaccessible, bail out if RH has been resumed. Use
2188de98402SBenjamin Herrenschmidt 	 * the spinlock to properly synchronize with possible pending
2198de98402SBenjamin Herrenschmidt 	 * RH suspend or resume activity.
2208de98402SBenjamin Herrenschmidt 	 *
2218de98402SBenjamin Herrenschmidt 	 * This is still racy as hcd->state is manipulated outside of
2228de98402SBenjamin Herrenschmidt 	 * any locks =P But that will be a different fix.
2238de98402SBenjamin Herrenschmidt 	 */
2248de98402SBenjamin Herrenschmidt 	spin_lock_irqsave (&ehci->lock, flags);
2258de98402SBenjamin Herrenschmidt 	if (hcd->state != HC_STATE_SUSPENDED) {
2268de98402SBenjamin Herrenschmidt 		rc = -EINVAL;
2278de98402SBenjamin Herrenschmidt 		goto bail;
2288de98402SBenjamin Herrenschmidt 	}
2298de98402SBenjamin Herrenschmidt 	writel (0, &ehci->regs->intr_enable);
2308de98402SBenjamin Herrenschmidt 	(void)readl(&ehci->regs->intr_enable);
2318de98402SBenjamin Herrenschmidt 
2328de98402SBenjamin Herrenschmidt 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
2338de98402SBenjamin Herrenschmidt  bail:
2348de98402SBenjamin Herrenschmidt 	spin_unlock_irqrestore (&ehci->lock, flags);
2358de98402SBenjamin Herrenschmidt 
236f03c17fcSDavid Brownell 	// could save FLADJ in case of Vaux power loss
2377ff71d6aSMatt Porter 	// ... we'd only use it to handle clock skew
2387ff71d6aSMatt Porter 
2398de98402SBenjamin Herrenschmidt 	return rc;
2407ff71d6aSMatt Porter }
2417ff71d6aSMatt Porter 
2427ff71d6aSMatt Porter static int ehci_pci_resume(struct usb_hcd *hcd)
2437ff71d6aSMatt Porter {
2447ff71d6aSMatt Porter 	struct ehci_hcd		*ehci = hcd_to_ehci(hcd);
2457ff71d6aSMatt Porter 	unsigned		port;
24618807521SDavid Brownell 	struct pci_dev		*pdev = to_pci_dev(hcd->self.controller);
2477ff71d6aSMatt Porter 	int			retval = -EINVAL;
2487ff71d6aSMatt Porter 
249f03c17fcSDavid Brownell 	// maybe restore FLADJ
2507ff71d6aSMatt Porter 
2517ff71d6aSMatt Porter 	if (time_before(jiffies, ehci->next_statechange))
2527ff71d6aSMatt Porter 		msleep(100);
2537ff71d6aSMatt Porter 
2548de98402SBenjamin Herrenschmidt 	/* Mark hardware accessible again as we are out of D3 state by now */
2558de98402SBenjamin Herrenschmidt 	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
2568de98402SBenjamin Herrenschmidt 
257f03c17fcSDavid Brownell 	/* If CF is clear, we lost PCI Vaux power and need to restart.  */
25818807521SDavid Brownell 	if (readl(&ehci->regs->configured_flag) != FLAG_CF)
259f03c17fcSDavid Brownell 		goto restart;
260f03c17fcSDavid Brownell 
2617ff71d6aSMatt Porter 	/* If any port is suspended (or owned by the companion),
2627ff71d6aSMatt Porter 	 * we know we can/must resume the HC (and mustn't reset it).
263f03c17fcSDavid Brownell 	 * We just defer that to the root hub code.
2647ff71d6aSMatt Porter 	 */
2657ff71d6aSMatt Porter 	for (port = HCS_N_PORTS(ehci->hcs_params); port > 0; ) {
2667ff71d6aSMatt Porter 		u32	status;
2677ff71d6aSMatt Porter 		port--;
2687ff71d6aSMatt Porter 		status = readl(&ehci->regs->port_status [port]);
2697ff71d6aSMatt Porter 		if (!(status & PORT_POWER))
2707ff71d6aSMatt Porter 			continue;
271f03c17fcSDavid Brownell 		if (status & (PORT_SUSPEND | PORT_RESUME | PORT_OWNER)) {
272f03c17fcSDavid Brownell 			usb_hcd_resume_root_hub(hcd);
273f03c17fcSDavid Brownell 			return 0;
2747ff71d6aSMatt Porter 		}
275f03c17fcSDavid Brownell 	}
276f03c17fcSDavid Brownell 
277f03c17fcSDavid Brownell restart:
278f03c17fcSDavid Brownell 	ehci_dbg(ehci, "lost power, restarting\n");
2791c50c317SAlan Stern 	usb_root_hub_lost_power(hcd->self.root_hub);
2807ff71d6aSMatt Porter 
2817ff71d6aSMatt Porter 	/* Else reset, to cope with power loss or flush-to-storage
282f03c17fcSDavid Brownell 	 * style "resume" having let BIOS kick in during reboot.
2837ff71d6aSMatt Porter 	 */
2847ff71d6aSMatt Porter 	(void) ehci_halt(ehci);
2857ff71d6aSMatt Porter 	(void) ehci_reset(ehci);
28618807521SDavid Brownell 	(void) ehci_pci_reinit(ehci, pdev);
2877ff71d6aSMatt Porter 
2887ff71d6aSMatt Porter 	/* emptying the schedule aborts any urbs */
2897ff71d6aSMatt Porter 	spin_lock_irq(&ehci->lock);
2907ff71d6aSMatt Porter 	if (ehci->reclaim)
2917ff71d6aSMatt Porter 		ehci->reclaim_ready = 1;
2927ff71d6aSMatt Porter 	ehci_work(ehci, NULL);
2937ff71d6aSMatt Porter 	spin_unlock_irq(&ehci->lock);
2947ff71d6aSMatt Porter 
2957ff71d6aSMatt Porter 	/* restart; khubd will disconnect devices */
2967ff71d6aSMatt Porter 	retval = ehci_run(hcd);
2977ff71d6aSMatt Porter 
29818807521SDavid Brownell 	/* here we "know" root ports should always stay powered */
2997ff71d6aSMatt Porter 	ehci_port_power(ehci, 1);
3007ff71d6aSMatt Porter 
3017ff71d6aSMatt Porter 	return retval;
3027ff71d6aSMatt Porter }
3037ff71d6aSMatt Porter #endif
3047ff71d6aSMatt Porter 
3057ff71d6aSMatt Porter static const struct hc_driver ehci_pci_hc_driver = {
3067ff71d6aSMatt Porter 	.description =		hcd_name,
3077ff71d6aSMatt Porter 	.product_desc =		"EHCI Host Controller",
3087ff71d6aSMatt Porter 	.hcd_priv_size =	sizeof(struct ehci_hcd),
3097ff71d6aSMatt Porter 
3107ff71d6aSMatt Porter 	/*
3117ff71d6aSMatt Porter 	 * generic hardware linkage
3127ff71d6aSMatt Porter 	 */
3137ff71d6aSMatt Porter 	.irq =			ehci_irq,
3147ff71d6aSMatt Porter 	.flags =		HCD_MEMORY | HCD_USB2,
3157ff71d6aSMatt Porter 
3167ff71d6aSMatt Porter 	/*
3177ff71d6aSMatt Porter 	 * basic lifecycle operations
3187ff71d6aSMatt Porter 	 */
3198926bfa7SDavid Brownell 	.reset =		ehci_pci_setup,
32018807521SDavid Brownell 	.start =		ehci_run,
3217ff71d6aSMatt Porter #ifdef	CONFIG_PM
3227ff71d6aSMatt Porter 	.suspend =		ehci_pci_suspend,
3237ff71d6aSMatt Porter 	.resume =		ehci_pci_resume,
3247ff71d6aSMatt Porter #endif
32518807521SDavid Brownell 	.stop =			ehci_stop,
3267ff71d6aSMatt Porter 
3277ff71d6aSMatt Porter 	/*
3287ff71d6aSMatt Porter 	 * managing i/o requests and associated device resources
3297ff71d6aSMatt Porter 	 */
3307ff71d6aSMatt Porter 	.urb_enqueue =		ehci_urb_enqueue,
3317ff71d6aSMatt Porter 	.urb_dequeue =		ehci_urb_dequeue,
3327ff71d6aSMatt Porter 	.endpoint_disable =	ehci_endpoint_disable,
3337ff71d6aSMatt Porter 
3347ff71d6aSMatt Porter 	/*
3357ff71d6aSMatt Porter 	 * scheduling support
3367ff71d6aSMatt Porter 	 */
3377ff71d6aSMatt Porter 	.get_frame_number =	ehci_get_frame,
3387ff71d6aSMatt Porter 
3397ff71d6aSMatt Porter 	/*
3407ff71d6aSMatt Porter 	 * root hub support
3417ff71d6aSMatt Porter 	 */
3427ff71d6aSMatt Porter 	.hub_status_data =	ehci_hub_status_data,
3437ff71d6aSMatt Porter 	.hub_control =		ehci_hub_control,
3440c0382e3SAlan Stern 	.bus_suspend =		ehci_bus_suspend,
3450c0382e3SAlan Stern 	.bus_resume =		ehci_bus_resume,
3467ff71d6aSMatt Porter };
3477ff71d6aSMatt Porter 
3487ff71d6aSMatt Porter /*-------------------------------------------------------------------------*/
3497ff71d6aSMatt Porter 
3507ff71d6aSMatt Porter /* PCI driver selection metadata; PCI hotplugging uses this */
3517ff71d6aSMatt Porter static const struct pci_device_id pci_ids [] = { {
3527ff71d6aSMatt Porter 	/* handle any USB 2.0 EHCI controller */
3537ff71d6aSMatt Porter 	PCI_DEVICE_CLASS(((PCI_CLASS_SERIAL_USB << 8) | 0x20), ~0),
3547ff71d6aSMatt Porter 	.driver_data =	(unsigned long) &ehci_pci_hc_driver,
3557ff71d6aSMatt Porter 	},
3567ff71d6aSMatt Porter 	{ /* end: all zeroes */ }
3577ff71d6aSMatt Porter };
3587ff71d6aSMatt Porter MODULE_DEVICE_TABLE(pci, pci_ids);
3597ff71d6aSMatt Porter 
3607ff71d6aSMatt Porter /* pci driver glue; this is a "new style" PCI driver module */
3617ff71d6aSMatt Porter static struct pci_driver ehci_pci_driver = {
3627ff71d6aSMatt Porter 	.name =		(char *) hcd_name,
3637ff71d6aSMatt Porter 	.id_table =	pci_ids,
3647ff71d6aSMatt Porter 
3657ff71d6aSMatt Porter 	.probe =	usb_hcd_pci_probe,
3667ff71d6aSMatt Porter 	.remove =	usb_hcd_pci_remove,
3677ff71d6aSMatt Porter 
3687ff71d6aSMatt Porter #ifdef	CONFIG_PM
3697ff71d6aSMatt Porter 	.suspend =	usb_hcd_pci_suspend,
3707ff71d6aSMatt Porter 	.resume =	usb_hcd_pci_resume,
3717ff71d6aSMatt Porter #endif
3727ff71d6aSMatt Porter };
3737ff71d6aSMatt Porter 
3747ff71d6aSMatt Porter static int __init ehci_hcd_pci_init(void)
3757ff71d6aSMatt Porter {
3767ff71d6aSMatt Porter 	if (usb_disabled())
3777ff71d6aSMatt Porter 		return -ENODEV;
3787ff71d6aSMatt Porter 
3797ff71d6aSMatt Porter 	pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n",
3807ff71d6aSMatt Porter 		hcd_name,
3817ff71d6aSMatt Porter 		sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
3827ff71d6aSMatt Porter 		sizeof(struct ehci_itd), sizeof(struct ehci_sitd));
3837ff71d6aSMatt Porter 
3847ff71d6aSMatt Porter 	return pci_register_driver(&ehci_pci_driver);
3857ff71d6aSMatt Porter }
3867ff71d6aSMatt Porter module_init(ehci_hcd_pci_init);
3877ff71d6aSMatt Porter 
3887ff71d6aSMatt Porter static void __exit ehci_hcd_pci_cleanup(void)
3897ff71d6aSMatt Porter {
3907ff71d6aSMatt Porter 	pci_unregister_driver(&ehci_pci_driver);
3917ff71d6aSMatt Porter }
3927ff71d6aSMatt Porter module_exit(ehci_hcd_pci_cleanup);
393