staging: octeon-usb: delete redundant flags from cvmx_usb_initialize()

The function will always figure out the used clock internally, so delete
a redudant parameter and the flag.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Aaro Koskinen 2013-10-01 23:43:09 +03:00 committed by Greg Kroah-Hartman
parent b8b04eef30
commit 9be317e69e
3 changed files with 25 additions and 39 deletions

View File

@ -552,20 +552,15 @@ static inline void __cvmx_usb_remove_pipe(struct cvmx_usb_pipe_list *list, struc
* functions.
* @usb_port_number:
* Which Octeon USB port to initialize.
* @flags: Flags to control hardware initialization. See
* enum cvmx_usb_initialize_flags for the flag
* definitions. Some flags are mandatory.
*
* Returns: 0 or a negative error code.
*/
int cvmx_usb_initialize(struct cvmx_usb_state *state, int usb_port_number,
enum cvmx_usb_initialize_flags flags)
int cvmx_usb_initialize(struct cvmx_usb_state *state, int usb_port_number)
{
union cvmx_usbnx_clk_ctl usbn_clk_ctl;
union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status;
struct cvmx_usb_internal_state *usb = (struct cvmx_usb_internal_state *)state;
usb->init_flags = flags;
enum cvmx_usb_initialize_flags flags = 0;
/* Make sure that state is large enough to store the internal state */
if (sizeof(*state) < sizeof(*usb))
@ -577,31 +572,26 @@ int cvmx_usb_initialize(struct cvmx_usb_state *state, int usb_port_number,
if (!OCTEON_IS_MODEL(OCTEON_CN52XX) && (usb_port_number > 0))
return -EINVAL;
/* Try to determine clock type automatically */
if ((flags & (CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI |
CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND)) == 0) {
if (octeon_usb_get_clock_type() == USB_CLOCK_TYPE_CRYSTAL_12)
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI; /* Only 12 MHZ crystals are supported */
else
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND;
}
if (octeon_usb_get_clock_type() == USB_CLOCK_TYPE_CRYSTAL_12) {
/* Only 12 MHZ crystals are supported */
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI;
} else {
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND;
if (flags & CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND) {
/* Check for auto ref clock frequency */
if (!(flags & CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK))
switch (octeon_usb_get_clock_type()) {
case USB_CLOCK_TYPE_REF_12:
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ;
break;
case USB_CLOCK_TYPE_REF_24:
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ;
break;
case USB_CLOCK_TYPE_REF_48:
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ;
break;
default:
return -EINVAL;
break;
}
switch (octeon_usb_get_clock_type()) {
case USB_CLOCK_TYPE_REF_12:
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ;
break;
case USB_CLOCK_TYPE_REF_24:
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ;
break;
case USB_CLOCK_TYPE_REF_48:
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ;
break;
default:
return -EINVAL;
break;
}
}
memset(usb, 0, sizeof(*usb));

View File

@ -427,7 +427,7 @@ typedef void (*cvmx_usb_callback_func_t)(struct cvmx_usb_state *state,
int bytes_transferred, void *user_data);
/**
* enum cvmx_usb_initialize_flags - flags to pass the initialization function
* enum cvmx_usb_initialize_flags - flags used by the initialization function
*
* @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI: The USB port uses a 12MHz crystal
* as clock source at USB_XO and
@ -435,9 +435,6 @@ typedef void (*cvmx_usb_callback_func_t)(struct cvmx_usb_state *state,
* @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND: The USB port uses 12/24/48MHz 2.5V
* board clock source at USB_XO.
* USB_XI should be tied to GND.
* @CVMX_USB_INITIALIZE_FLAGS_CLOCK_AUTO: Automatically determine clock type
* based on function in
* cvmx-helper-board.c.
* @CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK: Mask for clock speed field
* @CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ: Speed of reference clock or
* crystal
@ -449,7 +446,6 @@ typedef void (*cvmx_usb_callback_func_t)(struct cvmx_usb_state *state,
enum cvmx_usb_initialize_flags {
CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI = 1 << 0,
CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND = 1 << 1,
CVMX_USB_INITIALIZE_FLAGS_CLOCK_AUTO = 0,
CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK = 3 << 3,
CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ = 1 << 3,
CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ = 2 << 3,
@ -477,8 +473,8 @@ enum cvmx_usb_pipe_flags {
};
extern int cvmx_usb_get_num_ports(void);
extern int cvmx_usb_initialize(struct cvmx_usb_state *state, int usb_port_number,
enum cvmx_usb_initialize_flags flags);
extern int cvmx_usb_initialize(struct cvmx_usb_state *state,
int usb_port_number);
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);

View File

@ -705,7 +705,7 @@ static int octeon_usb_driver_probe(struct device *dev)
tasklet_init(&priv->dequeue_tasklet, octeon_usb_urb_dequeue_work, (unsigned long)priv);
INIT_LIST_HEAD(&priv->dequeue_list);
status = cvmx_usb_initialize(&priv->usb, usb_num, CVMX_USB_INITIALIZE_FLAGS_CLOCK_AUTO);
status = cvmx_usb_initialize(&priv->usb, usb_num);
if (status) {
dev_dbg(dev, "USB initialization failed with %d\n", status);
kfree(hcd);