FreeBSD kernel usb device Code
dwc_otg.c File Reference
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/unistd.h>
#include <sys/callout.h>
#include <sys/malloc.h>
#include <sys/priv.h>
#include <sys/rman.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usb_core.h>
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_busdma.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_transfer.h>
#include <dev/usb/usb_device.h>
#include <dev/usb/usb_hub.h>
#include <dev/usb/usb_util.h>
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
#include <dev/usb/controller/dwc_otg.h>
#include <dev/usb/controller/dwc_otgreg.h>
Include dependency graph for dwc_otg.c:

Go to the source code of this file.

Macros

#define USB_DEBUG_VAR   dwc_otg_debug
 
#define DWC_OTG_BUS2SC(bus)    __containerof(bus, struct dwc_otg_softc, sc_bus)
 
#define DWC_OTG_PC2UDEV(pc)    (USB_DMATAG_TO_XROOT((pc)->tag_parent)->udev)
 
#define DWC_OTG_MSK_GINT_THREAD_IRQ
 
#define DWC_OTG_PHY_DEFAULT   DWC_OTG_PHY_ULPI
 
#define DWC_OTG_INTR_ENDPT   1
 
#define HSETW(ptr, val)   ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }
 
#define STRING_VENDOR    "D\0W\0C\0O\0T\0G"
 
#define STRING_PRODUCT    "O\0T\0G\0 \0R\0o\0o\0t\0 \0H\0U\0B"
 

Functions

static SYSCTL_NODE (_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "USB DWC OTG")
 
 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 void dwc_otg_device_done (struct usb_xfer *, usb_error_t)
 
static void dwc_otg_do_poll (struct usb_bus *)
 
static void dwc_otg_standard_done (struct usb_xfer *)
 
static void dwc_otg_root_intr (struct dwc_otg_softc *)
 
static void dwc_otg_interrupt_poll_locked (struct dwc_otg_softc *)
 
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_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_read_fifo (struct dwc_otg_softc *sc, struct usb_page_cache *pc, uint32_t offset, uint32_t count)
 
static void dwc_otg_tx_fifo_reset (struct dwc_otg_softc *sc, uint32_t value)
 
static int dwc_otg_init_fifo (struct dwc_otg_softc *sc, uint8_t mode)
 
static uint8_t dwc_otg_uses_split (struct usb_device *udev)
 
static void dwc_otg_update_host_frame_interval (struct dwc_otg_softc *sc)
 
static void dwc_otg_clocks_on (struct dwc_otg_softc *sc)
 
static void dwc_otg_clocks_off (struct dwc_otg_softc *sc)
 
static void dwc_otg_pull_up (struct dwc_otg_softc *sc)
 
static void dwc_otg_pull_down (struct dwc_otg_softc *sc)
 
static void dwc_otg_enable_sof_irq (struct dwc_otg_softc *sc)
 
static void dwc_otg_resume_irq (struct dwc_otg_softc *sc)
 
static void dwc_otg_suspend_irq (struct dwc_otg_softc *sc)
 
static void dwc_otg_wakeup_peer (struct dwc_otg_softc *sc)
 
static void dwc_otg_set_address (struct dwc_otg_softc *sc, uint8_t addr)
 
static void dwc_otg_common_rx_ack (struct dwc_otg_softc *sc)
 
static void dwc_otg_clear_hcint (struct dwc_otg_softc *sc, uint8_t x)
 
