linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5
@ 2022-01-13 14:48 Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 01/10] ARM: at91: ddr: remove CONFIG_SOC_SAMA7 dependency Claudiu Beznea
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Claudiu Beznea @ 2022-01-13 14:48 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel, Claudiu Beznea


Hi,

This series adds CPU idle support for SAMA7G5. Along with this the
CPUFreq OPPs for SAMA7G5 and proper config has been added.

Thank you,
Claudiu Beznea

Changes in v2:
- collected tags
- add "opp-suspend" to 600MHz OPP on patch "ARM: dts: at91: sama7g5: add opps"
- add patches:
	ARM: dts: at91: fix low limit for CPU regulator
	ARM: dts: at91: sama7g5ek: set regulator voltages for standby state

Claudiu Beznea (10):
  ARM: at91: ddr: remove CONFIG_SOC_SAMA7 dependency
  ARM: at91: ddr: align macro definitions
  ARM: at91: ddr: fix typo to align with datasheet naming
  ARM: at91: PM: add cpu idle support for sama7g5
  ARM: at91: Kconfig: select PM_OPP
  ARM: dts: at91: fix low limit for CPU regulator
  ARM: dts: at91: sama7g5ek: set regulator voltages for standby state
  ARM: dts: at91: sama7g5: add opps
  ARM: configs: at91: sama7: enable cpu idle
  ARM: configs: at91: sama7: add config for cpufreq

 arch/arm/boot/dts/at91-sama7g5ek.dts |  7 ++++-
 arch/arm/boot/dts/sama7g5.dtsi       | 38 ++++++++++++++++++++++++++++
 arch/arm/configs/sama7_defconfig     |  9 ++++++-
 arch/arm/mach-at91/Kconfig           |  1 +
 arch/arm/mach-at91/pm.c              | 27 +++++++++++++++++++-
 arch/arm/mach-at91/pm_suspend.S      |  4 +--
 include/linux/clk/at91_pmc.h         |  4 +++
 include/soc/at91/sama7-ddr.h         | 15 +++++------
 8 files changed, 91 insertions(+), 14 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 01/10] ARM: at91: ddr: remove CONFIG_SOC_SAMA7 dependency
  2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
@ 2022-01-13 14:48 ` Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 02/10] ARM: at91: ddr: align macro definitions Claudiu Beznea
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2022-01-13 14:48 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel, Claudiu Beznea

Remove CONFIG_SOC_SAMA7 dependency to avoid having #ifdef preprocessor
directives in driver code (arch/arm/mach-at91/pm.c). This prepares the
code for next commits.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 include/soc/at91/sama7-ddr.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/soc/at91/sama7-ddr.h b/include/soc/at91/sama7-ddr.h
index f6542584ca13..13b47e26cdbe 100644
--- a/include/soc/at91/sama7-ddr.h
+++ b/include/soc/at91/sama7-ddr.h
@@ -11,8 +11,6 @@
 #ifndef __SAMA7_DDR_H__
 #define __SAMA7_DDR_H__
 
-#ifdef CONFIG_SOC_SAMA7
-
 /* DDR3PHY */
 #define DDR3PHY_PIR				(0x04)		/* DDR3PHY PHY Initialization Register	*/
 #define	DDR3PHY_PIR_DLLBYP		(1 << 17)	/* DLL Bypass */
@@ -75,6 +73,4 @@
 #define UDDRC_PCTRL_3				(0x6A0)		/* UDDRC Port 3 Control Register */
 #define UDDRC_PCTRL_4				(0x750)		/* UDDRC Port 4 Control Register */
 
-#endif /* CONFIG_SOC_SAMA7 */
-
 #endif /* __SAMA7_DDR_H__ */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 02/10] ARM: at91: ddr: align macro definitions
  2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 01/10] ARM: at91: ddr: remove CONFIG_SOC_SAMA7 dependency Claudiu Beznea
@ 2022-01-13 14:48 ` Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 03/10] ARM: at91: ddr: fix typo to align with datasheet naming Claudiu Beznea
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2022-01-13 14:48 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel, Claudiu Beznea

