This file contains the interface to the Core Interface Layer.
Go to the source code of this file.
Macros | |
| #define | DWC_ENDXFER_FORCE 1U |
| #define | DWC_ENDXFER_NODELAY 2U |
| #define | dwc_usb3_is_hwo(desc) ((desc)->control & DWC_DSCCTL_HWO_BIT) |
| #define | dwc_usb3_is_ioc(desc) ((desc)->control & DWC_DSCCTL_IOC_BIT) |
| #define | dwc_usb3_get_xfercnt(desc) |
| #define | dwc_usb3_get_xfersts(desc) |
| #define | dwc_usb3_get_xfersofn(desc) |
| #define | dwc_usb3_get_eventsofn(event) |
Functions | |
| int | dwc_usb3_pcd_check_snpsid (volatile dwc_usb3_device_t *dev, u32 addr_ofs) |
| This routine ensures the device is really a DWC_usb3 controller, by reading and verifying the SNPSID register contents. The value should be 0x5533XXXX, which corresponds to "U3", as in "USB3 version X.XXX". More... | |
| int | dwc_usb3_pcd_common_init (volatile dwc_usb3_device_t *dev, volatile u8 __iomem *base, const dwc_usb3_core_params_t *core_params) |
| This routine is called to initialize the DWC_usb3 CSR data structures. The register addresses in the device structures are initialized from the base address supplied by the caller. The calling routine must make the OS calls to get the base address of the DWC_usb3 controller registers. The core_params argument holds the parameters that specify how the core should be configured. More... | |
| void | dwc_usb3_pcd_common_remove (volatile dwc_usb3_device_t *dev) |
| void | dwc_usb3_pcd_device_init (volatile dwc_usb3_device_t *dev, int soft_reset, int restore) |
| This routine initializes the DWC_usb3 controller registers. More... | |
| void | dwc_usb3_pcd_device_remove (volatile dwc_usb3_device_t *dev) |
| This routine deinitializes the DWC_usb3 controller registers. More... | |
| u32 | dwc_usb3_pcd_get_link_state (volatile dwc_usb3_pcd_t *pcd) |
| This function retrieves the current link state. More... | |
| void | dwc_usb3_pcd_set_link_state (volatile dwc_usb3_pcd_t *pcd, u32 state) |
| This function sets state of USB link. More... | |
| void | dwc_usb3_pcd_remote_wake (volatile dwc_usb3_pcd_t *pcd, int function) |
| This function sends a Remote Wakeup to the host. More... | |
| void | dwc_usb3_pcd_do_test_mode (unsigned long data) |
| This routine is called when the SET_FEATURE TEST_MODE Setup packet is sent from the host. The Device Control register is written with the Test Mode bits set to the specified Test Mode. This is done as a tasklet so that the "Status" phase of the control transfer completes before transmitting the TEST packets. More... | |
| void | dwc_usb3_fill_desc (dwc_usb3_dma_desc_t *desc, dwc_dma_t dma_addr, u32 dma_len, u32 stream, u32 type, u32 ctrlbits, int own) |
| void | dwc_usb3_start_desc_chain (dwc_usb3_dma_desc_t *desc) |
| void | dwc_usb3_end_desc_chain (dwc_usb3_dma_desc_t *desc) |
| void | dwc_usb3_enable_desc (dwc_usb3_dma_desc_t *desc) |
| void | dwc_usb3_disable_desc (dwc_usb3_dma_desc_t *desc) |
| int | dwc_usb3_xmit_fn_remote_wake (volatile dwc_usb3_pcd_t *pcd, u32 intf) |
| int | dwc_usb3_xmit_ltm (volatile dwc_usb3_pcd_t *pcd, u32 value) |
| int | dwc_usb3_xmit_host_role_request (volatile dwc_usb3_pcd_t *pcd, u32 param) |
| int | dwc_usb3_set_scratchpad_buf_array (volatile dwc_usb3_pcd_t *pcd, dwc_dma_t dma_addr) |
| int | dwc_usb3_flush_fifo (volatile dwc_usb3_pcd_t *pcd, u32 fifo_sel) |
| int | dwc_usb3_dep_cfg (volatile dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, u32 depcfg0, u32 depcfg1, u32 depcfg2) |
| int | dwc_usb3_dep_xfercfg (volatile dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, u32 depstrmcfg) |
| u32 | dwc_usb3_dep_getepstate (volatile dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg) |
| int | dwc_usb3_dep_sstall (volatile dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg) |
| int | dwc_usb3_dep_cstall (volatile dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, int clr_pend) |
| int | dwc_usb3_dep_startxfer (volatile dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, dwc_dma_t dma_addr, u32 stream_or_uf) |
| int | dwc_usb3_dep_updatexfer (volatile dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, u32 tri) |
| int | dwc_usb3_dep_endxfer (volatile dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, u32 tri, u32 flags, void *condition) |
| int | dwc_usb3_dep_startnewcfg (volatile dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, u32 rsrcidx) |
| int | dwc_usb3_enable_ep (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_ep_t *ep) |
| int | dwc_usb3_disable_ep (volatile dwc_usb3_pcd_t *pcd, volatile dwc_usb3_pcd_ep_t *ep) |
| int | dwc_usb3_get_device_speed (volatile dwc_usb3_pcd_t *pcd) |
| int | dwc_usb3_get_frame (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_set_address (volatile dwc_usb3_pcd_t *pcd, int addr) |
| This function sets the Device Address. More... | |
| void | dwc_usb3_ena_usb2_phy_suspend (volatile dwc_usb3_pcd_t *pcd) |
| This function enables USB2 Phy suspend. More... | |
| void | dwc_usb3_dis_usb2_phy_suspend (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_ena_usb3_phy_suspend (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_dis_usb3_phy_suspend (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_accept_u1 (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_accept_u2 (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_enable_u1 (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_enable_u2 (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_disable_u1 (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_disable_u2 (volatile dwc_usb3_pcd_t *pcd) |
| int | dwc_usb3_u1_enabled (volatile dwc_usb3_pcd_t *pcd) |
| int | dwc_usb3_u2_enabled (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_clr_eps_enabled (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_dump_dev_registers (volatile dwc_usb3_pcd_t *pcd) |
| void | dwc_usb3_dump_dbgregs (volatile dwc_usb3_device_t *dev) |
| void | dwc_usb3_dump_global_registers (volatile dwc_usb3_device_t *dev) |
| void | dwc_usb3_set_tx_fifo_size (volatile dwc_usb3_device_t *dev, int *sz) |
| void | dwc_usb3_set_rx_fifo_size (volatile dwc_usb3_device_t *dev, u32 size) |
| void | dwc_usb3_init_eventbuf (volatile dwc_usb3_device_t *dev, int bufno, volatile u32 *addr, u32 size, dwc_dma_t dma_addr) |
| void | dwc_usb3_dis_flush_eventbuf_intr (volatile dwc_usb3_device_t *dev, int bufno) |
| void | dwc_usb3_enable_common_interrupts (volatile dwc_usb3_device_t *dev) |
| void | dwc_usb3_enable_device_interrupts (volatile dwc_usb3_device_t *dev) |
| int | dwc_usb3_handle_event (volatile dwc_usb3_device_t *dev) |
| int | dwc_usb3_irq (volatile dwc_usb3_device_t *dev, int irq) |
| int | dwc_usb3_task (volatile dwc_usb3_device_t *dev) |
| void | dwc_usb3_task_init (dwc_usb3_device_t *dev) |
| static __inline u32 | dwc_usb3_mode (volatile dwc_usb3_device_t *dev) |
| static __inline int | dwc_usb3_is_device_mode (volatile dwc_usb3_device_t *dev) |
| static __inline int | dwc_usb3_is_host_mode (volatile dwc_usb3_device_t *dev) |
| #define DWC_ENDXFER_FORCE 1U |
| #define DWC_ENDXFER_NODELAY 2U |
| #define dwc_usb3_is_hwo | ( | desc | ) | ((desc)->control & DWC_DSCCTL_HWO_BIT) |
| #define dwc_usb3_is_ioc | ( | desc | ) | ((desc)->control & DWC_DSCCTL_IOC_BIT) |
| #define dwc_usb3_get_xfercnt | ( | desc | ) |
| #define dwc_usb3_get_xfersts | ( | desc | ) |
| #define dwc_usb3_get_xfersofn | ( | desc | ) |
| #define dwc_usb3_get_eventsofn | ( | event | ) |
| void dwc_usb3_fill_desc | ( | dwc_usb3_dma_desc_t * | desc, |
| dwc_dma_t | dma_addr, | ||
| u32 | dma_len, | ||
| u32 | stream, | ||
| u32 | type, | ||
| u32 | ctrlbits, | ||
| int | own | ||
| ) |
Fill in the four dwords of a DMA descriptor (aka a TRB).
| void dwc_usb3_start_desc_chain | ( | dwc_usb3_dma_desc_t * | desc | ) |
Make a DMA descriptor the start of a chain by setting its CHN bit and clearing its IOC bit.
| desc | The DMA descriptor (TRB) to operate on. |
| void dwc_usb3_end_desc_chain | ( | dwc_usb3_dma_desc_t * | desc | ) |
Make a DMA descriptor the end of a chain by clearing its CHN bit and setting its IOC bit.
| desc | The DMA descriptor (TRB) to operate on. |
| void dwc_usb3_enable_desc | ( | dwc_usb3_dma_desc_t * | desc | ) |
Enable a DMA descriptor by setting its HWO bit.
| desc | The DMA descriptor (TRB) to operate on. |
| void dwc_usb3_disable_desc | ( | dwc_usb3_dma_desc_t * | desc | ) |
Disable a DMA descriptor by clearing its HWO bit.
NOTE: This must only be called if it is known that the hardware has finished with the DMA descriptor, but for some reason the hardware has not cleared the HWO bit.
| desc | The DMA descriptor (TRB) to operate on. |
| int dwc_usb3_xmit_fn_remote_wake | ( | volatile dwc_usb3_pcd_t * | pcd, |
| u32 | intf | ||
| ) |
Send TRANSMIT FUNCTION WAKE DEVICE NOTIFICATION command to Device
| int dwc_usb3_xmit_ltm | ( | volatile dwc_usb3_pcd_t * | pcd, |
| u32 | value | ||
| ) |
Send LATENCY TOLERANCE MESSAGE DEVICE NOTIFICATION command to Device
| int dwc_usb3_xmit_host_role_request | ( | volatile dwc_usb3_pcd_t * | pcd, |
| u32 | param | ||
| ) |
| int dwc_usb3_set_scratchpad_buf_array | ( | volatile dwc_usb3_pcd_t * | pcd, |
| dwc_dma_t | dma_addr | ||
| ) |
Send SET SCRATCHPAD BUFFER ARRAY command to Device
| int dwc_usb3_flush_fifo | ( | volatile dwc_usb3_pcd_t * | pcd, |
| u32 | fifo_sel | ||
| ) |
Send SELECTED FIFO FLUSH command to Device
| int dwc_usb3_dep_cfg | ( | volatile dwc_usb3_pcd_t * | pcd, |
| dwc_usb3_dev_ep_regs_t __iomem * | ep_reg, | ||
| u32 | depcfg0, | ||
| u32 | depcfg1, | ||
| u32 | depcfg2 | ||
| ) |
Send DEPCFG command to EP
| int dwc_usb3_dep_xfercfg | ( | volatile dwc_usb3_pcd_t * | pcd, |
| dwc_usb3_dev_ep_regs_t __iomem * | ep_reg, | ||
| u32 | depstrmcfg | ||
| ) |
Send DEPXFERCFG command to EP
| u32 dwc_usb3_dep_getepstate | ( | volatile dwc_usb3_pcd_t * | pcd, |
| dwc_usb3_dev_ep_regs_t __iomem * | ep_reg | ||
| ) |
Send DEPGETEPSTATE command to EP
| int dwc_usb3_dep_sstall | ( | volatile dwc_usb3_pcd_t * | pcd, |
| dwc_usb3_dev_ep_regs_t __iomem * | ep_reg | ||
| ) |
Send DEPSSTALL command to EP
| int dwc_usb3_dep_cstall | ( | volatile dwc_usb3_pcd_t * | pcd, |
| dwc_usb3_dev_ep_regs_t __iomem * | ep_reg, | ||
| int | clr_pend | ||
| ) |
Send DEPCSTALL command to EP
| int dwc_usb3_dep_startxfer | ( | volatile dwc_usb3_pcd_t * | pcd, |
| dwc_usb3_dev_ep_regs_t __iomem * | ep_reg, | ||
| dwc_dma_t | dma_addr, | ||
| u32 | stream_or_uf | ||
| ) |
Send DEPSTRTXFER command to EP
| int dwc_usb3_dep_updatexfer | ( | volatile dwc_usb3_pcd_t * | pcd, |
| dwc_usb3_dev_ep_regs_t __iomem * | ep_reg, | ||
| u32 | tri | ||
| ) |
Send DEPUPDTXFER command to EP
| int dwc_usb3_dep_endxfer | ( | volatile dwc_usb3_pcd_t * | pcd, |
| dwc_usb3_dev_ep_regs_t __iomem * | ep_reg, | ||
| u32 | tri, | ||
| u32 | flags, | ||
| void * | condition | ||
| ) |
Send DEPENDXFER command to EP
| int dwc_usb3_dep_startnewcfg | ( | volatile dwc_usb3_pcd_t * | pcd, |
| dwc_usb3_dev_ep_regs_t __iomem * | ep_reg, | ||
| u32 | rsrcidx | ||
| ) |
Send DEPSTRTNEWCFG command to EP
| int dwc_usb3_enable_ep | ( | volatile dwc_usb3_pcd_t * | pcd, |
| volatile dwc_usb3_pcd_ep_t * | ep | ||
| ) |
Enable an EP in the DALEPENA register.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| ep | The EP to enable. |
| int dwc_usb3_disable_ep | ( | volatile dwc_usb3_pcd_t * | pcd, |
| volatile dwc_usb3_pcd_ep_t * | ep | ||
| ) |
Disable an EP in the DALEPENA register.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| ep | The EP to disable. |
| int dwc_usb3_get_device_speed | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Get the device speed from the device status register and convert it to USB speed constant.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| int dwc_usb3_get_frame | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Get the current microframe number.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_set_address | ( | volatile dwc_usb3_pcd_t * | pcd, |
| int | addr | ||
| ) |
This function sets the Device Address.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| addr | The address to set. |
| void dwc_usb3_ena_usb2_phy_suspend | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
This function enables USB2 Phy suspend.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_dis_usb2_phy_suspend | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Disable USB2 Phy suspend.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_ena_usb3_phy_suspend | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Enable USB3 Phy suspend.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_dis_usb3_phy_suspend | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Disable USB3 Phy suspend.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_accept_u1 | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Enable the Device to accept U1 control commands from the Host.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_accept_u2 | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Enable the Device to accept U2 control commands from the Host.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_enable_u1 | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Enable U1 sleep.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_enable_u2 | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Enable U2 sleep.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_disable_u1 | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Disable U1 sleep.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_disable_u2 | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Disable U2 sleep.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| int dwc_usb3_u1_enabled | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Test whether U1 sleep is enabled.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| int dwc_usb3_u2_enabled | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Test whether U2 sleep is enabled.
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_clr_eps_enabled | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
Clear 'eps_enabled' flag and 'ena_once' flags for all EPs, so EPs will get completely reconfigured by SetConfig and SetInterface.
| void dwc_usb3_dump_dev_registers | ( | volatile dwc_usb3_pcd_t * | pcd | ) |
This routine reads the device registers and prints them
| pcd | Programming view of DWC_usb3 peripheral controller. |
| void dwc_usb3_dump_dbgregs | ( | volatile dwc_usb3_device_t * | dev | ) |
This routine dumps the core's internal debug registers
| dev | Programming view of DWC_usb3 controller. |
| void dwc_usb3_dump_global_registers | ( | volatile dwc_usb3_device_t * | dev | ) |
This routine reads the core global registers and prints them
| dev | Programming view of DWC_usb3 controller. |
| void dwc_usb3_set_tx_fifo_size | ( | volatile dwc_usb3_device_t * | dev, |
| int * | sz | ||
| ) |
Set the size of the Tx FIFOs
NOTE: The following code for setting the FIFO sizes only works for cores configured with the 3 RAM option. Setting FIFO sizes for the 2 RAM option is not implemented.
| dev | Programming view of DWC_usb3 controller. |
| sz | New sizes for the FIFOs. |
| void dwc_usb3_set_rx_fifo_size | ( | volatile dwc_usb3_device_t * | dev, |
| u32 | size | ||
| ) |
Set the size of the Rx FIFO
NOTE: The following code for setting the FIFO sizes only works for cores configured with the 3 RAM option. Setting FIFO sizes for the 2 RAM option is not implemented.
| dev | Programming view of DWC_usb3 controller. |
| size | New size for the FIFO. |
| void dwc_usb3_init_eventbuf | ( | volatile dwc_usb3_device_t * | dev, |
| int | bufno, | ||
| volatile u32 * | addr, | ||
| u32 | size, | ||
| dwc_dma_t | dma_addr | ||
| ) |
| void dwc_usb3_dis_flush_eventbuf_intr | ( | volatile dwc_usb3_device_t * | dev, |
| int | bufno | ||
| ) |
| void dwc_usb3_enable_common_interrupts | ( | volatile dwc_usb3_device_t * | dev | ) |
| void dwc_usb3_enable_device_interrupts | ( | volatile dwc_usb3_device_t * | dev | ) |
| int dwc_usb3_handle_event | ( | volatile dwc_usb3_device_t * | dev | ) |
| int dwc_usb3_irq | ( | volatile dwc_usb3_device_t * | dev, |
| int | irq | ||
| ) |
| int dwc_usb3_task | ( | volatile dwc_usb3_device_t * | dev | ) |
| void dwc_usb3_task_init | ( | dwc_usb3_device_t * | dev | ) |
|
static |
This routine returns the current operating mode, host or device.
|
static |
This routine returns true if the current operating mode is Device.
|
static |
This routine returns true if the current operating mode is Host.