ARM: omap1: innovator: move ohci phy power handling to board file
authorArnd Bergmann <arnd@arndb.de>
Tue, 6 Aug 2019 13:13:18 +0000 (15:13 +0200)
committerArnd Bergmann <arnd@arndb.de>
Thu, 21 Apr 2022 13:01:44 +0000 (15:01 +0200)
The innovator board needs a special case for its phy control.

Move the corresponding code into the board file and out of the
common code by adding another callback.

Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/arm/mach-omap1/board-innovator.c
drivers/usb/host/ohci-omap.c
include/linux/platform_data/usb-omap1.h

index e7d6735..f169e17 100644 (file)
@@ -290,6 +290,23 @@ static void __init innovator_init_smc91x(void)
 }
 
 #ifdef CONFIG_ARCH_OMAP15XX
+/*
+ * Board specific gang-switched transceiver power on/off.
+ */
+static int innovator_omap_ohci_transceiver_power(int on)
+{
+       if (on)
+               __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL)
+                               | ((1 << 5/*usb1*/) | (1 << 3/*usb2*/)),
+                              INNOVATOR_FPGA_CAM_USB_CONTROL);
+       else
+               __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL)
+                               & ~((1 << 5/*usb1*/) | (1 << 3/*usb2*/)),
+                              INNOVATOR_FPGA_CAM_USB_CONTROL);
+
+       return 0;
+}
+
 static struct omap_usb_config innovator1510_usb_config __initdata = {
        /* for bundled non-standard host and peripheral cables */
        .hmc_mode       = 4,
@@ -300,6 +317,8 @@ static struct omap_usb_config innovator1510_usb_config __initdata = {
 
        .register_dev   = 1,
        .pins[0]        = 2,
+
+       .transceiver_power = innovator_omap_ohci_transceiver_power,
 };
 
 static const struct omap_lcd_config innovator1510_lcd_config __initconst = {
index 750a90c..069791d 100644 (file)
@@ -67,31 +67,6 @@ static void omap_ohci_clock_power(struct ohci_omap_priv *priv, int on)
        }
 }
 
-/*
- * Board specific gang-switched transceiver power on/off.
- * NOTE:  OSK supplies power from DC, not battery.
- */
-static int omap_ohci_transceiver_power(struct ohci_omap_priv *priv, int on)
-{
-       if (on) {
-               if (machine_is_omap_innovator() && cpu_is_omap1510())
-                       __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL)
-                               | ((1 << 5/*usb1*/) | (1 << 3/*usb2*/)),
-                              INNOVATOR_FPGA_CAM_USB_CONTROL);
-               else if (priv->power)
-                       gpiod_set_value_cansleep(priv->power, 0);
-       } else {
-               if (machine_is_omap_innovator() && cpu_is_omap1510())
-                       __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL)
-                               & ~((1 << 5/*usb1*/) | (1 << 3/*usb2*/)),
-                              INNOVATOR_FPGA_CAM_USB_CONTROL);
-               else if (priv->power)
-                       gpiod_set_value_cansleep(priv->power, 1);
-       }
-
-       return 0;
-}
-
 #ifdef CONFIG_USB_OTG
 
 static void start_hnp(struct ohci_hcd *ohci)
@@ -202,7 +177,11 @@ static int ohci_omap_reset(struct usb_hcd *hcd)
        }
 
        /* FIXME hub_wq hub requests should manage power switching */
-       omap_ohci_transceiver_power(priv, 1);
+       if (config->transceiver_power)
+               return config->transceiver_power(1);
+
+       if (priv->power)
+               gpiod_set_value_cansleep(priv->power, 0);
 
        /* board init will have already handled HMC and mux setup.
         * any external transceiver should already be initialized
index 878e572..e7b8dc9 100644 (file)
@@ -50,6 +50,8 @@ struct omap_usb_config {
        int (*ocpi_enable)(void);
 
        void (*lb_reset)(void);
+
+       int (*transceiver_power)(int on);
 };
 
 #endif /* __LINUX_USB_OMAP1_H */