1 From c8f2a8aaae41fa0a40ad88855ae82696098230d7 Mon Sep 17 00:00:00 2001
2 From: Claudiu Beznea <claudiu.beznea@microchip.com>
3 Date: Thu, 15 Apr 2021 13:49:48 +0300
4 Subject: [PATCH 198/247] ARM: at91: pm: move the setup of soc_pm.bu->suspended
6 Move the setup of soc_pm.bu->suspended in platform_suspend::begin
7 function so that the PMC code in charge with clocks suspend/resume
8 to differentiate b/w standard PM mode and backup mode.
10 Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
11 Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
12 Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
13 Link: https://lore.kernel.org/r/20210415105010.569620-3-claudiu.beznea@microchip.com
15 arch/arm/mach-at91/pm.c | 15 ++++++++++++---
16 1 file changed, 12 insertions(+), 3 deletions(-)
18 diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
19 index 3fa223c21618..f182d8bf6f82 100644
20 --- a/arch/arm/mach-at91/pm.c
21 +++ b/arch/arm/mach-at91/pm.c
22 @@ -214,6 +214,8 @@ static int at91_sam9x60_config_pmc_ws(void __iomem *pmc, u32 mode, u32 polarity)
24 static int at91_pm_begin(suspend_state_t state)
30 soc_pm.data.mode = soc_pm.data.suspend_mode;
31 @@ -227,7 +229,16 @@ static int at91_pm_begin(suspend_state_t state)
32 soc_pm.data.mode = -1;
35 - return at91_pm_config_ws(soc_pm.data.mode, true);
36 + ret = at91_pm_config_ws(soc_pm.data.mode, true);
40 + if (soc_pm.data.mode == AT91_PM_BACKUP)
41 + soc_pm.bu->suspended = 1;
43 + soc_pm.bu->suspended = 0;
49 @@ -296,8 +307,6 @@ static int at91_suspend_finish(unsigned long val)
50 static void at91_pm_suspend(suspend_state_t state)
52 if (soc_pm.data.mode == AT91_PM_BACKUP) {
53 - soc_pm.bu->suspended = 1;
55 cpu_suspend(0, at91_suspend_finish);
57 /* The SRAM is lost between suspend cycles */