Lines Matching +full:out +full:- +full:of +full:- +full:reset

1 /*-
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * notice, this list of conditions and the following disclaimer in the
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 {"nvidia,tegra124-ehci", (uintptr_t)TEGRA124_EHCI},
69 {"nvidia,tegra210-ehci", (uintptr_t)TEGRA210_EHCI},
81 hwreset_t reset; member
93 device_printf(ehci_softc->sc_bus.bdev, "set host controller mode\n"); in tegra_ehci_post_reset()
104 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { in tegra_ehci_probe()
124 esc = &sc->ehci_softc; in tegra_ehci_detach()
125 if (sc->clk != NULL) in tegra_ehci_detach()
126 clk_release(sc->clk); in tegra_ehci_detach()
127 if (esc->sc_flags & EHCI_SCFLG_DONEINIT) in tegra_ehci_detach()
129 if (esc->sc_intr_hdl != NULL) in tegra_ehci_detach()
130 bus_teardown_intr(dev, esc->sc_irq_res, in tegra_ehci_detach()
131 esc->sc_intr_hdl); in tegra_ehci_detach()
132 if (sc->ehci_irq_res != NULL) in tegra_ehci_detach()
134 sc->ehci_irq_res); in tegra_ehci_detach()
135 if (sc->ehci_mem_res != NULL) in tegra_ehci_detach()
137 sc->ehci_mem_res); in tegra_ehci_detach()
138 if (sc->usb_alloc_called) in tegra_ehci_detach()
139 usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); in tegra_ehci_detach()
153 sc->dev = dev; in tegra_ehci_attach()
154 esc = &sc->ehci_softc; in tegra_ehci_attach()
158 sc->ehci_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in tegra_ehci_attach()
160 if (sc->ehci_mem_res == NULL) { in tegra_ehci_attach()
163 goto out; in tegra_ehci_attach()
167 sc->ehci_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, in tegra_ehci_attach()
169 if (sc->ehci_irq_res == NULL) { in tegra_ehci_attach()
172 goto out; in tegra_ehci_attach()
175 rv = hwreset_get_by_ofw_name(dev, 0, "usb", &sc->reset); in tegra_ehci_attach()
177 device_printf(dev, "Cannot get reset\n"); in tegra_ehci_attach()
179 goto out; in tegra_ehci_attach()
182 rv = phy_get_by_ofw_property(sc->dev, 0, "nvidia,phy", &sc->phy); in tegra_ehci_attach()
184 device_printf(sc->dev, "Cannot get 'nvidia,phy' phy\n"); in tegra_ehci_attach()
186 goto out; in tegra_ehci_attach()
189 rv = clk_get_by_ofw_index(sc->dev, 0, 0, &sc->clk); in tegra_ehci_attach()
192 goto out; in tegra_ehci_attach()
195 rv = clk_enable(sc->clk); in tegra_ehci_attach()
198 goto out; in tegra_ehci_attach()
202 rv = clk_get_freq(sc->clk, &freq); in tegra_ehci_attach()
205 goto out; in tegra_ehci_attach()
208 rv = hwreset_deassert(sc->reset); in tegra_ehci_attach()
210 device_printf(dev, "Cannot clear reset: %d\n", rv); in tegra_ehci_attach()
212 goto out; in tegra_ehci_attach()
215 rv = phy_enable(sc->phy); in tegra_ehci_attach()
218 goto out; in tegra_ehci_attach()
222 esc->sc_vendor_get_port_speed = ehci_get_port_speed_hostc; in tegra_ehci_attach()
223 esc->sc_vendor_post_reset = tegra_ehci_post_reset; in tegra_ehci_attach()
224 esc->sc_io_tag = rman_get_bustag(sc->ehci_mem_res); in tegra_ehci_attach()
225 esc->sc_bus.parent = dev; in tegra_ehci_attach()
226 esc->sc_bus.devices = esc->sc_devices; in tegra_ehci_attach()
227 esc->sc_bus.devices_max = EHCI_MAX_DEVICES; in tegra_ehci_attach()
228 esc->sc_bus.dma_bits = 32; in tegra_ehci_attach()
231 rv = usb_bus_mem_alloc_all(&esc->sc_bus, USB_GET_DMA_TAG(dev), in tegra_ehci_attach()
233 sc->usb_alloc_called = 1; in tegra_ehci_attach()
237 goto out; in tegra_ehci_attach()
244 rv = bus_space_subregion(esc->sc_io_tag, in tegra_ehci_attach()
245 rman_get_bushandle(sc->ehci_mem_res), in tegra_ehci_attach()
246 TEGRA_EHCI_REG_OFF, TEGRA_EHCI_REG_SIZE, &esc->sc_io_hdl); in tegra_ehci_attach()
250 goto out; in tegra_ehci_attach()
254 rv = bus_setup_intr(dev, sc->ehci_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, in tegra_ehci_attach()
255 NULL, (driver_intr_t *)ehci_interrupt, esc, &esc->sc_intr_hdl); in tegra_ehci_attach()
258 goto out; in tegra_ehci_attach()
262 esc->sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY); in tegra_ehci_attach()
263 if (esc->sc_bus.bdev == NULL) { in tegra_ehci_attach()
265 goto out; in tegra_ehci_attach()
267 device_set_ivars(esc->sc_bus.bdev, &esc->sc_bus); in tegra_ehci_attach()
269 esc->sc_id_vendor = USB_VENDOR_FREESCALE; in tegra_ehci_attach()
270 strlcpy(esc->sc_vendor, "Nvidia", sizeof(esc->sc_vendor)); in tegra_ehci_attach()
273 esc->sc_flags |= EHCI_SCFLG_TT; in tegra_ehci_attach()
274 esc->sc_flags |= EHCI_SCFLG_NORESTERM; in tegra_ehci_attach()
279 goto out; in tegra_ehci_attach()
281 esc->sc_flags |= EHCI_SCFLG_DONEINIT; in tegra_ehci_attach()
284 rv = device_probe_and_attach(esc->sc_bus.bdev); in tegra_ehci_attach()
288 goto out; in tegra_ehci_attach()
292 out: in tegra_ehci_attach()