Skip to contentSkip to conversation

patch "phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs" added to usb-linus

PATCH [email protected] 1 participant 1 message Mar 26, 2019

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 1396929e8a903db80425343cacca766a18ad6409 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai <[email protected]>
Date: Fri, 22 Mar 2019 16:51:07 +0800
Subject: phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs

While only the first PHY supports mode switching, the remaining PHYs work in USB host mode. They should support set_mode with mode=USB_HOST instead of failing. This is especially needed now that the USB core does set_mode for all USB ports, which was added in commit b97a31348379 ("usb:
core: comply to PHY framework").

Make set_mode with mode=USB_HOST a no-op instead of failing for the non-OTG USB PHYs.

Fixes 6ba43c291961 ("phy-sun4i-usb: Add support for phy_set_mode")
Cc stable <[email protected]>
---
 drivers/phy/allwinner/phy-sun4i-usb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/phy/allwinner/phy-sun4i-usb.c +4 -1
index 5163097b43df..4bbd9ede38c8 100644
@@ -485,8 +485,11 @@ static int sun4i_usb_phy_set_mode(struct phy *_phy,
 	struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
 	int new_mode;
 
-	if (phy->index != 0)
+	if (phy->index != 0) {
+		if (mode == PHY_MODE_USB_HOST)
+			return 0;
 		return -EINVAL;
+	}
 
 	switch (mode) {
 	case PHY_MODE_USB_HOST:
Signature · 1 line
2.21.0