Lines Matching +full:usb +full:- +full:ehci
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
43 #include <dev/usb/usb.h>
44 #include <dev/usb/usbdi.h>
46 #include <dev/usb/usb_core.h>
47 #include <dev/usb/usb_busdma.h>
48 #include <dev/usb/usb_process.h>
49 #include <dev/usb/usb_util.h>
51 #include <dev/usb/usb_controller.h>
52 #include <dev/usb/usb_bus.h>
53 #include <dev/usb/controller/ehci.h>
54 #include <dev/usb/controller/ehcireg.h>
58 #include <arm/ti/usb/omap_usb.h>
62 /* EHCI */
97 /*-------------------------------------------------------------------------*/
106 /*-------------------------------------------------------------------------*/
125 #define OMAP_EHCI_HC_DEVSTR "TI OMAP USB 2.0 controller"
128 ehci_softc_t base; /* storage for EHCI code */
136 * omap_ehci_read_4 - read a 32-bit value from the EHCI registers
137 * omap_ehci_write_4 - write a 32-bit value from the EHCI registers
138 * @sc: omap ehci device context
152 return (bus_read_4(sc->base.sc_io_res, off));
158 bus_write_4(sc->base.sc_io_res, off, val);
162 * omap_ehci_soft_phy_reset - resets the phy using the reset command
163 * @isc: omap ehci device context
197 if (timeout-- == 0) {
198 device_printf(isc->sc_dev, "PHY reset operation timed out\n");
205 * omap_ehci_init - initialises the USB host EHCI controller
206 * @isc: omap ehci device context
225 uhh_dev = device_get_parent(isc->sc_dev);
226 device_printf(isc->sc_dev, "Starting TI EHCI USB Controller\n");
230 * at startup - the default is 8 mircoframes (equates to 1ms).
247 * omap_ehci_probe - starts the given command
250 * Effectively boilerplate EHCI resume code.
264 if (!ofw_bus_is_compatible(dev, "ti,ehci-omap"))
273 * omap_ehci_attach - driver entry point, sets up the ECHI controller/driver
276 * Sets up bus spaces, interrupt handles, etc for the EHCI controller. It also
290 ehci_softc_t *sc = &isc->base;
299 * If we're running a Pandaboard, run Pandaboard-specific
303 if (ofw_bus_node_is_compatible(root, "ti,omap4-panda"))
308 sc->sc_bus.parent = dev;
309 sc->sc_bus.devices = sc->sc_devices;
310 sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
311 sc->sc_bus.dma_bits = 32;
313 sprintf(sc->sc_vendor, "Texas Instruments");
316 isc->sc_dev = dev;
319 if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(dev),
324 /* Allocate resource for the EHCI register set */
326 sc->sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
327 if (!sc->sc_io_res) {
328 device_printf(dev, "Error: Could not map EHCI memory\n");
333 sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
334 if (sc->sc_irq_res == NULL) {
340 sc->sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
341 if (!sc->sc_bus.bdev) {
342 device_printf(dev, "Error: could not add USB device\n");
346 device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
347 device_set_desc(sc->sc_bus.bdev, OMAP_EHCI_HC_DEVSTR);
352 device_printf(dev, "Error: could not setup OMAP EHCI, %d\n", err);
356 /* Set the tag and size of the register set in the EHCI context */
357 sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res);
358 sc->sc_io_tag = rman_get_bustag(sc->sc_io_res);
359 sc->sc_io_size = rman_get_size(sc->sc_io_res);
362 err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
363 NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl);
366 sc->sc_intr_hdl = NULL;
373 err = device_probe_and_attach(sc->sc_bus.bdev);
376 device_printf(dev, "Error: USB init failed err=%d\n", err);
388 * omap_ehci_detach - detach the device and cleanup the driver
391 * Clean-up routine where everything initialised in omap_ehci_attach is
393 * the on-chip module.
405 ehci_softc_t *sc = &isc->base;
416 if (sc->sc_io_res) {
420 if (sc->sc_irq_res && sc->sc_intr_hdl) {
426 err = bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intr_hdl);
429 sc->sc_intr_hdl = NULL;
432 /* Free the resources stored in the base EHCI handler */
433 if (sc->sc_irq_res) {
434 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res);
435 sc->sc_irq_res = NULL;
437 if (sc->sc_io_res) {
438 bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_io_res);
439 sc->sc_io_res = NULL;
461 "ehci",