Replace cvmx_usb_state_t with struct cvmx_usb_state.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* by this API, a zero will be returned. Most Octeon chips
* support one usb port, but some support two ports.
* cvmx_usb_initialize() must be called on independent
- * cvmx_usb_state_t structures.
+ * struct cvmx_usb_state.
*
* Returns: Number of port, zero if usb isn't supported
*/
* other access to the Octeon USB port is made. The port starts
* off in the disabled state.
*
- * @state: Pointer to an empty cvmx_usb_state_t structure
+ * @state: Pointer to an empty struct cvmx_usb_state
* that will be populated by the initialize call.
* This structure is then passed to all other USB
* functions.
*
* Returns: 0 or a negative error code.
*/
-int cvmx_usb_initialize(cvmx_usb_state_t *state, int usb_port_number,
+int cvmx_usb_initialize(struct cvmx_usb_state *state, int usb_port_number,
enum cvmx_usb_initialize_flags flags)
{
cvmx_usbnx_clk_ctl_t usbn_clk_ctl;
*
* Returns: 0 or a negative error code.
*/
-int cvmx_usb_shutdown(cvmx_usb_state_t *state)
+int cvmx_usb_shutdown(struct cvmx_usb_state *state)
{
cvmx_usbnx_clk_ctl_t usbn_clk_ctl;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
*
* Returns: 0 or a negative error code.
*/
-int cvmx_usb_enable(cvmx_usb_state_t *state)
+int cvmx_usb_enable(struct cvmx_usb_state *state)
{
cvmx_usbcx_ghwcfg3_t usbcx_ghwcfg3;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
*
* Returns: 0 or a negative error code.
*/
-int cvmx_usb_disable(cvmx_usb_state_t *state)
+int cvmx_usb_disable(struct cvmx_usb_state *state)
{
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
*
* Returns: Port status information
*/
-struct cvmx_usb_port_status cvmx_usb_get_status(cvmx_usb_state_t *state)
+struct cvmx_usb_port_status cvmx_usb_get_status(struct cvmx_usb_state *state)
{
cvmx_usbcx_hprt_t usbc_hprt;
struct cvmx_usb_port_status result;
* @port_status:
* Port status to set, most like returned by cvmx_usb_get_status()
*/
-void cvmx_usb_set_status(cvmx_usb_state_t *state, struct cvmx_usb_port_status port_status)
+void cvmx_usb_set_status(struct cvmx_usb_state *state, struct cvmx_usb_port_status port_status)
{
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
usb->port_status = port_status;
* Returns: A non negative value is a pipe handle. Negative
* values are error codes.
*/
-int cvmx_usb_open_pipe(cvmx_usb_state_t *state, enum cvmx_usb_pipe_flags flags,
+int cvmx_usb_open_pipe(struct cvmx_usb_state *state, enum cvmx_usb_pipe_flags flags,
int device_addr, int endpoint_num,
enum cvmx_usb_speed device_speed, int max_packet,
enum cvmx_usb_transfer transfer_type,
if (!callback)
return;
- callback((cvmx_usb_state_t *)usb, reason, complete_code, pipe_handle, submit_handle,
+ callback((struct cvmx_usb_state *)usb, reason, complete_code, pipe_handle, submit_handle,
bytes_transferred, user_data);
}
* Returns: A submitted transaction handle or negative on
* failure. Negative values are error codes.
*/
-int cvmx_usb_submit_bulk(cvmx_usb_state_t *state, int pipe_handle,
+int cvmx_usb_submit_bulk(struct cvmx_usb_state *state, int pipe_handle,
uint64_t buffer, int buffer_length,
cvmx_usb_callback_func_t callback,
void *user_data)
* Returns: A submitted transaction handle or negative on
* failure. Negative values are error codes.
*/
-int cvmx_usb_submit_interrupt(cvmx_usb_state_t *state, int pipe_handle,
+int cvmx_usb_submit_interrupt(struct cvmx_usb_state *state, int pipe_handle,
uint64_t buffer, int buffer_length,
cvmx_usb_callback_func_t callback,
void *user_data)
* Returns: A submitted transaction handle or negative on
* failure. Negative values are error codes.
*/
-int cvmx_usb_submit_control(cvmx_usb_state_t *state, int pipe_handle,
+int cvmx_usb_submit_control(struct cvmx_usb_state *state, int pipe_handle,
uint64_t control_header,
uint64_t buffer, int buffer_length,
cvmx_usb_callback_func_t callback,
* Returns: A submitted transaction handle or negative on
* failure. Negative values are error codes.
*/
-int cvmx_usb_submit_isochronous(cvmx_usb_state_t *state, int pipe_handle,
+int cvmx_usb_submit_isochronous(struct cvmx_usb_state *state, int pipe_handle,
int start_frame, int flags,
int number_packets,
struct cvmx_usb_iso_packet packets[],
*
* Returns: 0 or a negative error code.
*/
-int cvmx_usb_cancel(cvmx_usb_state_t *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;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
*
* Returns: 0 or a negative error code.
*/
-int cvmx_usb_cancel_all(cvmx_usb_state_t *state, int pipe_handle)
+int cvmx_usb_cancel_all(struct cvmx_usb_state *state, int pipe_handle)
{
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
cvmx_usb_pipe_t *pipe = usb->pipe + pipe_handle;
* Returns: 0 or a negative error code. EBUSY is returned if the pipe has
* outstanding transfers.
*/
-int cvmx_usb_close_pipe(cvmx_usb_state_t *state, int pipe_handle)
+int cvmx_usb_close_pipe(struct cvmx_usb_state *state, int pipe_handle)
{
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
cvmx_usb_pipe_t *pipe = usb->pipe + pipe_handle;
*
* Returns: 0 or a negative error code.
*/
-int cvmx_usb_register_callback(cvmx_usb_state_t *state,
+int cvmx_usb_register_callback(struct cvmx_usb_state *state,
enum cvmx_usb_callback reason,
cvmx_usb_callback_func_t callback,
void *user_data)
*
* Returns: USB frame number
*/
-int cvmx_usb_get_frame_number(cvmx_usb_state_t *state)
+int cvmx_usb_get_frame_number(struct cvmx_usb_state *state)
{
int frame_number;
cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t *)state;
(usb->frame_number - pipe->next_tx_frame) % pipe->interval;
} else {
struct cvmx_usb_port_status port;
- port = cvmx_usb_get_status((cvmx_usb_state_t *)usb);
+ port = cvmx_usb_get_status((struct cvmx_usb_state *)usb);
if (port.port_enabled) {
/* We'll retry the exact same transaction again */
transaction->retries++;
*
* Returns: 0 or a negative error code.
*/
-int cvmx_usb_poll(cvmx_usb_state_t *state)
+int cvmx_usb_poll(struct cvmx_usb_state *state)
{
cvmx_usbcx_hfnum_t usbc_hfnum;
cvmx_usbcx_gintsts_t usbc_gintsts;
* In the probe phase you should:
* - Use cvmx_usb_get_num_ports() to determine the number of
* USB port to be supported.
- * - Allocate space for a cvmx_usb_state_t structure for each
+ * - Allocate space for a struct cvmx_usb_state for each
* port.
* - Tell the operating system about each port
*
*
* The port callback prototype needs to look as follows:
*
- * void port_callback(cvmx_usb_state_t *usb,
+ * void port_callback(struct cvmx_usb_state *usb,
* enum cvmx_usb_callback reason,
* enum cvmx_usb_complete status,
* int pipe_handle,
* int submit_handle,
* int bytes_transferred,
* void *user_data);
- * - "usb" is the cvmx_usb_state_t for the port.
+ * - "usb" is the struct cvmx_usb_state for the port.
* - "reason" will always be CVMX_USB_CALLBACK_PORT_CHANGED.
* - "status" will always be CVMX_USB_COMPLETE_SUCCESS.
* - "pipe_handle" will always be -1.
*
* The completion callback prototype needs to look as follows:
*
- * void complete_callback(cvmx_usb_state_t *usb,
+ * void complete_callback(struct cvmx_usb_state *usb,
* enum cvmx_usb_callback reason,
* enum cvmx_usb_complete status,
* int pipe_handle,
* int submit_handle,
* int bytes_transferred,
* void *user_data);
- * - "usb" is the cvmx_usb_state_t for the port.
+ * - "usb" is the struct cvmx_usb_state for the port.
* - "reason" will always be CVMX_USB_CALLBACK_TRANSFER_COMPLETE.
* - "status" will be one of the cvmx_usb_complete enumerations.
* - "pipe_handle" is the handle to the pipe the transaction
* may change in future SDKs. No data in it should be referenced
* by user's of this API.
*/
-typedef struct
-{
- char data[65536];
-} cvmx_usb_state_t;
+struct cvmx_usb_state {
+ char data[65536];
+};
/**
* USB callback functions are always of the following type.
* - user_data = The user pointer supplied to the
* function cvmx_usb_submit() or
* cvmx_usb_register_callback() */
-typedef void (*cvmx_usb_callback_func_t)(cvmx_usb_state_t *state,
+typedef void (*cvmx_usb_callback_func_t)(struct cvmx_usb_state *state,
enum cvmx_usb_callback reason,
enum cvmx_usb_complete status,
int pipe_handle, int submit_handle,
};
extern int cvmx_usb_get_num_ports(void);
-extern int cvmx_usb_initialize(cvmx_usb_state_t *state, int usb_port_number,
+extern int cvmx_usb_initialize(struct cvmx_usb_state *state, int usb_port_number,
enum cvmx_usb_initialize_flags flags);
-extern int cvmx_usb_shutdown(cvmx_usb_state_t *state);
-extern int cvmx_usb_enable(cvmx_usb_state_t *state);
-extern int cvmx_usb_disable(cvmx_usb_state_t *state);
-extern struct cvmx_usb_port_status cvmx_usb_get_status(cvmx_usb_state_t *state);
-extern void cvmx_usb_set_status(cvmx_usb_state_t *state, struct cvmx_usb_port_status port_status);
-extern int cvmx_usb_open_pipe(cvmx_usb_state_t *state,
+extern int cvmx_usb_shutdown(struct cvmx_usb_state *state);
+extern int cvmx_usb_enable(struct cvmx_usb_state *state);
+extern int cvmx_usb_disable(struct cvmx_usb_state *state);
+extern struct cvmx_usb_port_status cvmx_usb_get_status(struct cvmx_usb_state *state);
+extern void cvmx_usb_set_status(struct cvmx_usb_state *state, struct cvmx_usb_port_status port_status);
+extern int cvmx_usb_open_pipe(struct cvmx_usb_state *state,
enum cvmx_usb_pipe_flags flags,
int device_addr, int endpoint_num,
enum cvmx_usb_speed device_speed, int max_packet,
enum cvmx_usb_direction transfer_dir, int interval,
int multi_count, int hub_device_addr,
int hub_port);
-extern int cvmx_usb_submit_bulk(cvmx_usb_state_t *state, int pipe_handle,
+extern int cvmx_usb_submit_bulk(struct cvmx_usb_state *state, int pipe_handle,
uint64_t buffer, int buffer_length,
cvmx_usb_callback_func_t callback,
void *user_data);
-extern int cvmx_usb_submit_interrupt(cvmx_usb_state_t *state, int pipe_handle,
+extern int cvmx_usb_submit_interrupt(struct cvmx_usb_state *state, int pipe_handle,
uint64_t buffer, int buffer_length,
cvmx_usb_callback_func_t callback,
void *user_data);
-extern int cvmx_usb_submit_control(cvmx_usb_state_t *state, int pipe_handle,
+extern int cvmx_usb_submit_control(struct cvmx_usb_state *state, int pipe_handle,
uint64_t control_header,
uint64_t buffer, int buffer_length,
cvmx_usb_callback_func_t callback,
CVMX_USB_ISOCHRONOUS_FLAGS_ASAP = 1 << 1,
};
-extern int cvmx_usb_submit_isochronous(cvmx_usb_state_t *state, int pipe_handle,
+extern int cvmx_usb_submit_isochronous(struct cvmx_usb_state *state, int pipe_handle,
int start_frame, int flags,
int number_packets,
struct cvmx_usb_iso_packet packets[],
uint64_t buffer, int buffer_length,
cvmx_usb_callback_func_t callback,
void *user_data);
-extern int cvmx_usb_cancel(cvmx_usb_state_t *state, int pipe_handle,
+extern int cvmx_usb_cancel(struct cvmx_usb_state *state, int pipe_handle,
int submit_handle);
-extern int cvmx_usb_cancel_all(cvmx_usb_state_t *state, int pipe_handle);
-extern int cvmx_usb_close_pipe(cvmx_usb_state_t *state, int pipe_handle);
-extern int cvmx_usb_register_callback(cvmx_usb_state_t *state,
+extern int cvmx_usb_cancel_all(struct cvmx_usb_state *state, int pipe_handle);
+extern int cvmx_usb_close_pipe(struct cvmx_usb_state *state, int pipe_handle);
+extern int cvmx_usb_register_callback(struct cvmx_usb_state *state,
enum cvmx_usb_callback reason,
cvmx_usb_callback_func_t callback,
void *user_data);
-extern int cvmx_usb_get_frame_number(cvmx_usb_state_t *state);
-extern int cvmx_usb_poll(cvmx_usb_state_t *state);
+extern int cvmx_usb_get_frame_number(struct cvmx_usb_state *state);
+extern int cvmx_usb_poll(struct cvmx_usb_state *state);
#endif /* __CVMX_USB_H__ */
struct octeon_hcd {
spinlock_t lock;
- cvmx_usb_state_t usb;
+ struct cvmx_usb_state usb;
struct tasklet_struct dequeue_tasklet;
struct list_head dequeue_list;
};
return container_of((void *)p, struct usb_hcd, hcd_priv);
}
-static inline struct octeon_hcd *cvmx_usb_to_octeon(cvmx_usb_state_t *p)
+static inline struct octeon_hcd *cvmx_usb_to_octeon(struct cvmx_usb_state *p)
{
return container_of(p, struct octeon_hcd, usb);
}
return IRQ_HANDLED;
}
-static void octeon_usb_port_callback(cvmx_usb_state_t *usb,
+static void octeon_usb_port_callback(struct cvmx_usb_state *usb,
enum cvmx_usb_callback reason,
enum cvmx_usb_complete status,
int pipe_handle,
return cvmx_usb_get_frame_number(&priv->usb);
}
-static void octeon_usb_urb_complete_callback(cvmx_usb_state_t *usb,
+static void octeon_usb_urb_complete_callback(struct cvmx_usb_state *usb,
enum cvmx_usb_callback reason,
enum cvmx_usb_complete status,
int pipe_handle,