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

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: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b8b04eef
...@@ -552,20 +552,15 @@ static inline void __cvmx_usb_remove_pipe(struct cvmx_usb_pipe_list *list, struc ...@@ -552,20 +552,15 @@ static inline void __cvmx_usb_remove_pipe(struct cvmx_usb_pipe_list *list, struc
* functions. * functions.
* @usb_port_number: * @usb_port_number:
* Which Octeon USB port to initialize. * 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. * Returns: 0 or a negative error code.
*/ */
int cvmx_usb_initialize(struct cvmx_usb_state *state, int usb_port_number, int cvmx_usb_initialize(struct cvmx_usb_state *state, int usb_port_number)
enum cvmx_usb_initialize_flags flags)
{ {
union cvmx_usbnx_clk_ctl usbn_clk_ctl; union cvmx_usbnx_clk_ctl usbn_clk_ctl;
union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status; union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status;
struct cvmx_usb_internal_state *usb = (struct cvmx_usb_internal_state *)state; struct cvmx_usb_internal_state *usb = (struct cvmx_usb_internal_state *)state;
enum cvmx_usb_initialize_flags flags = 0;
usb->init_flags = flags;
/* Make sure that state is large enough to store the internal state */ /* Make sure that state is large enough to store the internal state */
if (sizeof(*state) < sizeof(*usb)) if (sizeof(*state) < sizeof(*usb))
...@@ -577,31 +572,26 @@ int cvmx_usb_initialize(struct cvmx_usb_state *state, int usb_port_number, ...@@ -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)) if (!OCTEON_IS_MODEL(OCTEON_CN52XX) && (usb_port_number > 0))
return -EINVAL; return -EINVAL;
/* Try to determine clock type automatically */ /* Try to determine clock type automatically */
if ((flags & (CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI | if (octeon_usb_get_clock_type() == USB_CLOCK_TYPE_CRYSTAL_12) {
CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND)) == 0) { /* Only 12 MHZ crystals are supported */
if (octeon_usb_get_clock_type() == USB_CLOCK_TYPE_CRYSTAL_12) flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI;
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI; /* Only 12 MHZ crystals are supported */ } else {
else flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND;
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND;
}
if (flags & CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND) { switch (octeon_usb_get_clock_type()) {
/* Check for auto ref clock frequency */ case USB_CLOCK_TYPE_REF_12:
if (!(flags & CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK)) flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ;
switch (octeon_usb_get_clock_type()) { break;
case USB_CLOCK_TYPE_REF_12: case USB_CLOCK_TYPE_REF_24:
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ; flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ;
break; break;
case USB_CLOCK_TYPE_REF_24: case USB_CLOCK_TYPE_REF_48:
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ; flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ;
break; break;
case USB_CLOCK_TYPE_REF_48: default:
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ; return -EINVAL;
break; break;
default: }
return -EINVAL;
break;
}
} }
memset(usb, 0, sizeof(*usb)); memset(usb, 0, sizeof(*usb));
......
...@@ -427,7 +427,7 @@ typedef void (*cvmx_usb_callback_func_t)(struct cvmx_usb_state *state, ...@@ -427,7 +427,7 @@ typedef void (*cvmx_usb_callback_func_t)(struct cvmx_usb_state *state,
int bytes_transferred, void *user_data); 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 * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI: The USB port uses a 12MHz crystal
* as clock source at USB_XO and * as clock source at USB_XO and
...@@ -435,9 +435,6 @@ typedef void (*cvmx_usb_callback_func_t)(struct cvmx_usb_state *state, ...@@ -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 * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND: The USB port uses 12/24/48MHz 2.5V
* board clock source at USB_XO. * board clock source at USB_XO.
* USB_XI should be tied to GND. * 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_MHZ_MASK: Mask for clock speed field
* @CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ: Speed of reference clock or * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ: Speed of reference clock or
* crystal * crystal
...@@ -449,7 +446,6 @@ typedef void (*cvmx_usb_callback_func_t)(struct cvmx_usb_state *state, ...@@ -449,7 +446,6 @@ typedef void (*cvmx_usb_callback_func_t)(struct cvmx_usb_state *state,
enum cvmx_usb_initialize_flags { enum cvmx_usb_initialize_flags {
CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI = 1 << 0, CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI = 1 << 0,
CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND = 1 << 1, 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_MHZ_MASK = 3 << 3,
CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ = 1 << 3, CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ = 1 << 3,
CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ = 2 << 3, CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ = 2 << 3,
...@@ -477,8 +473,8 @@ enum cvmx_usb_pipe_flags { ...@@ -477,8 +473,8 @@ enum cvmx_usb_pipe_flags {
}; };
extern int cvmx_usb_get_num_ports(void); extern int cvmx_usb_get_num_ports(void);
extern int cvmx_usb_initialize(struct cvmx_usb_state *state, int usb_port_number, extern int cvmx_usb_initialize(struct cvmx_usb_state *state,
enum cvmx_usb_initialize_flags flags); int usb_port_number);
extern int cvmx_usb_shutdown(struct cvmx_usb_state *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_enable(struct cvmx_usb_state *state);
extern int cvmx_usb_disable(struct cvmx_usb_state *state); extern int cvmx_usb_disable(struct cvmx_usb_state *state);
......
...@@ -705,7 +705,7 @@ static int octeon_usb_driver_probe(struct device *dev) ...@@ -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); tasklet_init(&priv->dequeue_tasklet, octeon_usb_urb_dequeue_work, (unsigned long)priv);
INIT_LIST_HEAD(&priv->dequeue_list); 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) { if (status) {
dev_dbg(dev, "USB initialization failed with %d\n", status); dev_dbg(dev, "USB initialization failed with %d\n", status);
kfree(hcd); kfree(hcd);
......
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