Align all macro definitions.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 include/soc/at91/sama7-ddr.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/soc/at91/sama7-ddr.h b/include/soc/at91/sama7-ddr.h
index 13b47e26cdbe..817b360efbb8 100644
--- a/include/soc/at91/sama7-ddr.h
+++ b/include/soc/at91/sama7-ddr.h
@@ -13,11 +13,11 @@
 
 /* DDR3PHY */
 #define DDR3PHY_PIR				(0x04)		/* DDR3PHY PHY Initialization Register	*/
-#define	DDR3PHY_PIR_DLLBYP		(1 << 17)	/* DLL Bypass */
+#define	DDR3PHY_PIR_DLLBYP			(1 << 17)	/* DLL Bypass */
 #define		DDR3PHY_PIR_ITMSRST		(1 << 4)	/* Interface Timing Module Soft Reset */
-#define	DDR3PHY_PIR_DLLLOCK		(1 << 2)	/* DLL Lock */
+#define	DDR3PHY_PIR_DLLLOCK			(1 << 2)	/* DLL Lock */
 #define		DDR3PHY_PIR_DLLSRST		(1 << 1)	/* DLL Soft Rest */
-#define	DDR3PHY_PIR_INIT		(1 << 0)	/* Initialization Trigger */
+#define	DDR3PHY_PIR_INIT			(1 << 0)	/* Initialization Trigger */
 
 #define DDR3PHY_PGCR				(0x08)		/* DDR3PHY PHY General Configuration Register */
 #define		DDR3PHY_PGCR_CKDV1		(1 << 13)	/* CK# Disable Value */
@@ -65,7 +65,7 @@
 #define		UDDRC_SWSTAT_SW_DONE_ACK	(1 << 0)	/* Register programming done */
 
 #define UDDRC_PSTAT				(0x3FC)		/* UDDRC Port Status Register */
-#define	UDDRC_PSTAT_ALL_PORTS		(0x1F001F)	/* Read + writes outstanding transactions on all ports */
+#define	UDDRC_PSTAT_ALL_PORTS			(0x1F001F)	/* Read + writes outstanding transactions on all ports */
 
 #define UDDRC_PCTRL_0				(0x490)		/* UDDRC Port 0 Control Register */
 #define UDDRC_PCTRL_1				(0x540)		/* UDDRC Port 1 Control Register */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 03/10] ARM: at91: ddr: fix typo to align with datasheet naming
  2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 01/10] ARM: at91: ddr: remove CONFIG_SOC_SAMA7 dependency Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 02/10] ARM: at91: ddr: align macro definitions Claudiu Beznea
@ 2022-01-13 14:48 ` Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 04/10] ARM: at91: PM: add cpu idle support for sama7g5 Claudiu Beznea
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2022-01-13 14:48 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel, Claudiu Beznea

Fix typo on UDDRC_PWRCTL.SELFREF_SW bitmask to align with datasheet
naming.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/mach-at91/pm_suspend.S | 4 ++--
 include/soc/at91/sama7-ddr.h    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S
index fdb4f63ecde4..abe4ced33eda 100644
--- a/arch/arm/mach-at91/pm_suspend.S
+++ b/arch/arm/mach-at91/pm_suspend.S
@@ -159,7 +159,7 @@ sr_ena_1:
 
 	/* Switch to self-refresh. */
 	ldr	tmp1, [r2, #UDDRC_PWRCTL]
-	orr	tmp1, tmp1, #UDDRC_PWRCTRL_SELFREF_SW
+	orr	tmp1, tmp1, #UDDRC_PWRCTL_SELFREF_SW
 	str	tmp1, [r2, #UDDRC_PWRCTL]
 
 sr_ena_2:
@@ -276,7 +276,7 @@ sr_dis_5:
 
 	/* Trigger self-refresh exit. */
 	ldr	tmp1, [r2, #UDDRC_PWRCTL]
-	bic	tmp1, tmp1, #UDDRC_PWRCTRL_SELFREF_SW
+	bic	tmp1, tmp1, #UDDRC_PWRCTL_SELFREF_SW
 	str	tmp1, [r2, #UDDRC_PWRCTL]
 
 sr_dis_6:
diff --git a/include/soc/at91/sama7-ddr.h b/include/soc/at91/sama7-ddr.h
index 817b360efbb8..fee1b11bddca 100644
--- a/include/soc/at91/sama7-ddr.h
+++ b/include/soc/at91/sama7-ddr.h
@@ -53,7 +53,7 @@
 #define		UDDRC_STAT_OPMODE_MSK		(0x7 << 0)	/* Operating mode mask */
 
 #define UDDRC_PWRCTL				(0x30)		/* UDDRC Low Power Control Register */
-#define		UDDRC_PWRCTRL_SELFREF_SW	(1 << 5)	/* Software self-refresh */
+#define		UDDRC_PWRCTL_SELFREF_SW		(1 << 5)	/* Software self-refresh */
 
 #define UDDRC_DFIMISC				(0x1B0)		/* UDDRC DFI Miscellaneous Control Register */
 #define		UDDRC_DFIMISC_DFI_INIT_COMPLETE_EN (1 << 0)	/* PHY initialization complete enable signal */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 04/10] ARM: at91: PM: add cpu idle support for sama7g5
  2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
                   ` (2 preceding siblings ...)
  2022-01-13 14:48 ` [PATCH v2 03/10] ARM: at91: ddr: fix typo to align with datasheet naming Claudiu Beznea
@ 2022-01-13 14:48 ` Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 05/10] ARM: at91: Kconfig: select PM_OPP Claudiu Beznea
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2022-01-13 14:48 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel, Claudiu Beznea

