Linux USB
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Peter.Chen@nxp.com, gregkh@linuxfoundation.org,
	shawnguo@kernel.org, linux-imx@nxp.com,
	stern@rowland.harvard.edu, jun.li@freescale.com
Cc: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	kernel@pengutronix.de
Subject: [PATCH 1/3] USB: ehci-hub: let port_power() override the ehci_port_power()
Date: Thu, 27 Feb 2020 11:42:10 +0100	[thread overview]
Message-ID: <20200227104212.12562-2-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20200227104212.12562-1-m.felsch@pengutronix.de>

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 --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);
 	else
 		ehci_writel(ehci, temp & ~PORT_POWER, status_reg);
 
-	if (hcd->driver->port_power)
-		hcd->driver->port_power(hcd, portnum, enable);
-
 	return 0;
 }
-- 
2.20.1


  reply	other threads:[~2020-02-27 10:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 10:42 [PATCH 0/3] USB IMX Chipidea fix gpio vbus control Marco Felsch
2020-02-27 10:42 ` Marco Felsch [this message]
2020-02-27 10:42 ` [PATCH 2/3] Partially Revert "usb: chipidea: host: turn on vbus before add hcd if early vbus on is required" Marco Felsch
2020-02-27 10:42 ` [PATCH 3/3] Revert "usb: chipidea: add a flag for turn on vbus early for host" Marco Felsch
2020-02-27 11:18 ` [PATCH 0/3] USB IMX Chipidea fix gpio vbus control Peter Chen
2020-02-27 11:35   ` Marco Felsch
2020-02-27 12:20     ` Peter Chen
2020-02-27 12:44       ` Marco Felsch
2020-02-27 13:30         ` Peter Chen
2020-02-27 13:59           ` Peter Chen
2020-02-27 14:39           ` Marco Felsch
2020-02-28  2:51             ` Peter Chen
2020-02-28  7:48               ` Marco Felsch
2020-02-28  9:40                 ` Peter Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200227104212.12562-2-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=Peter.Chen@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.li@freescale.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox