Deleted Added
sdiff udiff text old ( 198151 ) new ( 199058 )
full compact
1/*-
2 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
3 * Copyright (c) 2004 The NetBSD Foundation, Inc. All rights reserved.
4 * Copyright (c) 2004 Lennart Augustsson. All rights reserved.
5 * Copyright (c) 2004 Charles M. Hannum. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 30 unchanged lines hidden (view full) ---

39 */
40
41/*
42 * TODO:
43 * 1) command failures are not recovered correctly
44 */
45
46#include <sys/cdefs.h>
47__FBSDID("$FreeBSD: head/sys/dev/usb/controller/ehci.c 198151 2009-10-15 20:07:08Z thompsa $");
48
49#include <sys/stdint.h>
50#include <sys/stddef.h>
51#include <sys/param.h>
52#include <sys/queue.h>
53#include <sys/types.h>
54#include <sys/systm.h>
55#include <sys/kernel.h>

--- 52 unchanged lines hidden (view full) ---

108
109extern struct usb_bus_methods ehci_bus_methods;
110extern struct usb_pipe_methods ehci_device_bulk_methods;
111extern struct usb_pipe_methods ehci_device_ctrl_methods;
112extern struct usb_pipe_methods ehci_device_intr_methods;
113extern struct usb_pipe_methods ehci_device_isoc_fs_methods;
114extern struct usb_pipe_methods ehci_device_isoc_hs_methods;
115
116static void ehci_do_poll(struct usb_bus *bus);
117static void ehci_device_done(struct usb_xfer *xfer, usb_error_t error);
118static uint8_t ehci_check_transfer(struct usb_xfer *xfer);
119static void ehci_timeout(void *arg);
120static void ehci_root_intr(ehci_softc_t *sc);
121
122struct ehci_std_temp {
123 ehci_softc_t *sc;
124 struct usb_page_cache *pc;
125 ehci_qtd_t *td;
126 ehci_qtd_t *td_next;
127 uint32_t average;

--- 110 unchanged lines hidden (view full) ---

238 uint16_t x;
239 uint16_t y;
240 uint16_t bit;
241 usb_error_t err = 0;
242
243 DPRINTF("start\n");
244
245 usb_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, 0);
246
247#if USB_DEBUG
248 if (ehcidebug > 2) {
249 ehci_dump_regs(sc);
250 }
251#endif
252
253 sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH);

--- 261 unchanged lines hidden (view full) ---

515 * shut down the controller when the system is going down
516 */
517void
518ehci_detach(ehci_softc_t *sc)
519{
520 USB_BUS_LOCK(&sc->sc_bus);
521
522 usb_callout_stop(&sc->sc_tmo_pcd);
523
524 EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
525 USB_BUS_UNLOCK(&sc->sc_bus);
526
527 if (ehci_hcreset(sc)) {
528 DPRINTF("reset failed!\n");
529 }
530
531 /* XXX let stray task complete */
532 usb_pause_mtx(NULL, hz / 20);
533
534 usb_callout_drain(&sc->sc_tmo_pcd);
535}
536
537void
538ehci_suspend(ehci_softc_t *sc)
539{
540 uint32_t cmd;
541 uint32_t hcr;
542 uint8_t i;

--- 924 unchanged lines hidden (view full) ---

1467 */
1468 if (ehci_check_transfer(xfer)) {
1469 /* queue has been modified */
1470 goto repeat;
1471 }
1472 }
1473}
1474
1475/*------------------------------------------------------------------------*
1476 * ehci_interrupt - EHCI interrupt handler
1477 *
1478 * NOTE: Do not access "sc->sc_bus.bdev" inside the interrupt handler,
1479 * hence the interrupt handler will be setup before "sc->sc_bus.bdev"
1480 * is present !
1481 *------------------------------------------------------------------------*/
1482void

--- 51 unchanged lines hidden (view full) ---

1534 /* block unprocessed interrupts */
1535 sc->sc_eintrs &= ~status;
1536 EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
1537 printf("%s: blocking interrupts 0x%x\n", __FUNCTION__, status);
1538 }
1539 /* poll all the USB transfers */
1540 ehci_interrupt_poll(sc);
1541
1542done:
1543 USB_BUS_UNLOCK(&sc->sc_bus);
1544}
1545
1546/*
1547 * called when a request does not complete
1548 */
1549static void

--- 2316 unchanged lines hidden ---