public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] soc/tegra: pmc: Fix incorrect DPD request
@ 2016-08-11  1:13 Vince Hsu
       [not found] ` <1470878016-6098-1-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Vince Hsu @ 2016-08-11  1:13 UTC (permalink / raw)
  To: swarren-3lzwWm7+Weoh9ZMKESR00Q,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	gnurou-Re5JQEeQqe8AvxtiuMwx3w, jonathanh-DDmLM1+adcrQT0dZR+AlfA,
	ldewangan-DDmLM1+adcrQT0dZR+AlfA
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, Vince Hsu

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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
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(-)

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)
 
 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;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] soc/tegra: pmc: Fix incorrect DPD request
       [not found] ` <1470878016-6098-1-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-08-11  8:27   ` Jon Hunter
       [not found]     ` <90071a29-8d79-7ec0-77b2-1669c248b845-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Hunter @ 2016-08-11  8:27 UTC (permalink / raw)
  To: Vince Hsu, swarren-3lzwWm7+Weoh9ZMKESR00Q,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	gnurou-Re5JQEeQqe8AvxtiuMwx3w, ldewangan-DDmLM1+adcrQT0dZR+AlfA
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA


On 11/08/16 02:13, Vince Hsu wrote:
> 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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
> 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(-)
> 
> 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)
>  
>  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;

Thanks for updating.

Reviewed-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Cheers
Jon

-- 
nvpublic

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] soc/tegra: pmc: Fix incorrect DPD request
       [not found]     ` <90071a29-8d79-7ec0-77b2-1669c248b845-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-08-23  5:42       ` Vince Hsu
       [not found]         ` <6d643c00-1d68-b9d2-45a5-38151b8525fc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Vince Hsu @ 2016-08-23  5:42 UTC (permalink / raw)
  To: Jon Hunter, swarren-3lzwWm7+Weoh9ZMKESR00Q,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	gnurou-Re5JQEeQqe8AvxtiuMwx3w, ldewangan-DDmLM1+adcrQT0dZR+AlfA
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

Hi Thierry,

Do you have objection to this patch?

Thanks,
Vince

On 08/11/2016 04:27 PM, Jon Hunter wrote:
> On 11/08/16 02:13, Vince Hsu wrote:
>> 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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>> ---
>> 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(-)
>>
>> 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)
>>   
>>   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;
> Thanks for updating.
>
> Reviewed-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>
> Cheers
> Jon
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] soc/tegra: pmc: Fix incorrect DPD request
       [not found]         ` <6d643c00-1d68-b9d2-45a5-38151b8525fc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-08-23  8:18           ` Jon Hunter
       [not found]             ` <2d7c66b8-1555-f66e-eb41-316092772579-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Hunter @ 2016-08-23  8:18 UTC (permalink / raw)
  To: Vince Hsu, swarren-3lzwWm7+Weoh9ZMKESR00Q,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	gnurou-Re5JQEeQqe8AvxtiuMwx3w, ldewangan-DDmLM1+adcrQT0dZR+AlfA
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

Hi Vince,

On 23/08/16 06:42, Vince Hsu wrote:
> 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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] soc/tegra: pmc: Fix incorrect DPD request
       [not found]             ` <2d7c66b8-1555-f66e-eb41-316092772579-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-08-23  8:27               ` Vince Hsu
  0 siblings, 0 replies; 5+ messages in thread
From: Vince Hsu @ 2016-08-23  8:27 UTC (permalink / raw)
  To: Jon Hunter, swarren-3lzwWm7+Weoh9ZMKESR00Q,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	gnurou-Re5JQEeQqe8AvxtiuMwx3w, ldewangan-DDmLM1+adcrQT0dZR+AlfA
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

Sorry that I did not notice that. Thanks Jon & Thierry!

Vince

On 08/23/2016 04:18 PM, Jon Hunter wrote:
> Hi Vince,
>
> On 23/08/16 06:42, Vince Hsu wrote:
>> 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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-23  8:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-11  1:13 [PATCH V2] soc/tegra: pmc: Fix incorrect DPD request Vince Hsu
     [not found] ` <1470878016-6098-1-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-11  8:27   ` Jon Hunter
     [not found]     ` <90071a29-8d79-7ec0-77b2-1669c248b845-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-23  5:42       ` Vince Hsu
     [not found]         ` <6d643c00-1d68-b9d2-45a5-38151b8525fc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-23  8:18           ` Jon Hunter
     [not found]             ` <2d7c66b8-1555-f66e-eb41-316092772579-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-23  8:27               ` Vince Hsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox