Deleted Added
full compact
ehci.c (203140) ehci.c (203693)
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>
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 203140 2010-01-29 01:30:13Z thompsa $");
47__FBSDID("$FreeBSD: head/sys/dev/usb/controller/ehci.c 203693 2010-02-09 00:38:40Z 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>

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

87
88#define EHCI_BUS2SC(bus) \
89 ((ehci_softc_t *)(((uint8_t *)(bus)) - \
90 ((uint8_t *)&(((ehci_softc_t *)0)->sc_bus))))
91
92#if USB_DEBUG
93static int ehcidebug = 0;
94static int ehcinohighspeed = 0;
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>

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

87
88#define EHCI_BUS2SC(bus) \
89 ((ehci_softc_t *)(((uint8_t *)(bus)) - \
90 ((uint8_t *)&(((ehci_softc_t *)0)->sc_bus))))
91
92#if USB_DEBUG
93static int ehcidebug = 0;
94static int ehcinohighspeed = 0;
95static int ehciiaadbug = 0;
96static int ehcilostintrbug = 0;
95
96SYSCTL_NODE(_hw_usb, OID_AUTO, ehci, CTLFLAG_RW, 0, "USB ehci");
97SYSCTL_INT(_hw_usb_ehci, OID_AUTO, debug, CTLFLAG_RW,
98 &ehcidebug, 0, "Debug level");
99SYSCTL_INT(_hw_usb_ehci, OID_AUTO, no_hs, CTLFLAG_RW,
100 &ehcinohighspeed, 0, "Disable High Speed USB");
97
98SYSCTL_NODE(_hw_usb, OID_AUTO, ehci, CTLFLAG_RW, 0, "USB ehci");
99SYSCTL_INT(_hw_usb_ehci, OID_AUTO, debug, CTLFLAG_RW,
100 &ehcidebug, 0, "Debug level");
101SYSCTL_INT(_hw_usb_ehci, OID_AUTO, no_hs, CTLFLAG_RW,
102 &ehcinohighspeed, 0, "Disable High Speed USB");
103SYSCTL_INT(_hw_usb_ehci, OID_AUTO, iaadbug, CTLFLAG_RW,
104 &ehciiaadbug, 0, "Enable doorbell bug workaround");
105SYSCTL_INT(_hw_usb_ehci, OID_AUTO, lostintrbug, CTLFLAG_RW,
106 &ehcilostintrbug, 0, "Enable lost interrupt bug workaround");
101
102TUNABLE_INT("hw.usb.ehci.debug", &ehcidebug);
103TUNABLE_INT("hw.usb.ehci.no_hs", &ehcinohighspeed);
107
108TUNABLE_INT("hw.usb.ehci.debug", &ehcidebug);
109TUNABLE_INT("hw.usb.ehci.no_hs", &ehcinohighspeed);
110TUNABLE_INT("hw.usb.ehci.iaadbug", &ehciiaadbug);
111TUNABLE_INT("hw.usb.ehci.lostintrbug", &ehcilostintrbug);
104
105static void ehci_dump_regs(ehci_softc_t *sc);
106static void ehci_dump_sqh(ehci_softc_t *sc, ehci_qh_t *sqh);
107
108#endif
109
110#define EHCI_INTR_ENDPT 1
111

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

246 usb_error_t err = 0;
247
248 DPRINTF("start\n");
249
250 usb_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, 0);
251 usb_callout_init_mtx(&sc->sc_tmo_poll, &sc->sc_bus.bus_mtx, 0);
252
253#if USB_DEBUG
112
113static void ehci_dump_regs(ehci_softc_t *sc);
114static void ehci_dump_sqh(ehci_softc_t *sc, ehci_qh_t *sqh);
115
116#endif
117
118#define EHCI_INTR_ENDPT 1
119

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

254 usb_error_t err = 0;
255
256 DPRINTF("start\n");
257
258 usb_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, 0);
259 usb_callout_init_mtx(&sc->sc_tmo_poll, &sc->sc_bus.bus_mtx, 0);
260
261#if USB_DEBUG
262 if (ehciiaadbug)
263 sc->sc_flags |= EHCI_SCFLG_IAADBUG;
264 if (ehcilostintrbug)
265 sc->sc_flags |= EHCI_SCFLG_LOSTINTRBUG;
254 if (ehcidebug > 2) {
255 ehci_dump_regs(sc);
256 }
257#endif
258
259 sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH);
260
261 version = EREAD2(sc, EHCI_HCIVERSION);

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

2275 uint32_t temp;
2276
2277 /* setup TD's and QH */
2278 ehci_setup_standard_chain(xfer, &sc->sc_async_p_last);
2279
2280 /* put transfer on interrupt queue */
2281 ehci_transfer_intr_enqueue(xfer);
2282
266 if (ehcidebug > 2) {
267 ehci_dump_regs(sc);
268 }
269#endif
270
271 sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH);
272
273 version = EREAD2(sc, EHCI_HCIVERSION);

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

2287 uint32_t temp;
2288
2289 /* setup TD's and QH */
2290 ehci_setup_standard_chain(xfer, &sc->sc_async_p_last);
2291
2292 /* put transfer on interrupt queue */
2293 ehci_transfer_intr_enqueue(xfer);
2294
2295 /*
2296 * XXX Certain nVidia chipsets choke when using the IAAD
2297 * feature too frequently.
2298 */
2299 if (sc->sc_flags & EHCI_SCFLG_IAADBUG)
2300 return;
2301
2283 /* XXX Performance quirk: Some Host Controllers have a too low
2284 * interrupt rate. Issue an IAAD to stimulate the Host
2285 * Controller after queueing the BULK transfer.
2286 */
2287 temp = EOREAD4(sc, EHCI_USBCMD);
2288 if (!(temp & EHCI_CMD_IAAD))
2289 EOWRITE4(sc, EHCI_USBCMD, temp | EHCI_CMD_IAAD);
2290}

--- 1611 unchanged lines hidden ---
2302 /* XXX Performance quirk: Some Host Controllers have a too low
2303 * interrupt rate. Issue an IAAD to stimulate the Host
2304 * Controller after queueing the BULK transfer.
2305 */
2306 temp = EOREAD4(sc, EHCI_USBCMD);
2307 if (!(temp & EHCI_CMD_IAAD))
2308 EOWRITE4(sc, EHCI_USBCMD, temp | EHCI_CMD_IAAD);
2309}

--- 1611 unchanged lines hidden ---