[1/3] USB: ehci-hub: let port_power() override the ehci_port_power()
diff mbox series

Message ID 20200227104212.12562-2-m.felsch@pengutronix.de
State New
Headers show
  • USB IMX Chipidea fix gpio vbus control
Related show

Commit Message

Marco Felsch Feb. 27, 2020, 10:42 a.m. UTC
Since commit 11a7e5940514 ("usb: ehci: add ehci_port_power interface")
drivers can add a port_power() override callback. Currently the
ChipIdea host driver is the only one using the callback to support gpio
controlled vbus enable/disable. Then commit 6adb9b7b5fb6 ("usb: chipidea:
add a flag for turn on vbus early for host") and commit 659459174188
("usb: chipidea: host: turn on vbus before add hcd if early vbus on is
required") adding a workaround to address the current core behaviour.
Since that the gpio based port-power is broken which was the only
use-case for this callback.

We should let the override callback override the core behaviour to avoid
adding local workarounds needed to address the core behaviour.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
 drivers/usb/host/ehci-hub.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff mbox series

diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index ce0eaf7d7c12..12b8c9055ab3 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -1338,13 +1338,13 @@  static int ehci_port_power(struct ehci_hcd *ehci, int portnum, bool enable)
 	u32 __iomem *status_reg = &ehci->regs->port_status[portnum];
 	u32 temp = ehci_readl(ehci, status_reg) & ~PORT_RWC_BITS;
+	if (hcd->driver->port_power)
+		return hcd->driver->port_power(hcd, portnum, enable);
 	if (enable)
 		ehci_writel(ehci, temp | PORT_POWER, status_reg);
 		ehci_writel(ehci, temp & ~PORT_POWER, status_reg);
-	if (hcd->driver->port_power)
-		hcd->driver->port_power(hcd, portnum, enable);
 	return 0;