Patch "ARM: at91: pm: change BU Power Switch to automatic mode" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ARM: at91: pm: change BU Power Switch to automatic mode

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm-at91-pm-change-bu-power-switch-to-automatic-mode.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8333a69d9b1b5ca49ca00fd92d07f1df5acc35a3
Author: Nicolas Ferre <nicolas.ferre@xxxxxxxxxxxxx>
Date:   Mon Nov 25 17:56:48 2024 +0100

    ARM: at91: pm: change BU Power Switch to automatic mode
    
    [ Upstream commit 6fc5bdfa872b7da51b5507a1327a17c3db2fcf95 ]
    
    Change how the Backup Unit Power is configured and force the
    automatic/hardware mode.
    This change eliminates the need for software management of the power
    switch, ensuring it transitions to the backup power source before
    entering low power modes.
    
    This is done in the only location where this switch was configured. It's
    usually done in the bootloader.
    
    Previously, the loss of the VDDANA (or VDDIN33) power source was not
    automatically compensated by an alternative power source. This resulted
    in the loss of Backup Unit content, including Backup Self-refresh low
    power mode information, OTP emulation configuration, and boot
    configuration, for instance.
    
    Fixes: ac809e7879b1 ("ARM: at91: pm: switch backup area to vbat in backup mode")
    Signed-off-by: Nicolas Ferre <nicolas.ferre@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241125165648.509162-1-nicolas.ferre@xxxxxxxxxxxxx
    Signed-off-by: Claudiu Beznea <claudiu.beznea@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index c8cc993ca8ca1..91efc3d4de61d 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -403,7 +403,21 @@ static int at91_suspend_finish(unsigned long val)
 	return 0;
 }
 
-static void at91_pm_switch_ba_to_vbat(void)
+/**
+ * at91_pm_switch_ba_to_auto() - Configure Backup Unit Power Switch
+ * to automatic/hardware mode.
+ *
+ * The Backup Unit Power Switch can be managed either by software or hardware.
+ * Enabling hardware mode allows the automatic transition of power between
+ * VDDANA (or VDDIN33) and VDDBU (or VBAT, respectively), based on the
+ * availability of these power sources.
+ *
+ * If the Backup Unit Power Switch is already in automatic mode, no action is
+ * required. If it is in software-controlled mode, it is switched to automatic
+ * mode to enhance safety and eliminate the need for toggling between power
+ * sources.
+ */
+static void at91_pm_switch_ba_to_auto(void)
 {
 	unsigned int offset = offsetof(struct at91_pm_sfrbu_regs, pswbu);
 	unsigned int val;
@@ -414,24 +428,19 @@ static void at91_pm_switch_ba_to_vbat(void)
 
 	val = readl(soc_pm.data.sfrbu + offset);
 
-	/* Already on VBAT. */
-	if (!(val & soc_pm.sfrbu_regs.pswbu.state))
+	/* Already on auto/hardware. */
+	if (!(val & soc_pm.sfrbu_regs.pswbu.ctrl))
 		return;
 
-	val &= ~soc_pm.sfrbu_regs.pswbu.softsw;
-	val |= soc_pm.sfrbu_regs.pswbu.key | soc_pm.sfrbu_regs.pswbu.ctrl;
+	val &= ~soc_pm.sfrbu_regs.pswbu.ctrl;
+	val |= soc_pm.sfrbu_regs.pswbu.key;
 	writel(val, soc_pm.data.sfrbu + offset);
-
-	/* Wait for update. */
-	val = readl(soc_pm.data.sfrbu + offset);
-	while (val & soc_pm.sfrbu_regs.pswbu.state)
-		val = readl(soc_pm.data.sfrbu + offset);
 }
 
 static void at91_pm_suspend(suspend_state_t state)
 {
 	if (soc_pm.data.mode == AT91_PM_BACKUP) {
-		at91_pm_switch_ba_to_vbat();
+		at91_pm_switch_ba_to_auto();
 
 		cpu_suspend(0, at91_suspend_finish);
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux