staging: octeon-usb: delete redundant flags from cvmx_usb_initialize()
authorAaro Koskinen <aaro.koskinen@iki.fi>
Tue, 1 Oct 2013 20:43:09 +0000 (23:43 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Oct 2013 20:38:05 +0000 (13:38 -0700)
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>
drivers/staging/octeon-usb/cvmx-usb.c
drivers/staging/octeon-usb/cvmx-usb.h
drivers/staging/octeon-usb/octeon-hcd.c

index 45dfe94199ae4ecd951a8142fb6f9140d226942c..22efd592a46c8ee10884a335ef486eac181584e0 100644 (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));
index 8bf36966ef15d77ae15f70e01b854975ccedde14..74edb0a72e834bcc62b57b2f3069d3e4ba6d0054 100644 (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);
index 5dbbd14ec615aba59d16c72a2e7acbe08f9073cf..9b9cc1f6be78928309e051f3efbec2e8bd4cf31a 100644 (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);