summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Nihalani <bnihalani@nvidia.com>2011-08-02 14:06:37 +0530
committerManish Tuteja <mtuteja@nvidia.com>2011-08-03 02:21:30 -0700
commit3c9247a4bdf0845806d994b8f10d82ad48268e20 (patch)
tree08abf11c926e42a9a53c67739c1f60f381eea2c2
parent2027fc9ef0e31acc6d6caf4e48f60995a9fb5ae6 (diff)
Revert "usb: host: ehci-tegra: Power saving on USB suspend"
This reverts commit a5dc52ce49d00bba963544251a1fe858e774780b. Bug 857124 Change-Id: Ib8c350b44d8334894f96439b67a8a41acabff848 Reviewed-on: http://git-master/r/44493 Reviewed-by: Joshua Cha <joshuac@nvidia.com> Tested-by: Joshua Cha <joshuac@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/include/mach/usb_phy.h2
-rw-r--r--arch/arm/mach-tegra/tegra2_clocks.c3
-rw-r--r--arch/arm/mach-tegra/tegra2_dvfs.c4
-rw-r--r--arch/arm/mach-tegra/usb_phy.c43
-rw-r--r--drivers/usb/host/ehci-tegra.c85
5 files changed, 21 insertions, 116 deletions
diff --git a/arch/arm/mach-tegra/include/mach/usb_phy.h b/arch/arm/mach-tegra/include/mach/usb_phy.h
index f3520a91dc59..609134c4ff82 100644
--- a/arch/arm/mach-tegra/include/mach/usb_phy.h
+++ b/arch/arm/mach-tegra/include/mach/usb_phy.h
@@ -116,8 +116,6 @@ void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy,
void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy);
-int tegra_usb_set_phy_clock(struct tegra_usb_phy *phy, char clock_on);
-
void tegra_usb_phy_close(struct tegra_usb_phy *phy);
int tegra_usb_phy_bus_connect(struct tegra_usb_phy *phy);
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index a86010bca6d8..a48baf9c8d35 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -2174,8 +2174,7 @@ struct clk tegra_list_periph_clks[] = {
PERIPH_CLK("disp1", "tegradc.0", NULL, 27, 0x138, 0x31E, 600000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* scales with voltage and process_id */
PERIPH_CLK("disp2", "tegradc.1", NULL, 26, 0x13c, 0x31E, 600000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* scales with voltage and process_id */
PERIPH_CLK("usbd", "fsl-tegra-udc", NULL, 22, 0, 0x31E, 480000000, mux_clk_m, 0), /* requires min voltage */
- PERIPH_CLK("usb2", "tegra-ehci.1", "usb2", 58, 0, 0x31E, 480000000, mux_clk_m, 0), /* requires min voltage */
- PERIPH_CLK("usb2min", "tegra-ehci.1", "usb2min", 95, 0, 0x31E, 60000000, mux_clk_m, 0), /* requires min voltage */
+ PERIPH_CLK("usb2", "tegra-ehci.1", NULL, 58, 0, 0x31E, 480000000, mux_clk_m, 0), /* requires min voltage */
PERIPH_CLK("usb3", "tegra-ehci.2", NULL, 59, 0, 0x31E, 480000000, mux_clk_m, 0), /* requires min voltage */
PERIPH_CLK("dsi", "dsi", NULL, 48, 0, 0x31E, 500000000, mux_plld_out0, 0), /* scales with voltage */
PERIPH_CLK("csi", "tegra_camera", "csi", 52, 0, 0x31E, 72000000, mux_pllp_out3, 0),
diff --git a/arch/arm/mach-tegra/tegra2_dvfs.c b/arch/arm/mach-tegra/tegra2_dvfs.c
index 4a7242e38165..b0c0a0c55372 100644
--- a/arch/arm/mach-tegra/tegra2_dvfs.c
+++ b/arch/arm/mach-tegra/tegra2_dvfs.c
@@ -191,10 +191,6 @@ static struct dvfs dvfs_init[] = {
CORE_DVFS("mipi", -1, 1, KHZ, 0, 40000, 40000, 40000, 40000, 60000, 60000),
CORE_DVFS("usbd", -1, 1, KHZ, 0, 0, 480000, 480000, 480000, 480000, 480000),
CORE_DVFS("usb2", -1, 1, KHZ, 0, 0, 480000, 480000, 480000, 480000, 480000),
- /*
- * Set VDD core to 0.95v when HSIC port is idle
- */
- CORE_DVFS("usb2min",-1, 1, KHZ, 60000, 60000, 60000, 60000, 60000, 60000, 60000),
CORE_DVFS("usb3", -1, 1, KHZ, 0, 0, 480000, 480000, 480000, 480000, 480000),
CORE_DVFS("pcie", -1, 1, KHZ, 0, 0, 0, 250000, 250000, 250000, 250000),
CORE_DVFS("dsi", -1, 1, KHZ, 100000, 100000, 100000, 500000, 500000, 500000, 500000),
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c
index a9d3dac8aea1..0dc14abc3fa4 100644
--- a/arch/arm/mach-tegra/usb_phy.c
+++ b/arch/arm/mach-tegra/usb_phy.c
@@ -1225,49 +1225,6 @@ err0:
return ERR_PTR(err);
}
-static void pulse_writel(int bit, void __iomem *addr)
-{
- int val;
-
- val = readl(addr);
- writel(val | bit, addr);
- udelay(10);
- writel(val & (~bit), addr);
-}
-
-int tegra_usb_set_phy_clock(struct tegra_usb_phy *phy, char clock_on)
-{
- int ret = 0;
- int val;
- void __iomem *base = phy->regs;
-
- BUG_ON(phy == NULL);
-
- if (clock_on) {
- pulse_writel(USB_SUSP_CLR, base + USB_SUSP_CTRL);
- } else {
- switch(phy->instance) {
- case 0:
- pulse_writel(USB_SUSP_SET, base + USB_SUSP_CTRL);
- break;
- case 1:
- case 2:
- val = readl(base + USB_PORTSC1);
- writel(val | USB_PORTSC1_PHCD, base + USB_PORTSC1);
- break;
- default:
- pr_err("unknow USB instance: %d\n", phy->instance);
- }
- }
-
- ret = utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID,
- clock_on ? USB_PHY_CLK_VALID : 0);
- if (ret)
- pr_err("failed turn %s EHCI port PHY clock\n",
- clock_on ? "on" : "off");
- return ret;
-}
-
int tegra_usb_phy_power_on(struct tegra_usb_phy *phy, bool is_dpd)
{
if (!phy->regulator_on) {
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index ea7b4cafcbf5..116b0806af03 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -47,15 +47,13 @@ struct tegra_ehci_hcd {
struct ehci_hcd *ehci;
struct tegra_usb_phy *phy;
struct clk *clk;
- struct clk *clk_min;
struct clk *emc_clk;
struct clk *sclk_clk;
struct otg_transceiver *transceiver;
- int hub_suspend_req;
int host_resumed;
- int bus_is_power_down;
+ int bus_suspended;
int port_resuming;
- int require_power_down_on_bus_suspend;
+ int power_down_on_bus_suspend;
struct delayed_work work;
enum tegra_usb_phy_port_speed port_speed;
};
@@ -71,7 +69,6 @@ static void tegra_ehci_power_up(struct usb_hcd *hcd, bool is_dpd)
#endif
tegra_usb_phy_power_on(tegra->phy, is_dpd);
tegra->host_resumed = 1;
- tegra->bus_is_power_down = 0;
}
static void tegra_ehci_power_down(struct usb_hcd *hcd, bool is_dpd)
@@ -80,16 +77,11 @@ static void tegra_ehci_power_down(struct usb_hcd *hcd, bool is_dpd)
tegra->host_resumed = 0;
tegra_usb_phy_power_off(tegra->phy, is_dpd);
- if (tegra->bus_is_power_down) {
- clk_disable(tegra->clk_min);
- return;
- }
#ifndef CONFIG_USB_HOTPLUG
clk_disable(tegra->clk);
#endif
- clk_disable(tegra->sclk_clk);
clk_disable(tegra->emc_clk);
- tegra->hub_suspend_req = 0;
+ clk_disable(tegra->sclk_clk);
}
static irqreturn_t tegra_ehci_irq (struct usb_hcd *hcd)
@@ -192,9 +184,6 @@ static int tegra_ehci_hub_control(
pr_err("%s: timeout waiting for SUSPEND\n", __func__);
set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports);
-
- tegra->hub_suspend_req = 1;
-
goto done;
}
@@ -540,51 +529,24 @@ static int tegra_ehci_setup(struct usb_hcd *hcd)
#ifdef CONFIG_PM
static int tegra_ehci_bus_suspend(struct usb_hcd *hcd)
{
- int ret = 0;
struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
+ int error_status = 0;
- if (0 != (ret = ehci_bus_suspend(hcd)))
- return ret;
-
- if (tegra->require_power_down_on_bus_suspend &&
- tegra->hub_suspend_req) {
- tegra_usb_set_phy_clock(tegra->phy, 0);
-
- if (0 != (ret = clk_enable(tegra->clk_min))) {
- pr_err("HSIC USB core clk enable failed\n");
- return ret;
- }
-
- clk_disable(tegra->clk);
-
- clk_disable(tegra->emc_clk);
-
- tegra->hub_suspend_req = 0;
- tegra->bus_is_power_down = 1;
+ error_status = ehci_bus_suspend(hcd);
+ if (!error_status && tegra->power_down_on_bus_suspend) {
+ tegra_usb_suspend(hcd, false);
+ tegra->bus_suspended = 1;
}
- return ret;
+ return error_status;
}
static int tegra_ehci_bus_resume(struct usb_hcd *hcd)
{
struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
- int ret;
-
- if (tegra->require_power_down_on_bus_suspend &&
- tegra->bus_is_power_down) {
- if (0 != (ret = clk_enable(tegra->clk)))
- pr_err("HSIC usb PHY clk enable failed\n");
-
- if (0 != (ret = clk_enable(tegra->emc_clk)))
- pr_err("HSIC USB EMC clk enable failed\n");
-
- clk_disable(tegra->clk_min);
- tegra_usb_set_phy_clock(tegra->phy, 1);
-
- msleep(50);
-
- tegra->bus_is_power_down = 0;
+ if (tegra->bus_suspended && tegra->power_down_on_bus_suspend) {
+ tegra_usb_resume(hcd, false);
+ tegra->bus_suspended = 0;
}
return ehci_bus_resume(hcd);
@@ -890,7 +852,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, tegra);
- tegra->clk = clk_get(&pdev->dev, "usb2");
+ tegra->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(tegra->clk)) {
dev_err(&pdev->dev, "Can't get ehci clock\n");
err = PTR_ERR(tegra->clk);
@@ -901,15 +863,6 @@ static int tegra_ehci_probe(struct platform_device *pdev)
if (err)
goto fail_clken;
- tegra->clk_min = clk_get(&pdev->dev, "usb2min");
- if (IS_ERR(tegra->clk_min)) {
- dev_err(&pdev->dev, "Can't get ehci clock fast\n");
- err = PTR_ERR(tegra->clk_min);
- goto fail_clk_min;
- }
- /* only need enable usb2min at the USB suspend time to ensure the
- * VDD core at least is 1.1v
- */
tegra->sclk_clk = clk_get(&pdev->dev, "sclk");
if (IS_ERR(tegra->sclk_clk)) {
@@ -963,9 +916,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
}
tegra->host_resumed = 1;
-
- tegra->require_power_down_on_bus_suspend =
- pdata->power_down_on_bus_suspend;
+ tegra->power_down_on_bus_suspend = pdata->power_down_on_bus_suspend;
tegra->ehci = hcd_to_ehci(hcd);
irq = platform_get_irq(pdev, 0);
@@ -1022,8 +973,6 @@ fail_emc_clk:
fail_sclk_clk:
clk_disable(tegra->clk);
fail_clken:
- clk_put(tegra->clk_min);
-fail_clk_min:
clk_put(tegra->clk);
fail_clk:
usb_put_hcd(hcd);
@@ -1038,6 +987,9 @@ static int tegra_ehci_resume(struct platform_device *pdev)
struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci);
+ if ((tegra->bus_suspended) && (tegra->power_down_on_bus_suspend))
+ return 0;
+
return tegra_usb_resume(hcd, true);
}
@@ -1046,6 +998,9 @@ static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state)
struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci);
+ if ((tegra->bus_suspended) && (tegra->power_down_on_bus_suspend))
+ return 0;
+
if (time_before(jiffies, tegra->ehci->next_statechange))
msleep(10);