From 9be317e69e088ffe78aea5bd3dafa3f7b4feb77b Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Tue, 1 Oct 2013 23:43:09 +0300 Subject: [PATCH] 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon-usb/cvmx-usb.c | 52 ++++++++++--------------- drivers/staging/octeon-usb/cvmx-usb.h | 10 ++--- drivers/staging/octeon-usb/octeon-hcd.c | 2 +- 3 files changed, 25 insertions(+), 39 deletions(-) diff --git a/drivers/staging/octeon-usb/cvmx-usb.c b/drivers/staging/octeon-usb/cvmx-usb.c index 45dfe94199ae..22efd592a46c 100644 --- a/drivers/staging/octeon-usb/cvmx-usb.c +++ b/drivers/staging/octeon-usb/cvmx-usb.c @@ -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)); diff --git a/drivers/staging/octeon-usb/cvmx-usb.h b/drivers/staging/octeon-usb/cvmx-usb.h index 8bf36966ef15..74edb0a72e83 100644 --- a/drivers/staging/octeon-usb/cvmx-usb.h +++ b/drivers/staging/octeon-usb/cvmx-usb.h @@ -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); diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 5dbbd14ec615..9b9cc1f6be78 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -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); -- 2.20.1