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>
This commit is contained in:
parent
29b4817d40
commit
a9ccc123a8
|
@ -967,8 +967,8 @@ static void tegra_io_rail_unprepare(void)
|
||||||
|
|
||||||
int tegra_io_rail_power_on(unsigned int id)
|
int tegra_io_rail_power_on(unsigned int id)
|
||||||
{
|
{
|
||||||
unsigned long request, status, value;
|
unsigned long request, status;
|
||||||
unsigned int bit, mask;
|
unsigned int bit;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
mutex_lock(&pmc->powergates_lock);
|
mutex_lock(&pmc->powergates_lock);
|
||||||
|
@ -977,15 +977,9 @@ int tegra_io_rail_power_on(unsigned int id)
|
||||||
if (err)
|
if (err)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
mask = 1 << bit;
|
tegra_pmc_writel(IO_DPD_REQ_CODE_OFF | BIT(bit), request);
|
||||||
|
|
||||||
value = tegra_pmc_readl(request);
|
err = tegra_io_rail_poll(status, BIT(bit), 0, 250);
|
||||||
value |= mask;
|
|
||||||
value &= ~IO_DPD_REQ_CODE_MASK;
|
|
||||||
value |= IO_DPD_REQ_CODE_OFF;
|
|
||||||
tegra_pmc_writel(value, request);
|
|
||||||
|
|
||||||
err = tegra_io_rail_poll(status, mask, 0, 250);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_info("tegra_io_rail_poll() failed: %d\n", err);
|
pr_info("tegra_io_rail_poll() failed: %d\n", err);
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1002,8 +996,8 @@ EXPORT_SYMBOL(tegra_io_rail_power_on);
|
||||||
|
|
||||||
int tegra_io_rail_power_off(unsigned int id)
|
int tegra_io_rail_power_off(unsigned int id)
|
||||||
{
|
{
|
||||||
unsigned long request, status, value;
|
unsigned long request, status;
|
||||||
unsigned int bit, mask;
|
unsigned int bit;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
mutex_lock(&pmc->powergates_lock);
|
mutex_lock(&pmc->powergates_lock);
|
||||||
|
@ -1014,15 +1008,9 @@ int tegra_io_rail_power_off(unsigned int id)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
mask = 1 << bit;
|
tegra_pmc_writel(IO_DPD_REQ_CODE_ON | BIT(bit), request);
|
||||||
|
|
||||||
value = tegra_pmc_readl(request);
|
err = tegra_io_rail_poll(status, BIT(bit), BIT(bit), 250);
|
||||||
value |= mask;
|
|
||||||
value &= ~IO_DPD_REQ_CODE_MASK;
|
|
||||||
value |= IO_DPD_REQ_CODE_ON;
|
|
||||||
tegra_pmc_writel(value, request);
|
|
||||||
|
|
||||||
err = tegra_io_rail_poll(status, mask, mask, 250);
|
|
||||||
if (err)
|
if (err)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue