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

staging: octeon-usb: cvmx-usb: fix whitespace issues

Fix most of the whitespace issues reported by checkpatch:
	- use tabs for indentation
	- brace placement vs. newlines
	- (foo_t*) -> (foo_t *)
	- i=0 -> i = 0
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 95e67a7a
......@@ -213,8 +213,7 @@ typedef struct {
uint64_t done = cvmx_get_cycle() + (uint64_t)timeout_usec * \
octeon_get_clock_rate() / 1000000; \
type c; \
while (1) \
{ \
while (1) { \
c.u32 = __cvmx_usb_read_csr32(usb, address); \
if (c.s.field op (value)) { \
result = 0; \
......@@ -226,16 +225,16 @@ typedef struct {
cvmx_wait(100); \
} \
} while (0); \
result;})
result; })
/* This macro logically sets a single field in a CSR. It does the sequence
read, modify, and write */
#define USB_SET_FIELD32(address, type, field, value)\
#define USB_SET_FIELD32(address, type, field, value) \
do { \
type c; \
c.u32 = __cvmx_usb_read_csr32(usb, address);\
c.u32 = __cvmx_usb_read_csr32(usb, address); \
c.s.field = value; \
__cvmx_usb_write_csr32(usb, address, c.u32);\
__cvmx_usb_write_csr32(usb, address, c.u32); \
} while (0)
/* Returns the IO address to push/pop stuff data from the FIFOs */
......@@ -470,13 +469,11 @@ static inline void __cvmx_usb_remove_pipe(cvmx_usb_pipe_list_t *list, cvmx_usb_p
list->head->prev = NULL;
else
list->tail = NULL;
}
else if (list->tail == pipe) {
} else if (list->tail == pipe) {
list->tail = pipe->prev;
list->tail->next = NULL;
pipe->prev = NULL;
}
else {
} else {
pipe->prev->next = pipe->next;
pipe->next->prev = pipe->prev;
pipe->prev = NULL;
......@@ -507,7 +504,7 @@ int cvmx_usb_initialize(cvmx_usb_state_t *state, int usb_port_number,
{
cvmx_usbnx_clk_ctl_t usbn_clk_ctl;
cvmx_usbnx_usbp_ctl_status_t usbn_usbp_ctl_status;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
usb->init_flags = flags;
......@@ -559,9 +556,9 @@ int cvmx_usb_initialize(cvmx_usb_state_t *state, int usb_port_number,
/* Initialize the transaction double linked list */
usb->free_transaction_head = NULL;
usb->free_transaction_tail = NULL;
for (i=0; i<MAX_TRANSACTIONS; i++)
for (i = 0; i < MAX_TRANSACTIONS; i++)
__cvmx_usb_free_transaction(usb, usb->transaction + i);
for (i=0; i<MAX_PIPES; i++)
for (i = 0; i < MAX_PIPES; i++)
__cvmx_usb_append_pipe(&usb->free_pipes, usb->pipe + i);
}
......@@ -585,8 +582,7 @@ int cvmx_usb_initialize(cvmx_usb_state_t *state, int usb_port_number,
if (OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
usbn_clk_ctl.cn31xx.p_rclk = 1; /* From CN31XX,CN30XX manual */
usbn_clk_ctl.cn31xx.p_xenbn = 0;
}
else if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN50XX))
} else if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN50XX))
usbn_clk_ctl.cn56xx.p_rtype = 2; /* From CN56XX,CN50XX manual */
else
usbn_clk_ctl.cn52xx.p_rtype = 1; /* From CN52XX manual */
......@@ -602,15 +598,13 @@ int cvmx_usb_initialize(cvmx_usb_state_t *state, int usb_port_number,
usbn_clk_ctl.s.p_c_sel = 2;
break;
}
}
else {
} else {
/* The USB port uses a 12MHz crystal as clock source
at USB_XO and USB_XI */
if (OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
usbn_clk_ctl.cn31xx.p_rclk = 1; /* From CN31XX,CN30XX manual */
usbn_clk_ctl.cn31xx.p_xenbn = 1;
}
else if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN50XX))
} else if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN50XX))
usbn_clk_ctl.cn56xx.p_rtype = 0; /* From CN56XX,CN50XX manual */
else
usbn_clk_ctl.cn52xx.p_rtype = 0; /* From CN52XX manual */
......@@ -748,7 +742,7 @@ int cvmx_usb_initialize(cvmx_usb_state_t *state, int usb_port_number,
usbcx_gintmsk.u32);
/* Disable all channel interrupts. We'll enable them per channel later */
for (channel=0; channel<8; channel++)
for (channel = 0; channel < 8; channel++)
__cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTMSKX(channel, usb->index), 0);
}
......@@ -794,7 +788,7 @@ int cvmx_usb_initialize(cvmx_usb_state_t *state, int usb_port_number,
int cvmx_usb_shutdown(cvmx_usb_state_t *state)
{
cvmx_usbnx_clk_ctl_t usbn_clk_ctl;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
/* Make sure all pipes are closed */
if (usb->idle_pipes.head ||
......@@ -829,7 +823,7 @@ int cvmx_usb_shutdown(cvmx_usb_state_t *state)
int cvmx_usb_enable(cvmx_usb_state_t *state)
{
cvmx_usbcx_ghwcfg3_t usbcx_ghwcfg3;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
usb->usbcx_hprt.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index));
......@@ -911,7 +905,7 @@ int cvmx_usb_enable(cvmx_usb_state_t *state)
*/
int cvmx_usb_disable(cvmx_usb_state_t *state)
{
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
/* Disable the port */
USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt_t, prtena, 1);
......@@ -937,7 +931,7 @@ cvmx_usb_port_status_t cvmx_usb_get_status(cvmx_usb_state_t *state)
{
cvmx_usbcx_hprt_t usbc_hprt;
cvmx_usb_port_status_t result;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
memset(&result, 0, sizeof(result));
......@@ -967,7 +961,7 @@ cvmx_usb_port_status_t cvmx_usb_get_status(cvmx_usb_state_t *state)
*/
void cvmx_usb_set_status(cvmx_usb_state_t *state, cvmx_usb_port_status_t port_status)
{
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
usb->port_status = port_status;
return;
}
......@@ -1073,7 +1067,7 @@ int cvmx_usb_open_pipe(cvmx_usb_state_t *state, cvmx_usb_pipe_flags_t flags,
int multi_count, int hub_device_addr, int hub_port)
{
cvmx_usb_pipe_t *pipe;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
if (unlikely((device_addr < 0) || (device_addr > MAX_USB_ADDRESS)))
return -EINVAL;
......@@ -1126,8 +1120,7 @@ int cvmx_usb_open_pipe(cvmx_usb_state_t *state, cvmx_usb_pipe_flags_t flags,
pipe->interval = interval*8;
/* Force start splits to be schedule on uFrame 0 */
pipe->next_tx_frame = ((usb->frame_number+7)&~7) + pipe->interval;
}
else {
} else {
pipe->interval = interval;
pipe->next_tx_frame = usb->frame_number + pipe->interval;
}
......@@ -1426,14 +1419,13 @@ static void __cvmx_usb_start_channel_control(cvmx_usb_internal_state_t *usb,
packets_to_transfer = (bytes_to_transfer + pipe->max_packet - 1) / pipe->max_packet;
if (packets_to_transfer == 0)
packets_to_transfer = 1;
else if ((packets_to_transfer>1) && (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
else if ((packets_to_transfer > 1) && (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
/* Limit to one packet when not using DMA. Channels must be restarted
between every packet for IN transactions, so there is no reason to
do multiple packets in a row */
packets_to_transfer = 1;
bytes_to_transfer = packets_to_transfer * pipe->max_packet;
}
else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
/* Limit the number of packet and data transferred to what the
hardware can handle */
packets_to_transfer = MAX_TRANSFER_PACKETS;
......@@ -1541,8 +1533,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
pipe->split_sc_frame = (usb->frame_number + 1) & 0x7f;
else
pipe->split_sc_frame = (usb->frame_number + 2) & 0x7f;
}
else
} else
pipe->split_sc_frame = -1;
usbc_hcsplt.s.spltena = 1;
......@@ -1572,8 +1563,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
usbc_hcsplt.s.xactpos = 3; /* Entire payload in one go */
else
usbc_hcsplt.s.xactpos = 2; /* First part of payload */
}
else {
} else {
/* Continuing the previous data, we must either be
in the middle or at the end */
if (bytes_to_transfer <= 188)
......@@ -1600,14 +1590,13 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
packets_to_transfer = (bytes_to_transfer + pipe->max_packet - 1) / pipe->max_packet;
if (packets_to_transfer == 0)
packets_to_transfer = 1;
else if ((packets_to_transfer>1) && (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
else if ((packets_to_transfer > 1) && (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
/* Limit to one packet when not using DMA. Channels must be restarted
between every packet for IN transactions, so there is no reason to
do multiple packets in a row */
packets_to_transfer = 1;
bytes_to_transfer = packets_to_transfer * pipe->max_packet;
}
else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
/* Limit the number of packet and data transferred to what the
hardware can handle */
packets_to_transfer = MAX_TRANSFER_PACKETS;
......@@ -1778,14 +1767,14 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof)
/* Only enable SOF interrupts when we have transactions pending in the
future that might need to be scheduled */
need_sof = 0;
for (ttype=CVMX_USB_TRANSFER_CONTROL; ttype<=CVMX_USB_TRANSFER_INTERRUPT; ttype++) {
for (ttype = CVMX_USB_TRANSFER_CONTROL; ttype <= CVMX_USB_TRANSFER_INTERRUPT; ttype++) {
pipe = usb->active_pipes[ttype].head;
while (pipe) {
if (pipe->next_tx_frame > usb->frame_number) {
need_sof = 1;
break;
}
pipe=pipe->next;
pipe = pipe->next;
}
}
USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), cvmx_usbcx_gintmsk_t, sofmsk, need_sof);
......@@ -1852,7 +1841,7 @@ static void __cvmx_usb_perform_callback(cvmx_usb_internal_state_t *usb,
* @param complete_code
* Completion code
*/
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_transaction_t *transaction,
cvmx_usb_complete_t complete_code)
......@@ -1977,8 +1966,7 @@ static int __cvmx_usb_submit_transaction(cvmx_usb_internal_state_t *usb,
if (pipe->tail) {
transaction->prev = pipe->tail;
transaction->prev->next = transaction;
}
else {
} else {
if (pipe->next_tx_frame < usb->frame_number)
pipe->next_tx_frame = usb->frame_number + pipe->interval -
(usb->frame_number - pipe->next_tx_frame) % pipe->interval;
......@@ -2035,7 +2023,7 @@ int cvmx_usb_submit_bulk(cvmx_usb_state_t *state, int pipe_handle,
void *user_data)
{
int submit_handle;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
/* Pipe handle checking is done later in a common place */
if (unlikely(!buffer))
......@@ -2094,7 +2082,7 @@ int cvmx_usb_submit_interrupt(cvmx_usb_state_t *state, int pipe_handle,
void *user_data)
{
int submit_handle;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
/* Pipe handle checking is done later in a common place */
if (unlikely(!buffer))
......@@ -2158,7 +2146,7 @@ int cvmx_usb_submit_control(cvmx_usb_state_t *state, int pipe_handle,
void *user_data)
{
int submit_handle;
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_control_header_t *header = cvmx_phys_to_ptr(control_header);
/* Pipe handle checking is done later in a common place */
......@@ -2240,7 +2228,7 @@ int cvmx_usb_submit_isochronous(cvmx_usb_state_t *state, int pipe_handle,
void *user_data)
{
int submit_handle;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
/* Pipe handle checking is done later in a common place */
if (unlikely(start_frame < 0))
......@@ -2290,7 +2278,7 @@ int cvmx_usb_submit_isochronous(cvmx_usb_state_t *state, int pipe_handle,
int cvmx_usb_cancel(cvmx_usb_state_t *state, int pipe_handle, int submit_handle)
{
cvmx_usb_transaction_t *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;
if (unlikely((pipe_handle < 0) || (pipe_handle >= MAX_PIPES)))
......@@ -2344,7 +2332,7 @@ int cvmx_usb_cancel(cvmx_usb_state_t *state, int pipe_handle, int submit_handle)
*/
int cvmx_usb_cancel_all(cvmx_usb_state_t *state, int pipe_handle)
{
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;
if (unlikely((pipe_handle < 0) || (pipe_handle >= MAX_PIPES)))
......@@ -2378,7 +2366,7 @@ int cvmx_usb_cancel_all(cvmx_usb_state_t *state, int pipe_handle)
*/
int cvmx_usb_close_pipe(cvmx_usb_state_t *state, int pipe_handle)
{
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;
if (unlikely((pipe_handle < 0) || (pipe_handle >= MAX_PIPES)))
......@@ -2416,7 +2404,7 @@ int cvmx_usb_register_callback(cvmx_usb_state_t *state,
cvmx_usb_callback_func_t callback,
void *user_data)
{
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
if (unlikely(reason >= __CVMX_USB_CALLBACK_END))
return -EINVAL;
......@@ -2442,7 +2430,7 @@ int cvmx_usb_register_callback(cvmx_usb_state_t *state,
int cvmx_usb_get_frame_number(cvmx_usb_state_t *state)
{
int frame_number;
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_usbcx_hfnum_t usbc_hfnum;
usbc_hfnum.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index));
......@@ -2499,17 +2487,14 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
usbc_hcchar.s.chdis = 1;
__cvmx_usb_write_csr32(usb, CVMX_USBCX_HCCHARX(channel, usb->index), usbc_hcchar.u32);
return 0;
}
else if (usbc_hcint.s.xfercompl) {
} else if (usbc_hcint.s.xfercompl) {
/* Successful IN/OUT with transfer complete. Channel halt isn't needed */
}
else {
} else {
cvmx_dprintf("USB%d: Channel %d interrupt without halt\n", usb->index, channel);
return 0;
}
}
}
else {
} else {
/* There is are no interrupts that we need to process when the channel is
still running */
if (!usbc_hcint.s.chhltd)
......@@ -2548,8 +2533,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
value of xfersize from its starting value and we know how many
bytes were written to the buffer */
bytes_this_transfer = transaction->xfersize - usbc_hctsiz.s.xfersize;
}
else {
} else {
/* OUT transaction don't decrement xfersize. Instead pktcnt is
decremented on every successful packet send. The hardware does
this when it receives an ACK, or NYET. If it doesn't
......@@ -2601,8 +2585,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
transferred */
pipe->pid_toggle = 0;
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_STALL);
}
else if (usbc_hcint.s.xacterr) {
} else if (usbc_hcint.s.xacterr) {
/* We know at least one packet worked if we get a ACK or NAK. Reset the retry counter */
if (usbc_hcint.s.nak || usbc_hcint.s.ack)
transaction->retries = 0;
......@@ -2611,8 +2594,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
/* XactErr as a response means the device signaled something wrong with
the transfer. For example, PID toggle errors cause these */
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_XACTERR);
}
else {
} else {
/* If this was a split then clear our split in progress marker */
if (usb->active_split == transaction)
usb->active_split = NULL;
......@@ -2625,18 +2607,13 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
pipe->next_tx_frame = usb->frame_number + pipe->interval -
(usb->frame_number - pipe->next_tx_frame) % pipe->interval;
}
}
else if (usbc_hcint.s.bblerr)
{
} else if (usbc_hcint.s.bblerr) {
/* Babble Error (BblErr) */
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_BABBLEERR);
}
else if (usbc_hcint.s.datatglerr)
{
} else if (usbc_hcint.s.datatglerr) {
/* We'll retry the exact same transaction again */
transaction->retries++;
}
else if (usbc_hcint.s.nyet) {
} else if (usbc_hcint.s.nyet) {
/* NYET as a response is only allowed in three cases: as a response to
a ping, as a response to a split transaction, and as a response to
a bulk out. The ping case is handled by hardware, so we only have
......@@ -2647,8 +2624,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
this transaction is complete */
if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet))
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
}
else {
} else {
/* Split transactions retry the split complete 4 times then rewind
to the start split and do the entire transactions again */
transaction->retries++;
......@@ -2659,8 +2635,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
pipe->split_sc_frame = -1;
}
}
}
else if (usbc_hcint.s.ack) {
} else if (usbc_hcint.s.ack) {
transaction->retries = 0;
/* The ACK bit can only be checked after the other error bits. This is
because a multi packet transfer may succeed in a number of packets
......@@ -2673,11 +2648,9 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
pipe */
pipe->flags &= ~__CVMX_USB_PIPE_FLAGS_NEED_PING;
switch (transaction->type)
{
switch (transaction->type) {
case CVMX_USB_TRANSFER_CONTROL:
switch (transaction->stage)
{
switch (transaction->stage) {
case CVMX_USB_STAGE_NON_CONTROL:
case CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE:
/* This should be impossible */
......@@ -2716,8 +2689,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
else
transaction->actual_bytes += pipe->max_packet;
}
}
else if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) {
} else if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) {
pipe->pid_toggle = 1;
transaction->stage = CVMX_USB_STAGE_STATUS;
}
......@@ -2726,8 +2698,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) {
pipe->pid_toggle = 1;
transaction->stage = CVMX_USB_STAGE_STATUS;
}
else {
} else {
transaction->stage = CVMX_USB_STAGE_DATA;
}
break;
......@@ -2760,8 +2731,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
}
}
}
else {
} else {
if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) &&
(pipe->transfer_type == CVMX_USB_TRANSFER_BULK) &&
(pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
......@@ -2788,8 +2758,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
pipe->next_tx_frame += pipe->interval;
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
}
}
else {
} else {
if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE) {
/* We are in the incoming data phase. Keep getting
data until we run out of space or get a small
......@@ -2798,19 +2767,16 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
pipe->next_tx_frame += pipe->interval;
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
}
}
else
} else
transaction->stage = CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
}
}
else {
} else {
pipe->next_tx_frame += pipe->interval;
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
}
break;
}
}
else if (usbc_hcint.s.nak) {
} else if (usbc_hcint.s.nak) {
/* If this was a split then clear our split in progress marker */
if (usb->active_split == transaction)
usb->active_split = NULL;
......@@ -2824,17 +2790,13 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
if (pipe->next_tx_frame < usb->frame_number)
pipe->next_tx_frame = usb->frame_number + pipe->interval -
(usb->frame_number - pipe->next_tx_frame) % pipe->interval;
}
else {
} else {
cvmx_usb_port_status_t port;
port = cvmx_usb_get_status((cvmx_usb_state_t *)usb);
if (port.port_enabled)
{
if (port.port_enabled) {
/* We'll retry the exact same transaction again */
transaction->retries++;
}
else
{
} else {
/* We get channel halted interrupts with no result bits sets when the
cable is unplugged */
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_ERROR);
......@@ -2859,7 +2821,7 @@ int cvmx_usb_poll(cvmx_usb_state_t *state)
{
cvmx_usbcx_hfnum_t usbc_hfnum;
cvmx_usbcx_gintsts_t usbc_gintsts;
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_PREFETCH(usb, 0);
CVMX_PREFETCH(usb, 1*128);
......
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