Commit 514e2a29 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Alexandre Belloni

ARM: at91: pm: Use ULP0 naming instead of slow clock

Switch to use ULP0 naming instead of slow clock naming for power modes, to
be as closed as possible to datasheet. This commit does the necessary
renaming and macro addition to be as close as possible to the namings
from [1].

[1] https://lore.kernel.org/lkml/1470650705-31418-3-git-send-email-wenyou.yang@atmel.comSigned-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 1e1d5b69
...@@ -40,15 +40,15 @@ extern void at91_pinctrl_gpio_resume(void); ...@@ -40,15 +40,15 @@ extern void at91_pinctrl_gpio_resume(void);
#endif #endif
static const match_table_t pm_modes __initconst = { static const match_table_t pm_modes __initconst = {
{ 0, "standby" }, { AT91_PM_STANDBY, "standby" },
{ AT91_PM_SLOW_CLOCK, "ulp0" }, { AT91_PM_ULP0, "ulp0" },
{ AT91_PM_BACKUP, "backup" }, { AT91_PM_BACKUP, "backup" },
{ -1, NULL }, { -1, NULL },
}; };
static struct at91_pm_data pm_data = { static struct at91_pm_data pm_data = {
.standby_mode = 0, .standby_mode = AT91_PM_STANDBY,
.suspend_mode = AT91_PM_SLOW_CLOCK, .suspend_mode = AT91_PM_ULP0,
}; };
#define at91_ramc_read(id, field) \ #define at91_ramc_read(id, field) \
...@@ -145,7 +145,7 @@ static int at91_pm_verify_clocks(void) ...@@ -145,7 +145,7 @@ static int at91_pm_verify_clocks(void)
*/ */
int at91_suspend_entering_slow_clock(void) int at91_suspend_entering_slow_clock(void)
{ {
return (pm_data.mode >= AT91_PM_SLOW_CLOCK); return (pm_data.mode >= AT91_PM_ULP0);
} }
EXPORT_SYMBOL(at91_suspend_entering_slow_clock); EXPORT_SYMBOL(at91_suspend_entering_slow_clock);
...@@ -186,7 +186,7 @@ static void at91_pm_suspend(suspend_state_t state) ...@@ -186,7 +186,7 @@ static void at91_pm_suspend(suspend_state_t state)
* event sources; and reduces DRAM power. But otherwise it's identical to * event sources; and reduces DRAM power. But otherwise it's identical to
* PM_SUSPEND_ON: cpu idle, and nothing fancy done with main or cpu clocks. * PM_SUSPEND_ON: cpu idle, and nothing fancy done with main or cpu clocks.
* *
* AT91_PM_SLOW_CLOCK is like STANDBY plus slow clock mode, so drivers must * AT91_PM_ULP0 is like STANDBY plus slow clock mode, so drivers must
* suspend more deeply, the master clock switches to the clk32k and turns off * suspend more deeply, the master clock switches to the clk32k and turns off
* the main oscillator * the main oscillator
* *
...@@ -204,7 +204,7 @@ static int at91_pm_enter(suspend_state_t state) ...@@ -204,7 +204,7 @@ static int at91_pm_enter(suspend_state_t state)
/* /*
* Ensure that clocks are in a valid state. * Ensure that clocks are in a valid state.
*/ */
if ((pm_data.mode >= AT91_PM_SLOW_CLOCK) && if (pm_data.mode >= AT91_PM_ULP0 &&
!at91_pm_verify_clocks()) !at91_pm_verify_clocks())
goto error; goto error;
...@@ -546,9 +546,9 @@ static void __init at91_pm_backup_init(void) ...@@ -546,9 +546,9 @@ static void __init at91_pm_backup_init(void)
pm_data.sfrbu = NULL; pm_data.sfrbu = NULL;
if (pm_data.standby_mode == AT91_PM_BACKUP) if (pm_data.standby_mode == AT91_PM_BACKUP)
pm_data.standby_mode = AT91_PM_SLOW_CLOCK; pm_data.standby_mode = AT91_PM_ULP0;
if (pm_data.suspend_mode == AT91_PM_BACKUP) if (pm_data.suspend_mode == AT91_PM_BACKUP)
pm_data.suspend_mode = AT91_PM_SLOW_CLOCK; pm_data.suspend_mode = AT91_PM_ULP0;
} }
struct pmc_info { struct pmc_info {
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
#define AT91_MEMCTRL_SDRAMC 1 #define AT91_MEMCTRL_SDRAMC 1
#define AT91_MEMCTRL_DDRSDR 2 #define AT91_MEMCTRL_DDRSDR 2
#define AT91_PM_SLOW_CLOCK 0x01 #define AT91_PM_STANDBY 0x00
#define AT91_PM_ULP0 0x01
#define AT91_PM_BACKUP 0x02 #define AT91_PM_BACKUP 0x02
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
...@@ -112,8 +112,8 @@ ENTRY(at91_pm_suspend_in_sram) ...@@ -112,8 +112,8 @@ ENTRY(at91_pm_suspend_in_sram)
bl at91_sramc_self_refresh bl at91_sramc_self_refresh
ldr r0, .pm_mode ldr r0, .pm_mode
cmp r0, #AT91_PM_SLOW_CLOCK cmp r0, #AT91_PM_ULP0
beq slow_clock beq ulp0_mode
cmp r0, #AT91_PM_BACKUP cmp r0, #AT91_PM_BACKUP
beq backup_mode beq backup_mode
...@@ -122,8 +122,8 @@ ENTRY(at91_pm_suspend_in_sram) ...@@ -122,8 +122,8 @@ ENTRY(at91_pm_suspend_in_sram)
at91_cpu_idle at91_cpu_idle
b exit_suspend b exit_suspend
slow_clock: ulp0_mode:
bl at91_slowck_mode bl at91_ulp0_mode
b exit_suspend b exit_suspend
backup_mode: backup_mode:
bl at91_backup_mode bl at91_backup_mode
...@@ -151,7 +151,7 @@ ENTRY(at91_backup_mode) ...@@ -151,7 +151,7 @@ ENTRY(at91_backup_mode)
str tmp1, [r0, #0] str tmp1, [r0, #0]
ENDPROC(at91_backup_mode) ENDPROC(at91_backup_mode)
ENTRY(at91_slowck_mode) ENTRY(at91_ulp0_mode)
ldr pmc, .pmc_base ldr pmc, .pmc_base
/* Save Master clock setting */ /* Save Master clock setting */
...@@ -212,7 +212,7 @@ ENTRY(at91_slowck_mode) ...@@ -212,7 +212,7 @@ ENTRY(at91_slowck_mode)
wait_mckrdy wait_mckrdy
mov pc, lr mov pc, lr
ENDPROC(at91_slowck_mode) ENDPROC(at91_ulp0_mode)
/* /*
* void at91_sramc_self_refresh(unsigned int is_active) * void at91_sramc_self_refresh(unsigned int is_active)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment