diff options
author | Nagarjuna Kristam <nkristam@nvidia.com> | 2019-10-18 15:08:09 +0530 |
---|---|---|
committer | Kishon Vijay Abraham I <kishon@ti.com> | 2019-10-23 13:20:36 +0530 |
commit | a8a24429dd1d799f1c6737779af88c1d39290a77 (patch) | |
tree | 6a78993eb757a7c102f8832a074010c18490f5b1 /drivers/phy/tegra/xusb-tegra186.c | |
parent | 90767cdfea89c3ac7012035d66633b9ba839091a (diff) | |
download | lwn-a8a24429dd1d799f1c6737779af88c1d39290a77.tar.gz lwn-a8a24429dd1d799f1c6737779af88c1d39290a77.zip |
phy: tegra: xusb: Add vbus override support on Tegra186
Tegra XUSB device control driver needs to control vbus override
during its operations, add API for the support.
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy/tegra/xusb-tegra186.c')
-rw-r--r-- | drivers/phy/tegra/xusb-tegra186.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/phy/tegra/xusb-tegra186.c b/drivers/phy/tegra/xusb-tegra186.c index 6f3afaf9398f..84c27394c181 100644 --- a/drivers/phy/tegra/xusb-tegra186.c +++ b/drivers/phy/tegra/xusb-tegra186.c @@ -857,9 +857,32 @@ static void tegra186_xusb_padctl_remove(struct tegra_xusb_padctl *padctl) { } +static int tegra186_xusb_padctl_vbus_override(struct tegra_xusb_padctl *padctl, + bool status) +{ + u32 value; + + dev_dbg(padctl->dev, "%s vbus override\n", status ? "set" : "clear"); + + value = padctl_readl(padctl, USB2_VBUS_ID); + + if (status) { + value |= VBUS_OVERRIDE; + value &= ~ID_OVERRIDE(~0); + value |= ID_OVERRIDE_FLOATING; + } else { + value &= ~VBUS_OVERRIDE; + } + + padctl_writel(padctl, value, USB2_VBUS_ID); + + return 0; +} + static const struct tegra_xusb_padctl_ops tegra186_xusb_padctl_ops = { .probe = tegra186_xusb_padctl_probe, .remove = tegra186_xusb_padctl_remove, + .vbus_override = tegra186_xusb_padctl_vbus_override, }; static const char * const tegra186_xusb_padctl_supply_names[] = { |