#include "compat.h"
#include <asm/arch/hwregs/intr_vect.h>
#include <asm/arch/hwregs/dma_defs.h>
#include <asm/arch/hwregs/iop/iop_reg_space.h>
#include <asm/arch/hwregs/iop/iop_mpu_macros.h>
#include <asm/arch/hwregs/iop/iop_mpu_defs.h>
#include <asm/arch/hwregs/iop/iop_spu_defs.h>
#include <asm/arch/hwregs/iop/iop_sw_cfg_defs.h>
#include <asm/arch/hwregs/iop/iop_sw_cpu_defs.h>
#include <asm/arch/hwregs/iop/iop_dmc_in_defs.h>
#include <asm/arch/hwregs/iop/iop_fifo_in_defs.h>
#include <asm/arch/hwregs/iop/iop_fifo_out_defs.h>
#include <asm/arch/hwregs/iop/iop_scrc_out_defs.h>
#include <asm/arch/hwregs/iop/iop_crc_par_defs.h>
#include <asm/arch/hwregs/iop/iop_sap_in_defs.h>
#include <asm/arch/hwregs/iop/iop_sap_out_defs.h>
#include <asm/arch/hwregs/iop/iop_timer_grp_defs.h>
#include "iop-usb.h"
#include "iop-usb-int.h"
Include dependency graph for iop-usb.c:
Go to the source code of this file.
Defines | |
#define | D(x) |
#define | IOP_TIMEOUT 1000 |
#define | MAX_INTERVAL_ISOC 1024 |
#define | MAX_INTERVAL_INTR 256 |
#define | NUM_TRANSFER_TYPE 4 |
#define | NUM_PER_TRANSFER_TYPE 2 |
#define | IOP_USB_GROUP_EOL (IOP_USB_BULK + 1) |
#define | TOTAL_DESCR_SIZE |
#define | DUMMY_BUF_SIZE 1500 |
#define | ALLOC_DESCR(num, type) ((type *) alloc_static_descr((num) * sizeof(type))) |
Functions | |
static __inline__ struct iop_usb_ed * | ctxt_to_ed (dma_descr_context *ctxt) |
static int | alloc_dummy_buf (void) |
static __inline__ int | init_alloc_static_descr (void) |
static __inline__ void * | alloc_static_descr (size_t size) |
static int | alloc_static_descrs (void) |
static void | init_dma_periodic (enum iop_usb_transaction_type type) |
static void | init_dma_in (void) |
static void | init_dma (void) |
static __inline__ void | enable_group (enum iop_usb_transfer_type type) |
static __inline__ void | reset_ed_status (struct iop_usb_ed *ed) |
static void | reset_out_context (struct iop_usb_ed *ed, struct iop_usb_td *td) |
static void | wait_on_ctxt (struct iop_usb_ed *ed) |
static void | schedule_periodic (unsigned int type, dma_descr_context *ctxt) |
void | iop_usb_endpoint_init (struct iop_usb_ed *ed, enum iop_usb_transfer_type type, unsigned int daddr, unsigned int epnum, int is_in, enum iop_usb_speed speed, unsigned int maxsize, unsigned int interval, unsigned long maxtime) |
void | iop_usb_endpoint_add (struct iop_usb_ed *ed) |
void | iop_usb_endpoint_release (struct iop_usb_ed *ed) |
void | iop_usb_endpoint_release_wait (struct iop_usb_ed *ed) |
void | iop_usb_trans_init (struct iop_usb_td *td, enum iop_usb_transaction_type type, unsigned int maxsize, void *buffer, unsigned int buffer_length, int zeropacket) |
static int | insert_descr_out (struct iop_usb_ed *ed, struct iop_usb_td *td) |
static void | insert_descr_in (struct iop_usb_ed *ed, struct iop_usb_td *td) |
static void | remove_descr_out (struct iop_usb_ed *ed, struct iop_usb_td *first, struct iop_usb_td *last) |
static void | remove_descr_in (struct iop_usb_ed *ed, struct iop_usb_td *first, struct iop_usb_td *last) |
int | iop_usb_trans_enqueue (struct iop_usb_ed *ed, struct iop_usb_td *td) |
void | iop_usb_trans_dequeue_lock (struct iop_usb_ed *ed) |
int | iop_usb_trans_dequeue (struct iop_usb_ed *ed, struct iop_usb_td *td_first, struct iop_usb_td *td_last) |
void | iop_usb_trans_dequeue_unlock (struct iop_usb_ed *ed) |
void | iop_usb_stop_periodic (enum iop_usb_transfer_type type) |
static void | finish_data (struct iop_usb_ed *ed, void(*cb)(struct iop_usb_td *, int, int)) |
void | iop_usb_trans_done_irq (void(*cb)(struct iop_usb_td *, int, int)) |
static __inline__ int | wait_mpu_idle (void) |
static __inline__ int | wait_mpu_reg_data (void) |
static int | read_mpu_mem (u32 addr, u32 *data) |
static int | write_mpu_mem (u32 addr, u32 data) |
static int | mpu_halt (void) |
static int | mpu_start (void) |
static int | mpu_rh_port_request (unsigned int req, unsigned int port, unsigned int feat) |
static int | fe_irq_request (void) |
static void | port_gio_config (unsigned int port, int low_speed) |
int __init_or_module | iop_usb_init (unsigned int dma_map, unsigned int ports, int int_phy) |
void | iop_usb_exit (void) |
void __init_or_module | iop_usb_config (void) |
int | iop_usb_reset (void) |
int | iop_usb_start (int intr_mask) |
int | iop_usb_get_frame (void) |
int | iop_usb_port_stat (unsigned int port, u16 *wPortStatus, u16 *wPortChange) |
int | iop_usb_set_port_feat (unsigned int port, unsigned int feat) |
int | iop_usb_clr_port_feat (unsigned int port, unsigned int feat) |
int | iop_usb_active_irqs (void) |
int | iop_usb_spu_nr (void) |
int | iop_usb_dma_map (void) |
Variables | |
static unsigned int | port_power |
static dma_descr_group * | group_top |
static dma_descr_group * | group_head |
struct { | |
int num | |
dma_descr_group * groups | |
} | group_periodic [NUM_PER_TRANSFER_TYPE] |
static unsigned long | group_top_phys |
static dma_descr_context * | ctxt_head |
static dma_descr_context * | ctxt_eol |
static dma_descr_context * | ctxt_in_eol |
static char * | dummy_buf |
static char * | cur_static_descr |
#define DUMMY_BUF_SIZE 1500 |
#define IOP_TIMEOUT 1000 |
#define IOP_USB_GROUP_EOL (IOP_USB_BULK + 1) |
#define MAX_INTERVAL_INTR 256 |
Definition at line 62 of file iop-usb.c.
Referenced by alloc_static_descrs(), and iop_usb_endpoint_init().
#define MAX_INTERVAL_ISOC 1024 |
Definition at line 59 of file iop-usb.c.
Referenced by alloc_static_descrs(), and iop_usb_endpoint_init().
#define NUM_PER_TRANSFER_TYPE 2 |
#define NUM_TRANSFER_TYPE 4 |
Definition at line 65 of file iop-usb.c.
Referenced by alloc_static_descrs(), init_dma(), and iop_usb_trans_done_irq().
#define TOTAL_DESCR_SIZE |
Value:
( \ (sizeof(dma_descr_context) * \ (NUM_TRANSFER_TYPE + NUM_PER_TRANSFER_TYPE + 2)) + \ (sizeof(dma_descr_group) * \ (1 + NUM_TRANSFER_TYPE + 1 + MAX_INTERVAL_ISOC + MAX_INTERVAL_INTR)) \ )
Definition at line 88 of file iop-usb.c.
Referenced by init_alloc_static_descr().
static int alloc_dummy_buf | ( | void | ) | [static] |
Definition at line 100 of file iop-usb.c.
References buf, dummy_buf, and DUMMY_BUF_SIZE.
Referenced by iop_usb_init().
static __inline__ void* alloc_static_descr | ( | size_t | size | ) | [static] |
static int alloc_static_descrs | ( | void | ) | [static] |
Definition at line 133 of file iop-usb.c.
References ALLOC_DESCR, ctxt_eol, ctxt_head, ctxt_in_eol, group_head, group_periodic, group_top, init_alloc_static_descr(), MAX_INTERVAL_INTR, MAX_INTERVAL_ISOC, NUM_PER_TRANSFER_TYPE, and NUM_TRANSFER_TYPE.
Referenced by iop_usb_init().
static __inline__ struct iop_usb_ed* ctxt_to_ed | ( | dma_descr_context * | ctxt | ) | [static] |
Definition at line 46 of file iop-usb.c.
Referenced by iop_usb_endpoint_add(), iop_usb_trans_done_irq(), and schedule_periodic().
static __inline__ void enable_group | ( | enum iop_usb_transfer_type | type | ) | [static] |
Definition at line 266 of file iop-usb.c.
References group_head.
Referenced by finish_data(), iop_usb_trans_dequeue_unlock(), and iop_usb_trans_enqueue().
static int fe_irq_request | ( | void | ) | [static] |
Definition at line 1059 of file iop-usb.c.
References read_mpu_mem(), and wait_mpu_idle().
Referenced by iop_usb_trans_dequeue_unlock().
static void finish_data | ( | struct iop_usb_ed * | ed, | |
void(*)(struct iop_usb_td *, int, int) | cb | |||
) | [static] |
Definition at line 837 of file iop-usb.c.
References ctxt_in_eol, data, data_in, enable_group(), length, reset_ed_status(), and reset_out_context().
Referenced by iop_usb_trans_done_irq().
static __inline__ int init_alloc_static_descr | ( | void | ) | [static] |
Definition at line 114 of file iop-usb.c.
References buf, cur_static_descr, and TOTAL_DESCR_SIZE.
Referenced by alloc_static_descrs().
static void init_dma | ( | void | ) | [static] |
Definition at line 192 of file iop-usb.c.
References BUG, ctxt_eol, ctxt_head, group_head, group_periodic, group_top, group_top_phys, groups, init_dma_in(), init_dma_periodic(), IOP_USB_GROUP_EOL, memset(), NUM_TRANSFER_TYPE, and type.
Referenced by iop_usb_start().
static void init_dma_in | ( | void | ) | [static] |
Definition at line 180 of file iop-usb.c.
References ctxt_in_eol, and memset().
Referenced by init_dma().
static void init_dma_periodic | ( | enum iop_usb_transaction_type | type | ) | [static] |
Definition at line 156 of file iop-usb.c.
References ctxt_eol, ctxt_head, group_head, group_periodic, groups, and memset().
Referenced by init_dma().
static void insert_descr_in | ( | struct iop_usb_ed * | ed, | |
struct iop_usb_td * | td | |||
) | [static] |
static int insert_descr_out | ( | struct iop_usb_ed * | ed, | |
struct iop_usb_td * | td | |||
) | [static] |
Definition at line 571 of file iop-usb.c.
References reset_out_context().
Referenced by iop_usb_trans_enqueue().
int iop_usb_clr_port_feat | ( | unsigned int | port, | |
unsigned int | feat | |||
) |
void __init_or_module iop_usb_config | ( | void | ) |
Definition at line 1254 of file iop-usb.c.
References BUG, iop_usb_cfg, mask, and port_gio_config().
int iop_usb_dma_map | ( | void | ) |
void iop_usb_endpoint_add | ( | struct iop_usb_ed * | ed | ) |
Definition at line 440 of file iop-usb.c.
References ctxt_head, ctxt_to_ed(), D, group_head, schedule_periodic(), and type.
void iop_usb_endpoint_init | ( | struct iop_usb_ed * | ed, | |
enum iop_usb_transfer_type | type, | |||
unsigned int | daddr, | |||
unsigned int | epnum, | |||
int | is_in, | |||
enum iop_usb_speed | speed, | |||
unsigned int | maxsize, | |||
unsigned int | interval, | |||
unsigned long | maxtime | |||
) |
Definition at line 377 of file iop-usb.c.
References BUG, ctxt_in_eol, MAX_INTERVAL_INTR, MAX_INTERVAL_ISOC, and memset().
void iop_usb_endpoint_release | ( | struct iop_usb_ed * | ed | ) |
Definition at line 468 of file iop-usb.c.
References ctxt_head, D, group_head, schedule_periodic(), and type.
void iop_usb_endpoint_release_wait | ( | struct iop_usb_ed * | ed | ) |
int iop_usb_get_frame | ( | void | ) |
int __init_or_module iop_usb_init | ( | unsigned int | dma_map, | |
unsigned int | ports, | |||
int | int_phy | |||
) |
Definition at line 1177 of file iop-usb.c.
References alloc_dummy_buf(), alloc_static_descrs(), and iop_usb_cfg.
Definition at line 1842 of file iop-usb.c.
References data, port_power, and read_mpu_mem().
Referenced by iop_usb_set_port_feat().
int iop_usb_reset | ( | void | ) |
int iop_usb_set_port_feat | ( | unsigned int | port, | |
unsigned int | feat | |||
) |
Definition at line 1862 of file iop-usb.c.
References iop_usb_port_stat(), mpu_rh_port_request(), port_gio_config(), and port_power.
int iop_usb_spu_nr | ( | void | ) |
int iop_usb_start | ( | int | intr_mask | ) |
Definition at line 1797 of file iop-usb.c.
References init_dma(), iop_usb_cfg, mpu_start(), port_power, read_mpu_mem(), and write_mpu_mem().
void iop_usb_stop_periodic | ( | enum iop_usb_transfer_type | type | ) |
int iop_usb_trans_dequeue | ( | struct iop_usb_ed * | ed, | |
struct iop_usb_td * | td_first, | |||
struct iop_usb_td * | td_last | |||
) |
void iop_usb_trans_dequeue_lock | ( | struct iop_usb_ed * | ed | ) |
void iop_usb_trans_dequeue_unlock | ( | struct iop_usb_ed * | ed | ) |
void iop_usb_trans_done_irq | ( | void(*)(struct iop_usb_td *, int, int) | cb | ) |
Definition at line 928 of file iop-usb.c.
References ctxt_head, ctxt_to_ed(), finish_data(), NUM_TRANSFER_TYPE, and type.
int iop_usb_trans_enqueue | ( | struct iop_usb_ed * | ed, | |
struct iop_usb_td * | td | |||
) |
Definition at line 753 of file iop-usb.c.
References D, enable_group(), insert_descr_in(), insert_descr_out(), and remove_descr_in().
void iop_usb_trans_init | ( | struct iop_usb_td * | td, | |
enum iop_usb_transaction_type | type, | |||
unsigned int | maxsize, | |||
void * | buffer, | |||
unsigned int | buffer_length, | |||
int | zeropacket | |||
) |
static int mpu_halt | ( | void | ) | [static] |
Definition at line 1002 of file iop-usb.c.
References wait_mpu_idle().
Referenced by iop_usb_reset().
static int mpu_rh_port_request | ( | unsigned int | req, | |
unsigned int | port, | |||
unsigned int | feat | |||
) | [static] |
Definition at line 1037 of file iop-usb.c.
References data, read_mpu_mem(), wait_mpu_idle(), and wait_mpu_reg_data().
Referenced by iop_usb_clr_port_feat(), and iop_usb_set_port_feat().
static int mpu_start | ( | void | ) | [static] |
Definition at line 1013 of file iop-usb.c.
References wait_mpu_idle().
Referenced by iop_usb_start().
static void port_gio_config | ( | unsigned int | port, | |
int | low_speed | |||
) | [static] |
Definition at line 1073 of file iop-usb.c.
References BUG.
Referenced by iop_usb_config(), and iop_usb_set_port_feat().
Definition at line 969 of file iop-usb.c.
References wait_mpu_idle().
Referenced by fe_irq_request(), iop_usb_dma_map(), iop_usb_get_frame(), iop_usb_port_stat(), iop_usb_start(), and mpu_rh_port_request().
static void remove_descr_in | ( | struct iop_usb_ed * | ed, | |
struct iop_usb_td * | first, | |||
struct iop_usb_td * | last | |||
) | [static] |
Definition at line 693 of file iop-usb.c.
Referenced by iop_usb_trans_dequeue(), and iop_usb_trans_enqueue().
static void remove_descr_out | ( | struct iop_usb_ed * | ed, | |
struct iop_usb_td * | first, | |||
struct iop_usb_td * | last | |||
) | [static] |
Definition at line 651 of file iop-usb.c.
References reset_out_context().
Referenced by iop_usb_trans_dequeue().
static __inline__ void reset_ed_status | ( | struct iop_usb_ed * | ed | ) | [static] |
static void reset_out_context | ( | struct iop_usb_ed * | ed, | |
struct iop_usb_td * | td | |||
) | [static] |
Definition at line 282 of file iop-usb.c.
Referenced by finish_data(), insert_descr_out(), and remove_descr_out().
static void schedule_periodic | ( | unsigned int | type, | |
dma_descr_context * | ctxt | |||
) | [static] |
Definition at line 331 of file iop-usb.c.
References ctxt_head, ctxt_to_ed(), group_periodic, groups, int, and num.
Referenced by iop_usb_endpoint_add(), and iop_usb_endpoint_release().
static __inline__ int wait_mpu_idle | ( | void | ) | [static] |
Definition at line 945 of file iop-usb.c.
References IOP_TIMEOUT, and timeout.
Referenced by fe_irq_request(), mpu_halt(), mpu_rh_port_request(), mpu_start(), read_mpu_mem(), and write_mpu_mem().
static __inline__ int wait_mpu_reg_data | ( | void | ) | [static] |
Definition at line 957 of file iop-usb.c.
References data, IOP_TIMEOUT, and timeout.
Referenced by mpu_rh_port_request().
static void wait_on_ctxt | ( | struct iop_usb_ed * | ed | ) | [static] |
Definition at line 300 of file iop-usb.c.
References group_head, group_periodic, groups, int, and type.
Referenced by iop_usb_endpoint_release_wait(), and iop_usb_trans_dequeue_lock().
Definition at line 989 of file iop-usb.c.
References wait_mpu_idle().
Referenced by iop_usb_start().
dma_descr_context* ctxt_eol [static] |
Definition at line 84 of file iop-usb.c.
Referenced by alloc_static_descrs(), init_dma(), and init_dma_periodic().
dma_descr_context* ctxt_head [static] |
Definition at line 83 of file iop-usb.c.
Referenced by alloc_static_descrs(), init_dma(), init_dma_periodic(), iop_usb_endpoint_add(), iop_usb_endpoint_release(), iop_usb_trans_done_irq(), and schedule_periodic().
dma_descr_context* ctxt_in_eol [static] |
Definition at line 85 of file iop-usb.c.
Referenced by alloc_static_descrs(), finish_data(), init_dma_in(), and iop_usb_endpoint_init().
char* cur_static_descr [static] |
Definition at line 112 of file iop-usb.c.
Referenced by alloc_static_descr(), and init_alloc_static_descr().
char* dummy_buf [static] |
dma_descr_group* group_head [static] |
Definition at line 75 of file iop-usb.c.
Referenced by alloc_static_descrs(), enable_group(), init_dma(), init_dma_periodic(), iop_usb_endpoint_add(), iop_usb_endpoint_release(), iop_usb_stop_periodic(), and wait_on_ctxt().
struct { ... } group_periodic[NUM_PER_TRANSFER_TYPE] [static] |
Referenced by alloc_static_descrs(), init_dma(), init_dma_periodic(), schedule_periodic(), and wait_on_ctxt().
dma_descr_group* group_top [static] |
unsigned long group_top_phys [static] |
dma_descr_group* groups |
Definition at line 78 of file iop-usb.c.
Referenced by create_elphel353_kdevelop(), createDefaultConfig(), encodeConfig(), init_dma(), init_dma_periodic(), mainJavascript(), schedule_periodic(), and wait_on_ctxt().
unsigned int port_power [static] |
Definition at line 42 of file iop-usb.c.
Referenced by iop_usb_clr_port_feat(), iop_usb_port_stat(), iop_usb_set_port_feat(), and iop_usb_start().