Skip to content

Commit 5a40fc4

Browse files
Nagarjuna Kristamthierryreding
authored andcommitted
phy: tegra: xusb: Add support to get companion USB 3 port
Tegra XUSB host, device mode driver requires the USB 3 companion port number for corresponding USB 2 port. Add API to retrieve the same. Signed-off-by: Nagarjuna Kristam <[email protected]> Reviewed-by: JC Kuo <[email protected]> Acked-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent e8f7d2f commit 5a40fc4

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

drivers/phy/tegra/xusb.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,27 @@ int tegra_phy_xusb_utmi_port_reset(struct phy *phy)
12991299
}
13001300
EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_port_reset);
13011301

1302+
int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl,
1303+
unsigned int port)
1304+
{
1305+
struct tegra_xusb_usb2_port *usb2;
1306+
struct tegra_xusb_usb3_port *usb3;
1307+
int i;
1308+
1309+
usb2 = tegra_xusb_find_usb2_port(padctl, port);
1310+
if (!usb2)
1311+
return -EINVAL;
1312+
1313+
for (i = 0; i < padctl->soc->ports.usb3.count; i++) {
1314+
usb3 = tegra_xusb_find_usb3_port(padctl, i);
1315+
if (usb3 && usb3->port == usb2->base.index)
1316+
return usb3->base.index;
1317+
}
1318+
1319+
return -ENODEV;
1320+
}
1321+
EXPORT_SYMBOL_GPL(tegra_xusb_padctl_get_usb3_companion);
1322+
13021323
MODULE_AUTHOR("Thierry Reding <[email protected]>");
13031324
MODULE_DESCRIPTION("Tegra XUSB Pad Controller driver");
13041325
MODULE_LICENSE("GPL v2");

include/linux/phy/tegra/xusb.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ int tegra_xusb_padctl_usb3_set_lfps_detect(struct tegra_xusb_padctl *padctl,
2121
int tegra_xusb_padctl_set_vbus_override(struct tegra_xusb_padctl *padctl,
2222
bool val);
2323
int tegra_phy_xusb_utmi_port_reset(struct phy *phy);
24+
int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl,
25+
unsigned int port);
2426
#endif /* PHY_TEGRA_XUSB_H */

0 commit comments

Comments
 (0)