Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/usb/controller/dwc_otg.c
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/condvar.h> | #include <sys/condvar.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/sx.h> | #include <sys/sx.h> | ||||
#include <sys/unistd.h> | #include <sys/unistd.h> | ||||
#include <sys/callout.h> | #include <sys/callout.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/priv.h> | #include <sys/priv.h> | ||||
#include <sys/rman.h> | |||||
#include <dev/usb/usb.h> | #include <dev/usb/usb.h> | ||||
#include <dev/usb/usbdi.h> | #include <dev/usb/usbdi.h> | ||||
#define USB_DEBUG_VAR dwc_otg_debug | #define USB_DEBUG_VAR dwc_otg_debug | ||||
#include <dev/usb/usb_core.h> | #include <dev/usb/usb_core.h> | ||||
#include <dev/usb/usb_debug.h> | #include <dev/usb/usb_debug.h> | ||||
▲ Show 20 Lines • Show All 3,791 Lines • ▼ Show 20 Lines | if (udev->state == USB_STATE_CONFIGURED || | ||||
USB_BUS_UNLOCK(&sc->sc_bus); | USB_BUS_UNLOCK(&sc->sc_bus); | ||||
} | } | ||||
} | } | ||||
int | int | ||||
dwc_otg_init(struct dwc_otg_softc *sc) | dwc_otg_init(struct dwc_otg_softc *sc) | ||||
{ | { | ||||
uint32_t temp; | uint32_t temp; | ||||
int err; | |||||
DPRINTF("start\n"); | DPRINTF("start\n"); | ||||
sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); | |||||
sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); | |||||
sc->sc_io_size = rman_get_size(sc->sc_io_res); | |||||
/* set up the bus structure */ | /* set up the bus structure */ | ||||
sc->sc_bus.devices = sc->sc_devices; | |||||
sc->sc_bus.devices_max = DWC_OTG_MAX_DEVICES; | |||||
sc->sc_bus.dma_bits = 32; | |||||
sc->sc_bus.usbrev = USB_REV_2_0; | sc->sc_bus.usbrev = USB_REV_2_0; | ||||
sc->sc_bus.methods = &dwc_otg_bus_methods; | sc->sc_bus.methods = &dwc_otg_bus_methods; | ||||
/* get all DMA memory */ | |||||
if (usb_bus_mem_alloc_all(&sc->sc_bus, | |||||
USB_GET_DMA_TAG(sc->sc_bus.parent), NULL)) { | |||||
return (ENOMEM); | |||||
} | |||||
sc->sc_bus.bdev = device_add_child(sc->sc_bus.parent, "usbus", -1); | |||||
if (sc->sc_bus.bdev == NULL) | |||||
return (ENXIO); | |||||
device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); | |||||
err = bus_setup_intr(sc->sc_bus.parent, sc->sc_irq_res, | |||||
INTR_TYPE_TTY | INTR_MPSAFE, &dwc_otg_filter_interrupt, | |||||
&dwc_otg_interrupt, sc, &sc->sc_intr_hdl); | |||||
if (err) { | |||||
sc->sc_intr_hdl = NULL; | |||||
return (ENXIO); | |||||
} | |||||
usb_callout_init_mtx(&sc->sc_timer, | usb_callout_init_mtx(&sc->sc_timer, | ||||
&sc->sc_bus.bus_mtx, 0); | &sc->sc_bus.bus_mtx, 0); | ||||
USB_BUS_LOCK(&sc->sc_bus); | USB_BUS_LOCK(&sc->sc_bus); | ||||
/* turn on clocks */ | /* turn on clocks */ | ||||
dwc_otg_clocks_on(sc); | dwc_otg_clocks_on(sc); | ||||
▲ Show 20 Lines • Show All 1,140 Lines • Show Last 20 Lines |