48#ifdef USB_GLOBAL_INCLUDE_FILE
49#include USB_GLOBAL_INCLUDE_FILE
51#include <sys/stdint.h>
52#include <sys/stddef.h>
57#include <sys/kernel.h>
59#include <sys/module.h>
62#include <sys/condvar.h>
63#include <sys/sysctl.h>
65#include <sys/unistd.h>
66#include <sys/callout.h>
67#include <sys/malloc.h>
74#define USB_DEBUG_VAR dwc_otg_debug
92#define DWC_OTG_BUS2SC(bus) \
93 __containerof(bus, struct dwc_otg_softc, sc_bus)
95#define DWC_OTG_PC2UDEV(pc) \
96 (USB_DMATAG_TO_XROOT((pc)->tag_parent)->udev)
98#define DWC_OTG_MSK_GINT_THREAD_IRQ \
99 (GINTSTS_USBRST | GINTSTS_ENUMDONE | GINTSTS_PRTINT | \
100 GINTSTS_WKUPINT | GINTSTS_USBSUSP | GINTMSK_OTGINTMSK | \
103#ifndef DWC_OTG_PHY_DEFAULT
104#define DWC_OTG_PHY_DEFAULT DWC_OTG_PHY_ULPI
109static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
111SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, phy_type, CTLFLAG_RDTUN,
112 &
dwc_otg_phy_type, 0,
"DWC OTG PHY TYPE - 0/1/2/3 - ULPI/HSIC/INTERNAL/UTMI+");
115static int dwc_otg_debug = 0;
118 &dwc_otg_debug, 0,
"DWC OTG debug level");
121#define DWC_OTG_INTR_ENDPT 1
150 .max_out_frame_size = 64,
152 .support_control = 1,
172 uint32_t
offset, uint32_t fifo, uint32_t count)
191 if (buf_res.
length > temp)
222 uint32_t
offset, uint32_t count)
241 if (buf_res.
length > temp)
283 for (temp = 0; temp != 16; temp++) {
307 if (fifo_size < fifo_regs) {
313 fifo_size -= fifo_regs;
324 tx_start = fifo_size;
326 if (fifo_size < 64) {
327 DPRINTFN(-1,
"Not enough data space for EP0 FIFO.\n");
338 DPRINTF(
"PTX/NPTX FIFO=%u\n", fifo_size);
344 ((fifo_size / 4) << 16) |
347 tx_start += fifo_size;
356 ((fifo_size / 4) << 16) |
374 (0x10 << 16) | (tx_start / 4));
387 pf->usb.max_out_frame_size = 1024 * 3;
388 pf->usb.is_simplex = 0;
389 pf->usb.support_bulk = 1;
390 pf->usb.support_interrupt = 1;
391 pf->usb.support_isochronous = 1;
392 pf->usb.support_out = 1;
394 if (x < sc->sc_dev_in_ep_max) {
402 if (limit <= fifo_size) {
403 pf->max_buffer = limit;
404 pf->usb.support_in = 1;
407 if (limit <= fifo_size) {
408 pf->usb.support_in = 1;
410 pf->usb.is_simplex = 1;
416 ((limit / 4) << 16) | (tx_start / 4));
419 pf->usb.max_in_frame_size = limit;
421 pf->usb.is_simplex = 1;
424 DPRINTF(
"FIFO%d = IN:%d / OUT:%d\n", x,
425 pf->usb.max_in_frame_size,
426 pf->usb.max_out_frame_size);
496 DPRINTF(
"HFIR=0x%08x\n", temp);
539 temp &= ~DCTL_SFTDISCON;
627 DPRINTFN(5,
"Remote wakeup\n");
640 temp &= ~DCTL_RMTWKUPSIG;
673 DPRINTFN(5,
"addr=%d\n",
addr);
676 temp &= ~DCFG_DEVADDR_SET(0x7F);
684 DPRINTFN(5,
"RX status clear\n");
729 DPRINTF(
"Periodic TX FIFO is not empty\n");
738 DPRINTF(
"Non-periodic TX FIFO is not empty\n");
793 for (y = 0; y != z; y++) {
851 DPRINTF(
"Halting channel %d\n", x);
897 DPRINTF(
"CH=%d ST=%d HCINT=0x%08x HCCHAR=0x%08x HCTSIZ=0x%08x\n",
1012 td->
hcsplt &= ~HCSPLT_COMPSPLT;
1138 DPRINTFN(0,
"Unsupported SETUP packet "
1139 "length, %d bytes\n",
count);
1179 DPRINTFN(5,
"stalling IN and OUT direction\n");
1222 if (frame_num & (td->
tmr_res - 1))
1234 }
else if (td->
did_nak != 0) {
1236 if (td->
tmr_res == frame_num) {
1272 DPRINTF(
"DATA ST=%d STATUS=0x%08x\n",
1280 DPRINTF(
"Data already received\n");
1306 if (count < td->max_packet_size) {
1366 DPRINTF(
"CH=%d ST=%d HCINT=0x%08x HCCHAR=0x%08x HCTSIZ=0x%08x\n",
1367 channel, td->
state, hcint,
1376 DPRINTF(
"CH=%d STALL\n", channel);
1381 DPRINTF(
"CH=%d ERROR\n", channel);
1405 switch (td->
state) {
1424 DPRINTF(
"Retrying packet due to "
1425 "data toggle error\n");
1440 DPRINTF(
"Retrying complete split\n");
1469 }
else if (td->
hcsplt != 0) {
1582 hcchar &= ~HCCHAR_ODDFRM;
1590 hcchar &= ~HCCHAR_ODDFRM;
1593 hcchar &= ~HCCHAR_ODDFRM;
1629 td->
hcsplt &= ~HCSPLT_COMPSPLT;
1643 td->
hcchar &= ~HCCHAR_ODDFRM;
1687 DPRINTFN(5,
"faking complete\n");
1709 if (count < td->max_packet_size) {
1748 temp &= ~DIEPCTL_SETD1PID;
1751 temp &= ~DIEPCTL_SETD0PID;
1758 if ((td->
remainder == 0) || got_short) {
1769 if (td->
ep_no == 0) {
1807 DPRINTF(
"CH=%d ST=%d HCINT=0x%08x HCCHAR=0x%08x HCTSIZ=0x%08x\n",
1808 channel, td->
state, hcint,
1816 DPRINTF(
"CH=%d STALL\n", channel);
1821 DPRINTF(
"CH=%d ERROR\n", channel);
1838 switch (td->
state) {
1961 td->
hcsplt &= ~HCSPLT_COMPSPLT;
1971 td->
hcsplt &= ~HCSPLT_XACTPOS_MASK;
1974 }
else if (td->
hcsplt != 0) {
1975 td->
hcsplt &= ~HCSPLT_COMPSPLT;
1993 if (rem_bytes <
count) {
1998 if (
count == rem_bytes) {
2041 hcchar &= ~HCCHAR_EPDIR_IN;
2048 hcchar &= ~HCCHAR_ODDFRM;
2066 if (
count == rem_bytes)
2105 hcchar &= ~HCCHAR_EPDIR_IN;
2112 hcchar &= ~HCCHAR_ODDFRM;
2130 uint32_t max_buffer;
2146 if ((td->
ep_no == 0) && (temp != 0) &&
2174 if (cpkt >= td->
npkt) {
2177 if (max_buffer != 0) {
2178 fifo_left = (td->
npkt - cpkt) *
2181 if (fifo_left > max_buffer)
2182 fifo_left = max_buffer;
2189 if (
count > fifo_left)
2221 DPRINTFN(5,
"busy ep=%d npkt=%d DIEPTSIZ=0x%08x "
2222 "DIEPCTL=0x%08x\n", td->
ep_no,
2240 if (
count > 0x7FFFFF)
2253 if (td->
npkt > mpkt) {
2287 temp &= ~DIEPCTL_SETD1PID;
2290 temp &= ~DIEPCTL_SETD0PID;
2328 DPRINTFN(5,
"busy ep=%d\n", td->
ep_no);
2339 if ((td->
ep_no == 0) && (temp != 0) &&
2345 DPRINTFN(5,
"faking complete\n");
2373 if ((td->
func) (sc, td)) {
2380 if (td->error_any) {
2382 }
else if (td->remainder > 0) {
2507 if ((temp & 7) == 0) {
2511 TAILQ_FOREACH_SAFE(xfer, &sc->
sc_bus.
intr_q.head, wait_entry, xfer_next) {
2538 TAILQ_REMOVE(&sc->
sc_bus.
intr_q.head, xfer, wait_entry);
2539 TAILQ_INSERT_TAIL(&head, xfer, wait_entry);
2542 TAILQ_FOREACH_SAFE(xfer, &sc->
sc_bus.
intr_q.head, wait_entry, xfer_next) {
2559 TAILQ_REMOVE(&sc->
sc_bus.
intr_q.head, xfer, wait_entry);
2560 TAILQ_INSERT_TAIL(&head, xfer, wait_entry);
2563 TAILQ_FOREACH_SAFE(xfer, &sc->
sc_bus.
intr_q.head, wait_entry, xfer_next) {
2586 TAILQ_REMOVE(&sc->
sc_bus.
intr_q.head, xfer, wait_entry);
2587 TAILQ_INSERT_TAIL(&head, xfer, wait_entry);
2590 TAILQ_FOREACH_SAFE(xfer, &sc->
sc_bus.
intr_q.head, wait_entry, xfer_next) {
2605 TAILQ_REMOVE(&sc->
sc_bus.
intr_q.head, xfer, wait_entry);
2606 TAILQ_INSERT_TAIL(&head, xfer, wait_entry);
2609 if ((temp & 7) < 6) {
2610 TAILQ_FOREACH_SAFE(xfer, &sc->
sc_bus.
intr_q.head, wait_entry, xfer_next) {
2625 TAILQ_REMOVE(&sc->
sc_bus.
intr_q.head, xfer, wait_entry);
2626 TAILQ_INSERT_TAIL(&head, xfer, wait_entry);
2631 TAILQ_CONCAT(&sc->
sc_bus.
intr_q.head, &head, wait_entry);
2634 TAILQ_FOREACH_SAFE(xfer, &sc->
sc_bus.
intr_q.head, wait_entry, xfer_next) {
2636 if (td == NULL || td->
hcsplt == 0)
2638 TAILQ_REMOVE(&sc->
sc_bus.
intr_q.head, xfer, wait_entry);
2639 TAILQ_INSERT_TAIL(&head, xfer, wait_entry);
2641 TAILQ_CONCAT(&head, &sc->
sc_bus.
intr_q.head, wait_entry);
2642 TAILQ_CONCAT(&sc->
sc_bus.
intr_q.head, &head, wait_entry);
2645 TAILQ_FOREACH_SAFE(xfer, &sc->
sc_bus.
intr_q.head, wait_entry, xfer_next) {
2649 TAILQ_REMOVE(&sc->
sc_bus.
intr_q.head, xfer, wait_entry);
2650 TAILQ_INSERT_TAIL(&head, xfer, wait_entry);
2652 TAILQ_CONCAT(&sc->
sc_bus.
intr_q.head, &head, wait_entry);
2654 if ((temp & 7) == 0) {
2655 DPRINTFN(12,
"SOF interrupt #%d, needsof=%d\n",
2684 uint8_t got_rx_status;
2696 if (++
count == 16) {
2710 temp &= ~HCINT_SOFTWARE_ONLY;
2712 haint &= ~(1U << x);
2737 DPRINTFN(5,
"channel halt complete ch=%u\n", ep_no);
2757 DPRINTF(
"Reading %d bytes from ep %d\n", temp, ep_no);
2767 DPRINTFN(5,
"RX status = 0x%08x: ch=%d pid=%d bytes=%d sts=%d\n",
2791 TAILQ_FOREACH(xfer, &sc->
sc_bus.
intr_q.head, wait_entry)
2794 if (got_rx_status) {
2811 TAILQ_FOREACH(xfer, &sc->
sc_bus.
intr_q.head, wait_entry) {
2820 DPRINTFN(5,
"vbus = %u\n", is_on);
2853 int retval = FILTER_HANDLED;
2866 retval = FILTER_SCHEDULE_THREAD;
2895 retval = FILTER_SCHEDULE_THREAD;
2917 DPRINTFN(14,
"GINTSTS=0x%08x HAINT=0x%08x HFNUM=0x%08x\n",
2941 DPRINTFN(5,
"end of reset\n");
2988 DPRINTFN(12,
"GINTSTS=0x%08x, HPRT=0x%08x\n",
status, hprt);
3052 DPRINTFN(5,
"resume interrupt\n");
3057 DPRINTFN(5,
"suspend interrupt\n");
3070 DPRINTFN(5,
"GOTGCTL=0x%08x\n", temp);
3131 DPRINTFN(9,
"addr=%d endpt=%d sumlen=%d speed=%d\n",
3220 if (temp.
len == 0) {
3367 else if (ival > 127)
3390 else if (ival > 127)
3578 DPRINTFN(13,
"xfer=%p endpoint=%p transfer done\n",
3623 DPRINTFN(9,
"xfer=%p, endpoint=%p, error=%d\n",
3673 DPRINTFN(5,
"endpoint=0x%x\n", ep_no);
3706 uint8_t ep_no, uint8_t ep_type, uint8_t ep_dir)
3724 mps = (mps + 3) & 0x7FC;
3773 DPRINTFN(5,
"endpoint=%p\n", ep);
3883 DPRINTF(
"Version = 0x%08x\n", temp);
4007 DPRINTF(
"Total FIFO size = %d bytes, Device EPs = %d/%d Host CHs = %d\n",
4027 DPRINTF(
"Disable Multi Process Interrupts\n");
4060 DPRINTFN(5,
"GOTCTL=0x%08x\n", temp);
4193 DPRINTFN(6,
"xfer=%p next=%d nframes=%d\n",
4242 .bcdUSB = {0x00, 0x02},
4246 .bMaxPacketSize = 64,
4247 .bcdDevice = {0x00, 0x01},
4250 .bNumConfigurations = 1,
4270 .bInterfaceProtocol = 0,
4281#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }
4293#define STRING_VENDOR \
4296#define STRING_PRODUCT \
4297 "O\0T\0G\0 \0R\0o\0o\0t\0 \0H\0U\0B"
4325 switch (
req->bmRequestType) {
4327 switch (
req->bRequest) {
4329 goto tr_handle_get_descriptor;
4331 goto tr_handle_get_config;
4333 goto tr_handle_get_status;
4340 switch (
req->bRequest) {
4342 goto tr_handle_set_address;
4344 goto tr_handle_set_config;
4356 switch (
req->bRequest) {
4360 goto tr_handle_clear_halt;
4362 goto tr_handle_clear_wakeup;
4370 goto tr_handle_set_halt;
4372 goto tr_handle_set_wakeup;
4385 switch (
req->bRequest) {
4387 goto tr_handle_get_ep_status;
4394 switch (
req->bRequest) {
4396 goto tr_handle_set_interface;
4406 switch (
req->bRequest) {
4408 goto tr_handle_get_interface;
4410 goto tr_handle_get_iface_status;
4427 switch (
req->bRequest) {
4439 switch (
req->bRequest) {
4441 goto tr_handle_clear_port_feature;
4443 goto tr_handle_set_port_feature;
4455 switch (
req->bRequest) {
4457 goto tr_handle_get_tt_state;
4459 goto tr_handle_get_port_status;
4466 switch (
req->bRequest) {
4468 goto tr_handle_get_class_descriptor;
4470 goto tr_handle_get_class_status;
4481tr_handle_get_descriptor:
4482 switch (
value >> 8) {
4498 switch (
value & 0xff) {
4505 len =
sizeof(dwc_otg_vendor);
4506 ptr = (
const void *)&dwc_otg_vendor;
4510 len =
sizeof(dwc_otg_product);
4511 ptr = (
const void *)&dwc_otg_product;
4522tr_handle_get_config:
4527tr_handle_get_status:
4532tr_handle_set_address:
4533 if (
value & 0xFF00) {
4539tr_handle_set_config:
4546tr_handle_get_interface:
4551tr_handle_get_tt_state:
4552tr_handle_get_class_status:
4553tr_handle_get_iface_status:
4554tr_handle_get_ep_status:
4560tr_handle_set_interface:
4561tr_handle_set_wakeup:
4562tr_handle_clear_wakeup:
4563tr_handle_clear_halt:
4566tr_handle_clear_port_feature:
4570 DPRINTFN(9,
"UR_CLEAR_PORT_FEATURE on port %d\n",
index);
4627tr_handle_set_port_feature:
4631 DPRINTFN(9,
"UR_SET_PORT_FEATURE\n");
4693tr_handle_get_port_status:
4695 DPRINTFN(9,
"UR_GET_PORT_STATUS\n");
4755tr_handle_get_class_descriptor:
4838 for (
n = 0;
n != ntd;
n++) {
4866 parm->
size[0] +=
sizeof(*td);
4884 DPRINTFN(2,
"endpoint=%p, addr=%d, endpt=%d, mode=%d (%d,%d)\n",
4901 DPRINTFN(-1,
"Non-isochronous high bandwidth "
4902 "endpoint not supported\n");
static void dwc_otg_device_state_change(struct usb_device *udev)
static void dwc_otg_vbus_interrupt(struct dwc_otg_softc *sc, uint8_t is_on)
static uint8_t dwc_otg_update_host_transfer_schedule_locked(struct dwc_otg_softc *sc)
static void dwc_otg_interrupt_poll_locked(struct dwc_otg_softc *)
int dwc_otg_init(struct dwc_otg_softc *sc)
void dwc_otg_interrupt(void *arg)
static void dwc_otg_clocks_on(struct dwc_otg_softc *sc)
static void dwc_otg_setup_standard_chain_sub(struct dwc_otg_std_temp *temp)
static void dwc_otg_start_standard_chain(struct usb_xfer *xfer)
static void dwc_otg_clear_stall_sub_locked(struct dwc_otg_softc *sc, uint32_t mps, uint8_t ep_no, uint8_t ep_type, uint8_t ep_dir)
static uint16_t dwc_otg_compute_isoc_rx_tt_slot(struct dwc_otg_tt_info *pinfo)
static usb_error_t dwc_otg_standard_done_sub(struct usb_xfer *xfer)
static void dwc_otg_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, struct usb_endpoint *ep)
int dwc_otg_filter_interrupt(void *arg)
static int dwc_otg_init_fifo(struct dwc_otg_softc *sc, uint8_t mode)
static void dwc_otg_read_fifo(struct dwc_otg_softc *sc, struct usb_page_cache *pc, uint32_t offset, uint32_t count)
static void dwc_otg_set_hw_power_sleep(struct usb_bus *bus, uint32_t state)
static void dwc_otg_device_non_isoc_open(struct usb_xfer *xfer)
static uint8_t dwc_otg_xfer_do_complete_locked(struct dwc_otg_softc *sc, struct usb_xfer *xfer)
static void dwc_otg_clear_stall(struct usb_device *udev, struct usb_endpoint *ep)
static void dwc_otg_pull_down(struct dwc_otg_softc *sc)
static void dwc_otg_timer_stop(struct dwc_otg_softc *sc)
static void dwc_otg_clocks_off(struct dwc_otg_softc *sc)
static void dwc_otg_device_isoc_enter(struct usb_xfer *xfer)
static const struct usb_pipe_methods dwc_otg_device_isoc_methods
static void dwc_otg_do_poll(struct usb_bus *)
#define DWC_OTG_INTR_ENDPT
static void dwc_otg_set_stall(struct usb_device *udev, struct usb_endpoint *ep, uint8_t *did_stall)
static void dwc_otg_setup_standard_chain(struct usb_xfer *xfer)
#define DWC_OTG_PHY_DEFAULT
static void dwc_otg_wakeup_peer(struct dwc_otg_softc *sc)
static void dwc_otg_common_rx_ack(struct dwc_otg_softc *sc)
static void dwc_otg_set_address(struct dwc_otg_softc *sc, uint8_t addr)
void dwc_otg_uninit(struct dwc_otg_softc *sc)
static dwc_otg_cmd_t dwc_otg_setup_rx
static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "USB DWC OTG")
static void dwc_otg_tx_fifo_reset(struct dwc_otg_softc *sc, uint32_t value)
static void dwc_otg_suspend_irq(struct dwc_otg_softc *sc)
static uint8_t dwc_otg_host_check_tx_fifo_empty(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
static void dwc_otg_resume_irq(struct dwc_otg_softc *sc)
static void dwc_otg_device_isoc_close(struct usb_xfer *xfer)
static void dwc_otg_get_hw_ep_profile(struct usb_device *udev, const struct usb_hw_ep_profile **ppf, uint8_t ep_addr)
static void dwc_otg_xfer_do_fifo(struct dwc_otg_softc *sc, struct usb_xfer *xfer)
static void dwc_otg_get_dma_delay(struct usb_device *udev, uint32_t *pus)
static void dwc_otg_suspend(struct dwc_otg_softc *sc)
static void dwc_otg_device_non_isoc_enter(struct usb_xfer *xfer)
SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, phy_type, CTLFLAG_RDTUN, &dwc_otg_phy_type, 0, "DWC OTG PHY TYPE - 0/1/2/3 - ULPI/HSIC/INTERNAL/UTMI+")
static dwc_otg_cmd_t dwc_otg_host_setup_tx
static void dwc_otg_device_done(struct usb_xfer *, usb_error_t)
static void dwc_otg_resume(struct dwc_otg_softc *sc)
static const struct usb_bus_methods dwc_otg_bus_methods
static const struct dwc_otg_config_desc dwc_otg_confd
static void dwc_otg_device_non_isoc_close(struct usb_xfer *xfer)
#define DWC_OTG_PC2UDEV(pc)
static int dwc_otg_phy_type
static void dwc_otg_update_host_frame_interval(struct dwc_otg_softc *sc)
static void dwc_otg_host_channel_free_sub(struct dwc_otg_softc *sc, struct dwc_otg_td *td, uint8_t index)
static void dwc_otg_root_intr(struct dwc_otg_softc *)
static void dwc_otg_timer_start(struct dwc_otg_softc *sc)
#define DWC_OTG_MSK_GINT_THREAD_IRQ
static uint8_t dwc_otg_host_rate_check_interrupt(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
USB_MAKE_STRING_DESC(STRING_VENDOR, dwc_otg_vendor)
static dwc_otg_cmd_t dwc_otg_host_data_tx
static void dwc_otg_xfer_unsetup(struct usb_xfer *xfer)
static uint8_t dwc_otg_host_data_rx_sub(struct dwc_otg_softc *sc, struct dwc_otg_td *td, uint8_t channel)
static const struct usb_hw_ep_profile dwc_otg_ep_profile[1]
static dwc_otg_cmd_t dwc_otg_data_rx
#define DWC_OTG_BUS2SC(bus)
static void dwc_otg_enable_sof_irq(struct dwc_otg_softc *sc)
static void dwc_otg_timeout(void *arg)
static dwc_otg_cmd_t dwc_otg_data_tx_sync
static usb_error_t dwc_otg_roothub_exec(struct usb_device *udev, struct usb_device_request *req, const void **pptr, uint16_t *plength)
static void dwc_otg_device_isoc_open(struct usb_xfer *xfer)
static void dwc_otg_device_isoc_start(struct usb_xfer *xfer)
static void dwc_otg_host_dump_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
static uint8_t dwc_otg_host_channel_alloc(struct dwc_otg_softc *sc, struct dwc_otg_td *td, uint8_t is_out)
static void dwc_otg_timer(void *_sc)
static void dwc_otg_device_non_isoc_start(struct usb_xfer *xfer)
static void dwc_otg_host_channel_free(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
static void dwc_otg_clear_hcint(struct dwc_otg_softc *sc, uint8_t x)
static const struct usb_hub_descriptor_min dwc_otg_hubd
static uint8_t dwc_otg_uses_split(struct usb_device *udev)
static void dwc_otg_standard_done(struct usb_xfer *)
static void dwc_otg_pull_up(struct dwc_otg_softc *sc)
static void dwc_otg_xfer_stall(struct usb_xfer *xfer)
static uint8_t dwc_otg_host_rate_check(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
static void dwc_otg_interrupt_complete_locked(struct dwc_otg_softc *sc)
static void dwc_otg_xfer_setup(struct usb_setup_params *parm)
static const struct usb_device_descriptor dwc_otg_devd
static dwc_otg_cmd_t dwc_otg_data_tx
static const struct usb_pipe_methods dwc_otg_device_non_isoc_methods
static void dwc_otg_device_resume(struct usb_device *udev)
static dwc_otg_cmd_t dwc_otg_host_data_rx
static void dwc_otg_write_fifo(struct dwc_otg_softc *sc, struct usb_page_cache *pc, uint32_t offset, uint32_t fifo, uint32_t count)
static void dwc_otg_device_suspend(struct usb_device *udev)
#define DWC_OTG_FRAME_MASK
#define DWC_OTG_PHY_INTERNAL
#define DWC_CHAN_ST_WAIT_S_ANE
#define DWC_OTG_WRITE_4(sc, reg, data)
#define DWC_OTG_TX_MAX_FIFO_SIZE
uint8_t() dwc_otg_cmd_t(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
#define DWC_OTG_MAX_CHANNELS
#define DWC_OTG_MAX_ENDPOINTS
#define DWC_CHAN_ST_WAIT_ANE
#define DWC_CHAN_ST_TX_WAIT_ISOC
#define DWC_OTG_READ_4(sc, reg)
#define DWC_OTG_TT_SLOT_MAX
#define DWC_CHAN_ST_WAIT_C_PKT
#define DWC_CHAN_ST_START
#define DWC_OTG_HOST_TIMER_RATE
#define DWC_OTG_MAX_DEVICES
#define DWC_CHAN_ST_WAIT_C_ANE
#define HCSPLT_HUBADDR_SHIFT
#define DSTS_ENUMSPD_GET(x)
#define GRXSTSRD_DPID_MASK
#define GINTMSK_NPTXFEMPMSK
#define GRXSTSRD_CHNUM_GET(x)
#define GHWCFG3_DFIFODEPTH_GET(x)
#define DCFG_DEVADDR_SET(x)
#define DOTG_DOEPTSIZ(ep)
#define DIEPCTL_EPTYPE_MASK
#define DOTG_HCINTMSK(ch)
#define HPRT_PRTSPD_SHIFT
#define GRXSTSRD_BCNT_GET(x)
#define GRSTCTL_TXFIFO(n)
#define DIEPCTL_EPTYPE_BULK
#define HCCHAR_EPTYPE_SHIFT
#define DIEPCTL_MPS_SET(n)
#define DIEPCTL_EPTYPE_SHIFT
#define GINTMSK_RXFLVLMSK
#define DXEPTSIZ_SET_MULTI(n)
#define HCINT_SOFTWARE_ONLY
#define DIEPCTL_EPTYPE_SET(n)
#define HCSPLT_XACTLEN_BURST
#define GHWCFG2_NUMDEVEPS_GET(x)
#define DXEPTSIZ_GET_NPKT(n)
#define DOTG_DOEPEACHINTMSK(ch)
#define HCFG_FSLSPCLKSEL_MASK
#define GINTMSK_HCHINTMSK
#define GHWCFG4_NUM_IN_EP_GET(x)
#define GRXSTSRD_STP_COMPLETE
#define HCINT_DEFAULT_MASK
#define GINTMSK_PTXFEMPMSK
#define GRXSTSRD_STP_DATA
#define DIEPCTL_TXFNUM_SET(n)
#define GAHBCFG_GLBLINTRMSK
#define HCSPLT_XACTPOS_MIDDLE
#define HCINT_HCH_DONE_MASK
#define DOTG_DIEPEACHINTMSK(ch)
#define DOTG_GGPIO_VBUSBSEN
#define HPRT_PRTOVRCURRCHNG
#define DXEPTSIZ_SET_NBYTES(n)
#define GHWCFG2_NUMHSTCHNL_GET(x)
#define DOTG_GGPIO_I2CPADEN
#define HCSPLT_XACTPOS_SHIFT
#define GUSBCFG_ULPI_UTMI_SEL
#define HCSPLT_XACTPOS_ALL
#define GINTMSK_USBSUSPMSK
#define GINTMSK_OTGINTMSK
#define DOTG_DIEPTSIZ(ep)
#define GINTSTS_SESSREQINT
#define DXEPTSIZ_SET_NPKT(n)
#define GINTMSK_WKUPINTMSK
#define DIEPMSK_XFERCOMPLMSK
#define DSTS_SOFFN_GET(x)
#define HCSPLT_PRTADDR_SHIFT
#define HCTSIZ_XFERSIZE_SHIFT
#define DIEPCTL_EPTYPE_ISOC
#define HCCHAR_EPTYPE_MASK
#define DOTG_GGPIO_NOVBUSSENS
#define GLPMCFG_HSIC_CONN
#define GUSBCFG_FORCEHOSTMODE
#define DIEPCTL_EPTYPE_INTERRUPT
#define HCCHAR_EPNUM_SHIFT
#define GUSBCFG_TRD_TIM_SET(x)
#define DOTG_GGPIO_VBUSASEN
#define HCTSIZ_PKTCNT_SHIFT
#define HPRT_PRTOVRCURRACT
#define HCFG_FSLSPCLKSEL_SHIFT
#define DOTG_DIEPTXF(fifo)
#define GRXSTSRD_DPID_DATA0
#define HCCHAR_DEVADDR_SHIFT
#define GRXSTSRD_PKTSTS_MASK
#define HCSPLT_XACTPOS_BEGIN
#define GRXSTSRD_OUT_DATA
#define GUSBCFG_FORCEDEVMODE
#define DOTG_GGPIO_PWRDWN
#define GINTMSK_IEPINTMSK
struct ehci_hw_softc __aligned
struct usb_config_descriptor confd
uint8_t change_over_current
uint8_t status_device_mode
uint8_t port_over_current
uint8_t status_high_speed
struct usb_hw_ep_profile usb
uint32_t sc_out_ctl[DWC_OTG_MAX_ENDPOINTS]
uint32_t sc_last_rx_status
struct dwc_otg_tt_info sc_tt_info[DWC_OTG_MAX_DEVICES]
struct dwc_otg_profile sc_hw_ep_profile[DWC_OTG_MAX_ENDPOINTS]
struct resource * sc_irq_res
uint16_t sc_current_rx_fifo
uint16_t sc_last_frame_num
uint16_t sc_current_rx_bytes
union dwc_otg_hub_temp sc_hub_temp
struct resource * sc_io_res
uint32_t sc_xfer_complete
struct usb_device * sc_devices[DWC_OTG_MAX_DEVICES]
struct dwc_otg_flags sc_flags
struct usb_callout sc_timer
struct dwc_otg_chan_state sc_chan_state[DWC_OTG_MAX_CHANNELS]
bus_space_tag_t sc_io_tag
uint32_t sc_in_ctl[DWC_OTG_MAX_ENDPOINTS]
uint32_t sc_bounce_buffer[MAX(512 *DWC_OTG_MAX_TXP, 1024)/4]
bus_space_handle_t sc_io_hdl
struct usb_page_cache * pc
struct dwc_otg_td * td_next
struct usb_page_cache * pc
struct dwc_otg_td * obj_next
void(* endpoint_init)(struct usb_device *, struct usb_endpoint_descriptor *, struct usb_endpoint *)
const struct usb_bus_methods * methods
struct usb_device ** devices
struct usb_xfer_queue intr_q
uByte bConfigurationValue
enum usb_hc_mode usb_mode
struct usb_device * parent_hs_hub
struct usb_device_descriptor ddesc
struct usb_device * parent_hub
struct usb_device_flags flags
const struct usb_pipe_methods * methods
struct usb_endpoint_descriptor * edesc
uWord wHubCharacteristics
uint16_t max_in_frame_size
void(* open)(struct usb_xfer *)
uint32_t hc_max_frame_size
uint8_t hc_max_packet_count
struct usb_xfer * curr_xfer
uint16_t hc_max_packet_size
enum usb_hc_mode usb_mode
usb_frlength_t * frlengths
struct usb_page_cache * frbuffers
struct usb_endpoint * endpoint
struct usb_xfer_flags_int flags_int
struct usb_xfer_flags flags
struct usb_xfer_root * xroot
struct usb_port_status ps
#define UT_WRITE_INTERFACE
#define UR_SET_DESCRIPTOR
#define UT_WRITE_CLASS_OTHER
#define UT_WRITE_CLASS_DEVICE
#define UPS_C_PORT_ENABLED
#define UPS_C_OVERCURRENT_INDICATOR
#define UR_CLEAR_TT_BUFFER
#define UHF_C_PORT_SUSPEND
#define UT_READ_CLASS_INTERFACE
#define UF_DEVICE_REMOTE_WAKEUP
#define UT_READ_VENDOR_INTERFACE
#define UHF_C_PORT_OVER_CURRENT
#define UPS_PORT_MODE_DEVICE
#define UHD_OC_INDIVIDUAL
#define UT_WRITE_ENDPOINT
#define UT_READ_CLASS_DEVICE
#define UT_WRITE_CLASS_INTERFACE
#define UT_READ_CLASS_OTHER
#define UHF_PORT_INDICATOR
#define UHD_PWR_NO_SWITCH
#define UPS_C_CONNECT_STATUS
#define UPS_CURRENT_CONNECT_STATUS
#define UHF_C_PORT_ENABLE
#define UT_WRITE_VENDOR_INTERFACE
#define UPS_OVERCURRENT_INDICATOR
#define UT_READ_INTERFACE
#define UR_GET_DESCRIPTOR
#define UHF_C_PORT_CONNECTION
void usbd_get_page(struct usb_page_cache *pc, usb_frlength_t offset, struct usb_page_search *res)
void usbd_copy_in(struct usb_page_cache *cache, usb_frlength_t offset, const void *ptr, usb_frlength_t len)
uint8_t usb_pc_buffer_is_aligned(struct usb_page_cache *pc, usb_frlength_t offset, usb_frlength_t len, usb_frlength_t mask)
void usbd_copy_out(struct usb_page_cache *cache, usb_frlength_t offset, void *ptr, usb_frlength_t len)
#define USB_GET_DMA_TAG(dev)
uint8_t usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, usb_bus_mem_cb_t *cb)
#define USB_HW_POWER_RESUME
#define USB_HW_POWER_SUSPEND
#define USB_HW_POWER_SHUTDOWN
const struct usb_string_lang usb_string_lang_en
#define USB_ADD_BYTES(ptr, size)
#define USB_BUS_SPIN_UNLOCK(_b)
#define USB_BUS_UNLOCK(_b)
#define USB_BUS_SPIN_LOCK(_b)
#define USB_BUS_LOCK_ASSERT(_b, _t)
enum usb_dev_speed usbd_get_speed(struct usb_device *udev)
TAILQ_HEAD(, urb) bsd_urb_list
void uhub_root_intr(struct usb_bus *bus, const uint8_t *ptr, uint8_t len)
void usbd_transfer_setup_sub(struct usb_setup_params *parm)
void usbd_transfer_done(struct usb_xfer *xfer, usb_error_t error)
uint8_t usbd_xfer_get_fps_shift(struct usb_xfer *xfer)
void usbd_transfer_enqueue(struct usb_xfer_queue *pq, struct usb_xfer *xfer)
uint8_t usbd_xfer_get_isochronous_start_frame(struct usb_xfer *xfer, uint32_t frame_curr, uint32_t frame_min, uint32_t frame_ms, uint32_t frame_mask, uint32_t *p_frame_start)
void usbd_transfer_timeout_ms(struct usb_xfer *xfer, void(*cb)(void *arg), usb_timeout_t ms)
void usb_pause_mtx(struct mtx *mtx, int timo)
#define usb_callout_init_mtx(c, m, f)
#define usb_callout_reset(c,...)
#define usb_callout_drain(c)
#define usb_callout_stop(c)