[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMdYzYopzOJ2RtWtYgP3G4ESVMFhCqU3fOQq_kCc1g51ZDZ=bA@mail.gmail.com>
Date: Wed, 24 Aug 2022 12:17:39 +0200
From: Peter Geis <pgwipeout@...il.com>
To: Michael Riesch <michael.riesch@...fvision.net>
Cc: Heiko Stuebner <heiko@...ech.de>,
Kishon Vijay Abraham I <kishon@...com>,
Vinod Koul <vkoul@...nel.org>,
Samuel Holland <samuel@...lland.org>,
Markus Reichl <m.reichl@...etechno.de>,
"open list:GENERIC PHY FRAMEWORK" <linux-phy@...ts.infradead.org>,
arm-mail-list <linux-arm-kernel@...ts.infradead.org>,
"open list:ARM/Rockchip SoC..." <linux-rockchip@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] phy: rockchip-inno-usb2: Return zero after otg sync
On Wed, Aug 24, 2022 at 7:33 AM Michael Riesch
<michael.riesch@...fvision.net> wrote:
>
> Hi Peter,
>
> On 8/23/22 16:47, Peter Geis wrote:
> > The otg sync state patch reuses the ret variable, but fails to set it to
> > zero after use. This leads to a situation when the otg port is in
> > peripheral mode where the otg phy aborts halfway through setup. It also
> > fails to account for a failure to register the extcon notifier. Fix this
> > by using our own variable and skipping otg sync in case of failure.
> >
> > Fixes: 8dc60f8da22f ("phy: rockchip-inno-usb2: Sync initial otg state")
> >
> > Reported-by: Markus Reichl <m.reichl@...etechno.de>
> > Reported-by: Michael Riesch <michael.riesch@...fvision.net>
> > Signed-off-by: Peter Geis <pgwipeout@...il.com>
> > Tested-by: Michael Riesch <michael.riesch@...fvision.net>
> > Tested-by: Markus Reichl <m.reichl@...etechno.de>
> > ---
> > drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> > index 0b1e9337ee8e..d579a22c61df 100644
> > --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> > +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> > @@ -1124,7 +1124,7 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
> > struct rockchip_usb2phy_port *rport,
> > struct device_node *child_np)
> > {
> > - int ret;
> > + int ret, id;
> >
> > rport->port_id = USB2PHY_PORT_OTG;
> > rport->port_cfg = &rphy->phy_cfg->port_cfgs[USB2PHY_PORT_OTG];
> > @@ -1164,11 +1164,12 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
> > EXTCON_USB_HOST, &rport->event_nb);
> > if (ret)
>
> This needs braces, right?
>
> if (ret) {
> > dev_err(rphy->dev, "register USB HOST notifier failed\n");
> > + goto out;
>
> }
>
> With the braces the patch works as expected.
Yup, thanks for that. I hate working without access to my hardware.
>
> Thanks and best regards,
> Michael
>
> >
> > if (!of_property_read_bool(rphy->dev->of_node, "extcon")) {
> > /* do initial sync of usb state */
> > - ret = property_enabled(rphy->grf, &rport->port_cfg->utmi_id);
> > - extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !ret);
> > + id = property_enabled(rphy->grf, &rport->port_cfg->utmi_id);
> > + extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !id);
> > }
> > }
> >
Powered by blists - more mailing lists