soc/tegra: pmc: Fix incorrect DPD request
PATCH v2 1/1 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.
---
Hi,
I did not notice Laxman had a series[1] which also touched pmc code, and it seems the series isn't merged yet. Should I rebase this patch on it?
Thanks,
Vince
drivers/soc/tegra/pmc.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
drivers/soc/tegra/pmc.c +8 -20
@@ -967,8 +967,8 @@ static void tegra_io_rail_unprepare(void)int tegra_io_rail_power_on (unsigned int id) { -unsigned long request, status, value; -unsigned int bit, mask; +unsigned long request, status; +unsigned int bit;int err;mutex_lock (&pmc->powergates_lock);
@@ -977,15 +977,9 @@ int tegra_io_rail_power_on(unsigned int id)if (err) goto error; - mask =1 << bit; +tegra_pmc_writel (IO_DPD_REQ_CODE_OFF |BIT (bit), request); - value =tegra_pmc_readl (request); - 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 ); + err =tegra_io_rail_poll (status,BIT (bit),0 ,250 );if (err) {pr_info ("tegra_io_rail_poll() failed: %d\n" , err); goto error;
@@ -1002,8 +996,8 @@ EXPORT_SYMBOL(tegra_io_rail_power_on);int tegra_io_rail_power_off (unsigned int id) { -unsigned long request, status, value; -unsigned int bit, mask; +unsigned long request, status; +unsigned int bit;int err;mutex_lock (&pmc->powergates_lock);
@@ -1014,15 +1008,9 @@ int tegra_io_rail_power_off(unsigned int id) goto error; } - mask =1 << bit; - - value =tegra_pmc_readl (request); - value |= mask; - value &= ~IO_DPD_REQ_CODE_MASK ; - value |=IO_DPD_REQ_CODE_ON ; -tegra_pmc_writel (value, request); +tegra_pmc_writel (IO_DPD_REQ_CODE_ON |BIT (bit), request); - err =tegra_io_rail_poll (status, mask, mask,250 ); + err =tegra_io_rail_poll (status,BIT (bit),BIT (bit),250 );if (err) goto error;
Signature · 1 line
2.7.4
A message that is not in the archive (sent off-list or not yet received): 1470878016-6098-1-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Jon Hunter
Reviewed-byQuoted 70 lines · Vince Hsu
Reading the
DPD_REQ&DPD2_REQregisters 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 <[email protected]>---
Hi,I did not notice Laxman had a series[1] which also touched pmc code, and it seems the series isn't merged yet. Should I rebase this patch on it?
Thanks,
Vincedrivers/soc/tegra/pmc.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)drivers/soc/tegra/pmc.c +6
-15@@ -967,8 +967,8 @@ static void tegra_io_rail_unprepare(void)int tegra_io_rail_power_on (unsigned int id) { -unsigned long request, status, value; -unsigned int bit, mask; +unsigned long request, status; +unsigned int bit;int err;mutex_lock (&pmc->powergates_lock);@@ -977,15 +977,9 @@ int tegra_io_rail_power_on(unsigned int id)if (err) goto error; - mask =1 << bit; +tegra_pmc_writel (IO_DPD_REQ_CODE_OFF |BIT (bit), request); - value =tegra_pmc_readl (request); - 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 ); + err =tegra_io_rail_poll (status,BIT (bit),0 ,250 );if (err) {pr_info ("tegra_io_rail_poll() failed: %d\n" , err); goto error;@@ -1002,8 +996,8 @@ EXPORT_SYMBOL(tegra_io_rail_power_on);int tegra_io_rail_power_off (unsigned int id) { -unsigned long request, status, value; -unsigned int bit, mask; +unsigned long request, status; +unsigned int bit;int err;mutex_lock (&pmc->powergates_lock);@@ -1014,15 +1008,9 @@ int tegra_io_rail_power_off(unsigned int id) goto error; } - mask =1 << bit; - - value =tegra_pmc_readl (request);
drivers/soc/tegra/pmc.c int tegra_io_rail_power_off(unsigned int id) · line 1015
Quoted 10 lines
drivers/soc/tegra/pmc.c +2
-5- value |= mask; - value &= ~IO_DPD_REQ_CODE_MASK ; - value |=IO_DPD_REQ_CODE_ON ; -tegra_pmc_writel (value, request); +tegra_pmc_writel (IO_DPD_REQ_CODE_ON |BIT (bit), request); - err =tegra_io_rail_poll (status, mask, mask,250 ); + err =tegra_io_rail_poll (status,BIT (bit),BIT (bit),250 );if (err) goto error;
Thanks for updating.
Cheers
Jon
Signature · 1 line
nvpublic
A message that is not in the archive (sent off-list or not yet received): 90071a29-8d79-7ec0-77b2-1669c248b845-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Hi Thierry,
Do you have objection to this patch?
Thanks,
Vince
Quoted 88 lines · Jon Hunter
Quoted 70 lines · Vince Hsu
Reading the
DPD_REQ&DPD2_REQregisters 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 <[email protected]>---
Hi,I did not notice Laxman had a series[1] which also touched pmc code, and it seems the series isn't merged yet. Should I rebase this patch on it?
Thanks,
Vincedrivers/soc/tegra/pmc.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)drivers/soc/tegra/pmc.c +6
-15@@ -967,8 +967,8 @@ static void tegra_io_rail_unprepare(void)int tegra_io_rail_power_on (unsigned int id) { -unsigned long request, status, value; -unsigned int bit, mask; +unsigned long request, status; +unsigned int bit;int err;mutex_lock (&pmc->powergates_lock);@@ -977,15 +977,9 @@ int tegra_io_rail_power_on(unsigned int id)if (err) goto error; - mask =1 << bit; +tegra_pmc_writel (IO_DPD_REQ_CODE_OFF |BIT (bit), request); - value =tegra_pmc_readl (request); - 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 ); + err =tegra_io_rail_poll (status,BIT (bit),0 ,250 );if (err) {pr_info ("tegra_io_rail_poll() failed: %d\n" , err); goto error;@@ -1002,8 +996,8 @@ EXPORT_SYMBOL(tegra_io_rail_power_on);int tegra_io_rail_power_off (unsigned int id) { -unsigned long request, status, value; -unsigned int bit, mask; +unsigned long request, status; +unsigned int bit;int err;mutex_lock (&pmc->powergates_lock);@@ -1014,15 +1008,9 @@ int tegra_io_rail_power_off(unsigned int id) goto error; } - mask =1 << bit; - - value =tegra_pmc_readl (request);drivers/soc/tegra/pmc.c int tegra_io_rail_power_off(unsigned int id) · line 1015
Quoted 10 lines
drivers/soc/tegra/pmc.c +2
-5- value |= mask; - value &= ~IO_DPD_REQ_CODE_MASK ; - value |=IO_DPD_REQ_CODE_ON ; -tegra_pmc_writel (value, request); +tegra_pmc_writel (IO_DPD_REQ_CODE_ON |BIT (bit), request); - err =tegra_io_rail_poll (status, mask, mask,250 ); + err =tegra_io_rail_poll (status,BIT (bit),BIT (bit),250 );if (err) goto error;Thanks for updating.
Reviewed-by Jon Hunter <[email protected]>Cheers
Jon
A message that is not in the archive (sent off-list or not yet received): 6d643c00-1d68-b9d2-45a5-38151b8525fc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Hi Vince,
Quoted 3 lines · Vince Hsu
Hi Thierry,
Do you have objection to this patch?
Thierry has queued it here:
http://git.kernel.org/cgit/linux/kernel/git/tegra/linux.git/log/?h=for-4.9/soc
Jon
Signature · 1 line
nvpublic
A message that is not in the archive (sent off-list or not yet received): 2d7c66b8-1555-f66e-eb41-316092772579-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Sorry that I did not notice that. Thanks Jon & Thierry!
Vince
Quoted 12 lines · Jon Hunter
Hi Vince,
Quoted 3 lines · Vince Hsu
Hi Thierry,
Do you have objection to this patch?
Thierry has queued it here:
http://git.kernel.org/cgit/linux/kernel/git/tegra/linux.git/log/?h=for-4.9/soc
Jon