ARM: at91: pm: add backup mode support for SAMA7G5
authorClaudiu Beznea <claudiu.beznea@microchip.com>
Thu, 15 Apr 2021 10:50:06 +0000 (13:50 +0300)
committerNicolas Ferre <nicolas.ferre@microchip.com>
Mon, 19 Jul 2021 12:32:12 +0000 (14:32 +0200)
Adapt at91_pm_backup_init() to work for SAMA7G5. Also, set the LPM pin
to shutdown controller. This will signal to PMIC that it needs to switch
to the state corresponding to backup mode.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Link: https://lore.kernel.org/r/20210415105010.569620-21-claudiu.beznea@microchip.com
arch/arm/mach-at91/pm.c
arch/arm/mach-at91/pm_suspend.S

index 91b4014..fcb2027 100644 (file)
@@ -729,7 +729,8 @@ static int __init at91_pm_backup_init(void)
        struct platform_device *pdev;
        int ret = -ENODEV, located = 0;
 
-       if (!IS_ENABLED(CONFIG_SOC_SAMA5D2))
+       if (!IS_ENABLED(CONFIG_SOC_SAMA5D2) &&
+           !IS_ENABLED(CONFIG_SOC_SAMA7G5))
                return -EPERM;
 
        if (!at91_is_pm_mode_active(AT91_PM_BACKUP))
index 7396e18..cbd61a3 100644 (file)
@@ -106,6 +106,12 @@ lp_done_\ena:
 #endif
        .endm
 
+       .macro at91_backup_set_lpm reg
+#ifdef CONFIG_SOC_SAMA7
+       orr     \reg, \reg, #0x200000
+#endif
+       .endm
+
        .text
 
        .arm
@@ -989,6 +995,7 @@ ulp_exit:
        ldr     r0, .shdwc
        mov     tmp1, #0xA5000000
        add     tmp1, tmp1, #0x1
+       at91_backup_set_lpm tmp1
        str     tmp1, [r0, #0]
 .endm