Lines Matching +full:usb +full:- +full:ehci

1 /*-
29 * EHCI driver for Tegra SoCs.
50 #include <dev/usb/usb.h>
51 #include <dev/usb/usbdi.h>
52 #include <dev/usb/usb_busdma.h>
53 #include <dev/usb/usb_process.h>
54 #include <dev/usb/usb_controller.h>
55 #include <dev/usb/usb_bus.h>
56 #include <dev/usb/controller/ehci.h>
57 #include <dev/usb/controller/ehcireg.h>
68 {"nvidia,tegra124-ehci", (uintptr_t)TEGRA124_EHCI},
69 {"nvidia,tegra210-ehci", (uintptr_t)TEGRA210_EHCI},
76 struct resource *ehci_mem_res; /* EHCI core regs. */
77 struct resource *ehci_irq_res; /* EHCI core IRQ. */
93 device_printf(ehci_softc->sc_bus.bdev, "set host controller mode\n");
104 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) {
105 device_set_desc(dev, "Nvidia Tegra EHCI controller");
124 esc = &sc->ehci_softc;
125 if (sc->clk != NULL)
126 clk_release(sc->clk);
127 if (esc->sc_flags & EHCI_SCFLG_DONEINIT)
129 if (esc->sc_intr_hdl != NULL)
130 bus_teardown_intr(dev, esc->sc_irq_res,
131 esc->sc_intr_hdl);
132 if (sc->ehci_irq_res != NULL)
134 sc->ehci_irq_res);
135 if (sc->ehci_mem_res != NULL)
137 sc->ehci_mem_res);
138 if (sc->usb_alloc_called)
139 usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc);
153 sc->dev = dev;
154 esc = &sc->ehci_softc;
158 sc->ehci_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
160 if (sc->ehci_mem_res == NULL) {
167 sc->ehci_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
169 if (sc->ehci_irq_res == NULL) {
175 rv = hwreset_get_by_ofw_name(dev, 0, "usb", &sc->reset);
182 rv = phy_get_by_ofw_property(sc->dev, 0, "nvidia,phy", &sc->phy);
184 device_printf(sc->dev, "Cannot get 'nvidia,phy' phy\n");
189 rv = clk_get_by_ofw_index(sc->dev, 0, 0, &sc->clk);
195 rv = clk_enable(sc->clk);
202 rv = clk_get_freq(sc->clk, &freq);
208 rv = hwreset_deassert(sc->reset);
215 rv = phy_enable(sc->phy);
221 /* Fill data for EHCI driver. */
222 esc->sc_vendor_get_port_speed = ehci_get_port_speed_hostc;
223 esc->sc_vendor_post_reset = tegra_ehci_post_reset;
224 esc->sc_io_tag = rman_get_bustag(sc->ehci_mem_res);
225 esc->sc_bus.parent = dev;
226 esc->sc_bus.devices = esc->sc_devices;
227 esc->sc_bus.devices_max = EHCI_MAX_DEVICES;
228 esc->sc_bus.dma_bits = 32;
231 rv = usb_bus_mem_alloc_all(&esc->sc_bus, USB_GET_DMA_TAG(dev),
233 sc->usb_alloc_called = 1;
241 * Set handle to USB related registers subregion used by
242 * generic EHCI driver.
244 rv = bus_space_subregion(esc->sc_io_tag,
245 rman_get_bushandle(sc->ehci_mem_res),
246 TEGRA_EHCI_REG_OFF, TEGRA_EHCI_REG_SIZE, &esc->sc_io_hdl);
248 device_printf(dev, "Could not create USB memory subregion\n");
254 rv = bus_setup_intr(dev, sc->ehci_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
255 NULL, (driver_intr_t *)ehci_interrupt, esc, &esc->sc_intr_hdl);
261 /* Add USB bus device. */
262 esc->sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
263 if (esc->sc_bus.bdev == NULL) {
264 device_printf(dev, "Could not add USB device\n");
267 device_set_ivars(esc->sc_bus.bdev, &esc->sc_bus);
269 esc->sc_id_vendor = USB_VENDOR_FREESCALE;
270 strlcpy(esc->sc_vendor, "Nvidia", sizeof(esc->sc_vendor));
273 esc->sc_flags |= EHCI_SCFLG_TT;
274 esc->sc_flags |= EHCI_SCFLG_NORESTERM;
277 device_printf(dev, "USB init failed: %d\n",
281 esc->sc_flags |= EHCI_SCFLG_DONEINIT;
284 rv = device_probe_and_attach(esc->sc_bus.bdev);
312 static DEFINE_CLASS_0(ehci, ehci_driver, ehci_methods,
315 MODULE_DEPEND(tegra_ehci, usb, 1, 1, 1);