#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include "cdnsp-gadget.h"
#include "cdnsp-trace.h"
static void cdnsp_free_stream_info(struct cdnsp_device *pdev,
struct cdnsp_ep *pep);
static struct cdnsp_segment *cdnsp_segment_alloc(struct cdnsp_device *pdev,
unsigned int cycle_state,
unsigned int max_packet,
gfp_t flags)
{ … }
static void cdnsp_segment_free(struct cdnsp_device *pdev,
struct cdnsp_segment *seg)
{ … }
static void cdnsp_free_segments_for_ring(struct cdnsp_device *pdev,
struct cdnsp_segment *first)
{ … }
static void cdnsp_link_segments(struct cdnsp_device *pdev,
struct cdnsp_segment *prev,
struct cdnsp_segment *next,
enum cdnsp_ring_type type)
{ … }
static void cdnsp_link_rings(struct cdnsp_device *pdev,
struct cdnsp_ring *ring,
struct cdnsp_segment *first,
struct cdnsp_segment *last,
unsigned int num_segs)
{ … }
static int cdnsp_insert_segment_mapping(struct radix_tree_root *trb_address_map,
struct cdnsp_ring *ring,
struct cdnsp_segment *seg,
gfp_t mem_flags)
{ … }
static void cdnsp_remove_segment_mapping(struct radix_tree_root *trb_address_map,
struct cdnsp_segment *seg)
{ … }
static int cdnsp_update_stream_segment_mapping(struct radix_tree_root *trb_address_map,
struct cdnsp_ring *ring,
struct cdnsp_segment *first_seg,
struct cdnsp_segment *last_seg,
gfp_t mem_flags)
{ … }
static void cdnsp_remove_stream_mapping(struct cdnsp_ring *ring)
{ … }
static int cdnsp_update_stream_mapping(struct cdnsp_ring *ring)
{ … }
static void cdnsp_ring_free(struct cdnsp_device *pdev, struct cdnsp_ring *ring)
{ … }
void cdnsp_initialize_ring_info(struct cdnsp_ring *ring)
{ … }
static int cdnsp_alloc_segments_for_ring(struct cdnsp_device *pdev,
struct cdnsp_segment **first,
struct cdnsp_segment **last,
unsigned int num_segs,
unsigned int cycle_state,
enum cdnsp_ring_type type,
unsigned int max_packet,
gfp_t flags)
{ … }
static struct cdnsp_ring *cdnsp_ring_alloc(struct cdnsp_device *pdev,
unsigned int num_segs,
enum cdnsp_ring_type type,
unsigned int max_packet,
gfp_t flags)
{ … }
void cdnsp_free_endpoint_rings(struct cdnsp_device *pdev, struct cdnsp_ep *pep)
{ … }
int cdnsp_ring_expansion(struct cdnsp_device *pdev,
struct cdnsp_ring *ring,
unsigned int num_trbs,
gfp_t flags)
{ … }
static int cdnsp_init_device_ctx(struct cdnsp_device *pdev)
{ … }
struct cdnsp_input_control_ctx
*cdnsp_get_input_control_ctx(struct cdnsp_container_ctx *ctx)
{ … }
struct cdnsp_slot_ctx *cdnsp_get_slot_ctx(struct cdnsp_container_ctx *ctx)
{ … }
struct cdnsp_ep_ctx *cdnsp_get_ep_ctx(struct cdnsp_container_ctx *ctx,
unsigned int ep_index)
{ … }
static void cdnsp_free_stream_ctx(struct cdnsp_device *pdev,
struct cdnsp_ep *pep)
{ … }
static struct cdnsp_stream_ctx
*cdnsp_alloc_stream_ctx(struct cdnsp_device *pdev, struct cdnsp_ep *pep)
{ … }
struct cdnsp_ring *cdnsp_dma_to_transfer_ring(struct cdnsp_ep *pep, u64 address)
{ … }
int cdnsp_alloc_stream_info(struct cdnsp_device *pdev,
struct cdnsp_ep *pep,
unsigned int num_stream_ctxs,
unsigned int num_streams)
{ … }
static void cdnsp_free_stream_info(struct cdnsp_device *pdev,
struct cdnsp_ep *pep)
{ … }
static void cdnsp_free_priv_device(struct cdnsp_device *pdev)
{ … }
static int cdnsp_alloc_priv_device(struct cdnsp_device *pdev)
{ … }
void cdnsp_copy_ep0_dequeue_into_input_ctx(struct cdnsp_device *pdev)
{ … }
int cdnsp_setup_addressable_priv_dev(struct cdnsp_device *pdev)
{ … }
static unsigned int cdnsp_parse_exponent_interval(struct usb_gadget *g,
struct cdnsp_ep *pep)
{ … }
static unsigned int cdnsp_microframes_to_exponent(struct usb_gadget *g,
struct cdnsp_ep *pep,
unsigned int desc_interval,
unsigned int min_exponent,
unsigned int max_exponent)
{ … }
static unsigned int cdnsp_get_endpoint_interval(struct usb_gadget *g,
struct cdnsp_ep *pep)
{ … }
static u32 cdnsp_get_endpoint_mult(struct usb_gadget *g, struct cdnsp_ep *pep)
{ … }
static u32 cdnsp_get_endpoint_max_burst(struct usb_gadget *g,
struct cdnsp_ep *pep)
{ … }
static u32 cdnsp_get_endpoint_type(const struct usb_endpoint_descriptor *desc)
{ … }
static u32 cdnsp_get_max_esit_payload(struct usb_gadget *g,
struct cdnsp_ep *pep)
{ … }
int cdnsp_endpoint_init(struct cdnsp_device *pdev,
struct cdnsp_ep *pep,
gfp_t mem_flags)
{ … }
void cdnsp_endpoint_zero(struct cdnsp_device *pdev, struct cdnsp_ep *pep)
{ … }
static int cdnsp_alloc_erst(struct cdnsp_device *pdev,
struct cdnsp_ring *evt_ring,
struct cdnsp_erst *erst)
{ … }
static void cdnsp_free_erst(struct cdnsp_device *pdev, struct cdnsp_erst *erst)
{ … }
void cdnsp_mem_cleanup(struct cdnsp_device *pdev)
{ … }
static void cdnsp_set_event_deq(struct cdnsp_device *pdev)
{ … }
static void cdnsp_add_in_port(struct cdnsp_device *pdev,
struct cdnsp_port *port,
__le32 __iomem *addr)
{ … }
static int cdnsp_setup_port_arrays(struct cdnsp_device *pdev)
{ … }
int cdnsp_mem_init(struct cdnsp_device *pdev)
{ … }