public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: rockchip-inno-usb2: Ignore OTG IRQs in host mode
@ 2022-07-08  6:14 Samuel Holland
  2022-07-08 11:47 ` Aw: " Frank Wunderlich
  2022-07-15 11:48 ` Vinod Koul
  0 siblings, 2 replies; 4+ messages in thread
From: Samuel Holland @ 2022-07-08  6:14 UTC (permalink / raw)
  To: Frank Wunderlich, Vinod Koul
  Cc: Greg Kroah-Hartman, Peter Geis, Samuel Holland, Heiko Stuebner,
	Kishon Vijay Abraham I, linux-arm-kernel, linux-kernel, linux-phy,
	linux-rockchip

When the OTG port is fixed to host mode, the driver does not request its
IRQs, nor does it enable those IRQs in hardware. Similarly, the driver
should ignore the OTG port IRQs when handling the shared interrupt.

Otherwise, it would update the extcon based on an ID pin which may be in
an undefined state, or try to queue a uninitialized work item.

Fixes: 6a98df08ccd5 ("phy: rockchip-inno-usb2: Fix muxed interrupt support")
Reported-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---

 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index 6711659f727c..26b841c49ec6 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -978,7 +978,9 @@ static irqreturn_t rockchip_usb2phy_irq(int irq, void *data)
 
 		switch (rport->port_id) {
 		case USB2PHY_PORT_OTG:
-			ret |= rockchip_usb2phy_otg_mux_irq(irq, rport);
+			if (rport->mode != USB_DR_MODE_HOST &&
+			    rport->mode != USB_DR_MODE_UNKNOWN)
+				ret |= rockchip_usb2phy_otg_mux_irq(irq, rport);
 			break;
 		case USB2PHY_PORT_HOST:
 			ret |= rockchip_usb2phy_linestate_irq(irq, rport);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Aw: [PATCH] phy: rockchip-inno-usb2: Ignore OTG IRQs in host mode
  2022-07-08  6:14 [PATCH] phy: rockchip-inno-usb2: Ignore OTG IRQs in host mode Samuel Holland
@ 2022-07-08 11:47 ` Frank Wunderlich
  2022-07-08 13:03   ` Peter Geis
  2022-07-15 11:48 ` Vinod Koul
  1 sibling, 1 reply; 4+ messages in thread
From: Frank Wunderlich @ 2022-07-08 11:47 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Vinod Koul, Greg Kroah-Hartman, Peter Geis, Samuel Holland,
	Heiko Stuebner, Kishon Vijay Abraham I, linux-arm-kernel,
	linux-kernel, linux-phy, linux-rockchip

Hi Samuel

thx for the fix...with this it works again

Tested-by: Frank Wunderlich <frank-w@public-files.de>

regards Frank


> Gesendet: Freitag, 08. Juli 2022 um 08:14 Uhr
> Von: "Samuel Holland" <samuel@sholland.org>
> An: "Frank Wunderlich" <frank-w@public-files.de>, "Vinod Koul" <vkoul@kernel.org>
> Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Peter Geis" <pgwipeout@gmail.com>, "Samuel Holland" <samuel@sholland.org>, "Heiko Stuebner" <heiko@sntech.de>, "Kishon Vijay Abraham I" <kishon@ti.com>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-rockchip@lists.infradead.org
> Betreff: [PATCH] phy: rockchip-inno-usb2: Ignore OTG IRQs in host mode
>
> When the OTG port is fixed to host mode, the driver does not request its
> IRQs, nor does it enable those IRQs in hardware. Similarly, the driver
> should ignore the OTG port IRQs when handling the shared interrupt.
>
> Otherwise, it would update the extcon based on an ID pin which may be in
> an undefined state, or try to queue a uninitialized work item.
>
> Fixes: 6a98df08ccd5 ("phy: rockchip-inno-usb2: Fix muxed interrupt support")
> Reported-by: Frank Wunderlich <frank-w@public-files.de>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
>
>  drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> index 6711659f727c..26b841c49ec6 100644
> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> @@ -978,7 +978,9 @@ static irqreturn_t rockchip_usb2phy_irq(int irq, void *data)
>
>  		switch (rport->port_id) {
>  		case USB2PHY_PORT_OTG:
> -			ret |= rockchip_usb2phy_otg_mux_irq(irq, rport);
> +			if (rport->mode != USB_DR_MODE_HOST &&
> +			    rport->mode != USB_DR_MODE_UNKNOWN)
> +				ret |= rockchip_usb2phy_otg_mux_irq(irq, rport);
>  			break;
>  		case USB2PHY_PORT_HOST:
>  			ret |= rockchip_usb2phy_linestate_irq(irq, rport);
> --
> 2.35.1
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] phy: rockchip-inno-usb2: Ignore OTG IRQs in host mode
  2022-07-08 11:47 ` Aw: " Frank Wunderlich
@ 2022-07-08 13:03   ` Peter Geis
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Geis @ 2022-07-08 13:03 UTC (permalink / raw)
  To: Frank Wunderlich
  Cc: Samuel Holland, Vinod Koul, Greg Kroah-Hartman, Heiko Stuebner,
	Kishon Vijay Abraham I, arm-mail-list, Linux Kernel Mailing List,
	open list:GENERIC PHY FRAMEWORK, open list:ARM/Rockchip SoC...

Good Morning,

I've confirmed this also resolves the issues with phy warnings on quartz64-a.
Tested-by: Peter Geis <pgwipeout@gmail.com>

Very Respectfully,
Peter Geis

On Fri, Jul 8, 2022 at 7:47 AM Frank Wunderlich <frank-w@public-files.de> wrote:
>
> Hi Samuel
>
> thx for the fix...with this it works again
>
> Tested-by: Frank Wunderlich <frank-w@public-files.de>
>
> regards Frank
>
>
> > Gesendet: Freitag, 08. Juli 2022 um 08:14 Uhr
> > Von: "Samuel Holland" <samuel@sholland.org>
> > An: "Frank Wunderlich" <frank-w@public-files.de>, "Vinod Koul" <vkoul@kernel.org>
> > Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Peter Geis" <pgwipeout@gmail.com>, "Samuel Holland" <samuel@sholland.org>, "Heiko Stuebner" <heiko@sntech.de>, "Kishon Vijay Abraham I" <kishon@ti.com>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-rockchip@lists.infradead.org
> > Betreff: [PATCH] phy: rockchip-inno-usb2: Ignore OTG IRQs in host mode
> >
> > When the OTG port is fixed to host mode, the driver does not request its
> > IRQs, nor does it enable those IRQs in hardware. Similarly, the driver
> > should ignore the OTG port IRQs when handling the shared interrupt.
> >
> > Otherwise, it would update the extcon based on an ID pin which may be in
> > an undefined state, or try to queue a uninitialized work item.
> >
> > Fixes: 6a98df08ccd5 ("phy: rockchip-inno-usb2: Fix muxed interrupt support")
> > Reported-by: Frank Wunderlich <frank-w@public-files.de>
> > Signed-off-by: Samuel Holland <samuel@sholland.org>
> > ---
> >
> >  drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> > index 6711659f727c..26b841c49ec6 100644
> > --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> > +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> > @@ -978,7 +978,9 @@ static irqreturn_t rockchip_usb2phy_irq(int irq, void *data)
> >
> >               switch (rport->port_id) {
> >               case USB2PHY_PORT_OTG:
> > -                     ret |= rockchip_usb2phy_otg_mux_irq(irq, rport);
> > +                     if (rport->mode != USB_DR_MODE_HOST &&
> > +                         rport->mode != USB_DR_MODE_UNKNOWN)
> > +                             ret |= rockchip_usb2phy_otg_mux_irq(irq, rport);
> >                       break;
> >               case USB2PHY_PORT_HOST:
> >                       ret |= rockchip_usb2phy_linestate_irq(irq, rport);
> > --
> > 2.35.1
> >
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] phy: rockchip-inno-usb2: Ignore OTG IRQs in host mode
  2022-07-08  6:14 [PATCH] phy: rockchip-inno-usb2: Ignore OTG IRQs in host mode Samuel Holland
  2022-07-08 11:47 ` Aw: " Frank Wunderlich
@ 2022-07-15 11:48 ` Vinod Koul
  1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2022-07-15 11:48 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Frank Wunderlich, Greg Kroah-Hartman, Peter Geis, Heiko Stuebner,
	Kishon Vijay Abraham I, linux-arm-kernel, linux-kernel, linux-phy,
	linux-rockchip

On 08-07-22, 01:14, Samuel Holland wrote:
> When the OTG port is fixed to host mode, the driver does not request its
> IRQs, nor does it enable those IRQs in hardware. Similarly, the driver
> should ignore the OTG port IRQs when handling the shared interrupt.
> 
> Otherwise, it would update the extcon based on an ID pin which may be in
> an undefined state, or try to queue a uninitialized work item.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-15 11:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-08  6:14 [PATCH] phy: rockchip-inno-usb2: Ignore OTG IRQs in host mode Samuel Holland
2022-07-08 11:47 ` Aw: " Frank Wunderlich
2022-07-08 13:03   ` Peter Geis
2022-07-15 11:48 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox