Lines Matching +full:generic +full:- +full:ehci

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2010-2012 Semihalf
54 #include <dev/usb/controller/ehci.h>
89 "ehci",
94 DRIVER_MODULE(ehci, simplebus, ehci_driver, 0, 0);
95 MODULE_DEPEND(ehci, usb, 1, 1, 1);
105 * Offsets from 0x000 ehci dev space, big-endian access.
132 * Offsets from USBCMD register, little-endian access.
157 tmp = bus_space_read_4(sc->sc_io_tag, sc->sc_io_hdl, USBMODE);
158 bus_space_write_4(sc->sc_io_tag, sc->sc_io_hdl, USBMODE, tmp | HOST_MODE);
201 tmp = bus_space_read_4(sc->sc_io_tag, sc->sc_io_hdl, PORTSC);
202 bus_space_write_4(sc->sc_io_tag, sc->sc_io_hdl, PORTSC, tmp & ~PORT_POWER_MASK);
215 if (((ofw_bus_is_compatible(dev, "fsl-usb2-dr")) == 0) &&
216 ((ofw_bus_is_compatible(dev, "fsl-usb2-mph")) == 0))
219 device_set_desc(dev, "Freescale integrated EHCI controller");
236 sc->sc_bus.parent = self;
237 sc->sc_bus.devices = sc->sc_devices;
238 sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
239 sc->sc_bus.dma_bits = 32;
241 if (usb_bus_mem_alloc_all(&sc->sc_bus,
245 /* Allocate io resource for EHCI */
246 sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid,
248 if (sc->sc_io_res == NULL) {
257 iot = rman_get_bustag(sc->sc_io_res);
260 * Set handle to USB related registers subregion used by generic
261 * EHCI driver
263 ioh = rman_get_bushandle(sc->sc_io_res);
266 &sc->sc_io_hdl);
277 /* Set little-endian tag for use by the generic EHCI driver */
278 sc->sc_io_tag = &bs_le_tag;
281 sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
283 if (sc->sc_irq_res == NULL) {
294 err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
295 NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl);
298 sc->sc_intr_hdl = NULL;
309 sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY);
310 if (!sc->sc_bus.bdev) {
320 device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
322 sc->sc_id_vendor = 0x1234;
323 strlcpy(sc->sc_vendor, "Freescale", sizeof(sc->sc_vendor));
344 * If usb subsystem is enabled in U-Boot, port power has to be turned
350 sc->sc_flags |= EHCI_SCFLG_DONTRESET | EHCI_SCFLG_NORESTERM;
354 sc->sc_flags |= EHCI_SCFLG_DONEINIT;
355 err = device_probe_and_attach(sc->sc_bus.bdev);
387 if (sc->sc_flags & EHCI_SCFLG_DONEINIT) {
389 sc->sc_flags &= ~EHCI_SCFLG_DONEINIT;
393 if (sc->sc_io_tag && sc->sc_io_hdl)
394 bus_space_write_4(sc->sc_io_tag, sc->sc_io_hdl, EHCI_USBINTR, 0);
396 if (sc->sc_irq_res && sc->sc_intr_hdl) {
397 err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl);
403 sc->sc_intr_hdl = NULL;
406 if (sc->sc_irq_res) {
407 bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res);
408 sc->sc_irq_res = NULL;
411 if (sc->sc_io_res) {
412 bus_release_resource(self, SYS_RES_MEMORY, 0, sc->sc_io_res);
413 sc->sc_io_res = NULL;
414 sc->sc_io_tag = 0;
415 sc->sc_io_hdl = 0;