This source file includes following definitions.
- uhci_pci_reset_hc
- uhci_pci_check_and_reset_hc
- uhci_pci_configure_hc
- uhci_pci_resume_detect_interrupts_are_broken
- uhci_pci_global_suspend_mode_is_broken
- uhci_pci_init
- uhci_shutdown
- uhci_pci_suspend
- uhci_pci_resume
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #include "pci-quirks.h"
22
23
24
25
26
27 static void uhci_pci_reset_hc(struct uhci_hcd *uhci)
28 {
29 uhci_reset_hc(to_pci_dev(uhci_dev(uhci)), uhci->io_addr);
30 }
31
32
33
34
35
36
37
38 static int uhci_pci_check_and_reset_hc(struct uhci_hcd *uhci)
39 {
40 return uhci_check_and_reset_hc(to_pci_dev(uhci_dev(uhci)),
41 uhci->io_addr);
42 }
43
44
45
46
47
48 static void uhci_pci_configure_hc(struct uhci_hcd *uhci)
49 {
50 struct pci_dev *pdev = to_pci_dev(uhci_dev(uhci));
51
52
53 pci_write_config_word(pdev, USBLEGSUP, USBLEGSUP_DEFAULT);
54
55
56 if (pdev->vendor == PCI_VENDOR_ID_INTEL)
57 pci_write_config_byte(pdev, USBRES_INTEL, 0);
58 }
59
60 static int uhci_pci_resume_detect_interrupts_are_broken(struct uhci_hcd *uhci)
61 {
62 int port;
63
64 switch (to_pci_dev(uhci_dev(uhci))->vendor) {
65 default:
66 break;
67
68 case PCI_VENDOR_ID_GENESYS:
69
70
71
72 return 1;
73
74 case PCI_VENDOR_ID_INTEL:
75
76
77
78
79
80
81
82 for (port = 0; port < uhci->rh_numports; ++port) {
83 if (inw(uhci->io_addr + USBPORTSC1 + port * 2) &
84 USBPORTSC_OC)
85 return 1;
86 }
87 break;
88 }
89 return 0;
90 }
91
92 static int uhci_pci_global_suspend_mode_is_broken(struct uhci_hcd *uhci)
93 {
94 int port;
95 const char *sys_info;
96 static const char bad_Asus_board[] = "A7V8X";
97
98
99
100
101
102 sys_info = dmi_get_system_info(DMI_BOARD_NAME);
103 if (sys_info && !strcmp(sys_info, bad_Asus_board)) {
104 for (port = 0; port < uhci->rh_numports; ++port) {
105 if (inw(uhci->io_addr + USBPORTSC1 + port * 2) &
106 USBPORTSC_CCS)
107 return 1;
108 }
109 }
110
111 return 0;
112 }
113
114 static int uhci_pci_init(struct usb_hcd *hcd)
115 {
116 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
117
118 uhci->io_addr = (unsigned long) hcd->rsrc_start;
119
120 uhci->rh_numports = uhci_count_ports(hcd);
121
122
123
124
125
126 if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_VIA)
127 uhci->oc_low = 1;
128
129
130 if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_HP)
131 uhci->wait_for_hp = 1;
132
133
134 if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_INTEL)
135 device_set_wakeup_capable(uhci_dev(uhci), true);
136
137
138 uhci->reset_hc = uhci_pci_reset_hc;
139 uhci->check_and_reset_hc = uhci_pci_check_and_reset_hc;
140 uhci->configure_hc = uhci_pci_configure_hc;
141 uhci->resume_detect_interrupts_are_broken =
142 uhci_pci_resume_detect_interrupts_are_broken;
143 uhci->global_suspend_mode_is_broken =
144 uhci_pci_global_suspend_mode_is_broken;
145
146
147
148
149
150 check_and_reset_hc(uhci);
151 return 0;
152 }
153
154
155
156
157
158
159
160
161 static void uhci_shutdown(struct pci_dev *pdev)
162 {
163 struct usb_hcd *hcd = pci_get_drvdata(pdev);
164
165 uhci_hc_died(hcd_to_uhci(hcd));
166 }
167
168 #ifdef CONFIG_PM
169
170 static int uhci_pci_resume(struct usb_hcd *hcd, bool hibernated);
171
172 static int uhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
173 {
174 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
175 struct pci_dev *pdev = to_pci_dev(uhci_dev(uhci));
176 int rc = 0;
177
178 dev_dbg(uhci_dev(uhci), "%s\n", __func__);
179
180 spin_lock_irq(&uhci->lock);
181 if (!HCD_HW_ACCESSIBLE(hcd) || uhci->dead)
182 goto done_okay;
183
184
185
186
187 pci_write_config_word(pdev, USBLEGSUP, 0);
188 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
189
190
191 if (do_wakeup) {
192 if (pdev->vendor == PCI_VENDOR_ID_INTEL)
193 pci_write_config_byte(pdev, USBRES_INTEL,
194 USBPORT1EN | USBPORT2EN);
195 }
196
197 done_okay:
198 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
199 spin_unlock_irq(&uhci->lock);
200
201 synchronize_irq(hcd->irq);
202
203
204 if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
205 uhci_pci_resume(hcd, false);
206 rc = -EBUSY;
207 }
208 return rc;
209 }
210
211 static int uhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
212 {
213 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
214
215 dev_dbg(uhci_dev(uhci), "%s\n", __func__);
216
217
218
219
220 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
221
222 spin_lock_irq(&uhci->lock);
223
224
225 if (hibernated) {
226 uhci->reset_hc(uhci);
227 finish_reset(uhci);
228 }
229
230
231
232
233 else {
234 check_and_reset_hc(uhci);
235 }
236 configure_hc(uhci);
237
238
239 if (uhci->rh_state == UHCI_RH_RESET)
240 usb_root_hub_lost_power(hcd->self.root_hub);
241
242 spin_unlock_irq(&uhci->lock);
243
244
245
246
247 if (!uhci->RD_enable && hcd->self.root_hub->do_remote_wakeup)
248 set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
249
250
251 usb_hcd_poll_rh_status(hcd);
252 return 0;
253 }
254
255 #endif
256
257 static const struct hc_driver uhci_driver = {
258 .description = hcd_name,
259 .product_desc = "UHCI Host Controller",
260 .hcd_priv_size = sizeof(struct uhci_hcd),
261
262
263 .irq = uhci_irq,
264 .flags = HCD_DMA | HCD_USB11,
265
266
267 .reset = uhci_pci_init,
268 .start = uhci_start,
269 #ifdef CONFIG_PM
270 .pci_suspend = uhci_pci_suspend,
271 .pci_resume = uhci_pci_resume,
272 .bus_suspend = uhci_rh_suspend,
273 .bus_resume = uhci_rh_resume,
274 #endif
275 .stop = uhci_stop,
276
277 .urb_enqueue = uhci_urb_enqueue,
278 .urb_dequeue = uhci_urb_dequeue,
279
280 .endpoint_disable = uhci_hcd_endpoint_disable,
281 .get_frame_number = uhci_hcd_get_frame_number,
282
283 .hub_status_data = uhci_hub_status_data,
284 .hub_control = uhci_hub_control,
285 };
286
287 static const struct pci_device_id uhci_pci_ids[] = { {
288
289 PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_UHCI, ~0),
290 .driver_data = (unsigned long) &uhci_driver,
291 }, { }
292 };
293
294 MODULE_DEVICE_TABLE(pci, uhci_pci_ids);
295
296 static struct pci_driver uhci_pci_driver = {
297 .name = (char *)hcd_name,
298 .id_table = uhci_pci_ids,
299
300 .probe = usb_hcd_pci_probe,
301 .remove = usb_hcd_pci_remove,
302 .shutdown = uhci_shutdown,
303
304 #ifdef CONFIG_PM
305 .driver = {
306 .pm = &usb_hcd_pci_pm_ops
307 },
308 #endif
309 };
310
311 MODULE_SOFTDEP("pre: ehci_pci");