ehci_imx.c (330897) | ehci_imx.c (331501) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2010-2012 Semihalf 5 * Copyright (c) 2012 The FreeBSD Foundation 6 * Copyright (c) 2013 Ian Lepore <ian@freebsd.org> 7 * All rights reserved. 8 * --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2010-2012 Semihalf 5 * Copyright (c) 2012 The FreeBSD Foundation 6 * Copyright (c) 2013 Ian Lepore <ian@freebsd.org> 7 * All rights reserved. 8 * --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: stable/11/sys/dev/usb/controller/ehci_imx.c 330897 2018-03-14 03:19:51Z eadler $"); | 35__FBSDID("$FreeBSD: stable/11/sys/dev/usb/controller/ehci_imx.c 331501 2018-03-24 22:39:38Z ian $"); |
36 37/* 38 * EHCI driver for Freescale i.MX SoCs which incorporate the USBOH3 controller. 39 */ 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/kernel.h> --- 219 unchanged lines hidden (view full) --- 263#define IMX_EHCI_REG_OFF 0x100 264#define IMX_EHCI_REG_SIZE 0x100 265 266struct imx_ehci_softc { 267 ehci_softc_t ehci_softc; 268 device_t dev; 269 struct resource *ehci_mem_res; /* EHCI core regs. */ 270 struct resource *ehci_irq_res; /* EHCI core IRQ. */ | 36 37/* 38 * EHCI driver for Freescale i.MX SoCs which incorporate the USBOH3 controller. 39 */ 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/kernel.h> --- 219 unchanged lines hidden (view full) --- 263#define IMX_EHCI_REG_OFF 0x100 264#define IMX_EHCI_REG_SIZE 0x100 265 266struct imx_ehci_softc { 267 ehci_softc_t ehci_softc; 268 device_t dev; 269 struct resource *ehci_mem_res; /* EHCI core regs. */ 270 struct resource *ehci_irq_res; /* EHCI core IRQ. */ |
271 bool usb_mem_allocated; |
|
271}; 272 273static struct ofw_compat_data compat_data[] = { 274 {"fsl,imx6q-usb", 1}, 275 {"fsl,imx53-usb", 1}, 276 {"fsl,imx51-usb", 1}, 277 {"fsl,imx28-usb", 1}, 278 {"fsl,imx27-usb", 1}, --- 47 unchanged lines hidden (view full) --- 326 esc->sc_intr_hdl); 327 if (sc->ehci_irq_res != NULL) 328 bus_release_resource(dev, SYS_RES_IRQ, 0, 329 sc->ehci_irq_res); 330 if (sc->ehci_mem_res != NULL) 331 bus_release_resource(dev, SYS_RES_MEMORY, 0, 332 sc->ehci_mem_res); 333 | 272}; 273 274static struct ofw_compat_data compat_data[] = { 275 {"fsl,imx6q-usb", 1}, 276 {"fsl,imx53-usb", 1}, 277 {"fsl,imx51-usb", 1}, 278 {"fsl,imx28-usb", 1}, 279 {"fsl,imx27-usb", 1}, --- 47 unchanged lines hidden (view full) --- 327 esc->sc_intr_hdl); 328 if (sc->ehci_irq_res != NULL) 329 bus_release_resource(dev, SYS_RES_IRQ, 0, 330 sc->ehci_irq_res); 331 if (sc->ehci_mem_res != NULL) 332 bus_release_resource(dev, SYS_RES_MEMORY, 0, 333 sc->ehci_mem_res); 334 |
334 usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); | 335 if (sc->usb_mem_allocated) 336 usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); |
335 336 /* During module unload there are lots of children leftover */ 337 device_delete_children(dev); 338 339 return (0); 340} 341 342static void --- 65 unchanged lines hidden (view full) --- 408 409 /* allocate all DMA memory */ 410 if (usb_bus_mem_alloc_all(&esc->sc_bus, USB_GET_DMA_TAG(dev), 411 &ehci_iterate_hw_softc) != 0) { 412 device_printf(dev, "usb_bus_mem_alloc_all() failed\n"); 413 err = ENOMEM; 414 goto out; 415 } | 337 338 /* During module unload there are lots of children leftover */ 339 device_delete_children(dev); 340 341 return (0); 342} 343 344static void --- 65 unchanged lines hidden (view full) --- 410 411 /* allocate all DMA memory */ 412 if (usb_bus_mem_alloc_all(&esc->sc_bus, USB_GET_DMA_TAG(dev), 413 &ehci_iterate_hw_softc) != 0) { 414 device_printf(dev, "usb_bus_mem_alloc_all() failed\n"); 415 err = ENOMEM; 416 goto out; 417 } |
418 sc->usb_mem_allocated = true; |
|
416 417 /* 418 * Set handle to USB related registers subregion used by 419 * generic EHCI driver. 420 */ 421 err = bus_space_subregion(esc->sc_io_tag, 422 rman_get_bushandle(sc->ehci_mem_res), 423 IMX_EHCI_REG_OFF, IMX_EHCI_REG_SIZE, &esc->sc_io_hdl); --- 91 unchanged lines hidden --- | 419 420 /* 421 * Set handle to USB related registers subregion used by 422 * generic EHCI driver. 423 */ 424 err = bus_space_subregion(esc->sc_io_tag, 425 rman_get_bushandle(sc->ehci_mem_res), 426 IMX_EHCI_REG_OFF, IMX_EHCI_REG_SIZE, &esc->sc_io_hdl); --- 91 unchanged lines hidden --- |