aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVince Hsu <vinceh@nvidia.com>2016-08-10 21:13:36 -0400
committerThierry Reding <treding@nvidia.com>2016-08-16 06:30:52 -0400
commita9ccc123a8e05365f7515dcd023b01100809a6fa (patch)
tree4f0e5fac730e70f93b705fc61abc65bd394398aa
parent29b4817d4018df78086157ea3a55c1d9424a7cfc (diff)
soc/tegra: pmc: Fix incorrect DPD request
Reading the DPD_REQ & DPD2_REQ registers returns the previous requests. If we sets the current request bit with the returned value, then other pads will be turned on or off unexpectedly. Signed-off-by: Vince Hsu <vinceh@nvidia.com> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--drivers/soc/tegra/pmc.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 71c834f3847e..7792ed88d80b 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -967,8 +967,8 @@ static void tegra_io_rail_unprepare(void)
967 967
968int tegra_io_rail_power_on(unsigned int id) 968int tegra_io_rail_power_on(unsigned int id)
969{ 969{
970 unsigned long request, status, value; 970 unsigned long request, status;
971 unsigned int bit, mask; 971 unsigned int bit;
972 int err; 972 int err;
973 973
974 mutex_lock(&pmc->powergates_lock); 974 mutex_lock(&pmc->powergates_lock);
@@ -977,15 +977,9 @@ int tegra_io_rail_power_on(unsigned int id)
977 if (err) 977 if (err)
978 goto error; 978 goto error;
979 979
980 mask = 1 << bit; 980 tegra_pmc_writel(IO_DPD_REQ_CODE_OFF | BIT(bit), request);
981 981
982 value = tegra_pmc_readl(request); 982 err = tegra_io_rail_poll(status, BIT(bit), 0, 250);
983 value |= mask;
984 value &= ~IO_DPD_REQ_CODE_MASK;
985 value |= IO_DPD_REQ_CODE_OFF;
986 tegra_pmc_writel(value, request);
987
988 err = tegra_io_rail_poll(status, mask, 0, 250);
989 if (err) { 983 if (err) {
990 pr_info("tegra_io_rail_poll() failed: %d\n", err); 984 pr_info("tegra_io_rail_poll() failed: %d\n", err);
991 goto error; 985 goto error;
@@ -1002,8 +996,8 @@ EXPORT_SYMBOL(tegra_io_rail_power_on);
1002 996
1003int tegra_io_rail_power_off(unsigned int id) 997int tegra_io_rail_power_off(unsigned int id)
1004{ 998{
1005 unsigned long request, status, value; 999 unsigned long request, status;
1006 unsigned int bit, mask; 1000 unsigned int bit;
1007 int err; 1001 int err;
1008 1002
1009 mutex_lock(&pmc->powergates_lock); 1003 mutex_lock(&pmc->powergates_lock);
@@ -1014,15 +1008,9 @@ int tegra_io_rail_power_off(unsigned int id)
1014 goto error; 1008 goto error;
1015 } 1009 }
1016 1010
1017 mask = 1 << bit; 1011 tegra_pmc_writel(IO_DPD_REQ_CODE_ON | BIT(bit), request);
1018
1019 value = tegra_pmc_readl(request);
1020 value |= mask;
1021 value &= ~IO_DPD_REQ_CODE_MASK;
1022 value |= IO_DPD_REQ_CODE_ON;
1023 tegra_pmc_writel(value, request);
1024 1012
1025 err = tegra_io_rail_poll(status, mask, mask, 250); 1013 err = tegra_io_rail_poll(status, BIT(bit), BIT(bit), 250);
1026 if (err) 1014 if (err)
1027 goto error; 1015 goto error;
1028 1016