Lines 217-222
static void __devinit quirk_usb_disable_
Link Here
|
217 |
u8 offset, cap_length; |
217 |
u8 offset, cap_length; |
218 |
int count = 256/4; |
218 |
int count = 256/4; |
219 |
|
219 |
|
|
|
220 |
printk("quirk_usb_disable_ehci\n"); |
221 |
|
220 |
if (!mmio_resource_enabled(pdev, 0)) |
222 |
if (!mmio_resource_enabled(pdev, 0)) |
221 |
return; |
223 |
return; |
222 |
|
224 |
|
Lines 233-243
static void __devinit quirk_usb_disable_
Link Here
|
233 |
*/ |
235 |
*/ |
234 |
hcc_params = readl(base + EHCI_HCC_PARAMS); |
236 |
hcc_params = readl(base + EHCI_HCC_PARAMS); |
235 |
offset = (hcc_params >> 8) & 0xff; |
237 |
offset = (hcc_params >> 8) & 0xff; |
|
|
238 |
printk("entering loop, initial offset %x\n", offset); |
236 |
while (offset && count--) { |
239 |
while (offset && count--) { |
237 |
u32 cap; |
240 |
u32 cap; |
238 |
int msec; |
241 |
int msec; |
239 |
|
242 |
|
240 |
pci_read_config_dword(pdev, offset, &cap); |
243 |
pci_read_config_dword(pdev, offset, &cap); |
|
|
244 |
printk("read %x at offset %x\n", cap, offset); |
241 |
switch (cap & 0xff) { |
245 |
switch (cap & 0xff) { |
242 |
case 1: /* BIOS/SMM/... handoff support */ |
246 |
case 1: /* BIOS/SMM/... handoff support */ |
243 |
if ((cap & EHCI_USBLEGSUP_BIOS)) { |
247 |
if ((cap & EHCI_USBLEGSUP_BIOS)) { |
Lines 265-271
static void __devinit quirk_usb_disable_
Link Here
|
265 |
/* always say Linux will own the hardware |
269 |
/* always say Linux will own the hardware |
266 |
* by setting EHCI_USBLEGSUP_OS. |
270 |
* by setting EHCI_USBLEGSUP_OS. |
267 |
*/ |
271 |
*/ |
|
|
272 |
printk("claiming OS at offset %x\n", offset + 3); |
268 |
pci_write_config_byte(pdev, offset + 3, 1); |
273 |
pci_write_config_byte(pdev, offset + 3, 1); |
|
|
274 |
printk("claimed\n"); |
269 |
|
275 |
|
270 |
/* if boot firmware now owns EHCI, spin till |
276 |
/* if boot firmware now owns EHCI, spin till |
271 |
* it hands it over. |
277 |
* it hands it over. |
Lines 276-281
static void __devinit quirk_usb_disable_
Link Here
|
276 |
msec -= 10; |
282 |
msec -= 10; |
277 |
pci_read_config_dword(pdev, offset, &cap); |
283 |
pci_read_config_dword(pdev, offset, &cap); |
278 |
} |
284 |
} |
|
|
285 |
printk("done spinning\n"); |
279 |
|
286 |
|
280 |
if (cap & EHCI_USBLEGSUP_BIOS) { |
287 |
if (cap & EHCI_USBLEGSUP_BIOS) { |
281 |
/* well, possibly buggy BIOS... try to shut |
288 |
/* well, possibly buggy BIOS... try to shut |
Lines 287-296
static void __devinit quirk_usb_disable_
Link Here
|
287 |
pci_write_config_byte(pdev, offset + 2, 0); |
294 |
pci_write_config_byte(pdev, offset + 2, 0); |
288 |
} |
295 |
} |
289 |
|
296 |
|
|
|
297 |
printk("disabling SMI\n"); |
290 |
/* just in case, always disable EHCI SMIs */ |
298 |
/* just in case, always disable EHCI SMIs */ |
291 |
pci_write_config_dword(pdev, |
299 |
pci_write_config_dword(pdev, |
292 |
offset + EHCI_USBLEGCTLSTS, |
300 |
offset + EHCI_USBLEGCTLSTS, |
293 |
0); |
301 |
0); |
|
|
302 |
printk("disable done\n"); |
294 |
break; |
303 |
break; |
295 |
case 0: /* illegal reserved capability */ |
304 |
case 0: /* illegal reserved capability */ |
296 |
cap = 0; |
305 |
cap = 0; |
Lines 311-321
static void __devinit quirk_usb_disable_
Link Here
|
311 |
/* |
320 |
/* |
312 |
* halt EHCI & disable its interrupts in any case |
321 |
* halt EHCI & disable its interrupts in any case |
313 |
*/ |
322 |
*/ |
|
|
323 |
printk("reading usbsts\n"); |
314 |
val = readl(op_reg_base + EHCI_USBSTS); |
324 |
val = readl(op_reg_base + EHCI_USBSTS); |
|
|
325 |
printk("usbsts reads %x\n", val); |
315 |
if ((val & EHCI_USBSTS_HALTED) == 0) { |
326 |
if ((val & EHCI_USBSTS_HALTED) == 0) { |
|
|
327 |
printk("status halted\n"); |
316 |
val = readl(op_reg_base + EHCI_USBCMD); |
328 |
val = readl(op_reg_base + EHCI_USBCMD); |
317 |
val &= ~EHCI_USBCMD_RUN; |
329 |
val &= ~EHCI_USBCMD_RUN; |
318 |
writel(val, op_reg_base + EHCI_USBCMD); |
330 |
writel(val, op_reg_base + EHCI_USBCMD); |
|
|
331 |
printk("cleared run\n"); |
319 |
|
332 |
|
320 |
wait_time = 2000; |
333 |
wait_time = 2000; |
321 |
delta = 100; |
334 |
delta = 100; |
Lines 328-336
static void __devinit quirk_usb_disable_
Link Here
|
328 |
break; |
341 |
break; |
329 |
} |
342 |
} |
330 |
} while (wait_time > 0); |
343 |
} while (wait_time > 0); |
|
|
344 |
|
345 |
printk("finished spinning\n"); |
331 |
} |
346 |
} |
|
|
347 |
printk("disable intr\n"); |
332 |
writel(0, op_reg_base + EHCI_USBINTR); |
348 |
writel(0, op_reg_base + EHCI_USBINTR); |
|
|
349 |
printk("done 1\n"); |
333 |
writel(0x3f, op_reg_base + EHCI_USBSTS); |
350 |
writel(0x3f, op_reg_base + EHCI_USBSTS); |
|
|
351 |
printk("done disable\n"); |
334 |
|
352 |
|
335 |
iounmap(base); |
353 |
iounmap(base); |
336 |
|
354 |
|