public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] phy: rockchip-inno-usb2: Sync initial otg state
@ 2022-06-22  0:31 Peter Geis
  2022-06-22  5:16 ` Samuel Holland
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Peter Geis @ 2022-06-22  0:31 UTC (permalink / raw)
  To: Heiko Stuebner, Kishon Vijay Abraham I, Vinod Koul,
	Samuel Holland
  Cc: Peter Geis, linux-phy, linux-arm-kernel, linux-rockchip,
	linux-kernel

The initial otg state for the phy defaults to device mode. The actual
state isn't detected until an ID IRQ fires. Fix this by syncing the ID
state during initialization.

Fixes: 51a9b2c03dd3 ("phy: rockchip-inno-usb2: Handle ID IRQ")
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index 6711659f727c..6e44069617df 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -1162,6 +1162,12 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
 					EXTCON_USB_HOST, &rport->event_nb);
 		if (ret)
 			dev_err(rphy->dev, "register USB HOST notifier failed\n");
+
+		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);
+		}
 	}
 
 out:
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-08-22  9:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-22  0:31 [PATCH] phy: rockchip-inno-usb2: Sync initial otg state Peter Geis
2022-06-22  5:16 ` Samuel Holland
2022-06-22  8:31   ` Peter Geis
2022-07-05  7:27 ` Vinod Koul
2022-07-26  8:54 ` Markus Reichl
     [not found] ` <88f2de00-32e3-ed74-082f-c0972a81f0f8@fivetechno.de>
2022-08-04  9:49   ` [BUG BISECT] " Peter Geis
2022-08-16  9:20     ` Michael Riesch
2022-08-16 15:27       ` Peter Geis
2022-08-17  8:25         ` Michael Riesch
2022-08-20 10:23           ` Peter Geis
2022-08-22  7:01             ` Michael Riesch
2022-08-22  9:28             ` Markus Reichl

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