Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: tegra: xusb: add utmi pad power on/down ops

Add utmi_pad_power_on/down ops for each SOC instead of exporting
tegra_phy_xusb_utmi_pad_power_on/down directly for Tegra186 chip.

Signed-off-by: BH Hsieh <bhsieh@nvidia.com>
Signed-off-by: Jim Lin <jilin@nvidia.com>
Link: https://lore.kernel.org/r/20220816082353.13390-2-jilin@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jim Lin and committed by
Greg Kroah-Hartman
77bfa0fc b7db5733

+39 -10
+12 -7
drivers/phy/tegra/xusb-tegra186.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved. 3 + * Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved. 4 4 */ 5 5 6 6 #include <linux/delay.h> ··· 638 638 mutex_unlock(&padctl->lock); 639 639 } 640 640 641 - static void tegra_phy_xusb_utmi_pad_power_on(struct phy *phy) 641 + static void tegra186_utmi_pad_power_on(struct phy *phy) 642 642 { 643 643 struct tegra_xusb_lane *lane = phy_get_drvdata(phy); 644 644 struct tegra_xusb_padctl *padctl = lane->pad->padctl; ··· 656 656 return; 657 657 } 658 658 659 + dev_dbg(dev, "power on UTMI pad %u\n", index); 660 + 659 661 tegra186_utmi_bias_pad_power_on(padctl); 660 662 661 663 udelay(2); ··· 671 669 padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); 672 670 } 673 671 674 - static void tegra_phy_xusb_utmi_pad_power_down(struct phy *phy) 672 + static void tegra186_utmi_pad_power_down(struct phy *phy) 675 673 { 676 674 struct tegra_xusb_lane *lane = phy_get_drvdata(phy); 677 675 struct tegra_xusb_padctl *padctl = lane->pad->padctl; ··· 680 678 681 679 if (!phy) 682 680 return; 681 + 682 + dev_dbg(padctl->dev, "power down UTMI pad %u\n", index); 683 683 684 684 value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); 685 685 value |= USB2_OTG_PD; ··· 853 849 value |= RPD_CTRL(priv->calib.rpd_ctrl); 854 850 padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); 855 851 856 - /* TODO: pad power saving */ 857 - tegra_phy_xusb_utmi_pad_power_on(phy); 852 + tegra186_utmi_pad_power_on(phy); 853 + 858 854 return 0; 859 855 } 860 856 861 857 static int tegra186_utmi_phy_power_off(struct phy *phy) 862 858 { 863 - /* TODO: pad power saving */ 864 - tegra_phy_xusb_utmi_pad_power_down(phy); 859 + tegra186_utmi_pad_power_down(phy); 865 860 866 861 return 0; 867 862 } ··· 1489 1486 .suspend_noirq = tegra186_xusb_padctl_suspend_noirq, 1490 1487 .resume_noirq = tegra186_xusb_padctl_resume_noirq, 1491 1488 .vbus_override = tegra186_xusb_padctl_vbus_override, 1489 + .utmi_pad_power_on = tegra186_utmi_pad_power_on, 1490 + .utmi_pad_power_down = tegra186_utmi_pad_power_down, 1492 1491 }; 1493 1492 1494 1493 #if IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC)
+21 -1
drivers/phy/tegra/xusb.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved. 3 + * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved. 4 4 */ 5 5 6 6 #include <linux/delay.h> ··· 1457 1457 return -ENOTSUPP; 1458 1458 } 1459 1459 EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_port_reset); 1460 + 1461 + void tegra_phy_xusb_utmi_pad_power_on(struct phy *phy) 1462 + { 1463 + struct tegra_xusb_lane *lane = phy_get_drvdata(phy); 1464 + struct tegra_xusb_padctl *padctl = lane->pad->padctl; 1465 + 1466 + if (padctl->soc->ops->utmi_pad_power_on) 1467 + padctl->soc->ops->utmi_pad_power_on(phy); 1468 + } 1469 + EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_pad_power_on); 1470 + 1471 + void tegra_phy_xusb_utmi_pad_power_down(struct phy *phy) 1472 + { 1473 + struct tegra_xusb_lane *lane = phy_get_drvdata(phy); 1474 + struct tegra_xusb_padctl *padctl = lane->pad->padctl; 1475 + 1476 + if (padctl->soc->ops->utmi_pad_power_down) 1477 + padctl->soc->ops->utmi_pad_power_down(phy); 1478 + } 1479 + EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_pad_power_down); 1460 1480 1461 1481 int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl, 1462 1482 unsigned int port)
+3 -1
drivers/phy/tegra/xusb.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 /* 3 - * Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved. 3 + * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved. 4 4 * Copyright (c) 2015, Google Inc. 5 5 */ 6 6 ··· 412 412 unsigned int index, bool enable); 413 413 int (*vbus_override)(struct tegra_xusb_padctl *padctl, bool set); 414 414 int (*utmi_port_reset)(struct phy *phy); 415 + void (*utmi_pad_power_on)(struct phy *phy); 416 + void (*utmi_pad_power_down)(struct phy *phy); 415 417 }; 416 418 417 419 struct tegra_xusb_padctl_soc {
+3 -1
include/linux/phy/tegra/xusb.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 /* 3 - * Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved. 3 + * Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved. 4 4 */ 5 5 6 6 #ifndef PHY_TEGRA_XUSB_H ··· 21 21 unsigned int port, bool enable); 22 22 int tegra_xusb_padctl_set_vbus_override(struct tegra_xusb_padctl *padctl, 23 23 bool val); 24 + void tegra_phy_xusb_utmi_pad_power_on(struct phy *phy); 25 + void tegra_phy_xusb_utmi_pad_power_down(struct phy *phy); 24 26 int tegra_phy_xusb_utmi_port_reset(struct phy *phy); 25 27 int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl, 26 28 unsigned int port);