Commit 66165dba authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'for-5.14-usb' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into usb-next

Thierry writes:

usb: tegra: Changes for v5.14-rc1

Implements proper suspend/resume for the XUSB controller found on recent
Tegra chips.

* tag 'for-5.14-usb' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  usb: xhci: tegra: Enable ELPG for runtime/system PM
  usb: xhci: tegra: Unlink power domain devices
  phy: tegra: xusb: Add wake/sleepwalk for Tegra186
  phy: tegra: xusb: Tegra210 host mode VBUS control
  phy: tegra: xusb: Add wake/sleepwalk for Tegra210
  phy: tegra: xusb: Add sleepwalk and suspend/resume
  phy: tegra: xusb: Add Tegra210 lane_iddq operation
  phy: tegra: xusb: Rearrange UPHY init on Tegra210
  phy: tegra: xusb: Move usb3 port init for Tegra210
parents 318324e6 971ee247
This diff is collapsed.
This diff is collapsed.
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved.
*/ */
#include <linux/delay.h> #include <linux/delay.h>
...@@ -321,11 +321,17 @@ static void tegra_xusb_lane_program(struct tegra_xusb_lane *lane) ...@@ -321,11 +321,17 @@ static void tegra_xusb_lane_program(struct tegra_xusb_lane *lane)
if (soc->num_funcs < 2) if (soc->num_funcs < 2)
return; return;
if (lane->pad->ops->iddq_enable)
lane->pad->ops->iddq_enable(lane);
/* choose function */ /* choose function */
value = padctl_readl(padctl, soc->offset); value = padctl_readl(padctl, soc->offset);
value &= ~(soc->mask << soc->shift); value &= ~(soc->mask << soc->shift);
value |= lane->function << soc->shift; value |= lane->function << soc->shift;
padctl_writel(padctl, value, soc->offset); padctl_writel(padctl, value, soc->offset);
if (lane->pad->ops->iddq_disable)
lane->pad->ops->iddq_disable(lane);
} }
static void tegra_xusb_pad_program(struct tegra_xusb_pad *pad) static void tegra_xusb_pad_program(struct tegra_xusb_pad *pad)
...@@ -376,7 +382,7 @@ static int tegra_xusb_setup_pads(struct tegra_xusb_padctl *padctl) ...@@ -376,7 +382,7 @@ static int tegra_xusb_setup_pads(struct tegra_xusb_padctl *padctl)
return 0; return 0;
} }
static bool tegra_xusb_lane_check(struct tegra_xusb_lane *lane, bool tegra_xusb_lane_check(struct tegra_xusb_lane *lane,
const char *function) const char *function)
{ {
const char *func = lane->soc->funcs[lane->function]; const char *func = lane->soc->funcs[lane->function];
...@@ -1267,10 +1273,36 @@ static int tegra_xusb_padctl_remove(struct platform_device *pdev) ...@@ -1267,10 +1273,36 @@ static int tegra_xusb_padctl_remove(struct platform_device *pdev)
return err; return err;
} }
static int tegra_xusb_padctl_suspend_noirq(struct device *dev)
{
struct tegra_xusb_padctl *padctl = dev_get_drvdata(dev);
if (padctl->soc && padctl->soc->ops && padctl->soc->ops->suspend_noirq)
return padctl->soc->ops->suspend_noirq(padctl);
return 0;
}
static int tegra_xusb_padctl_resume_noirq(struct device *dev)
{
struct tegra_xusb_padctl *padctl = dev_get_drvdata(dev);
if (padctl->soc && padctl->soc->ops && padctl->soc->ops->resume_noirq)
return padctl->soc->ops->resume_noirq(padctl);
return 0;
}
static const struct dev_pm_ops tegra_xusb_padctl_pm_ops = {
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(tegra_xusb_padctl_suspend_noirq,
tegra_xusb_padctl_resume_noirq)
};
static struct platform_driver tegra_xusb_padctl_driver = { static struct platform_driver tegra_xusb_padctl_driver = {
.driver = { .driver = {
.name = "tegra-xusb-padctl", .name = "tegra-xusb-padctl",
.of_match_table = tegra_xusb_padctl_of_match, .of_match_table = tegra_xusb_padctl_of_match,
.pm = &tegra_xusb_padctl_pm_ops,
}, },
.probe = tegra_xusb_padctl_probe, .probe = tegra_xusb_padctl_probe,
.remove = tegra_xusb_padctl_remove, .remove = tegra_xusb_padctl_remove,
...@@ -1337,6 +1369,62 @@ int tegra_xusb_padctl_hsic_set_idle(struct tegra_xusb_padctl *padctl, ...@@ -1337,6 +1369,62 @@ int tegra_xusb_padctl_hsic_set_idle(struct tegra_xusb_padctl *padctl,
} }
EXPORT_SYMBOL_GPL(tegra_xusb_padctl_hsic_set_idle); EXPORT_SYMBOL_GPL(tegra_xusb_padctl_hsic_set_idle);
int tegra_xusb_padctl_enable_phy_sleepwalk(struct tegra_xusb_padctl *padctl, struct phy *phy,
enum usb_device_speed speed)
{
struct tegra_xusb_lane *lane = phy_get_drvdata(phy);
if (lane->pad->ops->enable_phy_sleepwalk)
return lane->pad->ops->enable_phy_sleepwalk(lane, speed);
return -EOPNOTSUPP;
}
EXPORT_SYMBOL_GPL(tegra_xusb_padctl_enable_phy_sleepwalk);
int tegra_xusb_padctl_disable_phy_sleepwalk(struct tegra_xusb_padctl *padctl, struct phy *phy)
{
struct tegra_xusb_lane *lane = phy_get_drvdata(phy);
if (lane->pad->ops->disable_phy_sleepwalk)
return lane->pad->ops->disable_phy_sleepwalk(lane);
return -EOPNOTSUPP;
}
EXPORT_SYMBOL_GPL(tegra_xusb_padctl_disable_phy_sleepwalk);
int tegra_xusb_padctl_enable_phy_wake(struct tegra_xusb_padctl *padctl, struct phy *phy)
{
struct tegra_xusb_lane *lane = phy_get_drvdata(phy);
if (lane->pad->ops->enable_phy_wake)
return lane->pad->ops->enable_phy_wake(lane);
return -EOPNOTSUPP;
}
EXPORT_SYMBOL_GPL(tegra_xusb_padctl_enable_phy_wake);
int tegra_xusb_padctl_disable_phy_wake(struct tegra_xusb_padctl *padctl, struct phy *phy)
{
struct tegra_xusb_lane *lane = phy_get_drvdata(phy);
if (lane->pad->ops->disable_phy_wake)
return lane->pad->ops->disable_phy_wake(lane);
return -EOPNOTSUPP;
}
EXPORT_SYMBOL_GPL(tegra_xusb_padctl_disable_phy_wake);
bool tegra_xusb_padctl_remote_wake_detected(struct tegra_xusb_padctl *padctl, struct phy *phy)
{
struct tegra_xusb_lane *lane = phy_get_drvdata(phy);
if (lane->pad->ops->remote_wake_detected)
return lane->pad->ops->remote_wake_detected(lane);
return false;
}
EXPORT_SYMBOL_GPL(tegra_xusb_padctl_remote_wake_detected);
int tegra_xusb_padctl_usb3_set_lfps_detect(struct tegra_xusb_padctl *padctl, int tegra_xusb_padctl_usb3_set_lfps_detect(struct tegra_xusb_padctl *padctl,
unsigned int port, bool enable) unsigned int port, bool enable)
{ {
......
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
/* /*
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2015, Google Inc. * Copyright (c) 2015, Google Inc.
*/ */
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/usb/ch9.h>
#include <linux/usb/otg.h> #include <linux/usb/otg.h>
#include <linux/usb/role.h> #include <linux/usb/role.h>
...@@ -35,6 +36,10 @@ struct tegra_xusb_lane_soc { ...@@ -35,6 +36,10 @@ struct tegra_xusb_lane_soc {
const char * const *funcs; const char * const *funcs;
unsigned int num_funcs; unsigned int num_funcs;
struct {
unsigned int misc_ctl2;
} regs;
}; };
struct tegra_xusb_lane { struct tegra_xusb_lane {
...@@ -126,8 +131,17 @@ struct tegra_xusb_lane_ops { ...@@ -126,8 +131,17 @@ struct tegra_xusb_lane_ops {
struct device_node *np, struct device_node *np,
unsigned int index); unsigned int index);
void (*remove)(struct tegra_xusb_lane *lane); void (*remove)(struct tegra_xusb_lane *lane);
void (*iddq_enable)(struct tegra_xusb_lane *lane);
void (*iddq_disable)(struct tegra_xusb_lane *lane);
int (*enable_phy_sleepwalk)(struct tegra_xusb_lane *lane, enum usb_device_speed speed);
int (*disable_phy_sleepwalk)(struct tegra_xusb_lane *lane);
int (*enable_phy_wake)(struct tegra_xusb_lane *lane);
int (*disable_phy_wake)(struct tegra_xusb_lane *lane);
bool (*remote_wake_detected)(struct tegra_xusb_lane *lane);
}; };
bool tegra_xusb_lane_check(struct tegra_xusb_lane *lane, const char *function);
/* /*
* pads * pads
*/ */
...@@ -230,7 +244,7 @@ struct tegra_xusb_pcie_pad { ...@@ -230,7 +244,7 @@ struct tegra_xusb_pcie_pad {
struct reset_control *rst; struct reset_control *rst;
struct clk *pll; struct clk *pll;
unsigned int enable; bool enable;
}; };
static inline struct tegra_xusb_pcie_pad * static inline struct tegra_xusb_pcie_pad *
...@@ -245,7 +259,7 @@ struct tegra_xusb_sata_pad { ...@@ -245,7 +259,7 @@ struct tegra_xusb_sata_pad {
struct reset_control *rst; struct reset_control *rst;
struct clk *pll; struct clk *pll;
unsigned int enable; bool enable;
}; };
static inline struct tegra_xusb_sata_pad * static inline struct tegra_xusb_sata_pad *
...@@ -388,6 +402,8 @@ struct tegra_xusb_padctl_ops { ...@@ -388,6 +402,8 @@ struct tegra_xusb_padctl_ops {
const struct tegra_xusb_padctl_soc *soc); const struct tegra_xusb_padctl_soc *soc);
void (*remove)(struct tegra_xusb_padctl *padctl); void (*remove)(struct tegra_xusb_padctl *padctl);
int (*suspend_noirq)(struct tegra_xusb_padctl *padctl);
int (*resume_noirq)(struct tegra_xusb_padctl *padctl);
int (*usb3_save_context)(struct tegra_xusb_padctl *padctl, int (*usb3_save_context)(struct tegra_xusb_padctl *padctl,
unsigned int index); unsigned int index);
int (*hsic_set_idle)(struct tegra_xusb_padctl *padctl, int (*hsic_set_idle)(struct tegra_xusb_padctl *padctl,
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
/* /*
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved.
*/ */
#ifndef PHY_TEGRA_XUSB_H #ifndef PHY_TEGRA_XUSB_H
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
struct tegra_xusb_padctl; struct tegra_xusb_padctl;
struct device; struct device;
enum usb_device_speed;
struct tegra_xusb_padctl *tegra_xusb_padctl_get(struct device *dev); struct tegra_xusb_padctl *tegra_xusb_padctl_get(struct device *dev);
void tegra_xusb_padctl_put(struct tegra_xusb_padctl *padctl); void tegra_xusb_padctl_put(struct tegra_xusb_padctl *padctl);
...@@ -23,4 +24,11 @@ int tegra_xusb_padctl_set_vbus_override(struct tegra_xusb_padctl *padctl, ...@@ -23,4 +24,11 @@ int tegra_xusb_padctl_set_vbus_override(struct tegra_xusb_padctl *padctl,
int tegra_phy_xusb_utmi_port_reset(struct phy *phy); int tegra_phy_xusb_utmi_port_reset(struct phy *phy);
int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl, int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl,
unsigned int port); unsigned int port);
int tegra_xusb_padctl_enable_phy_sleepwalk(struct tegra_xusb_padctl *padctl, struct phy *phy,
enum usb_device_speed speed);
int tegra_xusb_padctl_disable_phy_sleepwalk(struct tegra_xusb_padctl *padctl, struct phy *phy);
int tegra_xusb_padctl_enable_phy_wake(struct tegra_xusb_padctl *padctl, struct phy *phy);
int tegra_xusb_padctl_disable_phy_wake(struct tegra_xusb_padctl *padctl, struct phy *phy);
bool tegra_xusb_padctl_remote_wake_detected(struct tegra_xusb_padctl *padctl, struct phy *phy);
#endif /* PHY_TEGRA_XUSB_H */ #endif /* PHY_TEGRA_XUSB_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment