Skip to contentSkip to conversation

phy: sun4i-usb: Make sure to disable PHY0 passby for peripheral mode

PATCH In review Paul Kocialkowski 2 participants 3 messages Mar 14, 2019 – Apr 17, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: sun4i-usb: Make sure to disable PHY0 passby for peripheral mode

On platforms where the MUSB and HCI controllers share PHY0, PHY passby is required when using the HCI controller with the PHY, but it must be disabled when the MUSB controller is used instead.

Without this, PHY0 passby is always enabled, which results in broken peripheral mode on such platforms (e.g. H3/H5).

Fixes ba4bdc9e1dc0 ("PHY: sunxi: Add driver for sunxi usb phy")
---
 drivers/phy/allwinner/phy-sun4i-usb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/phy/allwinner/phy-sun4i-usb.c +4 -0
index 5163097b43df..7b23920e0068 100644
@@ -551,6 +551,7 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 	struct sun4i_usb_phy_data *data =
 		container_of(work, struct sun4i_usb_phy_data, detect.work);
 	struct phy *phy0 = data->phys[0].phy;
+	struct sun4i_usb_phy *phy = phy_get_drvdata(phy0);
 	bool force_session_end, id_notify = false, vbus_notify = false;
 	int id_det, vbus_det;
 
@@ -607,6 +608,9 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 			mutex_unlock(&phy0->mutex);
 		}
 
+		/* Enable PHY0 passby for host mode only. */
+		sun4i_usb_phy_passby(phy, !id_det);
+
 		/* Re-route PHY0 if necessary */
 		if (data->cfg->phy0_dual_route)
 			sun4i_usb_phy0_reroute(data, id_det);
Signature · 1 line
2.20.1
#1 lore raw

Hi,

Quoted 8 lines · Paul Kocialkowski

On platforms where the MUSB and HCI controllers share PHY0, PHY passby is required when using the HCI controller with the PHY, but it must be disabled when the MUSB controller is used instead.

Without this, PHY0 passby is always enabled, which results in broken peripheral mode on such platforms (e.g. H3/H5).

Fixes ba4bdc9e1dc0 ("PHY: sunxi: Add driver for sunxi usb phy")

Does anyone have feedback about this? I was hoping to get it merged rather soon since it pretty much fixes USB gadget on H3/R40/V3/V3s.

Cheers,

Paul

Quoted 27 lines
---
 drivers/phy/allwinner/phy-sun4i-usb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/phy/allwinner/phy-sun4i-usb.c +4 -0
index 5163097b43df..7b23920e0068 100644
@@ -551,6 +551,7 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 	struct sun4i_usb_phy_data *data =
 		container_of(work, struct sun4i_usb_phy_data, detect.work);
 	struct phy *phy0 = data->phys[0].phy;
+	struct sun4i_usb_phy *phy = phy_get_drvdata(phy0);
 	bool force_session_end, id_notify = false, vbus_notify = false;
 	int id_det, vbus_det;
 
@@ -607,6 +608,9 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 			mutex_unlock(&phy0->mutex);
 		}
 
+		/* Enable PHY0 passby for host mode only. */
+		sun4i_usb_phy_passby(phy, !id_det);
+
 		/* Re-route PHY0 if necessary */
 		if (data->cfg->phy0_dual_route)
 			sun4i_usb_phy0_reroute(data, id_det);
Signature · 3 lines
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
#2 lore raw
Quoted 7 lines · Paul Kocialkowski

Hi,

Quoted 4 lines · Paul Kocialkowski

On platforms where the MUSB and HCI controllers share PHY0, PHY passby is required when using the HCI controller with the PHY, but it must be disabled when the MUSB controller is used instead.

Quoted 7 lines
Quoted 4 lines

Without this, PHY0 passby is always enabled, which results in broken peripheral mode on such platforms (e.g. H3/H5).

Fixes ba4bdc9e1dc0 ("PHY: sunxi: Add driver for sunxi usb phy")

Does anyone have feedback about this? I was hoping to get it merged rather soon since it pretty much fixes USB gadget on H3/R40/V3/V3s.

merged now, thanks.

-Kishon

Quoted 26 lines

Cheers,

Paul

Quoted 21 lines
---
 drivers/phy/allwinner/phy-sun4i-usb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/phy/allwinner/phy-sun4i-usb.c +1 -0
index 5163097b43df..7b23920e0068 100644
@@ -551,6 +551,7 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 	struct sun4i_usb_phy_data *data =
 		container_of(work, struct sun4i_usb_phy_data, detect.work);
 	struct phy *phy0 = data->phys[0].phy;
+	struct sun4i_usb_phy *phy = phy_get_drvdata(phy0);
 	bool force_session_end, id_notify = false, vbus_notify = false;
 	int id_det, vbus_det;
 
@@ -607,6 +608,9 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 			mutex_unlock(&phy0->mutex);
 		}
 
Quoted 6 lines

drivers/phy/allwinner/phy-sun4i-usb.c static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work) · line 616

Quoted 6 lines
drivers/phy/allwinner/phy-sun4i-usb.c +3 -0
+		/* Enable PHY0 passby for host mode only. */
+		sun4i_usb_phy_passby(phy, !id_det);
+
 		/* Re-route PHY0 if necessary */
 		if (data->cfg->phy0_dual_route)
 			sun4i_usb_phy0_reroute(data, id_det);

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel