Lines Matching +full:usb +full:- +full:ehci
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
35 * FDT attachment driver for the USB Enhanced Host Controller.
63 #include <dev/usb/usb.h>
64 #include <dev/usb/usbdi.h>
66 #include <dev/usb/usb_core.h>
67 #include <dev/usb/usb_busdma.h>
68 #include <dev/usb/usb_process.h>
69 #include <dev/usb/usb_util.h>
71 #include <dev/usb/usb_controller.h>
72 #include <dev/usb/usb_bus.h>
73 #include <dev/usb/controller/ehci.h>
74 #include <dev/usb/controller/ehcireg.h>
82 #define EHCI_HC_DEVSTR "Marvell Integrated USB 2.0 controller"
92 /* EHCI HC regs start at this offset within USB range */
111 {"mrvl,usb-ehci", HWTYPE_MV_EHCI_V1},
112 {"marvell,orion-ehci", HWTYPE_MV_EHCI_V2},
113 {"marvell,armada-3700-ehci", HWTYPE_MV_EHCI_V2},
136 if (!ofw_bus_search_compatible(self, compat_data)->ocd_data)
154 sc->sc_bus.parent = self;
155 sc->sc_bus.devices = sc->sc_devices;
156 sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
157 sc->sc_bus.dma_bits = 32;
159 hwtype = ofw_bus_search_compatible(self, compat_data)->ocd_data;
166 if (usb_bus_mem_alloc_all(&sc->sc_bus,
172 sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE);
173 if (!sc->sc_io_res) {
177 sc->sc_io_tag = rman_get_bustag(sc->sc_io_res);
178 bsh = rman_get_bushandle(sc->sc_io_res);
179 sc->sc_io_size = rman_get_size(sc->sc_io_res) - MV_USB_HOST_OFST;
182 * Marvell EHCI host controller registers start at certain offset
183 * within the whole USB registers range, so create a subregion for the
187 if (bus_space_subregion(sc->sc_io_tag, bsh, MV_USB_HOST_OFST,
188 sc->sc_io_size, &sc->sc_io_hdl) != 0)
189 panic("%s: unable to subregion USB host registers",
205 * Notice: Marvell EHCI controller has TWO interrupt lines, so make
207 * -- refer to DTS for the right resource number to use here.
209 sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
211 if (sc->sc_irq_res == NULL) {
216 sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY);
217 if (!sc->sc_bus.bdev) {
218 device_printf(self, "Could not add USB device\n");
221 device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
222 device_set_desc(sc->sc_bus.bdev, EHCI_HC_DEVSTR);
224 sprintf(sc->sc_vendor, "Marvell");
240 err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
241 NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl);
244 sc->sc_intr_hdl = NULL;
249 * Workaround for Marvell integrated EHCI controller: reset of
250 * the EHCI core clears the USBMODE register, which sets the core in
254 * Refer to errata document MV-S500832-00D.pdf (p. 5.24 GL USB-2) for
257 sc->sc_vendor_post_reset = mv_ehci_post_reset;
259 device_printf(self, "5.24 GL USB-2 workaround enabled\n");
262 sc->sc_flags |= EHCI_SCFLG_TT | EHCI_SCFLG_NORESTERM;
263 sc->sc_vendor_get_port_speed = ehci_get_port_speed_portsc;
266 err = device_probe_and_attach(sc->sc_bus.bdev);
269 device_printf(self, "USB init failed err=%d\n", err);
293 if (sc->sc_io_res) {
296 if (sc->sc_irq_res && sc->sc_intr_hdl) {
302 err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl);
308 sc->sc_intr_hdl = NULL;
322 if (sc->sc_irq_res) {
323 bus_release_resource(self, SYS_RES_IRQ, 1, sc->sc_irq_res);
324 sc->sc_irq_res = NULL;
326 if (sc->sc_io_res) {
328 sc->sc_io_res);
329 sc->sc_io_res = NULL;
331 usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
344 printf("USB error: ");
379 "ehci",
385 MODULE_DEPEND(ehci_mv, usb, 1, 1, 1);