summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorJC Kuo <jckuo@nvidia.com>2016-05-30 01:45:31 -0400
committerAshutosh Jha <ajha@nvidia.com>2016-06-07 12:29:27 -0400
commitbcdcc8e14f5f751ae8a0750f8a5e0aac7eb22bc8 (patch)
tree78cfd19fb66e462b8e9923c4cb93a5ca6ef22a6e /drivers/pinctrl
parente32f2308c75fa4864af32ee45fd3c80936d83176 (diff)
padctl_uphy: save and restore port_cap
This commit add the following padctl register to save/restore context. XUSB_PADCTL_USB2_PAD_MUX_0 XUSB_PADCTL_USB2_PORT_CAP_0 XUSB_PADCTL_SS_PORT_CAP_0 These registers are supposed to be re-programed at SC7 exit before XUSB host controller and device controller are un-powergated. This commit also remove the VCORE_DOWN programming from tegra186_usb3_phy_set_wake(), VCORE_DOWN programming now is done in usb3 phy power_on() and power_off() to match PG. bug 200192947 Change-Id: Ib6fe16382f3d33f317d1fbad85f688b810966184 Signed-off-by: JC Kuo <jckuo@nvidia.com> Reviewed-on: http://git-master/r/1155770 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Mark Kuo <mkuo@nvidia.com> Reviewed-by: ChihMin Cheng <ccheng@nvidia.com> Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl-tegra186-padctl-uphy.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/pinctrl/pinctrl-tegra186-padctl-uphy.c b/drivers/pinctrl/pinctrl-tegra186-padctl-uphy.c
index ff6da3b58..a248591e8 100644
--- a/drivers/pinctrl/pinctrl-tegra186-padctl-uphy.c
+++ b/drivers/pinctrl/pinctrl-tegra186-padctl-uphy.c
@@ -635,6 +635,9 @@ static const char * const source_pll_states[] = {
635 635
636struct padctl_context { 636struct padctl_context {
637 u32 vbus_id; 637 u32 vbus_id;
638 u32 usb2_pad_mux;
639 u32 usb2_port_cap;
640 u32 ss_port_cap;
638}; 641};
639 642
640struct tegra_padctl_uphy { 643struct tegra_padctl_uphy {
@@ -4917,10 +4920,22 @@ static int tegra186_uphy_pll_deinit(struct tegra_padctl_uphy *uphy)
4917static void tegra186_padctl_save(struct tegra_padctl_uphy *uphy) 4920static void tegra186_padctl_save(struct tegra_padctl_uphy *uphy)
4918{ 4921{
4919 uphy->padctl_context.vbus_id = padctl_readl(uphy, USB2_VBUS_ID); 4922 uphy->padctl_context.vbus_id = padctl_readl(uphy, USB2_VBUS_ID);
4923 uphy->padctl_context.usb2_pad_mux =
4924 padctl_readl(uphy, XUSB_PADCTL_USB2_PAD_MUX);
4925 uphy->padctl_context.usb2_port_cap =
4926 padctl_readl(uphy, XUSB_PADCTL_USB2_PORT_CAP);
4927 uphy->padctl_context.ss_port_cap =
4928 padctl_readl(uphy, XUSB_PADCTL_SS_PORT_CAP);
4920} 4929}
4921 4930
4922static void tegra186_padctl_restore(struct tegra_padctl_uphy *uphy) 4931static void tegra186_padctl_restore(struct tegra_padctl_uphy *uphy)
4923{ 4932{
4933 padctl_writel(uphy, uphy->padctl_context.usb2_pad_mux,
4934 XUSB_PADCTL_USB2_PAD_MUX);
4935 padctl_writel(uphy, uphy->padctl_context.usb2_port_cap,
4936 XUSB_PADCTL_USB2_PORT_CAP);
4937 padctl_writel(uphy, uphy->padctl_context.ss_port_cap,
4938 XUSB_PADCTL_SS_PORT_CAP);
4924 padctl_writel(uphy, uphy->padctl_context.vbus_id, USB2_VBUS_ID); 4939 padctl_writel(uphy, uphy->padctl_context.vbus_id, USB2_VBUS_ID);
4925} 4940}
4926 4941
@@ -5528,12 +5543,6 @@ static int tegra186_usb3_phy_set_wake(struct tegra_padctl_uphy *uphy,
5528 reg &= ~ALL_WAKE_EVENTS; 5543 reg &= ~ALL_WAKE_EVENTS;
5529 reg |= SS_PORT_WAKE_INTERRUPT_ENABLE(port); 5544 reg |= SS_PORT_WAKE_INTERRUPT_ENABLE(port);
5530 padctl_writel(uphy, reg, XUSB_PADCTL_ELPG_PROGRAM); 5545 padctl_writel(uphy, reg, XUSB_PADCTL_ELPG_PROGRAM);
5531
5532 usleep_range(10, 20);
5533
5534 reg = padctl_readl(uphy, XUSB_PADCTL_ELPG_PROGRAM_1);
5535 reg |= SSPX_ELPG_VCORE_DOWN(port);
5536 padctl_writel(uphy, reg, XUSB_PADCTL_ELPG_PROGRAM_1);
5537 } else { 5546 } else {
5538 dev_dbg(uphy->dev, "disable USB3 port %d wake\n", port); 5547 dev_dbg(uphy->dev, "disable USB3 port %d wake\n", port);
5539 5548
@@ -5548,12 +5557,6 @@ static int tegra186_usb3_phy_set_wake(struct tegra_padctl_uphy *uphy,
5548 reg &= ~ALL_WAKE_EVENTS; 5557 reg &= ~ALL_WAKE_EVENTS;
5549 reg |= SS_PORT_WAKEUP_EVENT(port); 5558 reg |= SS_PORT_WAKEUP_EVENT(port);
5550 padctl_writel(uphy, reg, XUSB_PADCTL_ELPG_PROGRAM); 5559 padctl_writel(uphy, reg, XUSB_PADCTL_ELPG_PROGRAM);
5551
5552 usleep_range(10, 20);
5553
5554 reg = padctl_readl(uphy, XUSB_PADCTL_ELPG_PROGRAM_1);
5555 reg &= ~SSPX_ELPG_VCORE_DOWN(port);
5556 padctl_writel(uphy, reg, XUSB_PADCTL_ELPG_PROGRAM_1);
5557 } 5560 }
5558 mutex_unlock(&uphy->lock); 5561 mutex_unlock(&uphy->lock);
5559 5562