ARM: at91: pm: cpu_idle: switch DDR to power-down mode
Nicolas Ferre
maintainerPATCH 1/1 ARM: at91: pm: cpu_idle: switch DDR to power-down mode
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, we instanciate a new sama5d3_ddr_standby() function.
--- arch/arm/mach-at91/pm.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
arch/arm/mach-at91/pm.c +18 -1
@@ -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 */ +at91_ramc_write (0 ,AT91_DDRSDRC_LPR , lpr0); + +cpu_do_idle (); + +at91_ramc_write (0 ,AT91_DDRSDRC_LPR , saved_lpr0); +} +/* We manage both DDRAM/SDRAM controllers, we need more than one value to * remember. */
@@ -323,7 +340,7 @@ static const struct of_device_id const ramc_ids[] __initconst = { { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby }, { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby }, { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby }, - { .compatible = "atmel,sama5d3-ddramc", .data = at91_ddr_standby }, + { .compatible = "atmel,sama5d3-ddramc", .data = sama5d3_ddr_standby }, {/*sentinel*/ } };
Signature · 1 line
2.9.0
Quoted 9 lines · Nicolas Ferre
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_idledriver. 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...
Quoted 5 lines
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 ^
Quoted 15 lines
we instanciate a new
sama5d3_ddr_standby()function.Signed-off-by Nicolas Ferre <[email protected]>--- arch/arm/mach-at91/pm.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)arch/arm/mach-at91/pm.c +0
-0@@ -289,6 +289,23 @@ static void at91_ddr_standby(void)at91_ramc_write (1 ,AT91_DDRSDRC_LPR , saved_lpr1); }
arch/arm/mach-at91/pm.c static void at91_ddr_standby(void) · line 301
Quoted 10 lines
arch/arm/mach-at91/pm.c +10
-0+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
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Nicolas Ferre
maintainerQuoted 10 lines · Alexandre Belloni
Quoted 9 lines · Nicolas Ferre
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_idledriver. 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...
Quoted 8 lines
Quoted 5 lines
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 ^
Quoted 1 line
we instanciate a new
sama5d3_ddr_standby()function.
And here ^ also: I rewrite a v2 now.
Quoted 13 lines
Quoted 13 lines
Signed-off-by Nicolas Ferre <[email protected]>--- arch/arm/mach-at91/pm.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)arch/arm/mach-at91/pm.c +0
-0@@ -289,6 +289,23 @@ static void at91_ddr_standby(void)at91_ramc_write (1 ,AT91_DDRSDRC_LPR , saved_lpr1); }
Quoted 12 lines
arch/arm/mach-at91/pm.c static void at91_ddr_standby(void) · line 301
Quoted 10 lines
arch/arm/mach-at91/pm.c +10
-0+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,
Signature · 1 line
Nicolas Ferre