Skip to content

Commit d843f03

Browse files
Wayne Changgregkh
authored andcommitted
phy: tegra: xusb: Add API to retrieve the port number of phy
This patch introduces a new API, tegra_xusb_padctl_get_port_number, to the Tegra XUSB Pad Controller driver. This API is used to identify the USB port that is associated with a given PHY. The function takes a PHY pointer for either a USB2 PHY or USB3 PHY as input and returns the corresponding port number. If the PHY pointer is invalid, it returns -ENODEV. Cc: [email protected] Signed-off-by: Wayne Chang <[email protected]> Reviewed-by: Jon Hunter <[email protected]> Tested-by: Jon Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 07cb1ec commit d843f03

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

drivers/phy/tegra/xusb.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,19 @@ int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl,
15311531
}
15321532
EXPORT_SYMBOL_GPL(tegra_xusb_padctl_get_usb3_companion);
15331533

1534+
int tegra_xusb_padctl_get_port_number(struct phy *phy)
1535+
{
1536+
struct tegra_xusb_lane *lane;
1537+
1538+
if (!phy)
1539+
return -ENODEV;
1540+
1541+
lane = phy_get_drvdata(phy);
1542+
1543+
return lane->index;
1544+
}
1545+
EXPORT_SYMBOL_GPL(tegra_xusb_padctl_get_port_number);
1546+
15341547
MODULE_AUTHOR("Thierry Reding <[email protected]>");
15351548
MODULE_DESCRIPTION("Tegra XUSB Pad Controller driver");
15361549
MODULE_LICENSE("GPL v2");

include/linux/phy/tegra/xusb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void tegra_phy_xusb_utmi_pad_power_down(struct phy *phy);
2626
int tegra_phy_xusb_utmi_port_reset(struct phy *phy);
2727
int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl,
2828
unsigned int port);
29+
int tegra_xusb_padctl_get_port_number(struct phy *phy);
2930
int tegra_xusb_padctl_enable_phy_sleepwalk(struct tegra_xusb_padctl *padctl, struct phy *phy,
3031
enum usb_device_speed speed);
3132
int tegra_xusb_padctl_disable_phy_sleepwalk(struct tegra_xusb_padctl *padctl, struct phy *phy);

0 commit comments

Comments
 (0)