Add CPU idle support for SAMA7G5. Support will make use of PMC_CPU_RATIO
register to divide the CPU clock by 16 before switching it to idle and
use automatic self-refresh option of DDR controller.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Stephen Boyd <sboyd@kernel.org>
---
 arch/arm/mach-at91/pm.c      | 27 ++++++++++++++++++++++++++-
 include/linux/clk/at91_pmc.h |  4 ++++
 include/soc/at91/sama7-ddr.h |  1 +
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index dd6f4ce3f766..0fd609e26615 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -605,6 +605,30 @@ static void at91sam9_sdram_standby(void)
 		at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1);
 }
 
+static void sama7g5_standby(void)
+{
+	int pwrtmg, ratio;
+
+	pwrtmg = readl(soc_pm.data.ramc[0] + UDDRC_PWRCTL);
+	ratio = readl(soc_pm.data.pmc + AT91_PMC_RATIO);
+
+	/*
+	 * Place RAM into self-refresh after a maximum idle clocks. The maximum
+	 * idle clocks is configured by bootloader in
+	 * UDDRC_PWRMGT.SELFREF_TO_X32.
+	 */
+	writel(pwrtmg | UDDRC_PWRCTL_SELFREF_EN,
+	       soc_pm.data.ramc[0] + UDDRC_PWRCTL);
+	/* Divide CPU clock by 16. */
+	writel(ratio & ~AT91_PMC_RATIO_RATIO, soc_pm.data.pmc + AT91_PMC_RATIO);
+
+	cpu_do_idle();
+
+	/* Restore previous configuration. */
+	writel(ratio, soc_pm.data.pmc + AT91_PMC_RATIO);
+	writel(pwrtmg, soc_pm.data.ramc[0] + UDDRC_PWRCTL);
+}
+
 struct ramc_info {
 	void (*idle)(void);
 	unsigned int memctrl;
@@ -615,6 +639,7 @@ static const struct ramc_info ramc_infos[] __initconst = {
 	{ .idle = at91sam9_sdram_standby, .memctrl = AT91_MEMCTRL_SDRAMC},
 	{ .idle = at91_ddr_standby, .memctrl = AT91_MEMCTRL_DDRSDR},
 	{ .idle = sama5d3_ddr_standby, .memctrl = AT91_MEMCTRL_DDRSDR},
+	{ .idle = sama7g5_standby, },
 };
 
 static const struct of_device_id ramc_ids[] __initconst = {
@@ -622,7 +647,7 @@ static const struct of_device_id ramc_ids[] __initconst = {
 	{ .compatible = "atmel,at91sam9260-sdramc", .data = &ramc_infos[1] },
 	{ .compatible = "atmel,at91sam9g45-ddramc", .data = &ramc_infos[2] },
 	{ .compatible = "atmel,sama5d3-ddramc", .data = &ramc_infos[3] },
-	{ .compatible = "microchip,sama7g5-uddrc", },
+	{ .compatible = "microchip,sama7g5-uddrc", .data = &ramc_infos[4], },
 	{ /*sentinel*/ }
 };
 
diff --git a/include/linux/clk/at91_pmc.h b/include/linux/clk/at91_pmc.h
index ccb3f034bfa9..3484309b59bf 100644
--- a/include/linux/clk/at91_pmc.h
+++ b/include/linux/clk/at91_pmc.h
@@ -78,6 +78,10 @@
 #define		AT91_PMC_MAINRDY	(1	<< 16)		/* Main Clock Ready */
 
 #define	AT91_CKGR_PLLAR		0x28			/* PLL A Register */
+
+#define	AT91_PMC_RATIO		0x2c			/* Processor clock ratio register [SAMA7G5 only] */
+#define		AT91_PMC_RATIO_RATIO	(0xf)		/* CPU clock ratio. */
+
 #define	AT91_CKGR_PLLBR		0x2c			/* PLL B Register */
 #define		AT91_PMC_DIV		(0xff  <<  0)		/* Divider */
 #define		AT91_PMC_PLLCOUNT	(0x3f  <<  8)		/* PLL Counter */
diff --git a/include/soc/at91/sama7-ddr.h b/include/soc/at91/sama7-ddr.h
index fee1b11bddca..9e17247474fa 100644
--- a/include/soc/at91/sama7-ddr.h
+++ b/include/soc/at91/sama7-ddr.h
@@ -53,6 +53,7 @@
 #define		UDDRC_STAT_OPMODE_MSK		(0x7 << 0)	/* Operating mode mask */
 
 #define UDDRC_PWRCTL				(0x30)		/* UDDRC Low Power Control Register */
+#define		UDDRC_PWRCTL_SELFREF_EN		(1 << 0)	/* Automatic self-refresh */
 #define		UDDRC_PWRCTL_SELFREF_SW		(1 << 5)	/* Software self-refresh */
 
 #define UDDRC_DFIMISC				(0x1B0)		/* UDDRC DFI Miscellaneous Control Register */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 05/10] ARM: at91: Kconfig: select PM_OPP
  2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
                   ` (3 preceding siblings ...)
  2022-01-13 14:48 ` [PATCH v2 04/10] ARM: at91: PM: add cpu idle support for sama7g5 Claudiu Beznea
@ 2022-01-13 14:48 ` Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 06/10] ARM: dts: at91: fix low limit for CPU regulator Claudiu Beznea
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2022-01-13 14:48 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel, Claudiu Beznea

Select PM_OPP. This is requested for CPUFreq driver.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/mach-at91/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 02f6b108fd5d..279810381256 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -63,6 +63,7 @@ config SOC_SAMA7G5
 	select HAVE_AT91_GENERATED_CLK
 	select HAVE_AT91_SAM9X60_PLL
 	select HAVE_AT91_UTMI
+	select PM_OPP
 	select SOC_SAMA7
 	help
 	  Select this if you are using one of Microchip's SAMA7G5 family SoC.
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 06/10] ARM: dts: at91: fix low limit for CPU regulator
  2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
                   ` (4 preceding siblings ...)
  2022-01-13 14:48 ` [PATCH v2 05/10] ARM: at91: Kconfig: select PM_OPP Claudiu Beznea
@ 2022-01-13 14:48 ` Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 07/10] ARM: dts: at91: sama7g5ek: set regulator voltages for standby state Claudiu Beznea
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2022-01-13 14:48 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel, Claudiu Beznea

Fix low limit for CPU regulator. Otherwise setting voltages lower than
1.125V will not be allowed (CPUFreq will not be allowed to set proper
voltages on proper frequencies).

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/boot/dts/at91-sama7g5ek.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/at91-sama7g5ek.dts b/arch/arm/boot/dts/at91-sama7g5ek.dts
index 0e1975c6812e..50f0fc3064cc 100644
--- a/arch/arm/boot/dts/at91-sama7g5ek.dts
+++ b/arch/arm/boot/dts/at91-sama7g5ek.dts
@@ -236,7 +236,7 @@ regulator-state-mem {
 
 				vddcpu: VDD_OTHER {
 					regulator-name = "VDD_OTHER";
-					regulator-min-microvolt = <1125000>;
+					regulator-min-microvolt = <1050000>;
 					regulator-max-microvolt = <1850000>;
 					regulator-initial-mode = <2>;
 					regulator-allowed-modes = <2>, <4>;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 07/10] ARM: dts: at91: sama7g5ek: set regulator voltages for standby state
  2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
                   ` (5 preceding siblings ...)
  2022-01-13 14:48 ` [PATCH v2 06/10] ARM: dts: at91: fix low limit for CPU regulator Claudiu Beznea
@ 2022-01-13 14:48 ` Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 08/10] ARM: dts: at91: sama7g5: add opps Claudiu Beznea
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2022-01-13 14:48 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel, Claudiu Beznea

Set regulator voltages for standby state to avoid wrong behavior of
system while in standby. The CPU voltage has been chosen as being the
one corresponding to OPP=600MHz. Next commit will set the 600MHz OPP
as the suspend OPP.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/boot/dts/at91-sama7g5ek.dts | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/at91-sama7g5ek.dts b/arch/arm/boot/dts/at91-sama7g5ek.dts
index 50f0fc3064cc..e48da0a053ec 100644
--- a/arch/arm/boot/dts/at91-sama7g5ek.dts
+++ b/arch/arm/boot/dts/at91-sama7g5ek.dts
@@ -185,6 +185,7 @@ vdd_3v3: VDD_IO {
 
 					regulator-state-standby {
 						regulator-on-in-suspend;
+						regulator-suspend-microvolt = <3300000>;
 						regulator-mode = <4>;
 					};
 
@@ -225,6 +226,7 @@ vddcore: VDD_CORE {
 
 					regulator-state-standby {
 						regulator-on-in-suspend;
+						regulator-suspend-voltage = <1150000>;
 						regulator-mode = <4>;
 					};
 
@@ -245,6 +247,7 @@ vddcpu: VDD_OTHER {
 
 					regulator-state-standby {
 						regulator-on-in-suspend;
+						regulator-suspend-voltage = <1050000>;
 						regulator-mode = <4>;
 					};
 
@@ -261,6 +264,7 @@ vldo1: LDO1 {
 					regulator-always-on;
 
 					regulator-state-standby {
+						regulator-suspend-voltage = <1800000>;
 						regulator-on-in-suspend;
 					};
 
@@ -275,6 +279,7 @@ vldo2: LDO2 {
 					regulator-max-microvolt = <3700000>;
 
 					regulator-state-standby {
+						regulator-suspend-voltage = <1800000>;
 						regulator-on-in-suspend;
 					};
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 08/10] ARM: dts: at91: sama7g5: add opps
  2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
                   ` (6 preceding siblings ...)
  2022-01-13 14:48 ` [PATCH v2 07/10] ARM: dts: at91: sama7g5ek: set regulator voltages for standby state Claudiu Beznea
@ 2022-01-13 14:48 ` Claudiu Beznea
  2022-01-13 14:48 ` [PATCH v2 09/10] ARM: configs: at91: sama7: enable cpu idle Claudiu Beznea
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2022-01-13 14:48 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel, Claudiu Beznea

Add OPPs for SAMA7G5 along with clock for CPU.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/boot/dts/sama7g5.dtsi | 38 ++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/arch/arm/boot/dts/sama7g5.dtsi b/arch/arm/boot/dts/sama7g5.dtsi
index 7039311bf678..21694519155e 100644
--- a/arch/arm/boot/dts/sama7g5.dtsi
+++ b/arch/arm/boot/dts/sama7g5.dtsi
@@ -30,6 +30,44 @@ cpu0: cpu@0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x0>;
+			clocks = <&pmc PMC_TYPE_CORE PMC_CPUPLL>;
+			clock-names = "cpu";
+			operating-points-v2 = <&cpu_opp_table>;
+		};
+	};
+
+	cpu_opp_table: opp-table {
+		compatible = "operating-points-v2";
+
+		opp-90000000 {
+			opp-hz = /bits/ 64 <90000000>;
+			opp-microvolt = <1050000 1050000 1225000>;
+			clock-latency-ns = <320000>;
+		};
+
+		opp-250000000 {
+			opp-hz = /bits/ 64 <250000000>;
+			opp-microvolt = <1050000 1050000 1225000>;
+			clock-latency-ns = <320000>;
+		};
+
+		opp-600000000 {
+			opp-hz = /bits/ 64 <600000000>;
+			opp-microvolt = <1050000 1050000 1225000>;
+			clock-latency-ns = <320000>;
+			opp-suspend;
+		};
+
+		opp-800000000 {
+			opp-hz = /bits/ 64 <800000000>;
+			opp-microvolt = <1150000 1125000 1225000>;
+			clock-latency-ns = <320000>;
+		};
+
+		opp-1000000002 {
+			opp-hz = /bits/ 64 <1000000002>;
+			opp-microvolt = <1250000 1225000 1300000>;
+			clock-latency-ns = <320000>;
 		};
 	};
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 09/10] ARM: configs: at91: sama7: enable cpu idle
  2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
                   ` (7 preceding siblings ...)
  2022-01-13 14:48 ` [PATCH v2 08/10] ARM: dts: at91: sama7g5: add opps Claudiu Beznea
@ 2022-01-13 14:48 ` Claudiu Beznea
  2022-01-13 14:49 ` [PATCH v2 10/10] ARM: configs: at91: sama7: add config for cpufreq Claudiu Beznea
  2022-02-25 11:38 ` [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Nicolas Ferre
  10 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2022-01-13 14:48 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel, Claudiu Beznea

Enable CPU idle support for SAMA7 config.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/configs/sama7_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/configs/sama7_defconfig b/arch/arm/configs/sama7_defconfig
index 938aae4bd80b..95c2a7ed4816 100644
--- a/arch/arm/configs/sama7_defconfig
+++ b/arch/arm/configs/sama7_defconfig
@@ -26,6 +26,7 @@ CONFIG_FORCE_MAX_ZONEORDER=15
 CONFIG_UACCESS_WITH_MEMCPY=y
 # CONFIG_ATAGS is not set
 CONFIG_CMDLINE="console=ttyS0,115200 earlyprintk ignore_loglevel"
+CONFIG_CPU_IDLE=y
 CONFIG_VFP=y
 CONFIG_NEON=y
 CONFIG_KERNEL_MODE_NEON=y
@@ -33,7 +34,6 @@ CONFIG_MODULES=y
 CONFIG_MODULE_FORCE_LOAD=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
-# CONFIG_BLK_DEV_BSG is not set
 CONFIG_PARTITION_ADVANCED=y
 # CONFIG_EFI_PARTITION is not set
 # CONFIG_COREDUMP is not set
@@ -90,6 +90,7 @@ CONFIG_BLK_DEV_RAM_SIZE=8192
 CONFIG_EEPROM_AT24=y
 CONFIG_SCSI=y
 CONFIG_BLK_DEV_SD=y
+# CONFIG_BLK_DEV_BSG is not set
 CONFIG_NETDEVICES=y
 CONFIG_MACB=y
 CONFIG_MICREL_PHY=y
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 10/10] ARM: configs: at91: sama7: add config for cpufreq
  2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
                   ` (8 preceding siblings ...)
  2022-01-13 14:48 ` [PATCH v2 09/10] ARM: configs: at91: sama7: enable cpu idle Claudiu Beznea
@ 2022-01-13 14:49 ` Claudiu Beznea
  2022-02-25 11:38 ` [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Nicolas Ferre
  10 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2022-01-13 14:49 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel, Claudiu Beznea

Add config flags for CPUFreq. This includes enabling CPUFreq support,
CPUFreq DT driver and governors, default one being the conservative
governor.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/configs/sama7_defconfig | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/configs/sama7_defconfig b/arch/arm/configs/sama7_defconfig
index 95c2a7ed4816..689e9afcb5b2 100644
--- a/arch/arm/configs/sama7_defconfig
+++ b/arch/arm/configs/sama7_defconfig
@@ -26,6 +26,12 @@ CONFIG_FORCE_MAX_ZONEORDER=15
 CONFIG_UACCESS_WITH_MEMCPY=y
 # CONFIG_ATAGS is not set
 CONFIG_CMDLINE="console=ttyS0,115200 earlyprintk ignore_loglevel"
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=y
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_CPUFREQ_DT=y
 CONFIG_CPU_IDLE=y
 CONFIG_VFP=y
 CONFIG_NEON=y
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5
  2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
                   ` (9 preceding siblings ...)
  2022-01-13 14:49 ` [PATCH v2 10/10] ARM: configs: at91: sama7: add config for cpufreq Claudiu Beznea
@ 2022-02-25 11:38 ` Nicolas Ferre
  10 siblings, 0 replies; 12+ messages in thread
From: Nicolas Ferre @ 2022-02-25 11:38 UTC (permalink / raw)
  To: Claudiu Beznea, alexandre.belloni, ludovic.desroches, robh+dt,
	linux, sboyd, mturquette
  Cc: linux-arm-kernel, linux-clk, devicetree, linux-kernel

On 13/01/2022 at 15:48, Claudiu Beznea wrote:
> 
> Hi,
> 
> This series adds CPU idle support for SAMA7G5. Along with this the
> CPUFreq OPPs for SAMA7G5 and proper config has been added.
> 
> Thank you,
> Claudiu Beznea

For whole series:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Patches queued in at91 tree for 5.18 (via arm-soc):
- 1-5 in at91-soc
- 6-8 in at91-dt
- 9, 10 in at91-defconfig

Best regards,
    Nicolas

> Changes in v2:
> - collected tags
> - add "opp-suspend" to 600MHz OPP on patch "ARM: dts: at91: sama7g5: add opps"
> - add patches:
> 	ARM: dts: at91: fix low limit for CPU regulator
> 	ARM: dts: at91: sama7g5ek: set regulator voltages for standby state
> 
> Claudiu Beznea (10):
>    ARM: at91: ddr: remove CONFIG_SOC_SAMA7 dependency
>    ARM: at91: ddr: align macro definitions
>    ARM: at91: ddr: fix typo to align with datasheet naming
>    ARM: at91: PM: add cpu idle support for sama7g5
>    ARM: at91: Kconfig: select PM_OPP
>    ARM: dts: at91: fix low limit for CPU regulator
>    ARM: dts: at91: sama7g5ek: set regulator voltages for standby state
>    ARM: dts: at91: sama7g5: add opps
>    ARM: configs: at91: sama7: enable cpu idle
>    ARM: configs: at91: sama7: add config for cpufreq
> 
>   arch/arm/boot/dts/at91-sama7g5ek.dts |  7 ++++-
>   arch/arm/boot/dts/sama7g5.dtsi       | 38 ++++++++++++++++++++++++++++
>   arch/arm/configs/sama7_defconfig     |  9 ++++++-
>   arch/arm/mach-at91/Kconfig           |  1 +
>   arch/arm/mach-at91/pm.c              | 27 +++++++++++++++++++-
>   arch/arm/mach-at91/pm_suspend.S      |  4 +--
>   include/linux/clk/at91_pmc.h         |  4 +++
>   include/soc/at91/sama7-ddr.h         | 15 +++++------
>   8 files changed, 91 insertions(+), 14 deletions(-)
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-02-25 11:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 14:48 [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Claudiu Beznea
2022-01-13 14:48 ` [PATCH v2 01/10] ARM: at91: ddr: remove CONFIG_SOC_SAMA7 dependency Claudiu Beznea
2022-01-13 14:48 ` [PATCH v2 02/10] ARM: at91: ddr: align macro definitions Claudiu Beznea
2022-01-13 14:48 ` [PATCH v2 03/10] ARM: at91: ddr: fix typo to align with datasheet naming Claudiu Beznea
2022-01-13 14:48 ` [PATCH v2 04/10] ARM: at91: PM: add cpu idle support for sama7g5 Claudiu Beznea
2022-01-13 14:48 ` [PATCH v2 05/10] ARM: at91: Kconfig: select PM_OPP Claudiu Beznea
2022-01-13 14:48 ` [PATCH v2 06/10] ARM: dts: at91: fix low limit for CPU regulator Claudiu Beznea
2022-01-13 14:48 ` [PATCH v2 07/10] ARM: dts: at91: sama7g5ek: set regulator voltages for standby state Claudiu Beznea
2022-01-13 14:48 ` [PATCH v2 08/10] ARM: dts: at91: sama7g5: add opps Claudiu Beznea
2022-01-13 14:48 ` [PATCH v2 09/10] ARM: configs: at91: sama7: enable cpu idle Claudiu Beznea
2022-01-13 14:49 ` [PATCH v2 10/10] ARM: configs: at91: sama7: add config for cpufreq Claudiu Beznea
2022-02-25 11:38 ` [PATCH v2 00/10] ARM: at91: add cpu idle and cpufreq opps for sama7g5 Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).