* The low level hardware can transfer a maximum of this number of bytes in each
* transfer. The field is 19 bits wide
*/
-#define MAX_TRANSFER_BYTES ((1<<19)-1)
+#define MAX_TRANSFER_BYTES ((1 << 19) - 1)
/*
* The low level hardware can transfer a maximum of this number of packets in
* each transfer. The field is 10 bits wide
*/
-#define MAX_TRANSFER_PACKETS ((1<<10)-1)
+#define MAX_TRANSFER_PACKETS ((1 << 10) - 1)
/**
* Logical transactions may take numerous low level
int channel;
int size;
u64 address;
- } entry[MAX_CHANNELS+1];
+ } entry[MAX_CHANNELS + 1];
int head;
int tail;
};
/* Returns the IO address to push/pop stuff data from the FIFOs */
#define USB_FIFO_ADDRESS(channel, usb_index) \
- (CVMX_USBCX_GOTGCTL(usb_index) + ((channel)+1)*0x1000)
+ (CVMX_USBCX_GOTGCTL(usb_index) + ((channel) + 1) * 0x1000)
/**
* struct octeon_temp_buffer - a bounce buffer for USB transfers
if (!interval)
interval = 1;
if (cvmx_usb_pipe_needs_split(usb, pipe)) {
- pipe->interval = interval*8;
+ pipe->interval = interval * 8;
/* Force start splits to be schedule on uFrame 0 */
- pipe->next_tx_frame = ((usb->frame_number+7)&~7) +
+ pipe->next_tx_frame = ((usb->frame_number + 7) & ~7) +
pipe->interval;
} else {
pipe->interval = interval;
fifo->entry[fifo->head].address =
cvmx_read64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) +
channel * 8);
- fifo->entry[fifo->head].size = (usbc_hctsiz.s.xfersize+3)>>2;
+ fifo->entry[fifo->head].size = (usbc_hctsiz.s.xfersize + 3) >> 2;
fifo->head++;
if (fifo->head > MAX_CHANNELS)
fifo->head = 0;
pipe->flags |= CVMX_USB_PIPE_FLAGS_SCHEDULED;
/* Mark this channel as in use */
- usb->idle_hardware_channels &= ~(1<<channel);
+ usb->idle_hardware_channels &= ~(1 << channel);
/* Enable the channel interrupt bits */
{
/* Enable the channel interrupt to propagate */
usbc_haintmsk.u32 = cvmx_usb_read_csr32(usb,
CVMX_USBCX_HAINTMSK(usb->index));
- usbc_haintmsk.s.haintmsk |= 1<<channel;
+ usbc_haintmsk.s.haintmsk |= 1 << channel;
cvmx_usb_write_csr32(usb, CVMX_USBCX_HAINTMSK(usb->index),
usbc_haintmsk.u32);
}
* We only store the lower two bits 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)
pipe->split_sc_frame =
(usb->frame_number + 1) & 0x7f;
* Set the startframe odd/even properly. This is only used for
* periodic
*/
- usbc_hcchar.s.oddfrm = usb->frame_number&1;
+ usbc_hcchar.s.oddfrm = usb->frame_number & 1;
/*
* Set the number of back to back packets allowed by this
CVMX_USBCX_HFIR(usb->index))
};
- if (hfnum.s.frrem < hfir.s.frint/4)
+ if (hfnum.s.frrem < hfir.s.frint / 4)
goto done;
}
/* Disable the channel interrupts now that it is done */
cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTMSKX(channel, usb->index), 0);
- usb->idle_hardware_channels |= (1<<channel);
+ usb->idle_hardware_channels |= (1 << channel);
/* Make sure this channel is tied to a valid pipe */
pipe = usb->pipe_for_channel[channel];
/* Update the frame counter */
usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index));
- if ((usb->frame_number&0x3fff) > usbc_hfnum.s.frnum)
+ if ((usb->frame_number & 0x3fff) > usbc_hfnum.s.frnum)
usb->frame_number += 0x4000;
usb->frame_number &= ~0x3fffull;
usb->frame_number |= usbc_hfnum.s.frnum;
channel = __fls(usbc_haint.u32);
cvmx_usb_poll_channel(usb, channel);
- usbc_haint.u32 ^= 1<<channel;
+ usbc_haint.u32 ^= 1 << channel;
}
}