[PATCH] phy: tegra: xusb: fix xusb backwards compatibility

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prior to implementing role switch support, all enabled ports enumerated
as host devices.
With role switch support enabled, device trees with otg ports which have
not been updated with usb-role-switch support now bail out during
enumeration.
This disables all xhci ports tied to the affected phy.

Retain backwards compatibility by forcing host mode on otg ports which
are missing the usb-role-switch flag.
Disable ports explicitly defined as peripheral mode that are missing the
usb-role-switch flag.

Signed-off-by: Peter Geis <pgwipeout@xxxxxxxxx>
Reported-by: Matias Zuniga <matias.nicolas.zc@xxxxxxxxx>

Fixes: e8f7d2f409a1 ("phy: tegra: xusb: Add usb-phy support")
---
 drivers/phy/tegra/xusb.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
index de4a46fe1763..c36dce13e0c6 100644
--- a/drivers/phy/tegra/xusb.c
+++ b/drivers/phy/tegra/xusb.c
@@ -734,10 +734,12 @@ static int tegra_xusb_usb2_port_parse_dt(struct tegra_xusb_usb2_port *usb2)
 			err = tegra_xusb_setup_usb_role_switch(port);
 			if (err < 0)
 				return err;
+		} else if (usb2->mode == USB_DR_MODE_PERIPHERAL) {
+			dev_err(&port->dev, "mandatory usb-role-switch not found for %s mode, disabling port\n", modes[usb2->mode]);
+			usb2->mode = USB_DR_MODE_UNKNOWN;
 		} else {
-			dev_err(&port->dev, "usb-role-switch not found for %s mode",
-				modes[usb2->mode]);
-			return -EINVAL;
+			dev_warn(&port->dev, "usb-role-switch not found for %s mode, forcing host\n", modes[usb2->mode]);
+			usb2->mode = USB_DR_MODE_HOST;
 		}
 	}
 
-- 
2.17.1




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux