Skip to content

Commit 2fd7a3f

Browse files
committed
Merge tag 'at91-soc-6.14' of https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux into soc/arm
Microchip AT91 SoC updates for v6.14 This update includes: - support for the SAMA7D65 SoC - support for automatic mode in the backup unit power switch, eliminating the need for software intervention when entering low power mode - a fix to release a device node reference in the failure path of the SoC driver initialization * tag 'at91-soc-6.14' of https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux: ARM: at91: add new SoC sama7d65 ARM: at91: pm: change BU Power Switch to automatic mode soc: atmel: fix device_node release in atmel_soc_device_init() Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents afc6713 + 452d18c commit 2fd7a3f

File tree

3 files changed

+32
-12
lines changed

3 files changed

+32
-12
lines changed

arch/arm/mach-at91/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ config SOC_SAMA5D4
5858
help
5959
Select this if you are using one of Microchip's SAMA5D4 family SoC.
6060

61+
config SOC_SAMA7D65
62+
bool "SAMA7D65 family"
63+
depends on ARCH_MULTI_V7
64+
select HAVE_AT91_GENERATED_CLK
65+
select HAVE_AT91_SAM9X60_PLL
66+
select HAVE_AT91_USB_CLK
67+
select HAVE_AT91_UTMI
68+
select SOC_SAMA7
69+
help
70+
Select this if you are using one of Microchip's SAMA7D65 family SoC.
71+
6172
config SOC_SAMA7G5
6273
bool "SAMA7G5 family"
6374
depends on ARCH_MULTI_V7

arch/arm/mach-at91/pm.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,21 @@ static int at91_suspend_finish(unsigned long val)
598598
return 0;
599599
}
600600

601-
static void at91_pm_switch_ba_to_vbat(void)
601+
/**
602+
* at91_pm_switch_ba_to_auto() - Configure Backup Unit Power Switch
603+
* to automatic/hardware mode.
604+
*
605+
* The Backup Unit Power Switch can be managed either by software or hardware.
606+
* Enabling hardware mode allows the automatic transition of power between
607+
* VDDANA (or VDDIN33) and VDDBU (or VBAT, respectively), based on the
608+
* availability of these power sources.
609+
*
610+
* If the Backup Unit Power Switch is already in automatic mode, no action is
611+
* required. If it is in software-controlled mode, it is switched to automatic
612+
* mode to enhance safety and eliminate the need for toggling between power
613+
* sources.
614+
*/
615+
static void at91_pm_switch_ba_to_auto(void)
602616
{
603617
unsigned int offset = offsetof(struct at91_pm_sfrbu_regs, pswbu);
604618
unsigned int val;
@@ -609,24 +623,19 @@ static void at91_pm_switch_ba_to_vbat(void)
609623

610624
val = readl(soc_pm.data.sfrbu + offset);
611625

612-
/* Already on VBAT. */
613-
if (!(val & soc_pm.sfrbu_regs.pswbu.state))
626+
/* Already on auto/hardware. */
627+
if (!(val & soc_pm.sfrbu_regs.pswbu.ctrl))
614628
return;
615629

616-
val &= ~soc_pm.sfrbu_regs.pswbu.softsw;
617-
val |= soc_pm.sfrbu_regs.pswbu.key | soc_pm.sfrbu_regs.pswbu.ctrl;
630+
val &= ~soc_pm.sfrbu_regs.pswbu.ctrl;
631+
val |= soc_pm.sfrbu_regs.pswbu.key;
618632
writel(val, soc_pm.data.sfrbu + offset);
619-
620-
/* Wait for update. */
621-
val = readl(soc_pm.data.sfrbu + offset);
622-
while (val & soc_pm.sfrbu_regs.pswbu.state)
623-
val = readl(soc_pm.data.sfrbu + offset);
624633
}
625634

626635
static void at91_pm_suspend(suspend_state_t state)
627636
{
628637
if (soc_pm.data.mode == AT91_PM_BACKUP) {
629-
at91_pm_switch_ba_to_vbat();
638+
at91_pm_switch_ba_to_auto();
630639

631640
cpu_suspend(0, at91_suspend_finish);
632641

drivers/soc/atmel/soc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ static const struct of_device_id at91_soc_allowed_list[] __initconst = {
399399

400400
static int __init atmel_soc_device_init(void)
401401
{
402-
struct device_node *np = of_find_node_by_path("/");
402+
struct device_node *np __free(device_node) = of_find_node_by_path("/");
403403

404404
if (!of_match_node(at91_soc_allowed_list, np))
405405
return 0;

0 commit comments

Comments
 (0)