xref: /linux/drivers/usb/host/ehci-pci.c (revision 7ff71d6adf81a43505b7cbaa034e4063d3439182)
1*7ff71d6aSMatt Porter /*
2*7ff71d6aSMatt Porter  * EHCI HCD (Host Controller Driver) PCI Bus Glue.
3*7ff71d6aSMatt Porter  *
4*7ff71d6aSMatt Porter  * Copyright (c) 2000-2004 by David Brownell
5*7ff71d6aSMatt Porter  *
6*7ff71d6aSMatt Porter  * This program is free software; you can redistribute it and/or modify it
7*7ff71d6aSMatt Porter  * under the terms of the GNU General Public License as published by the
8*7ff71d6aSMatt Porter  * Free Software Foundation; either version 2 of the License, or (at your
9*7ff71d6aSMatt Porter  * option) any later version.
10*7ff71d6aSMatt Porter  *
11*7ff71d6aSMatt Porter  * This program is distributed in the hope that it will be useful, but
12*7ff71d6aSMatt Porter  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13*7ff71d6aSMatt Porter  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14*7ff71d6aSMatt Porter  * for more details.
15*7ff71d6aSMatt Porter  *
16*7ff71d6aSMatt Porter  * You should have received a copy of the GNU General Public License
17*7ff71d6aSMatt Porter  * along with this program; if not, write to the Free Software Foundation,
18*7ff71d6aSMatt Porter  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*7ff71d6aSMatt Porter  */
20*7ff71d6aSMatt Porter 
21*7ff71d6aSMatt Porter #ifndef CONFIG_PCI
22*7ff71d6aSMatt Porter #error "This file is PCI bus glue.  CONFIG_PCI must be defined."
23*7ff71d6aSMatt Porter #endif
24*7ff71d6aSMatt Porter 
25*7ff71d6aSMatt Porter /*-------------------------------------------------------------------------*/
26*7ff71d6aSMatt Porter 
27*7ff71d6aSMatt Porter /* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/...
28*7ff71d6aSMatt Porter  * off the controller (maybe it can boot from highspeed USB disks).
29*7ff71d6aSMatt Porter  */
30*7ff71d6aSMatt Porter static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap)
31*7ff71d6aSMatt Porter {
32*7ff71d6aSMatt Porter 	struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller);
33*7ff71d6aSMatt Porter 
34*7ff71d6aSMatt Porter 	/* always say Linux will own the hardware */
35*7ff71d6aSMatt Porter 	pci_write_config_byte(pdev, where + 3, 1);
36*7ff71d6aSMatt Porter 
37*7ff71d6aSMatt Porter 	/* maybe wait a while for BIOS to respond */
38*7ff71d6aSMatt Porter 	if (cap & (1 << 16)) {
39*7ff71d6aSMatt Porter 		int msec = 5000;
40*7ff71d6aSMatt Porter 
41*7ff71d6aSMatt Porter 		do {
42*7ff71d6aSMatt Porter 			msleep(10);
43*7ff71d6aSMatt Porter 			msec -= 10;
44*7ff71d6aSMatt Porter 			pci_read_config_dword(pdev, where, &cap);
45*7ff71d6aSMatt Porter 		} while ((cap & (1 << 16)) && msec);
46*7ff71d6aSMatt Porter 		if (cap & (1 << 16)) {
47*7ff71d6aSMatt Porter 			ehci_err(ehci, "BIOS handoff failed (%d, %08x)\n",
48*7ff71d6aSMatt Porter 				where, cap);
49*7ff71d6aSMatt Porter 			// some BIOS versions seem buggy...
50*7ff71d6aSMatt Porter 			// return 1;
51*7ff71d6aSMatt Porter 			ehci_warn (ehci, "continuing after BIOS bug...\n");
52*7ff71d6aSMatt Porter 			/* disable all SMIs, and clear "BIOS owns" flag */
53*7ff71d6aSMatt Porter 			pci_write_config_dword(pdev, where + 4, 0);
54*7ff71d6aSMatt Porter 			pci_write_config_byte(pdev, where + 2, 0);
55*7ff71d6aSMatt Porter 		} else
56*7ff71d6aSMatt Porter 			ehci_dbg(ehci, "BIOS handoff succeeded\n");
57*7ff71d6aSMatt Porter 	}
58*7ff71d6aSMatt Porter 	return 0;
59*7ff71d6aSMatt Porter }
60*7ff71d6aSMatt Porter 
61*7ff71d6aSMatt Porter /* called by khubd or root hub init threads */
62*7ff71d6aSMatt Porter static int ehci_pci_reset (struct usb_hcd *hcd)
63*7ff71d6aSMatt Porter {
64*7ff71d6aSMatt Porter 	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
65*7ff71d6aSMatt Porter 	u32			temp;
66*7ff71d6aSMatt Porter 	unsigned		count = 256/4;
67*7ff71d6aSMatt Porter 
68*7ff71d6aSMatt Porter 	spin_lock_init (&ehci->lock);
69*7ff71d6aSMatt Porter 
70*7ff71d6aSMatt Porter 	ehci->caps = hcd->regs;
71*7ff71d6aSMatt Porter 	ehci->regs = hcd->regs + HC_LENGTH (readl (&ehci->caps->hc_capbase));
72*7ff71d6aSMatt Porter 	dbg_hcs_params (ehci, "reset");
73*7ff71d6aSMatt Porter 	dbg_hcc_params (ehci, "reset");
74*7ff71d6aSMatt Porter 
75*7ff71d6aSMatt Porter 	/* cache this readonly data; minimize chip reads */
76*7ff71d6aSMatt Porter 	ehci->hcs_params = readl (&ehci->caps->hcs_params);
77*7ff71d6aSMatt Porter 
78*7ff71d6aSMatt Porter 	if (hcd->self.controller->bus == &pci_bus_type) {
79*7ff71d6aSMatt Porter 		struct pci_dev	*pdev = to_pci_dev(hcd->self.controller);
80*7ff71d6aSMatt Porter 
81*7ff71d6aSMatt Porter 		switch (pdev->vendor) {
82*7ff71d6aSMatt Porter 		case PCI_VENDOR_ID_TDI:
83*7ff71d6aSMatt Porter 			if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
84*7ff71d6aSMatt Porter 				ehci->is_tdi_rh_tt = 1;
85*7ff71d6aSMatt Porter 				tdi_reset (ehci);
86*7ff71d6aSMatt Porter 			}
87*7ff71d6aSMatt Porter 			break;
88*7ff71d6aSMatt Porter 		case PCI_VENDOR_ID_AMD:
89*7ff71d6aSMatt Porter 			/* AMD8111 EHCI doesn't work, according to AMD errata */
90*7ff71d6aSMatt Porter 			if (pdev->device == 0x7463) {
91*7ff71d6aSMatt Porter 				ehci_info (ehci, "ignoring AMD8111 (errata)\n");
92*7ff71d6aSMatt Porter 				return -EIO;
93*7ff71d6aSMatt Porter 			}
94*7ff71d6aSMatt Porter 			break;
95*7ff71d6aSMatt Porter 		case PCI_VENDOR_ID_NVIDIA:
96*7ff71d6aSMatt Porter 			/* NVidia reports that certain chips don't handle
97*7ff71d6aSMatt Porter 			 * QH, ITD, or SITD addresses above 2GB.  (But TD,
98*7ff71d6aSMatt Porter 			 * data buffer, and periodic schedule are normal.)
99*7ff71d6aSMatt Porter 			 */
100*7ff71d6aSMatt Porter 			switch (pdev->device) {
101*7ff71d6aSMatt Porter 			case 0x003c:	/* MCP04 */
102*7ff71d6aSMatt Porter 			case 0x005b:	/* CK804 */
103*7ff71d6aSMatt Porter 			case 0x00d8:	/* CK8 */
104*7ff71d6aSMatt Porter 			case 0x00e8:	/* CK8S */
105*7ff71d6aSMatt Porter 				if (pci_set_consistent_dma_mask(pdev,
106*7ff71d6aSMatt Porter 							DMA_31BIT_MASK) < 0)
107*7ff71d6aSMatt Porter 					ehci_warn (ehci, "can't enable NVidia "
108*7ff71d6aSMatt Porter 						"workaround for >2GB RAM\n");
109*7ff71d6aSMatt Porter 				break;
110*7ff71d6aSMatt Porter 			}
111*7ff71d6aSMatt Porter 			break;
112*7ff71d6aSMatt Porter 		}
113*7ff71d6aSMatt Porter 
114*7ff71d6aSMatt Porter 		/* optional debug port, normally in the first BAR */
115*7ff71d6aSMatt Porter 		temp = pci_find_capability (pdev, 0x0a);
116*7ff71d6aSMatt Porter 		if (temp) {
117*7ff71d6aSMatt Porter 			pci_read_config_dword(pdev, temp, &temp);
118*7ff71d6aSMatt Porter 			temp >>= 16;
119*7ff71d6aSMatt Porter 			if ((temp & (3 << 13)) == (1 << 13)) {
120*7ff71d6aSMatt Porter 				temp &= 0x1fff;
121*7ff71d6aSMatt Porter 				ehci->debug = hcd->regs + temp;
122*7ff71d6aSMatt Porter 				temp = readl (&ehci->debug->control);
123*7ff71d6aSMatt Porter 				ehci_info (ehci, "debug port %d%s\n",
124*7ff71d6aSMatt Porter 					HCS_DEBUG_PORT(ehci->hcs_params),
125*7ff71d6aSMatt Porter 					(temp & DBGP_ENABLED)
126*7ff71d6aSMatt Porter 						? " IN USE"
127*7ff71d6aSMatt Porter 						: "");
128*7ff71d6aSMatt Porter 				if (!(temp & DBGP_ENABLED))
129*7ff71d6aSMatt Porter 					ehci->debug = NULL;
130*7ff71d6aSMatt Porter 			}
131*7ff71d6aSMatt Porter 		}
132*7ff71d6aSMatt Porter 
133*7ff71d6aSMatt Porter 		temp = HCC_EXT_CAPS (readl (&ehci->caps->hcc_params));
134*7ff71d6aSMatt Porter 	} else
135*7ff71d6aSMatt Porter 		temp = 0;
136*7ff71d6aSMatt Porter 
137*7ff71d6aSMatt Porter 	/* EHCI 0.96 and later may have "extended capabilities" */
138*7ff71d6aSMatt Porter 	while (temp && count--) {
139*7ff71d6aSMatt Porter 		u32		cap;
140*7ff71d6aSMatt Porter 
141*7ff71d6aSMatt Porter 		pci_read_config_dword (to_pci_dev(hcd->self.controller),
142*7ff71d6aSMatt Porter 				temp, &cap);
143*7ff71d6aSMatt Porter 		ehci_dbg (ehci, "capability %04x at %02x\n", cap, temp);
144*7ff71d6aSMatt Porter 		switch (cap & 0xff) {
145*7ff71d6aSMatt Porter 		case 1:			/* BIOS/SMM/... handoff */
146*7ff71d6aSMatt Porter 			if (bios_handoff (ehci, temp, cap) != 0)
147*7ff71d6aSMatt Porter 				return -EOPNOTSUPP;
148*7ff71d6aSMatt Porter 			break;
149*7ff71d6aSMatt Porter 		case 0:			/* illegal reserved capability */
150*7ff71d6aSMatt Porter 			ehci_warn (ehci, "illegal capability!\n");
151*7ff71d6aSMatt Porter 			cap = 0;
152*7ff71d6aSMatt Porter 			/* FALLTHROUGH */
153*7ff71d6aSMatt Porter 		default:		/* unknown */
154*7ff71d6aSMatt Porter 			break;
155*7ff71d6aSMatt Porter 		}
156*7ff71d6aSMatt Porter 		temp = (cap >> 8) & 0xff;
157*7ff71d6aSMatt Porter 	}
158*7ff71d6aSMatt Porter 	if (!count) {
159*7ff71d6aSMatt Porter 		ehci_err (ehci, "bogus capabilities ... PCI problems!\n");
160*7ff71d6aSMatt Porter 		return -EIO;
161*7ff71d6aSMatt Porter 	}
162*7ff71d6aSMatt Porter 	if (ehci_is_TDI(ehci))
163*7ff71d6aSMatt Porter 		ehci_reset (ehci);
164*7ff71d6aSMatt Porter 
165*7ff71d6aSMatt Porter 	ehci_port_power (ehci, 0);
166*7ff71d6aSMatt Porter 
167*7ff71d6aSMatt Porter 	/* at least the Genesys GL880S needs fixup here */
168*7ff71d6aSMatt Porter 	temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);
169*7ff71d6aSMatt Porter 	temp &= 0x0f;
170*7ff71d6aSMatt Porter 	if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) {
171*7ff71d6aSMatt Porter 		ehci_dbg (ehci, "bogus port configuration: "
172*7ff71d6aSMatt Porter 			"cc=%d x pcc=%d < ports=%d\n",
173*7ff71d6aSMatt Porter 			HCS_N_CC(ehci->hcs_params),
174*7ff71d6aSMatt Porter 			HCS_N_PCC(ehci->hcs_params),
175*7ff71d6aSMatt Porter 			HCS_N_PORTS(ehci->hcs_params));
176*7ff71d6aSMatt Porter 
177*7ff71d6aSMatt Porter 		if (hcd->self.controller->bus == &pci_bus_type) {
178*7ff71d6aSMatt Porter 			struct pci_dev	*pdev;
179*7ff71d6aSMatt Porter 
180*7ff71d6aSMatt Porter 			pdev = to_pci_dev(hcd->self.controller);
181*7ff71d6aSMatt Porter 			switch (pdev->vendor) {
182*7ff71d6aSMatt Porter 			case 0x17a0:		/* GENESYS */
183*7ff71d6aSMatt Porter 				/* GL880S: should be PORTS=2 */
184*7ff71d6aSMatt Porter 				temp |= (ehci->hcs_params & ~0xf);
185*7ff71d6aSMatt Porter 				ehci->hcs_params = temp;
186*7ff71d6aSMatt Porter 				break;
187*7ff71d6aSMatt Porter 			case PCI_VENDOR_ID_NVIDIA:
188*7ff71d6aSMatt Porter 				/* NF4: should be PCC=10 */
189*7ff71d6aSMatt Porter 				break;
190*7ff71d6aSMatt Porter 			}
191*7ff71d6aSMatt Porter 		}
192*7ff71d6aSMatt Porter 	}
193*7ff71d6aSMatt Porter 
194*7ff71d6aSMatt Porter 	/* force HC to halt state */
195*7ff71d6aSMatt Porter 	return ehci_halt (ehci);
196*7ff71d6aSMatt Porter }
197*7ff71d6aSMatt Porter 
198*7ff71d6aSMatt Porter static int ehci_pci_start (struct usb_hcd *hcd)
199*7ff71d6aSMatt Porter {
200*7ff71d6aSMatt Porter 	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
201*7ff71d6aSMatt Porter 	int result = 0;
202*7ff71d6aSMatt Porter 
203*7ff71d6aSMatt Porter 	if (hcd->self.controller->bus == &pci_bus_type) {
204*7ff71d6aSMatt Porter 		struct pci_dev		*pdev;
205*7ff71d6aSMatt Porter 		u16			port_wake;
206*7ff71d6aSMatt Porter 
207*7ff71d6aSMatt Porter 		pdev = to_pci_dev(hcd->self.controller);
208*7ff71d6aSMatt Porter 
209*7ff71d6aSMatt Porter 		/* Serial Bus Release Number is at PCI 0x60 offset */
210*7ff71d6aSMatt Porter 		pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
211*7ff71d6aSMatt Porter 
212*7ff71d6aSMatt Porter 		/* port wake capability, reported by boot firmware */
213*7ff71d6aSMatt Porter 		pci_read_config_word(pdev, 0x62, &port_wake);
214*7ff71d6aSMatt Porter 		hcd->can_wakeup = (port_wake & 1) != 0;
215*7ff71d6aSMatt Porter 
216*7ff71d6aSMatt Porter 		/* help hc dma work well with cachelines */
217*7ff71d6aSMatt Porter 		result = pci_set_mwi(pdev);
218*7ff71d6aSMatt Porter 		if (result)
219*7ff71d6aSMatt Porter 			ehci_dbg(ehci, "unable to enable MWI - not fatal.\n");
220*7ff71d6aSMatt Porter 	}
221*7ff71d6aSMatt Porter 
222*7ff71d6aSMatt Porter 	return ehci_run (hcd);
223*7ff71d6aSMatt Porter }
224*7ff71d6aSMatt Porter 
225*7ff71d6aSMatt Porter /* always called by thread; normally rmmod */
226*7ff71d6aSMatt Porter 
227*7ff71d6aSMatt Porter static void ehci_pci_stop (struct usb_hcd *hcd)
228*7ff71d6aSMatt Porter {
229*7ff71d6aSMatt Porter 	ehci_stop (hcd);
230*7ff71d6aSMatt Porter }
231*7ff71d6aSMatt Porter 
232*7ff71d6aSMatt Porter /*-------------------------------------------------------------------------*/
233*7ff71d6aSMatt Porter 
234*7ff71d6aSMatt Porter #ifdef	CONFIG_PM
235*7ff71d6aSMatt Porter 
236*7ff71d6aSMatt Porter /* suspend/resume, section 4.3 */
237*7ff71d6aSMatt Porter 
238*7ff71d6aSMatt Porter /* These routines rely on the bus (pci, platform, etc)
239*7ff71d6aSMatt Porter  * to handle powerdown and wakeup, and currently also on
240*7ff71d6aSMatt Porter  * transceivers that don't need any software attention to set up
241*7ff71d6aSMatt Porter  * the right sort of wakeup.
242*7ff71d6aSMatt Porter  */
243*7ff71d6aSMatt Porter 
244*7ff71d6aSMatt Porter static int ehci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
245*7ff71d6aSMatt Porter {
246*7ff71d6aSMatt Porter 	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
247*7ff71d6aSMatt Porter 
248*7ff71d6aSMatt Porter 	if (time_before (jiffies, ehci->next_statechange))
249*7ff71d6aSMatt Porter 		msleep (100);
250*7ff71d6aSMatt Porter 
251*7ff71d6aSMatt Porter #ifdef	CONFIG_USB_SUSPEND
252*7ff71d6aSMatt Porter 	(void) usb_suspend_device (hcd->self.root_hub);
253*7ff71d6aSMatt Porter #else
254*7ff71d6aSMatt Porter 	usb_lock_device (hcd->self.root_hub);
255*7ff71d6aSMatt Porter 	(void) ehci_hub_suspend (hcd);
256*7ff71d6aSMatt Porter 	usb_unlock_device (hcd->self.root_hub);
257*7ff71d6aSMatt Porter #endif
258*7ff71d6aSMatt Porter 
259*7ff71d6aSMatt Porter 	// save (PCI) FLADJ in case of Vaux power loss
260*7ff71d6aSMatt Porter 	// ... we'd only use it to handle clock skew
261*7ff71d6aSMatt Porter 
262*7ff71d6aSMatt Porter 	return 0;
263*7ff71d6aSMatt Porter }
264*7ff71d6aSMatt Porter 
265*7ff71d6aSMatt Porter static int ehci_pci_resume (struct usb_hcd *hcd)
266*7ff71d6aSMatt Porter {
267*7ff71d6aSMatt Porter 	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
268*7ff71d6aSMatt Porter 	unsigned		port;
269*7ff71d6aSMatt Porter 	struct usb_device	*root = hcd->self.root_hub;
270*7ff71d6aSMatt Porter 	int			retval = -EINVAL;
271*7ff71d6aSMatt Porter 
272*7ff71d6aSMatt Porter 	// maybe restore (PCI) FLADJ
273*7ff71d6aSMatt Porter 
274*7ff71d6aSMatt Porter 	if (time_before (jiffies, ehci->next_statechange))
275*7ff71d6aSMatt Porter 		msleep (100);
276*7ff71d6aSMatt Porter 
277*7ff71d6aSMatt Porter 	/* If any port is suspended (or owned by the companion),
278*7ff71d6aSMatt Porter 	 * we know we can/must resume the HC (and mustn't reset it).
279*7ff71d6aSMatt Porter 	 */
280*7ff71d6aSMatt Porter 	for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) {
281*7ff71d6aSMatt Porter 		u32	status;
282*7ff71d6aSMatt Porter 		port--;
283*7ff71d6aSMatt Porter 		status = readl (&ehci->regs->port_status [port]);
284*7ff71d6aSMatt Porter 		if (!(status & PORT_POWER))
285*7ff71d6aSMatt Porter 			continue;
286*7ff71d6aSMatt Porter 		if (status & (PORT_SUSPEND | PORT_OWNER)) {
287*7ff71d6aSMatt Porter 			down (&hcd->self.root_hub->serialize);
288*7ff71d6aSMatt Porter 			retval = ehci_hub_resume (hcd);
289*7ff71d6aSMatt Porter 			up (&hcd->self.root_hub->serialize);
290*7ff71d6aSMatt Porter 			break;
291*7ff71d6aSMatt Porter 		}
292*7ff71d6aSMatt Porter 		if (!root->children [port])
293*7ff71d6aSMatt Porter 			continue;
294*7ff71d6aSMatt Porter 		dbg_port (ehci, __FUNCTION__, port + 1, status);
295*7ff71d6aSMatt Porter 		usb_set_device_state (root->children[port],
296*7ff71d6aSMatt Porter 					USB_STATE_NOTATTACHED);
297*7ff71d6aSMatt Porter 	}
298*7ff71d6aSMatt Porter 
299*7ff71d6aSMatt Porter 	/* Else reset, to cope with power loss or flush-to-storage
300*7ff71d6aSMatt Porter 	 * style "resume" having activated BIOS during reboot.
301*7ff71d6aSMatt Porter 	 */
302*7ff71d6aSMatt Porter 	if (port == 0) {
303*7ff71d6aSMatt Porter 		(void) ehci_halt (ehci);
304*7ff71d6aSMatt Porter 		(void) ehci_reset (ehci);
305*7ff71d6aSMatt Porter 		(void) ehci_pci_reset (hcd);
306*7ff71d6aSMatt Porter 
307*7ff71d6aSMatt Porter 		/* emptying the schedule aborts any urbs */
308*7ff71d6aSMatt Porter 		spin_lock_irq (&ehci->lock);
309*7ff71d6aSMatt Porter 		if (ehci->reclaim)
310*7ff71d6aSMatt Porter 			ehci->reclaim_ready = 1;
311*7ff71d6aSMatt Porter 		ehci_work (ehci, NULL);
312*7ff71d6aSMatt Porter 		spin_unlock_irq (&ehci->lock);
313*7ff71d6aSMatt Porter 
314*7ff71d6aSMatt Porter 		/* restart; khubd will disconnect devices */
315*7ff71d6aSMatt Porter 		retval = ehci_run (hcd);
316*7ff71d6aSMatt Porter 
317*7ff71d6aSMatt Porter 		/* here we "know" root ports should always stay powered;
318*7ff71d6aSMatt Porter 		 * but some controllers may lose all power.
319*7ff71d6aSMatt Porter 		 */
320*7ff71d6aSMatt Porter 		ehci_port_power (ehci, 1);
321*7ff71d6aSMatt Porter 	}
322*7ff71d6aSMatt Porter 
323*7ff71d6aSMatt Porter 	return retval;
324*7ff71d6aSMatt Porter }
325*7ff71d6aSMatt Porter #endif
326*7ff71d6aSMatt Porter 
327*7ff71d6aSMatt Porter static const struct hc_driver ehci_pci_hc_driver = {
328*7ff71d6aSMatt Porter 	.description =		hcd_name,
329*7ff71d6aSMatt Porter 	.product_desc =		"EHCI Host Controller",
330*7ff71d6aSMatt Porter 	.hcd_priv_size =	sizeof(struct ehci_hcd),
331*7ff71d6aSMatt Porter 
332*7ff71d6aSMatt Porter 	/*
333*7ff71d6aSMatt Porter 	 * generic hardware linkage
334*7ff71d6aSMatt Porter 	 */
335*7ff71d6aSMatt Porter 	.irq =			ehci_irq,
336*7ff71d6aSMatt Porter 	.flags =		HCD_MEMORY | HCD_USB2,
337*7ff71d6aSMatt Porter 
338*7ff71d6aSMatt Porter 	/*
339*7ff71d6aSMatt Porter 	 * basic lifecycle operations
340*7ff71d6aSMatt Porter 	 */
341*7ff71d6aSMatt Porter 	.reset =		ehci_pci_reset,
342*7ff71d6aSMatt Porter 	.start =		ehci_pci_start,
343*7ff71d6aSMatt Porter #ifdef	CONFIG_PM
344*7ff71d6aSMatt Porter 	.suspend =		ehci_pci_suspend,
345*7ff71d6aSMatt Porter 	.resume =		ehci_pci_resume,
346*7ff71d6aSMatt Porter #endif
347*7ff71d6aSMatt Porter 	.stop =			ehci_pci_stop,
348*7ff71d6aSMatt Porter 
349*7ff71d6aSMatt Porter 	/*
350*7ff71d6aSMatt Porter 	 * managing i/o requests and associated device resources
351*7ff71d6aSMatt Porter 	 */
352*7ff71d6aSMatt Porter 	.urb_enqueue =		ehci_urb_enqueue,
353*7ff71d6aSMatt Porter 	.urb_dequeue =		ehci_urb_dequeue,
354*7ff71d6aSMatt Porter 	.endpoint_disable =	ehci_endpoint_disable,
355*7ff71d6aSMatt Porter 
356*7ff71d6aSMatt Porter 	/*
357*7ff71d6aSMatt Porter 	 * scheduling support
358*7ff71d6aSMatt Porter 	 */
359*7ff71d6aSMatt Porter 	.get_frame_number =	ehci_get_frame,
360*7ff71d6aSMatt Porter 
361*7ff71d6aSMatt Porter 	/*
362*7ff71d6aSMatt Porter 	 * root hub support
363*7ff71d6aSMatt Porter 	 */
364*7ff71d6aSMatt Porter 	.hub_status_data =	ehci_hub_status_data,
365*7ff71d6aSMatt Porter 	.hub_control =		ehci_hub_control,
366*7ff71d6aSMatt Porter 	.hub_suspend =		ehci_hub_suspend,
367*7ff71d6aSMatt Porter 	.hub_resume =		ehci_hub_resume,
368*7ff71d6aSMatt Porter };
369*7ff71d6aSMatt Porter 
370*7ff71d6aSMatt Porter /*-------------------------------------------------------------------------*/
371*7ff71d6aSMatt Porter 
372*7ff71d6aSMatt Porter /* PCI driver selection metadata; PCI hotplugging uses this */
373*7ff71d6aSMatt Porter static const struct pci_device_id pci_ids [] = { {
374*7ff71d6aSMatt Porter 	/* handle any USB 2.0 EHCI controller */
375*7ff71d6aSMatt Porter 	PCI_DEVICE_CLASS(((PCI_CLASS_SERIAL_USB << 8) | 0x20), ~0),
376*7ff71d6aSMatt Porter 	.driver_data =	(unsigned long) &ehci_pci_hc_driver,
377*7ff71d6aSMatt Porter 	},
378*7ff71d6aSMatt Porter 	{ /* end: all zeroes */ }
379*7ff71d6aSMatt Porter };
380*7ff71d6aSMatt Porter MODULE_DEVICE_TABLE (pci, pci_ids);
381*7ff71d6aSMatt Porter 
382*7ff71d6aSMatt Porter /* pci driver glue; this is a "new style" PCI driver module */
383*7ff71d6aSMatt Porter static struct pci_driver ehci_pci_driver = {
384*7ff71d6aSMatt Porter 	.name =		(char *) hcd_name,
385*7ff71d6aSMatt Porter 	.id_table =	pci_ids,
386*7ff71d6aSMatt Porter 
387*7ff71d6aSMatt Porter 	.probe =	usb_hcd_pci_probe,
388*7ff71d6aSMatt Porter 	.remove =	usb_hcd_pci_remove,
389*7ff71d6aSMatt Porter 
390*7ff71d6aSMatt Porter #ifdef	CONFIG_PM
391*7ff71d6aSMatt Porter 	.suspend =	usb_hcd_pci_suspend,
392*7ff71d6aSMatt Porter 	.resume =	usb_hcd_pci_resume,
393*7ff71d6aSMatt Porter #endif
394*7ff71d6aSMatt Porter };
395*7ff71d6aSMatt Porter 
396*7ff71d6aSMatt Porter static int __init ehci_hcd_pci_init (void)
397*7ff71d6aSMatt Porter {
398*7ff71d6aSMatt Porter 	if (usb_disabled())
399*7ff71d6aSMatt Porter 		return -ENODEV;
400*7ff71d6aSMatt Porter 
401*7ff71d6aSMatt Porter 	pr_debug ("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n",
402*7ff71d6aSMatt Porter 		hcd_name,
403*7ff71d6aSMatt Porter 		sizeof (struct ehci_qh), sizeof (struct ehci_qtd),
404*7ff71d6aSMatt Porter 		sizeof (struct ehci_itd), sizeof (struct ehci_sitd));
405*7ff71d6aSMatt Porter 
406*7ff71d6aSMatt Porter 	return pci_register_driver (&ehci_pci_driver);
407*7ff71d6aSMatt Porter }
408*7ff71d6aSMatt Porter module_init (ehci_hcd_pci_init);
409*7ff71d6aSMatt Porter 
410*7ff71d6aSMatt Porter static void __exit ehci_hcd_pci_cleanup (void)
411*7ff71d6aSMatt Porter {
412*7ff71d6aSMatt Porter 	pci_unregister_driver (&ehci_pci_driver);
413*7ff71d6aSMatt Porter }
414*7ff71d6aSMatt Porter module_exit (ehci_hcd_pci_cleanup);
415