diff options
author | Dominik Sliwa <dominik.sliwa@toradex.com> | 2017-02-08 16:53:34 +0100 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2017-04-04 13:42:14 +0200 |
commit | 45c26755661aa1d27f05ca4695d2f981c97213d1 (patch) | |
tree | a9f2cb86d79103cf6bbec283e8588e75a34faa26 | |
parent | 1fad13a736449ee7f41a405ab586642ab753764f (diff) |
apalis-tk1: fix lp1 sleep
Fix suspend and resume for LP1 sleep.
Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r-- | arch/arm/boot/dts/tegra124-apalis-eval.dts | 15 | ||||
-rw-r--r-- | arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-fixed.dtsi | 2 | ||||
-rw-r--r-- | arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-pmic.dtsi | 4 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-apalis-tk1-power.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-apalis-tk1.c | 18 | ||||
-rw-r--r-- | drivers/pci/host/pci-tegra.c | 41 | ||||
-rw-r--r-- | drivers/pci/msi.c | 2 | ||||
-rw-r--r-- | drivers/video/tegra/dc/lvds.c | 9 | ||||
-rw-r--r-- | drivers/video/tegra/dc/lvds.h | 1 |
9 files changed, 46 insertions, 47 deletions
diff --git a/arch/arm/boot/dts/tegra124-apalis-eval.dts b/arch/arm/boot/dts/tegra124-apalis-eval.dts index c5ecf9301229..9e32f873f949 100644 --- a/arch/arm/boot/dts/tegra124-apalis-eval.dts +++ b/arch/arm/boot/dts/tegra124-apalis-eval.dts @@ -179,22 +179,11 @@ }; }; - pmc { - status = "okay"; - nvidia,invert-interrupt; - nvidia,suspend-mode = <0>; - nvidia,cpu-pwr-good-time = <500>; - nvidia,cpu-pwr-off-time = <300>; - nvidia,core-pwr-good-time = <3845 3845>; - nvidia,core-pwr-off-time = <2000>; - nvidia,core-power-req-active-high; - nvidia,sys-clock-req-active-high; - nvidia,lp0-vec = <0xf46ff000 2064>; - }; - pcie-controller { nvidia,port0_status = <1>; nvidia,port1_status = <1>; + hvdd_pex-supply = <®_3v3>; + avdd_pex_pll-supply = <&as3722_sd4>; status = "okay"; }; diff --git a/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-fixed.dtsi b/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-fixed.dtsi index 2b73f2c1ace2..e00f482907b7 100644 --- a/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-fixed.dtsi +++ b/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-fixed.dtsi @@ -88,9 +88,11 @@ }; c9 { regulator-consumer-supply = "hvdd_pex"; + regulator-consumer-device = "tegra-pcie"; }; c10 { regulator-consumer-supply = "hvdd_pex_pll"; + regulator-consumer-device = "tegra-pcie"; }; c11 { regulator-consumer-supply = "vdd_sys_cam_3v3"; diff --git a/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-pmic.dtsi b/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-pmic.dtsi index 46bd097fc47e..695891d28a80 100644 --- a/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-pmic.dtsi +++ b/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-pmic.dtsi @@ -121,15 +121,19 @@ consumers { c1 { regulator-consumer-supply = "avdd_pex_pll"; + regulator-consumer-device = "tegra-pcie"; }; c2 { regulator-consumer-supply = "avddio_pex_pll"; + regulator-consumer-device = "tegra-pcie"; }; c3 { regulator-consumer-supply = "dvddio_pex"; + regulator-consumer-device = "tegra-pcie"; }; c4 { regulator-consumer-supply = "pwrdet_pex_ctl"; + regulator-consumer-device = "tegra-pcie"; }; c5 { regulator-consumer-supply = "avdd_sata"; diff --git a/arch/arm/mach-tegra/board-apalis-tk1-power.c b/arch/arm/mach-tegra/board-apalis-tk1-power.c index d1cf46b2c7ea..8e4bb5be6537 100644 --- a/arch/arm/mach-tegra/board-apalis-tk1-power.c +++ b/arch/arm/mach-tegra/board-apalis-tk1-power.c @@ -64,6 +64,7 @@ static struct tegra_suspend_platform_data apalis_tk1_suspend_data = { .min_residency_ncpu_slow = 5000, .min_residency_mclk_stop = 5000, .min_residency_crail = 20000, + .crail_up_early = true, }; /************************ Apalis TK1 CL-DVFS Data *********************/ diff --git a/arch/arm/mach-tegra/board-apalis-tk1.c b/arch/arm/mach-tegra/board-apalis-tk1.c index ac6b122fbc1a..82e0cfda87b3 100644 --- a/arch/arm/mach-tegra/board-apalis-tk1.c +++ b/arch/arm/mach-tegra/board-apalis-tk1.c @@ -517,22 +517,6 @@ static struct tegra_io_dpd pexclk2_io = { .io_dpd_bit = 6, }; -static struct tegra_suspend_platform_data apalis_tk1_suspend_data = { - .cpu_timer = 500, - .cpu_off_timer = 300, - .suspend_mode = TEGRA_SUSPEND_LP0, - .core_timer = 0x157e, - .core_off_timer = 10, - .corereq_high = true, - .sysclkreq_high = true, - .cpu_lp2_min_residency = 1000, - .min_residency_vmin_fmin = 1000, - .min_residency_ncpu_fast = 8000, - .min_residency_ncpu_slow = 5000, - .min_residency_mclk_stop = 5000, - .min_residency_crail = 20000, -}; - static void __init tegra_apalis_tk1_late_init(void) { apalis_tk1_display_init(); @@ -551,7 +535,7 @@ static void __init tegra_apalis_tk1_late_init(void) apalis_tk1_regulator_init(); apalis_tk1_dtv_init(); - tegra_init_suspend(&apalis_tk1_suspend_data); + apalis_tk1_suspend_init(); apalis_tk1_emc_init(); diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 9deee61446ff..1ef5791a892b 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -1093,9 +1093,9 @@ static int tegra_pcie_enable_controller(void) return ret; } -#ifdef USE_REGULATORS static int tegra_pcie_enable_regulators(void) { + int ret; PR_FUNC_LINE; if (tegra_pcie.power_rails_enabled) { pr_debug("PCIE: Already power rails enabled"); @@ -1139,11 +1139,11 @@ static int tegra_pcie_enable_regulators(void) } } if (tegra_pcie.regulator_hvdd) - regulator_enable(tegra_pcie.regulator_hvdd); + ret = regulator_enable(tegra_pcie.regulator_hvdd); if (tegra_pcie.regulator_pexio) - regulator_enable(tegra_pcie.regulator_pexio); + ret = regulator_enable(tegra_pcie.regulator_pexio); if (tegra_pcie.regulator_avdd_plle) - regulator_enable(tegra_pcie.regulator_avdd_plle); + ret = regulator_enable(tegra_pcie.regulator_avdd_plle); return 0; } @@ -1159,19 +1159,14 @@ static int tegra_pcie_disable_regulators(void) } if (tegra_pcie.regulator_hvdd) err = regulator_disable(tegra_pcie.regulator_hvdd); - if (err) - goto err_exit; if (tegra_pcie.regulator_pexio) err = regulator_disable(tegra_pcie.regulator_pexio); - if (err) - goto err_exit; if (tegra_pcie.regulator_avdd_plle) err = regulator_disable(tegra_pcie.regulator_avdd_plle); tegra_pcie.power_rails_enabled = 0; err_exit: return err; } -#endif static int tegra_pcie_power_ungate(void) { @@ -1426,6 +1421,15 @@ static int tegra_pcie_get_resources(void) pr_err("PCIE: failed to get clocks: %d\n", err); goto err_clk_get; } + + err = tegra_pcie_enable_regulators(); + if (err) { + pr_err("PCIE: failed to setup regulators: %d\n", err); + goto err_reg_get; + } + msleep(100); + /* wait 100ms for regulator to power-up */ + err = tegra_pcie_power_on(); if (err) { pr_err("PCIE: Failed to power on: %d\n", err); @@ -1453,6 +1457,7 @@ static int tegra_pcie_get_resources(void) err_pwr_on: tegra_pcie_power_off(false); +err_reg_get: err_clk_get: tegra_pcie_clocks_put(); return err; @@ -2027,7 +2032,6 @@ static int __init tegra_pcie_probe(struct platform_device *pdev) static int tegra_pcie_suspend_noirq(struct device *dev) { int ret = 0; - PR_FUNC_LINE; /* configure PE_WAKE signal as wake sources */ if (gpio_is_valid(tegra_pcie.plat_data->gpio_wake) && @@ -2040,7 +2044,9 @@ static int tegra_pcie_suspend_noirq(struct device *dev) return ret; } } - return tegra_pcie_power_off(true); + ret = tegra_pcie_power_off(true); + tegra_pcie_disable_regulators(); + return ret; } static bool tegra_pcie_enable_msi(bool); @@ -2052,6 +2058,8 @@ static int tegra_pcie_resume_noirq(struct device *dev) PR_FUNC_LINE; resume_path = true; + tegra_pcie_enable_regulators(); + if (gpio_is_valid(tegra_pcie.plat_data->gpio_wake) && device_may_wakeup(dev)) { ret = disable_irq_wake(gpio_to_irq( @@ -2069,7 +2077,12 @@ static int tegra_pcie_resume_noirq(struct device *dev) pr_err("PCIE: Failed to power on: %d\n", ret); return ret; } - tegra_pcie_enable_pads(true); + + ret = tegra_pcie_enable_pads(true); + if (ret) { + tegra_pcie_power_off(true); + goto exit; + } tegra_pcie_enable_controller(); tegra_pcie_setup_translations(); /* Set up MSI registers, if MSI have been enabled */ @@ -2077,13 +2090,13 @@ static int tegra_pcie_resume_noirq(struct device *dev) tegra_pcie_check_ports(); if (!tegra_pcie.num_ports) { - tegra_pcie_power_off(true); + ret = tegra_pcie_power_off(true); goto exit; } resume_path = false; exit: - return 0; + return ret; } static int tegra_pcie_resume(struct device *dev) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 2c1075213bec..4a5e4fddaed2 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -394,6 +394,8 @@ static void __pci_restore_msi_state(struct pci_dev *dev) return; entry = irq_get_msi_desc(dev->irq); + if (entry == NULL) + return; pci_intx_for_msi(dev, 0); msi_set_enable(dev, 0); diff --git a/drivers/video/tegra/dc/lvds.c b/drivers/video/tegra/dc/lvds.c index e204806f8fe4..45ab77f92dc1 100644 --- a/drivers/video/tegra/dc/lvds.c +++ b/drivers/video/tegra/dc/lvds.c @@ -69,6 +69,7 @@ static void tegra_dc_lvds_enable(struct tegra_dc *dc) tegra_dc_io_start(dc); tegra_sor_clk_enable(lvds->sor); + clk_prepare_enable(lvds->clk); /* Power on panel */ tegra_sor_pad_cal_power(lvds->sor, true); @@ -81,7 +82,7 @@ static void tegra_dc_lvds_enable(struct tegra_dc *dc) static void tegra_dc_lvds_disable(struct tegra_dc *dc) { struct tegra_dc_lvds_data *lvds = tegra_dc_get_outdata(dc); - + clk_disable_unprepare(lvds->clk); /* Power down SOR */ tegra_dc_sor_disable(lvds->sor, true); } @@ -91,7 +92,7 @@ static void tegra_dc_lvds_suspend(struct tegra_dc *dc) { struct tegra_dc_lvds_data *lvds = tegra_dc_get_outdata(dc); - tegra_dc_lvds_disable(dc); + clk_prepare_enable(lvds->clk); lvds->suspended = true; } @@ -102,7 +103,7 @@ static void tegra_dc_lvds_resume(struct tegra_dc *dc) if (!lvds->suspended) return; - tegra_dc_lvds_enable(dc); + clk_disable_unprepare(lvds->clk); } static long tegra_dc_lvds_setup_clk(struct tegra_dc *dc, struct clk *clk) @@ -120,6 +121,8 @@ static long tegra_dc_lvds_setup_clk(struct tegra_dc *dc, struct clk *clk) tegra_sor_setup_clk(lvds->sor, clk, true); + lvds->clk = clk; + return tegra_dc_pclk_round_rate(dc, lvds->sor->dc->mode.pclk); } diff --git a/drivers/video/tegra/dc/lvds.h b/drivers/video/tegra/dc/lvds.h index 96db6d759cfe..ccd366db53f6 100644 --- a/drivers/video/tegra/dc/lvds.h +++ b/drivers/video/tegra/dc/lvds.h @@ -23,6 +23,7 @@ struct tegra_dc_lvds_data { struct tegra_dc *dc; struct tegra_dc_sor_data *sor; + struct clk *clk; bool suspended; }; |