ehci_pci.c (196219) | ehci_pci.c (197554) |
---|---|
1/*- 2 * Copyright (c) 1998 The NetBSD Foundation, Inc. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to The NetBSD Foundation 6 * by Lennart Augustsson (augustss@carlstedt.se) at 7 * Carlstedt Research & Technology. 8 * --- 22 unchanged lines hidden (view full) --- 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1998 The NetBSD Foundation, Inc. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to The NetBSD Foundation 6 * by Lennart Augustsson (augustss@carlstedt.se) at 7 * Carlstedt Research & Technology. 8 * --- 22 unchanged lines hidden (view full) --- 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/sys/dev/usb/controller/ehci_pci.c 196219 2009-08-14 20:03:53Z jhb $"); | 39__FBSDID("$FreeBSD: head/sys/dev/usb/controller/ehci_pci.c 197554 2009-09-28 07:06:47Z thompsa $"); |
40 41/* 42 * USB Enhanced Host Controller Driver, a.k.a. USB 2.0 controller. 43 * 44 * The EHCI 1.0 spec can be found at 45 * http://developer.intel.com/technology/usb/download/ehci-r10.pdf 46 * and the USB 2.0 spec at 47 * http://www.usb.org/developers/docs/usb_20.zip --- 187 unchanged lines hidden (view full) --- 235 if (desc) { 236 device_set_desc(self, desc); 237 return (0); 238 } else { 239 return (ENXIO); 240 } 241} 242 | 40 41/* 42 * USB Enhanced Host Controller Driver, a.k.a. USB 2.0 controller. 43 * 44 * The EHCI 1.0 spec can be found at 45 * http://developer.intel.com/technology/usb/download/ehci-r10.pdf 46 * and the USB 2.0 spec at 47 * http://www.usb.org/developers/docs/usb_20.zip --- 187 unchanged lines hidden (view full) --- 235 if (desc) { 236 device_set_desc(self, desc); 237 return (0); 238 } else { 239 return (ENXIO); 240 } 241} 242 |
243static void 244ehci_pci_ati_quirk(device_t self, uint8_t is_sb700) 245{ 246 device_t smbdev; 247 uint32_t val; 248 249 if (is_sb700) { 250 /* Lookup SMBUS PCI device */ 251 smbdev = pci_find_device(PCI_EHCI_VENDORID_ATI, 0x4385); 252 if (smbdev == NULL) 253 return; 254 val = pci_get_revid(smbdev); 255 if (val != 0x3a && val != 0x3b) 256 return; 257 } 258 259 /* 260 * Note: this bit is described as reserved in SB700 261 * Register Reference Guide. 262 */ 263 val = pci_read_config(self, 0x53, 1); 264 if (!(val & 0x8)) { 265 val |= 0x8; 266 pci_write_config(self, 0x53, val, 1); 267 device_printf(self, "AMD SB600/700 quirk applied\n"); 268 } 269} 270 271static void 272ehci_pci_via_quirk(device_t self) 273{ 274 uint32_t val; 275 276 if ((pci_get_device(self) == 0x3104) && 277 ((pci_get_revid(self) & 0xf0) == 0x60)) { 278 /* Correct schedule sleep time to 10us */ 279 val = pci_read_config(self, 0x4b, 1); 280 if (val & 0x20) 281 return; 282 pci_write_config(self, 0x4b, val, 1); 283 device_printf(self, "VIA-quirk applied\n"); 284 } 285} 286 |
|
243static int 244ehci_pci_attach(device_t self) 245{ 246 ehci_softc_t *sc = device_get_softc(self); 247 int err; 248 int rid; 249 250 /* initialise some bus fields */ --- 114 unchanged lines hidden (view full) --- 365 (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl); 366#endif 367 if (err) { 368 device_printf(self, "Could not setup irq, %d\n", err); 369 sc->sc_intr_hdl = NULL; 370 goto error; 371 } 372 ehci_pci_takecontroller(self); | 287static int 288ehci_pci_attach(device_t self) 289{ 290 ehci_softc_t *sc = device_get_softc(self); 291 int err; 292 int rid; 293 294 /* initialise some bus fields */ --- 114 unchanged lines hidden (view full) --- 409 (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl); 410#endif 411 if (err) { 412 device_printf(self, "Could not setup irq, %d\n", err); 413 sc->sc_intr_hdl = NULL; 414 goto error; 415 } 416 ehci_pci_takecontroller(self); |
417 418 /* Undocumented quirks taken from Linux */ 419 420 switch (pci_get_vendor(self)) { 421 case PCI_EHCI_VENDORID_ATI: 422 /* SB600 and SB700 EHCI quirk */ 423 switch (pci_get_device(self)) { 424 case 0x4386: 425 ehci_pci_ati_quirk(self, 0); 426 break; 427 case 0x4396: 428 ehci_pci_ati_quirk(self, 1); 429 break; 430 default: 431 break; 432 } 433 break; 434 435 case PCI_EHCI_VENDORID_VIA: 436 ehci_pci_via_quirk(self); 437 break; 438 439 default: 440 break; 441 } 442 |
|
373 err = ehci_init(sc); 374 if (!err) { 375 err = device_probe_and_attach(sc->sc_bus.bdev); 376 } 377 if (err) { 378 device_printf(self, "USB init failed err=%d\n", err); 379 goto error; 380 } --- 125 unchanged lines hidden --- | 443 err = ehci_init(sc); 444 if (!err) { 445 err = device_probe_and_attach(sc->sc_bus.bdev); 446 } 447 if (err) { 448 device_printf(self, "USB init failed err=%d\n", err); 449 goto error; 450 } --- 125 unchanged lines hidden --- |