static uint8_t dwc_otg_host_check_tx_fifo_empty (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_host_channel_free_sub (struct dwc_otg_softc *sc, struct dwc_otg_td *td, uint8_t index)
 
static void dwc_otg_host_channel_free (struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 
static void dwc_otg_host_dump_rx (struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 
static uint8_t dwc_otg_host_setup_tx (struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 
static uint8_t dwc_otg_setup_rx (struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 
static uint8_t dwc_otg_host_rate_check_interrupt (struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 
static uint8_t dwc_otg_host_rate_check (struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 
static uint8_t dwc_otg_host_data_rx_sub (struct dwc_otg_softc *sc, struct dwc_otg_td *td, uint8_t channel)
 
static uint8_t dwc_otg_host_data_rx (struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 
static uint8_t dwc_otg_data_rx (struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 
static uint8_t dwc_otg_host_data_tx (struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 
static uint8_t dwc_otg_data_tx (struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 
static uint8_t dwc_otg_data_tx_sync (struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 
static void dwc_otg_xfer_do_fifo (struct dwc_otg_softc *sc, 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_timer (void *_sc)
 
static void dwc_otg_timer_start (struct dwc_otg_softc *sc)
 
static void dwc_otg_timer_stop (struct dwc_otg_softc *sc)
 
static uint16_t dwc_otg_compute_isoc_rx_tt_slot (struct dwc_otg_tt_info *pinfo)
 
static uint8_t dwc_otg_update_host_transfer_schedule_locked (struct dwc_otg_softc *sc)
 
static void dwc_otg_interrupt_complete_locked (struct dwc_otg_softc *sc)
 
static void dwc_otg_vbus_interrupt (struct dwc_otg_softc *sc, uint8_t is_on)
 
int dwc_otg_filter_interrupt (void *arg)
 
void dwc_otg_interrupt (void *arg)
 
static void dwc_otg_setup_standard_chain_sub (struct dwc_otg_std_temp *temp)
 
static void dwc_otg_setup_standard_chain (struct usb_xfer *xfer)
 
static void dwc_otg_timeout (void *arg)
 
static void dwc_otg_start_standard_chain (struct usb_xfer *xfer)
 
static usb_error_t dwc_otg_standard_done_sub (struct usb_xfer *xfer)
 
static void dwc_otg_xfer_stall (struct usb_xfer *xfer)
 
static void dwc_otg_set_stall (struct usb_device *udev, struct usb_endpoint *ep, uint8_t *did_stall)
 
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 void dwc_otg_clear_stall (struct usb_device *udev, struct usb_endpoint *ep)
 
static void dwc_otg_device_state_change (struct usb_device *udev)
 
int dwc_otg_init (struct dwc_otg_softc *sc)
 
void dwc_otg_uninit (struct dwc_otg_softc *sc)
 
static void dwc_otg_suspend (struct dwc_otg_softc *sc)
 
static void dwc_otg_resume (struct dwc_otg_softc *sc)
 
static void dwc_otg_device_non_isoc_open (struct usb_xfer *xfer)
 
static void dwc_otg_device_non_isoc_close (struct usb_xfer *xfer)
 
static void dwc_otg_device_non_isoc_enter (struct usb_xfer *xfer)
 
static void dwc_otg_device_non_isoc_start (struct usb_xfer *xfer)
 
static void dwc_otg_device_isoc_open (struct usb_xfer *xfer)
 
static void dwc_otg_device_isoc_close (struct usb_xfer *xfer)
 
static void dwc_otg_device_isoc_enter (struct usb_xfer *xfer)
 
static void dwc_otg_device_isoc_start (struct usb_xfer *xfer)
 
 USB_MAKE_STRING_DESC (STRING_VENDOR, dwc_otg_vendor)
 
 USB_MAKE_STRING_DESC (STRING_PRODUCT, dwc_otg_product)
 
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_xfer_setup (struct usb_setup_params *parm)
 
static void dwc_otg_xfer_unsetup (struct usb_xfer *xfer)
 
static void dwc_otg_ep_init (struct usb_device *udev, struct usb_endpoint_descriptor *edesc, struct usb_endpoint *ep)
 
static void dwc_otg_set_hw_power_sleep (struct usb_bus *bus, uint32_t state)
 
static void dwc_otg_get_dma_delay (struct usb_device *udev, uint32_t *pus)
 
static void dwc_otg_device_resume (struct usb_device *udev)
 
static void dwc_otg_device_suspend (struct usb_device *udev)
 

Variables

static int dwc_otg_phy_type = DWC_OTG_PHY_DEFAULT
 
static const struct usb_bus_methods dwc_otg_bus_methods
 
static const struct usb_pipe_methods dwc_otg_device_non_isoc_methods
 
static const struct usb_pipe_methods dwc_otg_device_isoc_methods
 
static dwc_otg_cmd_t dwc_otg_setup_rx
 
static dwc_otg_cmd_t dwc_otg_data_rx
 
static dwc_otg_cmd_t dwc_otg_data_tx
 
static dwc_otg_cmd_t dwc_otg_data_tx_sync
 
static dwc_otg_cmd_t dwc_otg_host_setup_tx
 
static dwc_otg_cmd_t dwc_otg_host_data_tx
 
static dwc_otg_cmd_t dwc_otg_host_data_rx
 
static const struct usb_hw_ep_profile dwc_otg_ep_profile [1]
 
static const struct usb_device_descriptor dwc_otg_devd
 
static const struct dwc_otg_config_desc dwc_otg_confd
 
static const struct usb_hub_descriptor_min dwc_otg_hubd
 

Macro Definition Documentation

◆ DWC_OTG_BUS2SC

#define DWC_OTG_BUS2SC (   bus)     __containerof(bus, struct dwc_otg_softc, sc_bus)

Definition at line 92 of file dwc_otg.c.

◆ DWC_OTG_INTR_ENDPT

#define DWC_OTG_INTR_ENDPT   1

Definition at line 121 of file dwc_otg.c.

◆ DWC_OTG_MSK_GINT_THREAD_IRQ

#define DWC_OTG_MSK_GINT_THREAD_IRQ
Value:
GINTSTS_WKUPINT | GINTSTS_USBSUSP | GINTMSK_OTGINTMSK | \
GINTSTS_SESSREQINT)
#define GINTSTS_ENUMDONE
Definition: dwc_otgreg.h:241
#define GINTSTS_USBSUSP
Definition: dwc_otgreg.h:243
#define GINTSTS_USBRST
Definition: dwc_otgreg.h:242
#define GINTMSK_OTGINTMSK
Definition: dwc_otgreg.h:282
#define GINTSTS_PRTINT
Definition: dwc_otgreg.h:230

Definition at line 98 of file dwc_otg.c.

◆ DWC_OTG_PC2UDEV

#define DWC_OTG_PC2UDEV (   pc)     (USB_DMATAG_TO_XROOT((pc)->tag_parent)->udev)

Definition at line 95 of file dwc_otg.c.

◆ DWC_OTG_PHY_DEFAULT

#define DWC_OTG_PHY_DEFAULT   DWC_OTG_PHY_ULPI

Definition at line 104 of file dwc_otg.c.

◆ HSETW

#define HSETW (   ptr,
  val 
)    ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }

Definition at line 4281 of file dwc_otg.c.

◆ STRING_PRODUCT

#define STRING_PRODUCT    "O\0T\0G\0 \0R\0o\0o\0t\0 \0H\0U\0B"

Definition at line 4296 of file dwc_otg.c.

◆ STRING_VENDOR

#define STRING_VENDOR    "D\0W\0C\0O\0T\0G"

Definition at line 4293 of file dwc_otg.c.

◆ USB_DEBUG_VAR

#define USB_DEBUG_VAR   dwc_otg_debug

Definition at line 74 of file dwc_otg.c.

Function Documentation

◆ dwc_otg_clear_hcint()

static void dwc_otg_clear_hcint ( struct dwc_otg_softc sc,
uint8_t  x 
)
static

Definition at line 703 of file dwc_otg.c.

References DOTG_HCINT, DWC_OTG_READ_4, DWC_OTG_WRITE_4, dwc_otg_chan_state::hcint, and dwc_otg_softc::sc_chan_state.

Referenced by dwc_otg_host_channel_alloc().

Here is the caller graph for this function:

◆ dwc_otg_clear_stall()

◆ dwc_otg_clear_stall_sub_locked()

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

◆ dwc_otg_clocks_off()

static void dwc_otg_clocks_off ( struct dwc_otg_softc sc)
static

Definition at line 516 of file dwc_otg.c.

References dwc_otg_flags::clocks_off, and dwc_otg_softc::sc_flags.

Referenced by dwc_otg_init(), dwc_otg_roothub_exec(), and dwc_otg_uninit().

Here is the caller graph for this function:

◆ dwc_otg_clocks_on()

static void dwc_otg_clocks_on ( struct dwc_otg_softc sc)
static

Definition at line 503 of file dwc_otg.c.

References dwc_otg_flags::clocks_off, dwc_otg_flags::port_powered, and dwc_otg_softc::sc_flags.

Referenced by dwc_otg_init(), and dwc_otg_roothub_exec().

Here is the caller graph for this function:

◆ dwc_otg_common_rx_ack()

◆ dwc_otg_compute_isoc_rx_tt_slot()

static uint16_t dwc_otg_compute_isoc_rx_tt_slot ( struct dwc_otg_tt_info pinfo)
static

Definition at line 2481 of file dwc_otg.c.

References DWC_OTG_TT_SLOT_MAX, and dwc_otg_tt_info::slot_index.

Referenced by dwc_otg_update_host_transfer_schedule_locked().

Here is the caller graph for this function:

◆ dwc_otg_data_rx()

◆ dwc_otg_data_tx()

◆ dwc_otg_data_tx_sync()

static uint8_t dwc_otg_data_tx_sync ( struct dwc_otg_softc sc,
struct dwc_otg_td td 
)
static

◆ dwc_otg_device_done()

◆ dwc_otg_device_isoc_close()

static void dwc_otg_device_isoc_close ( struct usb_xfer xfer)
static

Definition at line 4176 of file dwc_otg.c.

References dwc_otg_device_done(), and USB_ERR_CANCELLED.

Here is the call graph for this function:

◆ dwc_otg_device_isoc_enter()

static void dwc_otg_device_isoc_enter ( struct usb_xfer xfer)
static

Definition at line 4182 of file dwc_otg.c.

◆ dwc_otg_device_isoc_open()

static void dwc_otg_device_isoc_open ( struct usb_xfer xfer)
static

Definition at line 4171 of file dwc_otg.c.

◆ dwc_otg_device_isoc_start()

◆ dwc_otg_device_non_isoc_close()

static void dwc_otg_device_non_isoc_close ( struct usb_xfer xfer)
static

Definition at line 4141 of file dwc_otg.c.

References dwc_otg_device_done(), and USB_ERR_CANCELLED.

Here is the call graph for this function:

◆ dwc_otg_device_non_isoc_enter()

static void dwc_otg_device_non_isoc_enter ( struct usb_xfer xfer)
static

Definition at line 4147 of file dwc_otg.c.

◆ dwc_otg_device_non_isoc_open()

static void dwc_otg_device_non_isoc_open ( struct usb_xfer xfer)
static

Definition at line 4136 of file dwc_otg.c.

◆ dwc_otg_device_non_isoc_start()

static void dwc_otg_device_non_isoc_start ( struct usb_xfer xfer)
static

Definition at line 4152 of file dwc_otg.c.

References dwc_otg_setup_standard_chain(), and dwc_otg_start_standard_chain().

Here is the call graph for this function:

◆ dwc_otg_device_resume()

static void dwc_otg_device_resume ( struct usb_device udev)
static

Definition at line 4941 of file dwc_otg.c.

References usb_device::bus, DPRINTF, and dwc_otg_do_poll().

Here is the call graph for this function:

◆ dwc_otg_device_state_change()

◆ dwc_otg_device_suspend()

static void dwc_otg_device_suspend ( struct usb_device udev)
static

Definition at line 4950 of file dwc_otg.c.

References DPRINTF.

◆ dwc_otg_do_poll()

static void dwc_otg_do_poll ( struct usb_bus bus)
static

Definition at line 4118 of file dwc_otg.c.

References bus, DWC_OTG_BUS2SC, dwc_otg_interrupt_complete_locked(), dwc_otg_interrupt_poll_locked(), dwc_otg_softc::sc_bus, USB_BUS_LOCK, USB_BUS_SPIN_LOCK, USB_BUS_SPIN_UNLOCK, and USB_BUS_UNLOCK.

Referenced by dwc_otg_device_resume(), and dwc_otg_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_enable_sof_irq()

static void dwc_otg_enable_sof_irq ( struct dwc_otg_softc sc)
static

◆ dwc_otg_ep_init()

◆ dwc_otg_filter_interrupt()

◆ dwc_otg_get_dma_delay()

static void dwc_otg_get_dma_delay ( struct usb_device udev,
uint32_t *  pus 
)
static

Definition at line 4934 of file dwc_otg.c.

◆ dwc_otg_get_hw_ep_profile()

static void dwc_otg_get_hw_ep_profile ( struct usb_device udev,
const struct usb_hw_ep_profile **  ppf,
uint8_t  ep_addr 
)
static

Definition at line 157 of file dwc_otg.c.

References usb_device::bus, DWC_OTG_BUS2SC, dwc_otg_softc::sc_dev_ep_max, dwc_otg_softc::sc_hw_ep_profile, and dwc_otg_profile::usb.

Referenced by dwc_otg_xfer_setup().

Here is the caller graph for this function:

◆ dwc_otg_host_channel_alloc()

◆ dwc_otg_host_channel_free()

static void dwc_otg_host_channel_free ( struct dwc_otg_softc sc,
struct dwc_otg_td td 
)
static

Definition at line 861 of file dwc_otg.c.

References dwc_otg_host_channel_free_sub(), and dwc_otg_td::max_packet_count.

Referenced by dwc_otg_device_done(), dwc_otg_host_data_rx(), dwc_otg_host_data_tx(), and dwc_otg_host_setup_tx().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_host_channel_free_sub()

static void dwc_otg_host_channel_free_sub ( struct dwc_otg_softc sc,
struct dwc_otg_td td,
uint8_t  index 
)
static

◆ dwc_otg_host_check_tx_fifo_empty()

static uint8_t dwc_otg_host_check_tx_fifo_empty ( struct dwc_otg_softc sc,
struct dwc_otg_td td 
)
static

◆ dwc_otg_host_data_rx()

◆ dwc_otg_host_data_rx_sub()

◆ dwc_otg_host_data_tx()

static uint8_t dwc_otg_host_data_tx ( struct dwc_otg_softc sc,
struct dwc_otg_td td 
)
static

◆ dwc_otg_host_dump_rx()

static void dwc_otg_host_dump_rx ( struct dwc_otg_softc sc,
struct dwc_otg_td td 
)
static

Definition at line 869 of file dwc_otg.c.

References dwc_otg_td::channel, dwc_otg_common_rx_ack(), DWC_OTG_MAX_CHANNELS, GRXSTSRD_CHNUM_GET, dwc_otg_td::max_packet_count, and dwc_otg_softc::sc_last_rx_status.

Referenced by dwc_otg_host_data_tx(), and dwc_otg_host_setup_tx().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_host_rate_check()

static uint8_t dwc_otg_host_rate_check ( struct dwc_otg_softc sc,
struct dwc_otg_td td 
)
static

◆ dwc_otg_host_rate_check_interrupt()

static uint8_t dwc_otg_host_rate_check_interrupt ( struct dwc_otg_softc sc,
struct dwc_otg_td td 
)
static

Definition at line 1197 of file dwc_otg.c.

References dwc_otg_softc::sc_tmr_val, dwc_otg_td::set_toggle, dwc_otg_td::tmr_res, dwc_otg_td::tmr_val, and dwc_otg_td::toggle.

Referenced by dwc_otg_update_host_transfer_schedule_locked().

Here is the caller graph for this function:

◆ dwc_otg_host_setup_tx()

◆ dwc_otg_init()

int dwc_otg_init ( struct dwc_otg_softc sc)

Definition at line 3836 of file dwc_otg.c.

References usb_bus::bdev, usb_bus::bus_mtx, DCTL_CGNPINNAK, DCTL_CGOUTNAK, DCTL_SFTDISCON, usb_bus::devices, usb_bus::devices_max, DIEPMSK_XFERCOMPLMSK, usb_bus::dma_bits, DOTG_DAINTMSK, DOTG_DCTL, DOTG_DEACHINTMSK, DOTG_DIEPEACHINTMSK, DOTG_DIEPMSK, DOTG_DOEPEACHINTMSK, DOTG_DOEPMSK, DOTG_GAHBCFG, DOTG_GGPIO, DOTG_GGPIO_I2CPADEN, DOTG_GGPIO_NOVBUSSENS, DOTG_GGPIO_PWRDWN, DOTG_GGPIO_VBUSASEN, DOTG_GGPIO_VBUSBSEN, DOTG_GHWCFG2, DOTG_GHWCFG3, DOTG_GHWCFG4, DOTG_GINTMSK, DOTG_GLPMCFG, DOTG_GOTGCTL, DOTG_GRSTCTL, DOTG_GSNPSID, DOTG_GUSBCFG, DOTG_HCFG, DOTG_PCGCCTL, DPRINTF, DWC_MODE_DEVICE, DWC_MODE_HOST, DWC_MODE_OTG, dwc_otg_bus_methods, dwc_otg_clocks_off(), dwc_otg_clocks_on(), dwc_otg_do_poll(), dwc_otg_filter_interrupt(), dwc_otg_init_fifo(), dwc_otg_interrupt(), DWC_OTG_MAX_CHANNELS, DWC_OTG_MAX_DEVICES, DWC_OTG_MAX_ENDPOINTS, DWC_OTG_MSK_GINT_THREAD_IRQ, DWC_OTG_PHY_HSIC, DWC_OTG_PHY_INTERNAL, dwc_otg_phy_type, DWC_OTG_PHY_ULPI, DWC_OTG_PHY_UTMI, DWC_OTG_READ_4, dwc_otg_vbus_interrupt(), DWC_OTG_WRITE_4, GAHBCFG_GLBLINTRMSK, GHWCFG2_MPI, GHWCFG2_NUMDEVEPS_GET, GHWCFG2_NUMHSTCHNL_GET, GHWCFG3_DFIFODEPTH_GET, GHWCFG4_NUM_IN_EP_GET, GLPMCFG_HSIC_CONN, GOTGCTL_ASESVLD, GOTGCTL_BSESVLD, GRSTCTL_CSFTRST, GUSBCFG_FORCEDEVMODE, GUSBCFG_FORCEHOSTMODE, GUSBCFG_PHYIF, GUSBCFG_PHYSEL, GUSBCFG_TRD_TIM_SET, GUSBCFG_ULPI_UTMI_SEL, HCFG_FSLSPCLKSEL_MASK, HCFG_FSLSPCLKSEL_SHIFT, HCFG_FSLSSUPP, usb_bus::methods, usb_bus::parent, dwc_otg_softc::sc_bus, dwc_otg_softc::sc_dev_ep_max, dwc_otg_softc::sc_dev_in_ep_max, dwc_otg_softc::sc_devices, dwc_otg_softc::sc_fifo_size, dwc_otg_softc::sc_host_ch_max, dwc_otg_softc::sc_intr_hdl, dwc_otg_softc::sc_io_hdl, dwc_otg_softc::sc_io_res, dwc_otg_softc::sc_io_size, dwc_otg_softc::sc_io_tag, dwc_otg_softc::sc_irq_mask, dwc_otg_softc::sc_irq_res, dwc_otg_softc::sc_mode, dwc_otg_softc::sc_phy_bits, dwc_otg_softc::sc_phy_type, dwc_otg_softc::sc_timer, USB_BUS_LOCK, usb_bus_mem_alloc_all(), USB_BUS_UNLOCK, usb_callout_init_mtx, USB_GET_DMA_TAG, usb_pause_mtx(), USB_REV_2_0, and usb_bus::usbrev.

Referenced by dwc_otg_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_init_fifo()

◆ dwc_otg_interrupt()

void dwc_otg_interrupt ( void *  arg)

Definition at line 2903 of file dwc_otg.c.

References dwc_otg_flags::change_connect, dwc_otg_flags::change_enabled, dwc_otg_flags::change_over_current, dwc_otg_flags::change_suspend, DOTG_DSTS, DOTG_GINTMSK, DOTG_GINTSTS, DOTG_GOTGCTL, DOTG_HAINT, DOTG_HFNUM, DOTG_HPRT, DSTS_ENUMSPD_GET, DSTS_ENUMSPD_HI, DWC_MODE_DEVICE, dwc_otg_init_fifo(), dwc_otg_interrupt_complete_locked(), DWC_OTG_MSK_GINT_THREAD_IRQ, DWC_OTG_READ_4, dwc_otg_resume_irq(), dwc_otg_root_intr(), dwc_otg_set_address(), dwc_otg_suspend_irq(), dwc_otg_update_host_frame_interval(), dwc_otg_vbus_interrupt(), DWC_OTG_WRITE_4, GINTMSK_OTGINTMSK, GINTMSK_SOFMSK, GINTMSK_USBSUSPMSK, GINTMSK_WKUPINTMSK, GINTSTS_ENUMDONE, GINTSTS_PRTINT, GINTSTS_SESSREQINT, GINTSTS_USBRST, GINTSTS_USBSUSP, GINTSTS_WKUPINT, GOTGCTL_ASESVLD, GOTGCTL_BSESVLD, HPRT_PRTCONNDET, HPRT_PRTCONNSTS, HPRT_PRTENA, HPRT_PRTENCHNG, HPRT_PRTOVRCURRACT, HPRT_PRTOVRCURRCHNG, HPRT_PRTPWR, HPRT_PRTSPD_HIGH, HPRT_PRTSPD_LOW, HPRT_PRTSPD_MASK, HPRT_PRTSPD_SHIFT, HPRT_PRTSUSP, dwc_otg_flags::port_enabled, dwc_otg_flags::port_over_current, dwc_otg_flags::port_powered, dwc_otg_softc::sc_bus, dwc_otg_softc::sc_flags, dwc_otg_softc::sc_hprt_val, dwc_otg_softc::sc_irq_mask, dwc_otg_softc::sc_xfer_complete, status, dwc_otg_flags::status_bus_reset, dwc_otg_flags::status_device_mode, dwc_otg_flags::status_high_speed, dwc_otg_flags::status_low_speed, dwc_otg_flags::status_suspend, USB_BUS_LOCK, USB_BUS_SPIN_LOCK, USB_BUS_SPIN_UNLOCK, and USB_BUS_UNLOCK.

Referenced by dwc_otg_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_interrupt_complete_locked()

static void dwc_otg_interrupt_complete_locked ( struct dwc_otg_softc sc)
static

Definition at line 2806 of file dwc_otg.c.

References dwc_otg_xfer_do_complete_locked(), usb_bus::intr_q, and dwc_otg_softc::sc_bus.

Referenced by dwc_otg_clear_stall_sub_locked(), dwc_otg_do_poll(), dwc_otg_interrupt(), and dwc_otg_set_stall().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_interrupt_poll_locked()

◆ dwc_otg_pull_down()

static void dwc_otg_pull_down ( struct dwc_otg_softc sc)
static

Definition at line 545 of file dwc_otg.c.

References dwc_otg_flags::d_pulled_up, DCTL_SFTDISCON, DOTG_DCTL, DWC_OTG_READ_4, DWC_OTG_WRITE_4, and dwc_otg_softc::sc_flags.

Referenced by dwc_otg_roothub_exec(), and dwc_otg_uninit().

Here is the caller graph for this function:

◆ dwc_otg_pull_up()

static void dwc_otg_pull_up ( struct dwc_otg_softc sc)
static

Definition at line 528 of file dwc_otg.c.

References dwc_otg_flags::d_pulled_up, DOTG_DCTL, DWC_OTG_READ_4, DWC_OTG_WRITE_4, dwc_otg_flags::port_powered, and dwc_otg_softc::sc_flags.

Referenced by dwc_otg_roothub_exec().

Here is the caller graph for this function:

◆ dwc_otg_read_fifo()

static void dwc_otg_read_fifo ( struct dwc_otg_softc sc,
struct usb_page_cache pc,
uint32_t  offset,
uint32_t  count 
)
static

◆ dwc_otg_resume()

static void dwc_otg_resume ( struct dwc_otg_softc sc)
static

Definition at line 4112 of file dwc_otg.c.

Referenced by dwc_otg_set_hw_power_sleep().

Here is the caller graph for this function:

◆ dwc_otg_resume_irq()

static void dwc_otg_resume_irq ( struct dwc_otg_softc sc)
static

Definition at line 576 of file dwc_otg.c.

References dwc_otg_flags::change_suspend, DOTG_GINTMSK, dwc_otg_root_intr(), DWC_OTG_WRITE_4, GINTMSK_USBSUSPMSK, dwc_otg_softc::sc_flags, dwc_otg_softc::sc_irq_mask, dwc_otg_flags::status_device_mode, and dwc_otg_flags::status_suspend.

Referenced by dwc_otg_interrupt(), and dwc_otg_wakeup_peer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_root_intr()

static void dwc_otg_root_intr ( struct dwc_otg_softc sc)
static

Definition at line 3492 of file dwc_otg.c.

References dwc_otg_softc::sc_bus, dwc_otg_softc::sc_hub_idata, uhub_root_intr(), and USB_BUS_LOCK_ASSERT.

Referenced by dwc_otg_interrupt(), dwc_otg_resume_irq(), dwc_otg_suspend_irq(), and dwc_otg_vbus_interrupt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_roothub_exec()

static usb_error_t dwc_otg_roothub_exec ( struct usb_device udev,
struct usb_device_request req,
const void **  pptr,
uint16_t *  plength 
)
static

Definition at line 4303 of file dwc_otg.c.

References usb_device::bus, usb_bus::bus_mtx, dwc_otg_flags::change_connect, dwc_otg_flags::change_enabled, dwc_otg_flags::change_over_current, dwc_otg_flags::change_reset, dwc_otg_flags::change_suspend, DOTG_HPRT, DPRINTF, DWC_MODE_DEVICE, DWC_MODE_HOST, DWC_MODE_OTG, DWC_OTG_BUS2SC, dwc_otg_clocks_off(), dwc_otg_clocks_on(), dwc_otg_confd, dwc_otg_devd, dwc_otg_hubd, dwc_otg_init_fifo(), dwc_otg_pull_down(), dwc_otg_pull_up(), dwc_otg_suspend_irq(), dwc_otg_timer_start(), dwc_otg_timer_stop(), dwc_otg_wakeup_peer(), DWC_OTG_WRITE_4, HPRT_PRTENA, HPRT_PRTPWR, HPRT_PRTRST, HPRT_PRTSUSP, index, len, dwc_otg_flags::port_enabled, dwc_otg_flags::port_over_current, dwc_otg_flags::port_powered, pptr, dwc_otg_hub_temp::ps, req, dwc_otg_softc::sc_bus, dwc_otg_softc::sc_conf, dwc_otg_softc::sc_flags, dwc_otg_softc::sc_hprt_val, dwc_otg_softc::sc_hub_temp, dwc_otg_softc::sc_mode, dwc_otg_softc::sc_rt_addr, dwc_otg_flags::status_bus_reset, dwc_otg_flags::status_device_mode, dwc_otg_flags::status_high_speed, dwc_otg_flags::status_low_speed, dwc_otg_flags::status_suspend, dwc_otg_flags::status_vbus, UDESC_CONFIG, UDESC_DEVICE, UDESC_STRING, UDS_SELF_POWERED, UF_DEVICE_REMOTE_WAKEUP, UF_ENDPOINT_HALT, UGETW, UHF_C_PORT_CONNECTION, UHF_C_PORT_ENABLE, UHF_C_PORT_OVER_CURRENT, UHF_C_PORT_RESET, UHF_C_PORT_SUSPEND, UHF_PORT_ENABLE, UHF_PORT_INDICATOR, UHF_PORT_POWER, UHF_PORT_RESET, UHF_PORT_SUSPEND, UHF_PORT_TEST, UPS_C_CONNECT_STATUS, UPS_C_OVERCURRENT_INDICATOR, UPS_C_PORT_ENABLED, UPS_C_PORT_RESET, UPS_C_SUSPEND, UPS_CURRENT_CONNECT_STATUS, UPS_HIGH_SPEED, UPS_LOW_SPEED, UPS_OVERCURRENT_INDICATOR, UPS_PORT_ENABLED, UPS_PORT_MODE_DEVICE, UPS_PORT_POWER, UPS_SUSPEND, UR_CLEAR_FEATURE, UR_CLEAR_TT_BUFFER, UR_GET_CONFIG, UR_GET_DESCRIPTOR, UR_GET_INTERFACE, UR_GET_STATUS, UR_GET_TT_STATE, UR_RESET_TT, UR_SET_ADDRESS, UR_SET_CONFIG, UR_SET_DESCRIPTOR, UR_SET_FEATURE, UR_SET_INTERFACE, UR_STOP_TT, UR_SYNCH_FRAME, USB_BUS_LOCK_ASSERT, USB_ERR_IOERROR, USB_ERR_STALLED, usb_pause_mtx(), usb_string_lang_en, USETW, UT_READ_CLASS_DEVICE, UT_READ_CLASS_INTERFACE, UT_READ_CLASS_OTHER, UT_READ_DEVICE, UT_READ_ENDPOINT, UT_READ_INTERFACE, UT_READ_VENDOR_INTERFACE, UT_WRITE_CLASS_DEVICE, UT_WRITE_CLASS_INTERFACE, UT_WRITE_CLASS_OTHER, UT_WRITE_DEVICE, UT_WRITE_ENDPOINT, UT_WRITE_INTERFACE, UT_WRITE_VENDOR_INTERFACE, value, usb_port_status::wPortChange, usb_port_status::wPortStatus, and dwc_otg_hub_temp::wValue.

Here is the call graph for this function:

◆ dwc_otg_set_address()

static void dwc_otg_set_address ( struct dwc_otg_softc sc,
uint8_t  addr 
)
static

Definition at line 669 of file dwc_otg.c.

References addr, DCFG_DEVADDR_SET, DOTG_DCFG, DWC_OTG_READ_4, and DWC_OTG_WRITE_4.

Referenced by dwc_otg_interrupt(), and dwc_otg_setup_rx().

Here is the caller graph for this function:

◆ dwc_otg_set_hw_power_sleep()

static void dwc_otg_set_hw_power_sleep ( struct usb_bus bus,
uint32_t  state 
)
static

Definition at line 4914 of file dwc_otg.c.

References bus, DWC_OTG_BUS2SC, dwc_otg_resume(), dwc_otg_suspend(), dwc_otg_uninit(), state, USB_HW_POWER_RESUME, USB_HW_POWER_SHUTDOWN, and USB_HW_POWER_SUSPEND.

Here is the call graph for this function:

◆ dwc_otg_set_stall()

◆ dwc_otg_setup_rx()

◆ dwc_otg_setup_standard_chain()

static void dwc_otg_setup_standard_chain ( struct usb_xfer xfer)
static

Definition at line 3123 of file dwc_otg.c.

References usb_xfer::address, usb_xfer_root::bus, usb_xfer_flags_int::control_act, usb_xfer_flags_int::control_hdr, usb_xfer_flags_int::control_stall, usb_xfer_flags_int::control_xfr, dwc_otg_std_temp::did_stall, DWC_OTG_BUS2SC, dwc_otg_data_rx, dwc_otg_data_tx, dwc_otg_data_tx_sync, dwc_otg_host_data_rx, dwc_otg_host_data_tx, dwc_otg_host_setup_tx, DWC_OTG_HOST_TIMER_RATE, dwc_otg_setup_rx, dwc_otg_setup_standard_chain_sub(), dwc_otg_uses_split(), usb_xfer::endpoint, usb_xfer::endpointno, dwc_otg_td::ep_type, usb_xfer::flags, usb_device::flags, usb_xfer::flags_int, usb_xfer_flags::force_short_xfer, usb_xfer::frbuffers, usb_xfer::frlengths, dwc_otg_std_temp::func, dwc_otg_td::hcchar, HCCHAR_CHENA, HCCHAR_DEVADDR_SHIFT, HCCHAR_EPDIR_IN, HCCHAR_EPNUM_SHIFT, HCCHAR_EPTYPE_SHIFT, HCCHAR_LSPDDEV, HCCHAR_MC_SHIFT, HCCHAR_MPS_SHIFT, dwc_otg_td::hcsplt, HCSPLT_HUBADDR_SHIFT, HCSPLT_PRTADDR_SHIFT, HCSPLT_SPLTENA, usb_device::hs_hub_addr, usb_device::hs_port_no, usb_xfer::interval, usb_xfer_flags_int::isochronous_xfr, dwc_otg_std_temp::len, dwc_otg_std_temp::max_frame_size, usb_xfer::max_frame_size, usb_xfer::max_packet_count, usb_xfer::max_packet_size, usb_xfer::nframes, dwc_otg_std_temp::offset, dwc_otg_std_temp::pc, dwc_otg_softc::sc_last_frame_num, dwc_otg_softc::sc_tmr_val, dwc_otg_td::set_toggle, dwc_otg_std_temp::setup_alt_next, usb_xfer_flags_int::short_frames_ok, dwc_otg_std_temp::short_pkt, usb_device::speed, usb_xfer::sumlen, dwc_otg_std_temp::td, dwc_otg_std_temp::td_next, usb_xfer::td_start, usb_xfer::td_transfer_cache, usb_xfer::td_transfer_first, usb_xfer::td_transfer_last, dwc_otg_td::tmr_res, dwc_otg_td::tmr_val, dwc_otg_td::toggle, usb_endpoint::toggle_next, usb_xfer_root::udev, UE_ADDR, UE_CONTROL, UE_DIR_IN, UE_GET_ADDR, UE_GET_DIR, UE_INTERRUPT, UE_ISOCHRONOUS, usb_device_flags::usb_mode, USB_MODE_HOST, USB_SPEED_FULL, USB_SPEED_HIGH, USB_SPEED_LOW, usbd_get_speed(), usbd_xfer_get_fps_shift(), and usb_xfer::xroot.

Referenced by dwc_otg_device_isoc_start(), and dwc_otg_device_non_isoc_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_setup_standard_chain_sub()

◆ dwc_otg_standard_done()

static void dwc_otg_standard_done ( struct usb_xfer xfer)
static

◆ dwc_otg_standard_done_sub()

◆ dwc_otg_start_standard_chain()

◆ dwc_otg_suspend()

static void dwc_otg_suspend ( struct dwc_otg_softc sc)
static

Definition at line 4106 of file dwc_otg.c.

Referenced by dwc_otg_set_hw_power_sleep().

Here is the caller graph for this function:

◆ dwc_otg_suspend_irq()

static void dwc_otg_suspend_irq ( struct dwc_otg_softc sc)
static

Definition at line 599 of file dwc_otg.c.

References dwc_otg_flags::change_suspend, DOTG_GINTMSK, dwc_otg_root_intr(), DWC_OTG_WRITE_4, GINTMSK_WKUPINTMSK, dwc_otg_softc::sc_flags, dwc_otg_softc::sc_irq_mask, dwc_otg_flags::status_device_mode, and dwc_otg_flags::status_suspend.

Referenced by dwc_otg_interrupt(), and dwc_otg_roothub_exec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_timeout()

static void dwc_otg_timeout ( void *  arg)
static

Definition at line 3428 of file dwc_otg.c.

References usb_xfer_root::bus, DPRINTF, dwc_otg_device_done(), USB_BUS_LOCK_ASSERT, USB_ERR_TIMEOUT, and usb_xfer::xroot.

Referenced by dwc_otg_start_standard_chain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_timer()

static void dwc_otg_timer ( void *  _sc)
static

◆ dwc_otg_timer_start()

static void dwc_otg_timer_start ( struct dwc_otg_softc sc)
static

Definition at line 2455 of file dwc_otg.c.

References DWC_OTG_HOST_TIMER_RATE, dwc_otg_timer(), dwc_otg_softc::sc_timer, dwc_otg_softc::sc_timer_active, and usb_callout_reset.

Referenced by dwc_otg_roothub_exec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_timer_stop()

static void dwc_otg_timer_stop ( struct dwc_otg_softc sc)
static

Definition at line 2469 of file dwc_otg.c.

References dwc_otg_softc::sc_timer, dwc_otg_softc::sc_timer_active, and usb_callout_stop.

Referenced by dwc_otg_roothub_exec(), and dwc_otg_uninit().

Here is the caller graph for this function:

◆ dwc_otg_tx_fifo_reset()

static void dwc_otg_tx_fifo_reset ( struct dwc_otg_softc sc,
uint32_t  value 
)
static

Definition at line 275 of file dwc_otg.c.

References DOTG_GRSTCTL, DWC_OTG_READ_4, DWC_OTG_WRITE_4, GRSTCTL_RXFFLSH, GRSTCTL_TXFFLSH, and value.

Referenced by dwc_otg_clear_stall_sub_locked(), dwc_otg_init_fifo(), and dwc_otg_setup_rx().

Here is the caller graph for this function:

◆ dwc_otg_uninit()

◆ dwc_otg_update_host_frame_interval()

static void dwc_otg_update_host_frame_interval ( struct dwc_otg_softc sc)
static

Definition at line 466 of file dwc_otg.c.

References DOTG_HFIR, DPRINTF, DWC_OTG_READ_4, DWC_OTG_WRITE_4, HFIR_FRINT_MASK, dwc_otg_softc::sc_flags, and dwc_otg_flags::status_high_speed.

Referenced by dwc_otg_interrupt().

Here is the caller graph for this function:

◆ dwc_otg_update_host_transfer_schedule_locked()

◆ dwc_otg_uses_split()

static uint8_t dwc_otg_uses_split ( struct usb_device udev)
static

Definition at line 454 of file dwc_otg.c.

References usb_device::parent_hs_hub, usb_device::parent_hub, usb_device::speed, and USB_SPEED_HIGH.

Referenced by dwc_otg_setup_standard_chain(), and dwc_otg_xfer_setup().

Here is the caller graph for this function:

◆ dwc_otg_vbus_interrupt()

static void dwc_otg_vbus_interrupt ( struct dwc_otg_softc sc,
uint8_t  is_on 
)
static

◆ dwc_otg_wakeup_peer()

static void dwc_otg_wakeup_peer ( struct dwc_otg_softc sc)
static

◆ dwc_otg_write_fifo()

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

Definition at line 171 of file dwc_otg.c.

References usb_page_search::buffer, count, usb_page_search::length, offset, dwc_otg_softc::sc_bounce_buffer, dwc_otg_softc::sc_io_hdl, dwc_otg_softc::sc_io_tag, usb_pc_buffer_is_aligned(), usbd_copy_out(), and usbd_get_page().

Referenced by dwc_otg_data_tx(), and dwc_otg_host_data_tx().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_xfer_do_complete_locked()

static uint8_t dwc_otg_xfer_do_complete_locked ( struct dwc_otg_softc sc,
struct usb_xfer xfer 
)
static

Definition at line 2412 of file dwc_otg.c.

References dwc_otg_standard_done(), and usb_xfer::td_transfer_cache.

Referenced by dwc_otg_interrupt_complete_locked(), and dwc_otg_start_standard_chain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dwc_otg_xfer_do_fifo()

static void dwc_otg_xfer_do_fifo ( struct dwc_otg_softc sc,
struct usb_xfer xfer 
)
static

◆ dwc_otg_xfer_setup()

◆ dwc_otg_xfer_stall()

static void dwc_otg_xfer_stall ( struct usb_xfer xfer)
static

Definition at line 3644 of file dwc_otg.c.

References dwc_otg_device_done(), and USB_ERR_STALLED.

Here is the call graph for this function:

◆ dwc_otg_xfer_unsetup()

static void dwc_otg_xfer_unsetup ( struct usb_xfer xfer)
static

Definition at line 4873 of file dwc_otg.c.

◆ SYSCTL_INT()

SYSCTL_INT ( _hw_usb_dwc_otg  ,
OID_AUTO  ,
phy_type  ,
CTLFLAG_RDTUN  ,
dwc_otg_phy_type,
,
"DWC OTG PHY TYPE - 0/1/2/3 - ULPI/HSIC/INTERNAL/UTMI+"   
)

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _hw_usb  ,
OID_AUTO  ,
dwc_otg  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"USB DWC OTG"   
)
static

◆ USB_MAKE_STRING_DESC() [1/2]

USB_MAKE_STRING_DESC ( STRING_PRODUCT  ,
dwc_otg_product   
)

◆ USB_MAKE_STRING_DESC() [2/2]

USB_MAKE_STRING_DESC ( STRING_VENDOR  ,
dwc_otg_vendor   
)

Variable Documentation

◆ dwc_otg_bus_methods

static const struct usb_bus_methods dwc_otg_bus_methods
static
Initial value:
=
{
.endpoint_init = &dwc_otg_ep_init,
.xfer_setup = &dwc_otg_xfer_setup,
.xfer_unsetup = &dwc_otg_xfer_unsetup,
.get_hw_ep_profile = &dwc_otg_get_hw_ep_profile,
.xfer_stall = &dwc_otg_xfer_stall,
.set_stall = &dwc_otg_set_stall,
.clear_stall = &dwc_otg_clear_stall,
.roothub_exec = &dwc_otg_roothub_exec,
.xfer_poll = &dwc_otg_do_poll,
.device_state_change = &dwc_otg_device_state_change,
.set_hw_power_sleep = &dwc_otg_set_hw_power_sleep,
.get_dma_delay = &dwc_otg_get_dma_delay,
.device_resume = &dwc_otg_device_resume,
.device_suspend = &dwc_otg_device_suspend,
}
static void dwc_otg_device_state_change(struct usb_device *udev)
Definition: dwc_otg.c:3801
static void dwc_otg_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, struct usb_endpoint *ep)
Definition: dwc_otg.c:4879
static void dwc_otg_set_hw_power_sleep(struct usb_bus *bus, uint32_t state)
Definition: dwc_otg.c:4914
static void dwc_otg_clear_stall(struct usb_device *udev, struct usb_endpoint *ep)
Definition: dwc_otg.c:3768
static void dwc_otg_do_poll(struct usb_bus *)
Definition: dwc_otg.c:4118
static void dwc_otg_set_stall(struct usb_device *udev, struct usb_endpoint *ep, uint8_t *did_stall)
Definition: dwc_otg.c:3650
static void dwc_otg_get_hw_ep_profile(struct usb_device *udev, const struct usb_hw_ep_profile **ppf, uint8_t ep_addr)
Definition: dwc_otg.c:157
static void dwc_otg_get_dma_delay(struct usb_device *udev, uint32_t *pus)
Definition: dwc_otg.c:4934
static void dwc_otg_xfer_unsetup(struct usb_xfer *xfer)
Definition: dwc_otg.c:4873
static usb_error_t dwc_otg_roothub_exec(struct usb_device *udev, struct usb_device_request *req, const void **pptr, uint16_t *plength)
Definition: dwc_otg.c:4303
static void dwc_otg_xfer_stall(struct usb_xfer *xfer)
Definition: dwc_otg.c:3644
static void dwc_otg_xfer_setup(struct usb_setup_params *parm)
Definition: dwc_otg.c:4773
static void dwc_otg_device_resume(struct usb_device *udev)
Definition: dwc_otg.c:4941
static void dwc_otg_device_suspend(struct usb_device *udev)
Definition: dwc_otg.c:4950

Definition at line 125 of file dwc_otg.c.

Referenced by dwc_otg_init().

◆ dwc_otg_confd

const struct dwc_otg_config_desc dwc_otg_confd
static
Initial value:
= {
.confd = {
.bLength = sizeof(struct usb_config_descriptor),
.wTotalLength[0] = sizeof(dwc_otg_confd),
.bMaxPower = 0,
},
.ifcd = {
.bLength = sizeof(struct usb_interface_descriptor),
.bNumEndpoints = 1,
.bInterfaceClass = UICLASS_HUB,
.bInterfaceSubClass = UISUBCLASS_HUB,
.bInterfaceProtocol = 0,
},
.endpd = {
.bLength = sizeof(struct usb_endpoint_descriptor),
.bEndpointAddress = (UE_DIR_IN | DWC_OTG_INTR_ENDPT),
.wMaxPacketSize[0] = 8,
.bInterval = 255,
},
}
#define DWC_OTG_INTR_ENDPT
Definition: dwc_otg.c:121
static const struct dwc_otg_config_desc dwc_otg_confd
Definition: dwc_otg.c:4253
uByte bDescriptorType
Definition: usb.h:387
uByte bNumInterface
Definition: usb.h:389
uByte bmAttributes
Definition: usb.h:393
uByte iConfiguration
Definition: usb.h:392
uByte bConfigurationValue
Definition: usb.h:390
uByte bDescriptorType
Definition: usb.h:527
uWord wMaxPacketSize
Definition: usb.h:558
#define UE_INTERRUPT
Definition: usb.h:544
#define UC_SELF_POWERED
Definition: usb.h:395
#define UISUBCLASS_HUB
Definition: usb.h:480
#define UDESC_CONFIG
Definition: usb.h:196
#define UDESC_ENDPOINT
Definition: usb.h:200
#define UE_DIR_IN
Definition: usb.h:531
#define UICLASS_HUB
Definition: usb.h:479
#define UDESC_INTERFACE
Definition: usb.h:199

Definition at line 4253 of file dwc_otg.c.

Referenced by dwc_otg_roothub_exec().

◆ dwc_otg_data_rx

dwc_otg_cmd_t dwc_otg_data_rx
static

Definition at line 130 of file dwc_otg.c.

Referenced by dwc_otg_setup_standard_chain().

◆ dwc_otg_data_tx

dwc_otg_cmd_t dwc_otg_data_tx
static

Definition at line 131 of file dwc_otg.c.

Referenced by dwc_otg_setup_standard_chain().

◆ dwc_otg_data_tx_sync

dwc_otg_cmd_t dwc_otg_data_tx_sync
static

Definition at line 132 of file dwc_otg.c.

Referenced by dwc_otg_setup_standard_chain().

◆ dwc_otg_devd

const struct usb_device_descriptor dwc_otg_devd
static
Initial value:
= {
.bLength = sizeof(struct usb_device_descriptor),
.bcdUSB = {0x00, 0x02},
.bDeviceClass = UDCLASS_HUB,
.bDeviceSubClass = UDSUBCLASS_HUB,
.bDeviceProtocol = UDPROTO_HSHUBSTT,
.bMaxPacketSize = 64,
.bcdDevice = {0x00, 0x01},
.iManufacturer = 1,
.iProduct = 2,
.bNumConfigurations = 1,
}
uByte bDescriptorType
Definition: usb.h:290
#define UDSUBCLASS_HUB
Definition: usb.h:374
#define UDCLASS_HUB
Definition: usb.h:373
#define UDPROTO_HSHUBSTT
Definition: usb.h:376
#define UDESC_DEVICE
Definition: usb.h:195

Definition at line 4239 of file dwc_otg.c.

Referenced by dwc_otg_roothub_exec().

◆ dwc_otg_device_isoc_methods

static const struct usb_pipe_methods dwc_otg_device_isoc_methods
static
Initial value:
=
{
}
static void dwc_otg_device_isoc_enter(struct usb_xfer *xfer)
Definition: dwc_otg.c:4182
static void dwc_otg_device_isoc_close(struct usb_xfer *xfer)
Definition: dwc_otg.c:4176
static void dwc_otg_device_isoc_open(struct usb_xfer *xfer)
Definition: dwc_otg.c:4171
static void dwc_otg_device_isoc_start(struct usb_xfer *xfer)
Definition: dwc_otg.c:4187

Definition at line 127 of file dwc_otg.c.

Referenced by dwc_otg_ep_init().

◆ dwc_otg_device_non_isoc_methods

static const struct usb_pipe_methods dwc_otg_device_non_isoc_methods
static
Initial value:
=
{
}
static void dwc_otg_device_non_isoc_open(struct usb_xfer *xfer)
Definition: dwc_otg.c:4136
static void dwc_otg_device_non_isoc_enter(struct usb_xfer *xfer)
Definition: dwc_otg.c:4147
static void dwc_otg_device_non_isoc_close(struct usb_xfer *xfer)
Definition: dwc_otg.c:4141
static void dwc_otg_device_non_isoc_start(struct usb_xfer *xfer)
Definition: dwc_otg.c:4152

Definition at line 126 of file dwc_otg.c.

Referenced by dwc_otg_ep_init().

◆ dwc_otg_ep_profile

const struct usb_hw_ep_profile dwc_otg_ep_profile[1]
static
Initial value:
= {
[0] = {
.max_in_frame_size = 64,
.max_out_frame_size = 64,
.is_simplex = 1,
.support_control = 1,
}
}

Definition at line 147 of file dwc_otg.c.

Referenced by dwc_otg_init_fifo().

◆ dwc_otg_host_data_rx

dwc_otg_cmd_t dwc_otg_host_data_rx
static

Definition at line 136 of file dwc_otg.c.

Referenced by dwc_otg_setup_standard_chain().

◆ dwc_otg_host_data_tx

dwc_otg_cmd_t dwc_otg_host_data_tx
static

Definition at line 135 of file dwc_otg.c.

Referenced by dwc_otg_setup_standard_chain().

◆ dwc_otg_host_setup_tx

dwc_otg_cmd_t dwc_otg_host_setup_tx
static

Definition at line 134 of file dwc_otg.c.

Referenced by dwc_otg_setup_standard_chain().

◆ dwc_otg_hubd

const struct usb_hub_descriptor_min dwc_otg_hubd
static
Initial value:
= {
.bDescLength = sizeof(dwc_otg_hubd),
.bDescriptorType = UDESC_HUB,
.bNbrPorts = 1,
HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)),
.bPwrOn2PwrGood = 50,
.bHubContrCurrent = 0,
.DeviceRemovable = {0},
}
#define HSETW(ptr, val)
Definition: dwc_otg.c:4281
static const struct usb_hub_descriptor_min dwc_otg_hubd
Definition: dwc_otg.c:4283
#define UDESC_HUB
Definition: usb.h:214
#define UHD_OC_INDIVIDUAL
Definition: usb.h:614
#define UHD_PWR_NO_SWITCH
Definition: usb.h:610

Definition at line 4283 of file dwc_otg.c.

Referenced by dwc_otg_roothub_exec().

◆ dwc_otg_phy_type

int dwc_otg_phy_type = DWC_OTG_PHY_DEFAULT
static

Definition at line 107 of file dwc_otg.c.

Referenced by dwc_otg_init().

◆ dwc_otg_setup_rx

dwc_otg_cmd_t dwc_otg_setup_rx
static

Definition at line 129 of file dwc_otg.c.

Referenced by dwc_otg_setup_standard_chain().