Commit 48f61f83 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman

staging: octeon-usb: cvmx_usb_transaction_t -> struct cvmx_usb_transaction

Replace cvmx_usb_transaction_t with struct cvmx_usb_transaction.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a24ed35a
...@@ -115,29 +115,46 @@ enum cvmx_usb_stage { ...@@ -115,29 +115,46 @@ enum cvmx_usb_stage {
}; };
/** /**
* This structure describes each pending USB transaction * struct cvmx_usb_transaction - describes each pending USB transaction
* regardless of type. These are linked together to form a list * regardless of type. These are linked together
* of pending requests for a pipe. * to form a list of pending requests for a pipe.
*/ *
typedef struct cvmx_usb_transaction { * @prev: Transaction before this one in the pipe.
struct cvmx_usb_transaction *prev; /**< Transaction before this one in the pipe */ * @next: Transaction after this one in the pipe.
struct cvmx_usb_transaction *next; /**< Transaction after this one in the pipe */ * @type: Type of transaction, duplicated of the pipe.
enum cvmx_usb_transfer type; /**< Type of transaction, duplicated of the pipe */ * @flags: State flags for this transaction.
enum cvmx_usb_transaction_flags flags; /**< State flags for this transaction */ * @buffer: User's physical buffer address to read/write.
uint64_t buffer; /**< User's physical buffer address to read/write */ * @buffer_length: Size of the user's buffer in bytes.
int buffer_length; /**< Size of the user's buffer in bytes */ * @control_header: For control transactions, physical address of the 8
uint64_t control_header; /**< For control transactions, physical address of the 8 byte standard header */ * byte standard header.
int iso_start_frame; /**< For ISO transactions, the starting frame number */ * @iso_start_frame: For ISO transactions, the starting frame number.
int iso_number_packets; /**< For ISO transactions, the number of packets in the request */ * @iso_number_packets: For ISO transactions, the number of packets in the
struct cvmx_usb_iso_packet *iso_packets;/**< For ISO transactions, the sub packets in the request */ * request.
* @iso_packets: For ISO transactions, the sub packets in the request.
* @actual_bytes: Actual bytes transfer for this transaction.
* @stage: For control transactions, the current stage.
* @callback: User's callback function when complete.
* @callback_data: User's data.
*/
struct cvmx_usb_transaction {
struct cvmx_usb_transaction *prev;
struct cvmx_usb_transaction *next;
enum cvmx_usb_transfer type;
enum cvmx_usb_transaction_flags flags;
uint64_t buffer;
int buffer_length;
uint64_t control_header;
int iso_start_frame;
int iso_number_packets;
struct cvmx_usb_iso_packet *iso_packets;
int xfersize; int xfersize;
int pktcnt; int pktcnt;
int retries; int retries;
int actual_bytes; /**< Actual bytes transfer for this transaction */ int actual_bytes;
enum cvmx_usb_stage stage; /**< For control transactions, the current stage */ enum cvmx_usb_stage stage;
cvmx_usb_callback_func_t callback; /**< User's callback function when complete */ cvmx_usb_callback_func_t callback;
void *callback_data; /**< User's data */ void *callback_data;
} cvmx_usb_transaction_t; };
/** /**
* A pipe represents a virtual connection between Octeon and some * A pipe represents a virtual connection between Octeon and some
...@@ -146,8 +163,8 @@ typedef struct cvmx_usb_transaction { ...@@ -146,8 +163,8 @@ typedef struct cvmx_usb_transaction {
typedef struct cvmx_usb_pipe { typedef struct cvmx_usb_pipe {
struct cvmx_usb_pipe *prev; /**< Pipe before this one in the list */ struct cvmx_usb_pipe *prev; /**< Pipe before this one in the list */
struct cvmx_usb_pipe *next; /**< Pipe after this one in the list */ struct cvmx_usb_pipe *next; /**< Pipe after this one in the list */
cvmx_usb_transaction_t *head; /**< The first pending transaction */ struct cvmx_usb_transaction *head; /**< The first pending transaction */
cvmx_usb_transaction_t *tail; /**< The last pending transaction */ struct cvmx_usb_transaction *tail; /**< The last pending transaction */
uint64_t interval; /**< For periodic pipes, the interval between packets in frames */ uint64_t interval; /**< For periodic pipes, the interval between packets in frames */
uint64_t next_tx_frame; /**< The next frame this pipe is allowed to transmit on */ uint64_t next_tx_frame; /**< The next frame this pipe is allowed to transmit on */
enum cvmx_usb_pipe_flags flags; /**< State flags for this pipe */ enum cvmx_usb_pipe_flags flags; /**< State flags for this pipe */
...@@ -189,10 +206,10 @@ typedef struct { ...@@ -189,10 +206,10 @@ typedef struct {
int idle_hardware_channels; /**< Bit set for every idle hardware channel */ int idle_hardware_channels; /**< Bit set for every idle hardware channel */
cvmx_usbcx_hprt_t usbcx_hprt; /**< Stored port status so we don't need to read a CSR to determine splits */ cvmx_usbcx_hprt_t usbcx_hprt; /**< Stored port status so we don't need to read a CSR to determine splits */
cvmx_usb_pipe_t *pipe_for_channel[MAX_CHANNELS]; /**< Map channels to pipes */ cvmx_usb_pipe_t *pipe_for_channel[MAX_CHANNELS]; /**< Map channels to pipes */
cvmx_usb_transaction_t *free_transaction_head; /**< List of free transactions head */ struct cvmx_usb_transaction *free_transaction_head; /**< List of free transactions head */
cvmx_usb_transaction_t *free_transaction_tail; /**< List of free transactions tail */ struct cvmx_usb_transaction *free_transaction_tail; /**< List of free transactions tail */
cvmx_usb_pipe_t pipe[MAX_PIPES]; /**< Storage for pipes */ cvmx_usb_pipe_t pipe[MAX_PIPES]; /**< Storage for pipes */
cvmx_usb_transaction_t transaction[MAX_TRANSACTIONS]; /**< Storage for transactions */ struct cvmx_usb_transaction transaction[MAX_TRANSACTIONS]; /**< Storage for transactions */
cvmx_usb_callback_func_t callback[__CVMX_USB_CALLBACK_END]; /**< User global callbacks */ cvmx_usb_callback_func_t callback[__CVMX_USB_CALLBACK_END]; /**< User global callbacks */
void *callback_data[__CVMX_USB_CALLBACK_END]; /**< User data for each callback */ void *callback_data[__CVMX_USB_CALLBACK_END]; /**< User data for each callback */
int indent; /**< Used by debug output to indent functions */ int indent; /**< Used by debug output to indent functions */
...@@ -201,7 +218,7 @@ typedef struct { ...@@ -201,7 +218,7 @@ typedef struct {
cvmx_usb_pipe_list_t idle_pipes; /**< List of open pipes that have no transactions */ cvmx_usb_pipe_list_t idle_pipes; /**< List of open pipes that have no transactions */
cvmx_usb_pipe_list_t active_pipes[4]; /**< Active pipes indexed by transfer type */ cvmx_usb_pipe_list_t active_pipes[4]; /**< Active pipes indexed by transfer type */
uint64_t frame_number; /**< Increments every SOF interrupt for time keeping */ uint64_t frame_number; /**< Increments every SOF interrupt for time keeping */
cvmx_usb_transaction_t *active_split; /**< Points to the current active split, or NULL */ struct cvmx_usb_transaction *active_split; /**< Points to the current active split, or NULL */
cvmx_usb_tx_fifo_t periodic; cvmx_usb_tx_fifo_t periodic;
cvmx_usb_tx_fifo_t nonperiodic; cvmx_usb_tx_fifo_t nonperiodic;
} cvmx_usb_internal_state_t; } cvmx_usb_internal_state_t;
...@@ -391,9 +408,9 @@ int cvmx_usb_get_num_ports(void) ...@@ -391,9 +408,9 @@ int cvmx_usb_get_num_ports(void)
* *
* Returns: Transaction or NULL * Returns: Transaction or NULL
*/ */
static inline cvmx_usb_transaction_t *__cvmx_usb_alloc_transaction(cvmx_usb_internal_state_t *usb) static inline struct cvmx_usb_transaction *__cvmx_usb_alloc_transaction(cvmx_usb_internal_state_t *usb)
{ {
cvmx_usb_transaction_t *t; struct cvmx_usb_transaction *t;
t = usb->free_transaction_head; t = usb->free_transaction_head;
if (t) { if (t) {
usb->free_transaction_head = t->next; usb->free_transaction_head = t->next;
...@@ -417,7 +434,7 @@ static inline cvmx_usb_transaction_t *__cvmx_usb_alloc_transaction(cvmx_usb_inte ...@@ -417,7 +434,7 @@ static inline cvmx_usb_transaction_t *__cvmx_usb_alloc_transaction(cvmx_usb_inte
* Transaction to free * Transaction to free
*/ */
static inline void __cvmx_usb_free_transaction(cvmx_usb_internal_state_t *usb, static inline void __cvmx_usb_free_transaction(cvmx_usb_internal_state_t *usb,
cvmx_usb_transaction_t *transaction) struct cvmx_usb_transaction *transaction)
{ {
transaction->flags = 0; transaction->flags = 0;
transaction->prev = NULL; transaction->prev = NULL;
...@@ -1022,7 +1039,7 @@ void cvmx_usb_set_status(struct cvmx_usb_state *state, struct cvmx_usb_port_stat ...@@ -1022,7 +1039,7 @@ void cvmx_usb_set_status(struct cvmx_usb_state *state, struct cvmx_usb_port_stat
* Returns: Handle * Returns: Handle
*/ */
static inline int __cvmx_usb_get_submit_handle(cvmx_usb_internal_state_t *usb, static inline int __cvmx_usb_get_submit_handle(cvmx_usb_internal_state_t *usb,
cvmx_usb_transaction_t *transaction) struct cvmx_usb_transaction *transaction)
{ {
return ((unsigned long)transaction - (unsigned long)usb->transaction) / return ((unsigned long)transaction - (unsigned long)usb->transaction) /
sizeof(*transaction); sizeof(*transaction);
...@@ -1380,7 +1397,7 @@ static void __cvmx_usb_start_channel_control(cvmx_usb_internal_state_t *usb, ...@@ -1380,7 +1397,7 @@ static void __cvmx_usb_start_channel_control(cvmx_usb_internal_state_t *usb,
int channel, int channel,
cvmx_usb_pipe_t *pipe) cvmx_usb_pipe_t *pipe)
{ {
cvmx_usb_transaction_t *transaction = pipe->head; struct cvmx_usb_transaction *transaction = pipe->head;
cvmx_usb_control_header_t *header = cvmx_phys_to_ptr(transaction->control_header); cvmx_usb_control_header_t *header = cvmx_phys_to_ptr(transaction->control_header);
int bytes_to_transfer = transaction->buffer_length - transaction->actual_bytes; int bytes_to_transfer = transaction->buffer_length - transaction->actual_bytes;
int packets_to_transfer; int packets_to_transfer;
...@@ -1509,7 +1526,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb, ...@@ -1509,7 +1526,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
int channel, int channel,
cvmx_usb_pipe_t *pipe) cvmx_usb_pipe_t *pipe)
{ {
cvmx_usb_transaction_t *transaction = pipe->head; struct cvmx_usb_transaction *transaction = pipe->head;
/* Make sure all writes to the DMA region get flushed */ /* Make sure all writes to the DMA region get flushed */
CVMX_SYNCW; CVMX_SYNCW;
...@@ -1900,7 +1917,7 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof) ...@@ -1900,7 +1917,7 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof)
*/ */
static void __cvmx_usb_perform_callback(cvmx_usb_internal_state_t *usb, static void __cvmx_usb_perform_callback(cvmx_usb_internal_state_t *usb,
cvmx_usb_pipe_t *pipe, cvmx_usb_pipe_t *pipe,
cvmx_usb_transaction_t *transaction, struct cvmx_usb_transaction *transaction,
enum cvmx_usb_callback reason, enum cvmx_usb_callback reason,
enum cvmx_usb_complete complete_code) enum cvmx_usb_complete complete_code)
{ {
...@@ -1945,7 +1962,7 @@ static void __cvmx_usb_perform_callback(cvmx_usb_internal_state_t *usb, ...@@ -1945,7 +1962,7 @@ static void __cvmx_usb_perform_callback(cvmx_usb_internal_state_t *usb,
*/ */
static void __cvmx_usb_perform_complete(cvmx_usb_internal_state_t *usb, static void __cvmx_usb_perform_complete(cvmx_usb_internal_state_t *usb,
cvmx_usb_pipe_t *pipe, cvmx_usb_pipe_t *pipe,
cvmx_usb_transaction_t *transaction, struct cvmx_usb_transaction *transaction,
enum cvmx_usb_complete complete_code) enum cvmx_usb_complete complete_code)
{ {
/* If this was a split then clear our split in progress marker */ /* If this was a split then clear our split in progress marker */
...@@ -2037,7 +2054,7 @@ static int __cvmx_usb_submit_transaction(cvmx_usb_internal_state_t *usb, ...@@ -2037,7 +2054,7 @@ static int __cvmx_usb_submit_transaction(cvmx_usb_internal_state_t *usb,
void *user_data) void *user_data)
{ {
int submit_handle; int submit_handle;
cvmx_usb_transaction_t *transaction; struct cvmx_usb_transaction *transaction;
cvmx_usb_pipe_t *pipe = usb->pipe + pipe_handle; cvmx_usb_pipe_t *pipe = usb->pipe + pipe_handle;
if (unlikely((pipe_handle < 0) || (pipe_handle >= MAX_PIPES))) if (unlikely((pipe_handle < 0) || (pipe_handle >= MAX_PIPES)))
...@@ -2382,7 +2399,7 @@ int cvmx_usb_submit_isochronous(struct cvmx_usb_state *state, int pipe_handle, ...@@ -2382,7 +2399,7 @@ int cvmx_usb_submit_isochronous(struct cvmx_usb_state *state, int pipe_handle,
*/ */
int cvmx_usb_cancel(struct cvmx_usb_state *state, int pipe_handle, int submit_handle) int cvmx_usb_cancel(struct cvmx_usb_state *state, int pipe_handle, int submit_handle)
{ {
cvmx_usb_transaction_t *transaction; struct cvmx_usb_transaction *transaction;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state; cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
cvmx_usb_pipe_t *pipe = usb->pipe + pipe_handle; cvmx_usb_pipe_t *pipe = usb->pipe + pipe_handle;
...@@ -2561,7 +2578,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -2561,7 +2578,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
cvmx_usbcx_hctsizx_t usbc_hctsiz; cvmx_usbcx_hctsizx_t usbc_hctsiz;
cvmx_usbcx_hccharx_t usbc_hcchar; cvmx_usbcx_hccharx_t usbc_hcchar;
cvmx_usb_pipe_t *pipe; cvmx_usb_pipe_t *pipe;
cvmx_usb_transaction_t *transaction; struct cvmx_usb_transaction *transaction;
int bytes_this_transfer; int bytes_this_transfer;
int bytes_in_last_packet; int bytes_in_last_packet;
int packets_processed; int packets_processed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment