Commit 3e842f73 authored by Devendra Naga's avatar Devendra Naga Committed by Greg Kroah-Hartman

staging: octeon-usb: fix checkpatch error

this places the opening braces just after the if, else, elseif, switch
statements

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Signed-off-by: default avatarDevendra Naga <devendra.aaru@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1ead9c58
...@@ -1674,15 +1674,13 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb, ...@@ -1674,15 +1674,13 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
usbc_hcintmsk.u32 = 0; usbc_hcintmsk.u32 = 0;
usbc_hcintmsk.s.chhltdmsk = 1; usbc_hcintmsk.s.chhltdmsk = 1;
if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
{
/* Channels need these extra interrupts when we aren't in DMA mode */ /* Channels need these extra interrupts when we aren't in DMA mode */
usbc_hcintmsk.s.datatglerrmsk = 1; usbc_hcintmsk.s.datatglerrmsk = 1;
usbc_hcintmsk.s.frmovrunmsk = 1; usbc_hcintmsk.s.frmovrunmsk = 1;
usbc_hcintmsk.s.bblerrmsk = 1; usbc_hcintmsk.s.bblerrmsk = 1;
usbc_hcintmsk.s.xacterrmsk = 1; usbc_hcintmsk.s.xacterrmsk = 1;
if (__cvmx_usb_pipe_needs_split(usb, pipe)) if (__cvmx_usb_pipe_needs_split(usb, pipe)) {
{
/* Splits don't generate xfercompl, so we need ACK and NYET */ /* Splits don't generate xfercompl, so we need ACK and NYET */
usbc_hcintmsk.s.nyetmsk = 1; usbc_hcintmsk.s.nyetmsk = 1;
usbc_hcintmsk.s.ackmsk = 1; usbc_hcintmsk.s.ackmsk = 1;
...@@ -1722,13 +1720,11 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb, ...@@ -1722,13 +1720,11 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
/* We need to do split transactions when we are talking to non high /* We need to do split transactions when we are talking to non high
speed devices that are behind a high speed hub */ speed devices that are behind a high speed hub */
if (__cvmx_usb_pipe_needs_split(usb, pipe)) if (__cvmx_usb_pipe_needs_split(usb, pipe)) {
{
/* On the start split phase (stage is even) record the frame number we /* On the start split phase (stage is even) record the frame number we
will need to send the split complete. We only store the lower two bits will need to send the split complete. We only store the lower two bits
since the time ahead can only be two frames */ since the time ahead can only be two frames */
if ((transaction->stage&1) == 0) if ((transaction->stage&1) == 0) {
{
if (transaction->type == CVMX_USB_TRANSFER_BULK) if (transaction->type == CVMX_USB_TRANSFER_BULK)
pipe->split_sc_frame = (usb->frame_number + 1) & 0x7f; pipe->split_sc_frame = (usb->frame_number + 1) & 0x7f;
else else
...@@ -1752,14 +1748,12 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb, ...@@ -1752,14 +1748,12 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
begin/middle/end of the data or all */ begin/middle/end of the data or all */
if (!usbc_hcsplt.s.compsplt && if (!usbc_hcsplt.s.compsplt &&
(pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) && (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
(pipe->transfer_type == CVMX_USB_TRANSFER_ISOCHRONOUS)) (pipe->transfer_type == CVMX_USB_TRANSFER_ISOCHRONOUS)) {
{
/* Clear the split complete frame number as there isn't going /* Clear the split complete frame number as there isn't going
to be a split complete */ to be a split complete */
pipe->split_sc_frame = -1; pipe->split_sc_frame = -1;
/* See if we've started this transfer and sent data */ /* See if we've started this transfer and sent data */
if (transaction->actual_bytes == 0) if (transaction->actual_bytes == 0) {
{
/* Nothing sent yet, this is either a begin or the /* Nothing sent yet, this is either a begin or the
entire payload */ entire payload */
if (bytes_to_transfer <= 188) if (bytes_to_transfer <= 188)
...@@ -1767,8 +1761,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb, ...@@ -1767,8 +1761,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
else else
usbc_hcsplt.s.xactpos = 2; /* First part of payload */ usbc_hcsplt.s.xactpos = 2; /* First part of payload */
} }
else else {
{
/* Continuing the previous data, we must either be /* Continuing the previous data, we must either be
in the middle or at the end */ in the middle or at the end */
if (bytes_to_transfer <= 188) if (bytes_to_transfer <= 188)
...@@ -1784,8 +1777,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb, ...@@ -1784,8 +1777,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
/* Make sure the transfer never exceeds the byte limit of the hardware. /* Make sure the transfer never exceeds the byte limit of the hardware.
Further bytes will be sent as continued transactions */ Further bytes will be sent as continued transactions */
if (bytes_to_transfer > MAX_TRANSFER_BYTES) if (bytes_to_transfer > MAX_TRANSFER_BYTES) {
{
/* Round MAX_TRANSFER_BYTES to a multiple of out packet size */ /* Round MAX_TRANSFER_BYTES to a multiple of out packet size */
bytes_to_transfer = MAX_TRANSFER_BYTES / pipe->max_packet; bytes_to_transfer = MAX_TRANSFER_BYTES / pipe->max_packet;
bytes_to_transfer *= pipe->max_packet; bytes_to_transfer *= pipe->max_packet;
...@@ -1796,16 +1788,14 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb, ...@@ -1796,16 +1788,14 @@ 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; packets_to_transfer = (bytes_to_transfer + pipe->max_packet - 1) / pipe->max_packet;
if (packets_to_transfer == 0) if (packets_to_transfer == 0)
packets_to_transfer = 1; 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 /* Limit to one packet when not using DMA. Channels must be restarted
between every packet for IN transactions, so there is no reason to between every packet for IN transactions, so there is no reason to
do multiple packets in a row */ do multiple packets in a row */
packets_to_transfer = 1; packets_to_transfer = 1;
bytes_to_transfer = packets_to_transfer * pipe->max_packet; 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 /* Limit the number of packet and data transferred to what the
hardware can handle */ hardware can handle */
packets_to_transfer = MAX_TRANSFER_PACKETS; packets_to_transfer = MAX_TRANSFER_PACKETS;
...@@ -1856,8 +1846,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb, ...@@ -1856,8 +1846,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
} }
/* Do transaction type specific fixups as needed */ /* Do transaction type specific fixups as needed */
switch (transaction->type) switch (transaction->type) {
{
case CVMX_USB_TRANSFER_CONTROL: case CVMX_USB_TRANSFER_CONTROL:
__cvmx_usb_start_channel_control(usb, channel, pipe); __cvmx_usb_start_channel_control(usb, channel, pipe);
break; break;
...@@ -1865,12 +1854,10 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb, ...@@ -1865,12 +1854,10 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
case CVMX_USB_TRANSFER_INTERRUPT: case CVMX_USB_TRANSFER_INTERRUPT:
break; break;
case CVMX_USB_TRANSFER_ISOCHRONOUS: case CVMX_USB_TRANSFER_ISOCHRONOUS:
if (!__cvmx_usb_pipe_needs_split(usb, pipe)) if (!__cvmx_usb_pipe_needs_split(usb, pipe)) {
{
/* ISO transactions require different PIDs depending on direction /* ISO transactions require different PIDs depending on direction
and how many packets are needed */ and how many packets are needed */
if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
{
if (pipe->multi_count < 2) /* Need DATA0 */ if (pipe->multi_count < 2) /* Need DATA0 */
USB_SET_FIELD32(CVMX_USBCX_HCTSIZX(channel, usb->index), cvmx_usbcx_hctsizx_t, pid, 0); USB_SET_FIELD32(CVMX_USBCX_HCTSIZX(channel, usb->index), cvmx_usbcx_hctsizx_t, pid, 0);
else /* Need MDATA */ else /* Need MDATA */
...@@ -1908,13 +1895,11 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb, ...@@ -1908,13 +1895,11 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
static cvmx_usb_pipe_t *__cvmx_usb_find_ready_pipe(cvmx_usb_internal_state_t *usb, cvmx_usb_pipe_list_t *list, uint64_t current_frame) static cvmx_usb_pipe_t *__cvmx_usb_find_ready_pipe(cvmx_usb_internal_state_t *usb, cvmx_usb_pipe_list_t *list, uint64_t current_frame)
{ {
cvmx_usb_pipe_t *pipe = list->head; cvmx_usb_pipe_t *pipe = list->head;
while (pipe) while (pipe) {
{
if (!(pipe->flags & __CVMX_USB_PIPE_FLAGS_SCHEDULED) && pipe->head && if (!(pipe->flags & __CVMX_USB_PIPE_FLAGS_SCHEDULED) && pipe->head &&
(pipe->next_tx_frame <= current_frame) && (pipe->next_tx_frame <= current_frame) &&
((pipe->split_sc_frame == -1) || ((((int)current_frame - (int)pipe->split_sc_frame) & 0x7f) < 0x40)) && ((pipe->split_sc_frame == -1) || ((((int)current_frame - (int)pipe->split_sc_frame) & 0x7f) < 0x40)) &&
(!usb->active_split || (usb->active_split == pipe->head))) (!usb->active_split || (usb->active_split == pipe->head))) {
{
CVMX_PREFETCH(pipe, 128); CVMX_PREFETCH(pipe, 128);
CVMX_PREFETCH(pipe->head, 0); CVMX_PREFETCH(pipe->head, 0);
return pipe; return pipe;
...@@ -1944,8 +1929,7 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof) ...@@ -1944,8 +1929,7 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof)
CVMX_USB_LOG_CALLED(); CVMX_USB_LOG_CALLED();
CVMX_USB_LOG_PARAM("%p", usb); CVMX_USB_LOG_PARAM("%p", usb);
if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
{
/* Without DMA we need to be careful to not schedule something at the end of a frame and cause an overrun */ /* Without DMA we need to be careful to not schedule something at the end of a frame and cause an overrun */
cvmx_usbcx_hfnum_t hfnum = {.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index))}; cvmx_usbcx_hfnum_t hfnum = {.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index))};
cvmx_usbcx_hfir_t hfir = {.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HFIR(usb->index))}; cvmx_usbcx_hfir_t hfir = {.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HFIR(usb->index))};
...@@ -1953,13 +1937,11 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof) ...@@ -1953,13 +1937,11 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof)
goto done; goto done;
} }
while (usb->idle_hardware_channels) while (usb->idle_hardware_channels) {
{
/* Find an idle channel */ /* Find an idle channel */
CVMX_CLZ(channel, usb->idle_hardware_channels); CVMX_CLZ(channel, usb->idle_hardware_channels);
channel = 31 - channel; channel = 31 - channel;
if (cvmx_unlikely(channel > 7)) if (cvmx_unlikely(channel > 7)) {
{
if (cvmx_unlikely(usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_DEBUG_INFO)) if (cvmx_unlikely(usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_DEBUG_INFO))
cvmx_dprintf("%s: Idle hardware channels has a channel higher than 7. This is wrong\n", __FUNCTION__); cvmx_dprintf("%s: Idle hardware channels has a channel higher than 7. This is wrong\n", __FUNCTION__);
break; break;
...@@ -1967,8 +1949,7 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof) ...@@ -1967,8 +1949,7 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof)
/* Find a pipe needing service */ /* Find a pipe needing service */
pipe = NULL; pipe = NULL;
if (is_sof) if (is_sof) {
{
/* Only process periodic pipes on SOF interrupts. This way we are /* Only process periodic pipes on SOF interrupts. This way we are
sure that the periodic data is sent in the beginning of the sure that the periodic data is sent in the beginning of the
frame */ frame */
...@@ -1976,8 +1957,7 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof) ...@@ -1976,8 +1957,7 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof)
if (cvmx_likely(!pipe)) if (cvmx_likely(!pipe))
pipe = __cvmx_usb_find_ready_pipe(usb, usb->active_pipes + CVMX_USB_TRANSFER_INTERRUPT, usb->frame_number); pipe = __cvmx_usb_find_ready_pipe(usb, usb->active_pipes + CVMX_USB_TRANSFER_INTERRUPT, usb->frame_number);
} }
if (cvmx_likely(!pipe)) if (cvmx_likely(!pipe)) {
{
pipe = __cvmx_usb_find_ready_pipe(usb, usb->active_pipes + CVMX_USB_TRANSFER_CONTROL, usb->frame_number); pipe = __cvmx_usb_find_ready_pipe(usb, usb->active_pipes + CVMX_USB_TRANSFER_CONTROL, usb->frame_number);
if (cvmx_likely(!pipe)) if (cvmx_likely(!pipe))
pipe = __cvmx_usb_find_ready_pipe(usb, usb->active_pipes + CVMX_USB_TRANSFER_BULK, usb->frame_number); pipe = __cvmx_usb_find_ready_pipe(usb, usb->active_pipes + CVMX_USB_TRANSFER_BULK, usb->frame_number);
...@@ -1989,14 +1969,12 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof) ...@@ -1989,14 +1969,12 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof)
CVMX_USB_LOG_PARAM("%p", pipe); CVMX_USB_LOG_PARAM("%p", pipe);
if (cvmx_unlikely((usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_DEBUG_TRANSFERS) || if (cvmx_unlikely((usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_DEBUG_TRANSFERS) ||
(pipe->flags & CVMX_USB_PIPE_FLAGS_DEBUG_TRANSFERS))) (pipe->flags & CVMX_USB_PIPE_FLAGS_DEBUG_TRANSFERS))) {
{
cvmx_usb_transaction_t *transaction = pipe->head; cvmx_usb_transaction_t *transaction = pipe->head;
const cvmx_usb_control_header_t *header = (transaction->control_header) ? cvmx_phys_to_ptr(transaction->control_header) : NULL; const cvmx_usb_control_header_t *header = (transaction->control_header) ? cvmx_phys_to_ptr(transaction->control_header) : NULL;
const char *dir = (pipe->transfer_dir == CVMX_USB_DIRECTION_IN) ? "IN" : "OUT"; const char *dir = (pipe->transfer_dir == CVMX_USB_DIRECTION_IN) ? "IN" : "OUT";
const char *type; const char *type;
switch (pipe->transfer_type) switch (pipe->transfer_type) {
{
case CVMX_USB_TRANSFER_CONTROL: case CVMX_USB_TRANSFER_CONTROL:
type = "SETUP"; type = "SETUP";
dir = (header->s.request_type & 0x80) ? "IN" : "OUT"; dir = (header->s.request_type & 0x80) ? "IN" : "OUT";
...@@ -2025,13 +2003,10 @@ static void __cvmx_usb_schedule(cvmx_usb_internal_state_t *usb, int is_sof) ...@@ -2025,13 +2003,10 @@ 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 /* Only enable SOF interrupts when we have transactions pending in the
future that might need to be scheduled */ future that might need to be scheduled */
need_sof = 0; 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; pipe = usb->active_pipes[ttype].head;
while (pipe) while (pipe) {
{ if (pipe->next_tx_frame > usb->frame_number) {
if (pipe->next_tx_frame > usb->frame_number)
{
need_sof = 1; need_sof = 1;
break; break;
} }
...@@ -2071,13 +2046,11 @@ static void __cvmx_usb_perform_callback(cvmx_usb_internal_state_t *usb, ...@@ -2071,13 +2046,11 @@ static void __cvmx_usb_perform_callback(cvmx_usb_internal_state_t *usb,
if (pipe) if (pipe)
pipe_handle = __cvmx_usb_get_pipe_handle(usb, pipe); pipe_handle = __cvmx_usb_get_pipe_handle(usb, pipe);
if (transaction) if (transaction) {
{
submit_handle = __cvmx_usb_get_submit_handle(usb, transaction); submit_handle = __cvmx_usb_get_submit_handle(usb, transaction);
bytes_transferred = transaction->actual_bytes; bytes_transferred = transaction->actual_bytes;
/* Transactions are allowed to override the default callback */ /* Transactions are allowed to override the default callback */
if ((reason == CVMX_USB_CALLBACK_TRANSFER_COMPLETE) && transaction->callback) if ((reason == CVMX_USB_CALLBACK_TRANSFER_COMPLETE) && transaction->callback) {
{
callback = transaction->callback; callback = transaction->callback;
user_data = transaction->callback_data; user_data = transaction->callback_data;
} }
...@@ -2132,16 +2105,14 @@ static void __cvmx_usb_perform_complete(cvmx_usb_internal_state_t * usb, ...@@ -2132,16 +2105,14 @@ static void __cvmx_usb_perform_complete(cvmx_usb_internal_state_t * usb,
/* Isochronous transactions need extra processing as they might not be done /* Isochronous transactions need extra processing as they might not be done
after a single data transfer */ after a single data transfer */
if (cvmx_unlikely(transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)) if (cvmx_unlikely(transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)) {
{
/* Update the number of bytes transferred in this ISO packet */ /* Update the number of bytes transferred in this ISO packet */
transaction->iso_packets[0].length = transaction->actual_bytes; transaction->iso_packets[0].length = transaction->actual_bytes;
transaction->iso_packets[0].status = complete_code; transaction->iso_packets[0].status = complete_code;
/* If there are more ISOs pending and we succeeded, schedule the next /* If there are more ISOs pending and we succeeded, schedule the next
one */ one */
if ((transaction->iso_number_packets > 1) && (complete_code == CVMX_USB_COMPLETE_SUCCESS)) if ((transaction->iso_number_packets > 1) && (complete_code == CVMX_USB_COMPLETE_SUCCESS)) {
{
transaction->actual_bytes = 0; /* No bytes transferred for this packet as of yet */ transaction->actual_bytes = 0; /* No bytes transferred for this packet as of yet */
transaction->iso_number_packets--; /* One less ISO waiting to transfer */ transaction->iso_number_packets--; /* One less ISO waiting to transfer */
transaction->iso_packets++; /* Increment to the next location in our packet array */ transaction->iso_packets++; /* Increment to the next location in our packet array */
...@@ -2159,8 +2130,7 @@ static void __cvmx_usb_perform_complete(cvmx_usb_internal_state_t * usb, ...@@ -2159,8 +2130,7 @@ static void __cvmx_usb_perform_complete(cvmx_usb_internal_state_t * usb,
transaction->prev->next = transaction->next; transaction->prev->next = transaction->next;
else else
pipe->head = transaction->next; pipe->head = transaction->next;
if (!pipe->head) if (!pipe->head) {
{
__cvmx_usb_remove_pipe(usb->active_pipes + pipe->transfer_type, pipe); __cvmx_usb_remove_pipe(usb->active_pipes + pipe->transfer_type, pipe);
__cvmx_usb_append_pipe(&usb->idle_pipes, pipe); __cvmx_usb_append_pipe(&usb->idle_pipes, pipe);
...@@ -2247,13 +2217,11 @@ static int __cvmx_usb_submit_transaction(cvmx_usb_internal_state_t *usb, ...@@ -2247,13 +2217,11 @@ static int __cvmx_usb_submit_transaction(cvmx_usb_internal_state_t *usb,
transaction->stage = CVMX_USB_STAGE_NON_CONTROL; transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
transaction->next = NULL; transaction->next = NULL;
if (pipe->tail) if (pipe->tail) {
{
transaction->prev = pipe->tail; transaction->prev = pipe->tail;
transaction->prev->next = transaction; transaction->prev->next = transaction;
} }
else else {
{
if (pipe->next_tx_frame < usb->frame_number) if (pipe->next_tx_frame < usb->frame_number)
pipe->next_tx_frame = usb->frame_number + pipe->interval - pipe->next_tx_frame = usb->frame_number + pipe->interval -
(usb->frame_number - pipe->next_tx_frame) % pipe->interval; (usb->frame_number - pipe->next_tx_frame) % pipe->interval;
...@@ -2626,8 +2594,7 @@ cvmx_usb_status_t cvmx_usb_cancel(cvmx_usb_state_t *state, int pipe_handle, ...@@ -2626,8 +2594,7 @@ cvmx_usb_status_t cvmx_usb_cancel(cvmx_usb_state_t *state, int pipe_handle,
/* If the transaction is the HEAD of the queue and scheduled. We need to /* If the transaction is the HEAD of the queue and scheduled. We need to
treat it special */ treat it special */
if ((pipe->head == transaction) && if ((pipe->head == transaction) &&
(pipe->flags & __CVMX_USB_PIPE_FLAGS_SCHEDULED)) (pipe->flags & __CVMX_USB_PIPE_FLAGS_SCHEDULED)) {
{
cvmx_usbcx_hccharx_t usbc_hcchar; cvmx_usbcx_hccharx_t usbc_hcchar;
usb->pipe_for_channel[pipe->channel] = NULL; usb->pipe_for_channel[pipe->channel] = NULL;
...@@ -2637,8 +2604,7 @@ cvmx_usb_status_t cvmx_usb_cancel(cvmx_usb_state_t *state, int pipe_handle, ...@@ -2637,8 +2604,7 @@ cvmx_usb_status_t cvmx_usb_cancel(cvmx_usb_state_t *state, int pipe_handle,
usbc_hcchar.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HCCHARX(pipe->channel, usb->index)); usbc_hcchar.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HCCHARX(pipe->channel, usb->index));
/* If the channel isn't enabled then the transaction already completed */ /* If the channel isn't enabled then the transaction already completed */
if (usbc_hcchar.s.chena) if (usbc_hcchar.s.chena) {
{
usbc_hcchar.s.chdis = 1; usbc_hcchar.s.chdis = 1;
__cvmx_usb_write_csr32(usb, CVMX_USBCX_HCCHARX(pipe->channel, usb->index), usbc_hcchar.u32); __cvmx_usb_write_csr32(usb, CVMX_USBCX_HCCHARX(pipe->channel, usb->index), usbc_hcchar.u32);
} }
...@@ -2676,8 +2642,7 @@ cvmx_usb_status_t cvmx_usb_cancel_all(cvmx_usb_state_t *state, int pipe_handle) ...@@ -2676,8 +2642,7 @@ cvmx_usb_status_t cvmx_usb_cancel_all(cvmx_usb_state_t *state, int pipe_handle)
CVMX_USB_RETURN(CVMX_USB_INVALID_PARAM); CVMX_USB_RETURN(CVMX_USB_INVALID_PARAM);
/* Simply loop through and attempt to cancel each transaction */ /* Simply loop through and attempt to cancel each transaction */
while (pipe->head) while (pipe->head) {
{
cvmx_usb_status_t result = cvmx_usb_cancel(state, pipe_handle, cvmx_usb_status_t result = cvmx_usb_cancel(state, pipe_handle,
__cvmx_usb_get_submit_handle(usb, pipe->head)); __cvmx_usb_get_submit_handle(usb, pipe->head));
if (cvmx_unlikely(result != CVMX_USB_SUCCESS)) if (cvmx_unlikely(result != CVMX_USB_SUCCESS))
...@@ -2814,12 +2779,10 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -2814,12 +2779,10 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
/* Read the interrupt status bits for the channel */ /* Read the interrupt status bits for the channel */
usbc_hcint.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HCINTX(channel, usb->index)); usbc_hcint.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HCINTX(channel, usb->index));
if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
{
usbc_hcchar.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HCCHARX(channel, usb->index)); usbc_hcchar.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HCCHARX(channel, usb->index));
if (usbc_hcchar.s.chena && usbc_hcchar.s.chdis) if (usbc_hcchar.s.chena && usbc_hcchar.s.chdis) {
{
/* There seems to be a bug in CN31XX which can cause interrupt /* There seems to be a bug in CN31XX which can cause interrupt
IN transfers to get stuck until we do a write of HCCHARX IN transfers to get stuck until we do a write of HCCHARX
without changing things */ without changing things */
...@@ -2829,10 +2792,8 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -2829,10 +2792,8 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
/* In non DMA mode the channels don't halt themselves. We need to /* In non DMA mode the channels don't halt themselves. We need to
manually disable channels that are left running */ manually disable channels that are left running */
if (!usbc_hcint.s.chhltd) if (!usbc_hcint.s.chhltd) {
{ if (usbc_hcchar.s.chena) {
if (usbc_hcchar.s.chena)
{
cvmx_usbcx_hcintmskx_t hcintmsk; cvmx_usbcx_hcintmskx_t hcintmsk;
/* Disable all interrupts except CHHLTD */ /* Disable all interrupts except CHHLTD */
hcintmsk.u32 = 0; hcintmsk.u32 = 0;
...@@ -2842,19 +2803,16 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -2842,19 +2803,16 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
__cvmx_usb_write_csr32(usb, CVMX_USBCX_HCCHARX(channel, usb->index), usbc_hcchar.u32); __cvmx_usb_write_csr32(usb, CVMX_USBCX_HCCHARX(channel, usb->index), usbc_hcchar.u32);
CVMX_USB_RETURN(0); CVMX_USB_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 */ /* 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); cvmx_dprintf("USB%d: Channel %d interrupt without halt\n", usb->index, channel);
CVMX_USB_RETURN(0); CVMX_USB_RETURN(0);
} }
} }
} }
else else {
{
/* There is are no interrupts that we need to process when the channel is /* There is are no interrupts that we need to process when the channel is
still running */ still running */
if (!usbc_hcint.s.chhltd) if (!usbc_hcint.s.chhltd)
...@@ -2887,16 +2845,14 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -2887,16 +2845,14 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
/* Calculating the number of bytes successfully transferred is dependent on /* Calculating the number of bytes successfully transferred is dependent on
the transfer direction */ the transfer direction */
packets_processed = transaction->pktcnt - usbc_hctsiz.s.pktcnt; packets_processed = transaction->pktcnt - usbc_hctsiz.s.pktcnt;
if (usbc_hcchar.s.epdir) if (usbc_hcchar.s.epdir) {
{
/* IN transactions are easy. For every byte received the hardware /* IN transactions are easy. For every byte received the hardware
decrements xfersize. All we need to do is subtract the current decrements xfersize. All we need to do is subtract the current
value of xfersize from its starting value and we know how many value of xfersize from its starting value and we know how many
bytes were written to the buffer */ bytes were written to the buffer */
bytes_this_transfer = transaction->xfersize - usbc_hctsiz.s.xfersize; bytes_this_transfer = transaction->xfersize - usbc_hctsiz.s.xfersize;
} }
else else {
{
/* OUT transaction don't decrement xfersize. Instead pktcnt is /* OUT transaction don't decrement xfersize. Instead pktcnt is
decremented on every successful packet send. The hardware does decremented on every successful packet send. The hardware does
this when it receives an ACK, or NYET. If it doesn't this when it receives an ACK, or NYET. If it doesn't
...@@ -2950,8 +2906,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -2950,8 +2906,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
(pipe->transfer_dir == CVMX_USB_DIRECTION_OUT)) (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT))
pipe->flags |= __CVMX_USB_PIPE_FLAGS_NEED_PING; pipe->flags |= __CVMX_USB_PIPE_FLAGS_NEED_PING;
if (usbc_hcint.s.stall) if (usbc_hcint.s.stall) {
{
/* STALL as a response means this transaction cannot be completed /* STALL as a response means this transaction cannot be completed
because the device can't process transactions. Tell the user. Any because the device can't process transactions. Tell the user. Any
data that was transferred will be counted on the actual bytes data that was transferred will be counted on the actual bytes
...@@ -2959,20 +2914,17 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -2959,20 +2914,17 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
pipe->pid_toggle = 0; pipe->pid_toggle = 0;
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_STALL); __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 */ /* 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) if (usbc_hcint.s.nak || usbc_hcint.s.ack)
transaction->retries = 0; transaction->retries = 0;
transaction->retries++; transaction->retries++;
if (transaction->retries > MAX_RETRIES) if (transaction->retries > MAX_RETRIES) {
{
/* XactErr as a response means the device signaled something wrong with /* XactErr as a response means the device signaled something wrong with
the transfer. For example, PID toggle errors cause these */ the transfer. For example, PID toggle errors cause these */
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_XACTERR); __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 this was a split then clear our split in progress marker */
if (usb->active_split == transaction) if (usb->active_split == transaction)
usb->active_split = NULL; usb->active_split = NULL;
...@@ -2996,27 +2948,23 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -2996,27 +2948,23 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
/* We'll retry the exact same transaction again */ /* We'll retry the exact same transaction again */
transaction->retries++; 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 /* 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 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 a bulk out. The ping case is handled by hardware, so we only have
splits and bulk out */ splits and bulk out */
if (!__cvmx_usb_pipe_needs_split(usb, pipe)) if (!__cvmx_usb_pipe_needs_split(usb, pipe)) {
{
transaction->retries = 0; transaction->retries = 0;
/* If there is more data to go then we need to try again. Otherwise /* If there is more data to go then we need to try again. Otherwise
this transaction is complete */ this transaction is complete */
if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet))
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); __cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
} }
else else {
{
/* Split transactions retry the split complete 4 times then rewind /* Split transactions retry the split complete 4 times then rewind
to the start split and do the entire transactions again */ to the start split and do the entire transactions again */
transaction->retries++; transaction->retries++;
if ((transaction->retries & 0x3) == 0) if ((transaction->retries & 0x3) == 0) {
{
/* Rewind to the beginning of the transaction by anding off the /* Rewind to the beginning of the transaction by anding off the
split complete bit */ split complete bit */
transaction->stage &= ~1; transaction->stage &= ~1;
...@@ -3024,8 +2972,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -3024,8 +2972,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
} }
} }
} }
else if (usbc_hcint.s.ack) else if (usbc_hcint.s.ack) {
{
transaction->retries = 0; transaction->retries = 0;
/* The ACK bit can only be checked after the other error bits. This is /* 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 because a multi packet transfer may succeed in a number of packets
...@@ -3052,8 +2999,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -3052,8 +2999,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
pipe->pid_toggle = 1; pipe->pid_toggle = 1;
if (__cvmx_usb_pipe_needs_split(usb, pipe)) if (__cvmx_usb_pipe_needs_split(usb, pipe))
transaction->stage = CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE; transaction->stage = CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE;
else else {
{
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);
if (header->s.length) if (header->s.length)
transaction->stage = CVMX_USB_STAGE_DATA; transaction->stage = CVMX_USB_STAGE_DATA;
...@@ -3071,34 +3017,29 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -3071,34 +3017,29 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
} }
break; break;
case CVMX_USB_STAGE_DATA: case CVMX_USB_STAGE_DATA:
if (__cvmx_usb_pipe_needs_split(usb, pipe)) if (__cvmx_usb_pipe_needs_split(usb, pipe)) {
{
transaction->stage = CVMX_USB_STAGE_DATA_SPLIT_COMPLETE; transaction->stage = CVMX_USB_STAGE_DATA_SPLIT_COMPLETE;
/* For setup OUT data that are splits, the hardware /* For setup OUT data that are splits, the hardware
doesn't appear to count transferred data. Here doesn't appear to count transferred data. Here
we manually update the data transferred */ we manually update the data transferred */
if (!usbc_hcchar.s.epdir) if (!usbc_hcchar.s.epdir) {
{
if (buffer_space_left < pipe->max_packet) if (buffer_space_left < pipe->max_packet)
transaction->actual_bytes += buffer_space_left; transaction->actual_bytes += buffer_space_left;
else else
transaction->actual_bytes += pipe->max_packet; 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; pipe->pid_toggle = 1;
transaction->stage = CVMX_USB_STAGE_STATUS; transaction->stage = CVMX_USB_STAGE_STATUS;
} }
break; break;
case CVMX_USB_STAGE_DATA_SPLIT_COMPLETE: case CVMX_USB_STAGE_DATA_SPLIT_COMPLETE:
if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) {
{
pipe->pid_toggle = 1; pipe->pid_toggle = 1;
transaction->stage = CVMX_USB_STAGE_STATUS; transaction->stage = CVMX_USB_STAGE_STATUS;
} }
else else {
{
transaction->stage = CVMX_USB_STAGE_DATA; transaction->stage = CVMX_USB_STAGE_DATA;
} }
break; break;
...@@ -3119,31 +3060,26 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -3119,31 +3060,26 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
it finishes with an ACK is during a split transaction. For it finishes with an ACK is during a split transaction. For
splits we need to continue the transfer if more data is splits we need to continue the transfer if more data is
needed */ needed */
if (__cvmx_usb_pipe_needs_split(usb, pipe)) if (__cvmx_usb_pipe_needs_split(usb, pipe)) {
{
if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL) if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL)
transaction->stage = CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE; transaction->stage = CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
else else {
{
if (buffer_space_left && (bytes_in_last_packet == pipe->max_packet)) if (buffer_space_left && (bytes_in_last_packet == pipe->max_packet))
transaction->stage = CVMX_USB_STAGE_NON_CONTROL; transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
else else {
{
if (transaction->type == CVMX_USB_TRANSFER_INTERRUPT) if (transaction->type == CVMX_USB_TRANSFER_INTERRUPT)
pipe->next_tx_frame += pipe->interval; pipe->next_tx_frame += pipe->interval;
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); __cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
} }
} }
} }
else else {
{
if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) && if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) &&
(pipe->transfer_type == CVMX_USB_TRANSFER_BULK) && (pipe->transfer_type == CVMX_USB_TRANSFER_BULK) &&
(pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) && (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
(usbc_hcint.s.nak)) (usbc_hcint.s.nak))
pipe->flags |= __CVMX_USB_PIPE_FLAGS_NEED_PING; pipe->flags |= __CVMX_USB_PIPE_FLAGS_NEED_PING;
if (!buffer_space_left || (bytes_in_last_packet < pipe->max_packet)) if (!buffer_space_left || (bytes_in_last_packet < pipe->max_packet)) {
{
if (transaction->type == CVMX_USB_TRANSFER_INTERRUPT) if (transaction->type == CVMX_USB_TRANSFER_INTERRUPT)
pipe->next_tx_frame += pipe->interval; pipe->next_tx_frame += pipe->interval;
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); __cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
...@@ -3151,32 +3087,26 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -3151,32 +3087,26 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
} }
break; break;
case CVMX_USB_TRANSFER_ISOCHRONOUS: case CVMX_USB_TRANSFER_ISOCHRONOUS:
if (__cvmx_usb_pipe_needs_split(usb, pipe)) if (__cvmx_usb_pipe_needs_split(usb, pipe)) {
{
/* ISOCHRONOUS OUT splits don't require a complete split stage. /* ISOCHRONOUS OUT splits don't require a complete split stage.
Instead they use a sequence of begin OUT splits to transfer Instead they use a sequence of begin OUT splits to transfer
the data 188 bytes at a time. Once the transfer is complete, the data 188 bytes at a time. Once the transfer is complete,
the pipe sleeps until the next schedule interval */ the pipe sleeps until the next schedule interval */
if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
{
/* If no space left or this wasn't a max size packet then /* If no space left or this wasn't a max size packet then
this transfer is complete. Otherwise start it again this transfer is complete. Otherwise start it again
to send the next 188 bytes */ to send the next 188 bytes */
if (!buffer_space_left || (bytes_this_transfer < 188)) if (!buffer_space_left || (bytes_this_transfer < 188)) {
{
pipe->next_tx_frame += pipe->interval; pipe->next_tx_frame += pipe->interval;
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); __cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
} }
} }
else else {
{ if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE) {
if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE)
{
/* We are in the incoming data phase. Keep getting /* We are in the incoming data phase. Keep getting
data until we run out of space or get a small data until we run out of space or get a small
packet */ packet */
if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) {
{
pipe->next_tx_frame += pipe->interval; pipe->next_tx_frame += pipe->interval;
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); __cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
} }
...@@ -3185,16 +3115,14 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -3185,16 +3115,14 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
transaction->stage = CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE; transaction->stage = CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
} }
} }
else else {
{
pipe->next_tx_frame += pipe->interval; pipe->next_tx_frame += pipe->interval;
__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS); __cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
} }
break; 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 this was a split then clear our split in progress marker */
if (usb->active_split == transaction) if (usb->active_split == transaction)
usb->active_split = NULL; usb->active_split = NULL;
...@@ -3209,8 +3137,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel) ...@@ -3209,8 +3137,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
pipe->next_tx_frame = usb->frame_number + pipe->interval - pipe->next_tx_frame = usb->frame_number + pipe->interval -
(usb->frame_number - pipe->next_tx_frame) % pipe->interval; (usb->frame_number - pipe->next_tx_frame) % pipe->interval;
} }
else else {
{
cvmx_usb_port_status_t port; cvmx_usb_port_status_t port;
port = cvmx_usb_get_status((cvmx_usb_state_t *)usb); port = cvmx_usb_get_status((cvmx_usb_state_t *)usb);
if (port.port_enabled) if (port.port_enabled)
...@@ -3269,8 +3196,7 @@ cvmx_usb_status_t cvmx_usb_poll(cvmx_usb_state_t *state) ...@@ -3269,8 +3196,7 @@ cvmx_usb_status_t cvmx_usb_poll(cvmx_usb_state_t *state)
/* Clear the interrupts now that we know about them */ /* Clear the interrupts now that we know about them */
__cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index), usbc_gintsts.u32); __cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index), usbc_gintsts.u32);
if (usbc_gintsts.s.rxflvl) if (usbc_gintsts.s.rxflvl) {
{
/* RxFIFO Non-Empty (RxFLvl) /* RxFIFO Non-Empty (RxFLvl)
Indicates that there is at least one packet pending to be read Indicates that there is at least one packet pending to be read
from the RxFIFO. */ from the RxFIFO. */
...@@ -3278,14 +3204,12 @@ cvmx_usb_status_t cvmx_usb_poll(cvmx_usb_state_t *state) ...@@ -3278,14 +3204,12 @@ cvmx_usb_status_t cvmx_usb_poll(cvmx_usb_state_t *state)
if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
__cvmx_usb_poll_rx_fifo(usb); __cvmx_usb_poll_rx_fifo(usb);
} }
if (usbc_gintsts.s.ptxfemp || usbc_gintsts.s.nptxfemp) if (usbc_gintsts.s.ptxfemp || usbc_gintsts.s.nptxfemp) {
{
/* Fill the Tx FIFOs when not in DMA mode */ /* Fill the Tx FIFOs when not in DMA mode */
if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
__cvmx_usb_poll_tx_fifo(usb); __cvmx_usb_poll_tx_fifo(usb);
} }
if (usbc_gintsts.s.disconnint || usbc_gintsts.s.prtint) if (usbc_gintsts.s.disconnint || usbc_gintsts.s.prtint) {
{
cvmx_usbcx_hprt_t usbc_hprt; cvmx_usbcx_hprt_t usbc_hprt;
/* Disconnect Detected Interrupt (DisconnInt) /* Disconnect Detected Interrupt (DisconnInt)
Asserted when a device disconnect is detected. */ Asserted when a device disconnect is detected. */
...@@ -3307,8 +3231,7 @@ cvmx_usb_status_t cvmx_usb_poll(cvmx_usb_state_t *state) ...@@ -3307,8 +3231,7 @@ cvmx_usb_status_t cvmx_usb_poll(cvmx_usb_state_t *state)
usbc_hprt.s.prtena = 0; usbc_hprt.s.prtena = 0;
__cvmx_usb_write_csr32(usb, CVMX_USBCX_HPRT(usb->index), usbc_hprt.u32); __cvmx_usb_write_csr32(usb, CVMX_USBCX_HPRT(usb->index), usbc_hprt.u32);
} }
if (usbc_gintsts.s.hchint) if (usbc_gintsts.s.hchint) {
{
/* Host Channels Interrupt (HChInt) /* Host Channels Interrupt (HChInt)
The core sets this bit to indicate that an interrupt is pending on The core sets this bit to indicate that an interrupt is pending on
one of the channels of the core (in Host mode). The application one of the channels of the core (in Host mode). The application
...@@ -3320,8 +3243,7 @@ cvmx_usb_status_t cvmx_usb_poll(cvmx_usb_state_t *state) ...@@ -3320,8 +3243,7 @@ cvmx_usb_status_t cvmx_usb_poll(cvmx_usb_state_t *state)
appropriate status bit in the HCINTn register to clear this bit. */ appropriate status bit in the HCINTn register to clear this bit. */
cvmx_usbcx_haint_t usbc_haint; cvmx_usbcx_haint_t usbc_haint;
usbc_haint.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HAINT(usb->index)); usbc_haint.u32 = __cvmx_usb_read_csr32(usb, CVMX_USBCX_HAINT(usb->index));
while (usbc_haint.u32) while (usbc_haint.u32) {
{
int channel; int channel;
CVMX_CLZ(channel, usbc_haint.u32); CVMX_CLZ(channel, usbc_haint.u32);
channel = 31 - channel; channel = 31 - channel;
......
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