All of lore.kernel.org
 help / color / mirror / Atom feed
From: nicolas.ferre@microchip.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: at91: pm: cpu_idle: switch DDR to power-down mode
Date: Tue, 14 Mar 2017 09:21:35 +0100	[thread overview]
Message-ID: <c4762297-e2ef-e6cd-536d-536dc27ab4e6@microchip.com> (raw)
In-Reply-To: <20170313210742.r7jdbuyp72ma76vl@piout.net>

Le 13/03/2017 ? 22:07, Alexandre Belloni a ?crit :
> On 13/03/2017 at 18:14:50 +0100, Nicolas Ferre wrote:
>> On some DDR controllers, compatible with the sama5d3 one,
>> the sequence to enter/exit/re-enter the self-refresh mode adds
>> more constrains than what is currently written in the at91_idle
>> driver. An actual access to the DDR chip is needed between exit
>> and re-enter of this mode which is somehow difficult to implement.
>> This sequence can completely hang the SoC. It is particularly
>> experienced on parts which embed a L2 cache if the code run
>> between IDLE calls fits in it...
>>
>> Moreover, as the intention is to enter and exit pretty rapidly
>> from IDLE, the power-down mode is a good candidate.
>>
>> So now we use power-down instead of self-refresh. As we can
>> simplify the funciton for sama5d3 compatible DDR controllers,
>               typo ^
> 
>> we instanciate a new sama5d3_ddr_standby() function.

And here ^ also: I rewrite a v2 now.


>> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
>> ---
>>  arch/arm/mach-at91/pm.c | 19 ++++++++++++++++++-
>>  1 file changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
>> index 3d89b7905bd9..63e7df8ec815 100644
>> --- a/arch/arm/mach-at91/pm.c
>> +++ b/arch/arm/mach-at91/pm.c
>> @@ -289,6 +289,23 @@ static void at91_ddr_standby(void)
>>  		at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1);
>>  }
>>  
>> +static void sama5d3_ddr_standby(void)
>> +{
>> +	u32 lpr0;
>> +	u32 saved_lpr0;
>> +
>> +	saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR);
>> +	lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB;
>> +	lpr0 |= AT91_DDRSDRC_LPCB_POWER_DOWN;
>> +
>> +	/* self-refresh mode now */
> 
> So this is not self refresh anymore

True, and useless comment in this case: so I simply remove it!
Sorry for the noise.

Regards,
-- 
Nicolas Ferre

WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Ferre <nicolas.ferre@microchip.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Boris BREZILLON <boris.brezillon@free-electrons.com>,
	Wenyou Yang <wenyou.yang@microchip.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARM: at91: pm: cpu_idle: switch DDR to power-down mode
Date: Tue, 14 Mar 2017 09:21:35 +0100	[thread overview]
Message-ID: <c4762297-e2ef-e6cd-536d-536dc27ab4e6@microchip.com> (raw)
In-Reply-To: <20170313210742.r7jdbuyp72ma76vl@piout.net>

Le 13/03/2017 à 22:07, Alexandre Belloni a écrit :
> On 13/03/2017 at 18:14:50 +0100, Nicolas Ferre wrote:
>> On some DDR controllers, compatible with the sama5d3 one,
>> the sequence to enter/exit/re-enter the self-refresh mode adds
>> more constrains than what is currently written in the at91_idle
>> driver. An actual access to the DDR chip is needed between exit
>> and re-enter of this mode which is somehow difficult to implement.
>> This sequence can completely hang the SoC. It is particularly
>> experienced on parts which embed a L2 cache if the code run
>> between IDLE calls fits in it...
>>
>> Moreover, as the intention is to enter and exit pretty rapidly
>> from IDLE, the power-down mode is a good candidate.
>>
>> So now we use power-down instead of self-refresh. As we can
>> simplify the funciton for sama5d3 compatible DDR controllers,
>               typo ^
> 
>> we instanciate a new sama5d3_ddr_standby() function.

And here ^ also: I rewrite a v2 now.


>> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
>> ---
>>  arch/arm/mach-at91/pm.c | 19 ++++++++++++++++++-
>>  1 file changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
>> index 3d89b7905bd9..63e7df8ec815 100644
>> --- a/arch/arm/mach-at91/pm.c
>> +++ b/arch/arm/mach-at91/pm.c
>> @@ -289,6 +289,23 @@ static void at91_ddr_standby(void)
>>  		at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1);
>>  }
>>  
>> +static void sama5d3_ddr_standby(void)
>> +{
>> +	u32 lpr0;
>> +	u32 saved_lpr0;
>> +
>> +	saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR);
>> +	lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB;
>> +	lpr0 |= AT91_DDRSDRC_LPCB_POWER_DOWN;
>> +
>> +	/* self-refresh mode now */
> 
> So this is not self refresh anymore

True, and useless comment in this case: so I simply remove it!
Sorry for the noise.

Regards,
-- 
Nicolas Ferre

  reply	other threads:[~2017-03-14  8:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 17:14 [PATCH] ARM: at91: pm: cpu_idle: switch DDR to power-down mode Nicolas Ferre
2017-03-13 17:14 ` Nicolas Ferre
2017-03-13 21:07 ` Alexandre Belloni
2017-03-13 21:07   ` Alexandre Belloni
2017-03-14  8:21   ` Nicolas Ferre [this message]
2017-03-14  8:21     ` Nicolas Ferre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4762297-e2ef-e6cd-536d-536dc27ab4e6@microchip.com \
    --to=nicolas.ferre@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.