Unverified Commit 2fd7a3f2 authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

Merge tag 'at91-soc-6.14' of...

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/20250107081424.758980-3-claudiu.beznea@tuxon.dev


Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents afc67135 452d18c7
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -58,6 +58,17 @@ config SOC_SAMA5D4
	help
	  Select this if you are using one of Microchip's SAMA5D4 family SoC.

config SOC_SAMA7D65
	bool "SAMA7D65 family"
	depends on ARCH_MULTI_V7
	select HAVE_AT91_GENERATED_CLK
	select HAVE_AT91_SAM9X60_PLL
	select HAVE_AT91_USB_CLK
	select HAVE_AT91_UTMI
	select SOC_SAMA7
	help
	  Select this if you are using one of Microchip's SAMA7D65 family SoC.

config SOC_SAMA7G5
	bool "SAMA7G5 family"
	depends on ARCH_MULTI_V7
+20 −11
Original line number Diff line number Diff line
@@ -598,7 +598,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;
@@ -609,24 +623,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);

+1 −1
Original line number Diff line number Diff line
@@ -399,7 +399,7 @@ static const struct of_device_id at91_soc_allowed_list[] __initconst = {

static int __init atmel_soc_device_init(void)
{
	struct device_node *np = of_find_node_by_path("/");
	struct device_node *np __free(device_node) = of_find_node_by_path("/");

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