linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] ARM: at91: some fixes and one cleanup
@ 2022-08-26  8:39 Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 1/9] ARM: configs: at91: remove CONFIG_MICROCHIP_PIT64B Claudiu Beznea
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-08-26  8:39 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, claudiu.beznea, robh+dt,
	krzysztof.kozlowski+dt, linux, arnd
  Cc: cristian.birsan, linux-arm-kernel, devicetree, linux-kernel

Hi,

The following series adds some fixes on PM and device trees and a
cleanup on sam9x60ek device tree.

Thank you,
Claudiu Beznea

Claudiu Beznea (9):
  ARM: configs: at91: remove CONFIG_MICROCHIP_PIT64B
  ARM: at91: pm: fix self-refresh for sama7g5
  ARM: at91: pm: fix DDR recalibration when resuming from backup and
    self-refresh
  ARM: dts: at91: sama5d27_wlsom1: specify proper regulator output
    ranges
  ARM: dts: at91: sama5d2_icp: specify proper regulator output ranges
  ARM: dts: at91: sama7g5ek: specify proper regulator output ranges
  ARM: dts: at91: sama5d27_wlsom1: don't keep ldo2 enabled all the time
  ARM: dts: at91: sama5d2_icp: don't keep vdd_other enabled all the time
  ARM: dts: at91: sam9x60ek: remove simple-bus for regulators

 arch/arm/boot/dts/at91-sam9x60ek.dts        | 78 ++++++++++-----------
 arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi | 21 +++---
 arch/arm/boot/dts/at91-sama5d2_icp.dts      | 21 +++---
 arch/arm/boot/dts/at91-sama7g5ek.dts        | 18 ++---
 arch/arm/configs/at91_dt_defconfig          |  1 -
 arch/arm/configs/sama7_defconfig            |  1 -
 arch/arm/mach-at91/pm.c                     | 36 ++++++++--
 arch/arm/mach-at91/pm_suspend.S             | 24 +++++--
 include/soc/at91/sama7-ddr.h                |  8 +++
 9 files changed, 122 insertions(+), 86 deletions(-)

-- 
2.34.1


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

* [PATCH 1/9] ARM: configs: at91: remove CONFIG_MICROCHIP_PIT64B
  2022-08-26  8:39 [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu Beznea
@ 2022-08-26  8:39 ` Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 2/9] ARM: at91: pm: fix self-refresh for sama7g5 Claudiu Beznea
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-08-26  8:39 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, claudiu.beznea, robh+dt,
	krzysztof.kozlowski+dt, linux, arnd
  Cc: cristian.birsan, linux-arm-kernel, devicetree, linux-kernel

Since commit f611af4c3bfa ("ARM: at91: Kconfig: implement PIT64B selection")
there is no need to explicitly select PIT64B.

Fixes: f611af4c3bfa ("ARM: at91: Kconfig: implement PIT64B selection")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---

This is based on patch at [1].

[1] https://lore.kernel.org/all/20220818135522.3143514-2-arnd@kernel.org/

 arch/arm/configs/at91_dt_defconfig | 1 -
 arch/arm/configs/sama7_defconfig   | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 5cc72266eaff..9ea08337b174 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -196,7 +196,6 @@ CONFIG_RTC_DRV_AT91SAM9=y
 CONFIG_DMADEVICES=y
 CONFIG_AT_HDMAC=y
 CONFIG_AT_XDMAC=y
-CONFIG_MICROCHIP_PIT64B=y
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_IIO=y
 CONFIG_AT91_ADC=y
diff --git a/arch/arm/configs/sama7_defconfig b/arch/arm/configs/sama7_defconfig
index 8803536854c6..72af50d9e48a 100644
--- a/arch/arm/configs/sama7_defconfig
+++ b/arch/arm/configs/sama7_defconfig
@@ -188,7 +188,6 @@ CONFIG_RTC_DRV_AT91SAM9=y
 CONFIG_DMADEVICES=y
 CONFIG_AT_XDMAC=y
 CONFIG_STAGING=y
-CONFIG_MICROCHIP_PIT64B=y
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_IIO=y
 CONFIG_IIO_SW_TRIGGER=y
-- 
2.34.1


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

* [PATCH 2/9] ARM: at91: pm: fix self-refresh for sama7g5
  2022-08-26  8:39 [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 1/9] ARM: configs: at91: remove CONFIG_MICROCHIP_PIT64B Claudiu Beznea
@ 2022-08-26  8:39 ` Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 3/9] ARM: at91: pm: fix DDR recalibration when resuming from backup and self-refresh Claudiu Beznea
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-08-26  8:39 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, claudiu.beznea, robh+dt,
	krzysztof.kozlowski+dt, linux, arnd
  Cc: cristian.birsan, linux-arm-kernel, devicetree, linux-kernel,
	Frederic Schumacher

It has been discovered that on some parts, from time to time, self-refresh
procedure doesn't work as expected. Debugging and investigating it proved
that disabling AC DLL introduce glitches in RAM controllers which
leads to unexpected behavior. This is confirmed as a hardware bug. DLL
bypass disables 3 DLLs: 2 DX DLLs and AC DLL. Thus, keep only DX DLLs
disabled. This introduce 6mA extra current consumption on VDDCORE when
switching ot any ULP mode or standby mode but the self-refresh procedure
still works.

Fixes: f0bbf17958e8 ("ARM: at91: pm: add self-refresh support for sama7g5")
Suggested-by: Frederic Schumacher <frederic.schumacher@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Tested-by: Cristian Birsan <cristian.birsan@microchip.com>
---
 arch/arm/mach-at91/pm_suspend.S | 24 +++++++++++++++++-------
 include/soc/at91/sama7-ddr.h    |  4 ++++
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S
index abe4ced33eda..ffed4d949042 100644
--- a/arch/arm/mach-at91/pm_suspend.S
+++ b/arch/arm/mach-at91/pm_suspend.S
@@ -172,9 +172,15 @@ sr_ena_2:
 	/* Put DDR PHY's DLL in bypass mode for non-backup modes. */
 	cmp	r7, #AT91_PM_BACKUP
 	beq	sr_ena_3
-	ldr	tmp1, [r3, #DDR3PHY_PIR]
-	orr	tmp1, tmp1, #DDR3PHY_PIR_DLLBYP
-	str	tmp1, [r3, #DDR3PHY_PIR]
+
+	/* Disable DX DLLs. */
+	ldr	tmp1, [r3, #DDR3PHY_DX0DLLCR]
+	orr	tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
+	str	tmp1, [r3, #DDR3PHY_DX0DLLCR]
+
+	ldr	tmp1, [r3, #DDR3PHY_DX1DLLCR]
+	orr	tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
+	str	tmp1, [r3, #DDR3PHY_DX1DLLCR]
 
 sr_ena_3:
 	/* Power down DDR PHY data receivers. */
@@ -221,10 +227,14 @@ sr_ena_3:
 	bic	tmp1, tmp1, #DDR3PHY_DSGCR_ODTPDD_ODT0
 	str	tmp1, [r3, #DDR3PHY_DSGCR]
 
-	/* Take DDR PHY's DLL out of bypass mode. */
-	ldr	tmp1, [r3, #DDR3PHY_PIR]
-	bic	tmp1, tmp1, #DDR3PHY_PIR_DLLBYP
-	str	tmp1, [r3, #DDR3PHY_PIR]
+	/* Enable DX DLLs. */
+	ldr	tmp1, [r3, #DDR3PHY_DX0DLLCR]
+	bic	tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
+	str	tmp1, [r3, #DDR3PHY_DX0DLLCR]
+
+	ldr	tmp1, [r3, #DDR3PHY_DX1DLLCR]
+	bic	tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS
+	str	tmp1, [r3, #DDR3PHY_DX1DLLCR]
 
 	/* Enable quasi-dynamic programming. */
 	mov	tmp1, #0
diff --git a/include/soc/at91/sama7-ddr.h b/include/soc/at91/sama7-ddr.h
index 9e17247474fa..2706bc48c076 100644
--- a/include/soc/at91/sama7-ddr.h
+++ b/include/soc/at91/sama7-ddr.h
@@ -39,6 +39,10 @@
 
 #define DDR3PHY_ZQ0SR0				(0x188)		/* ZQ status register 0 */
 
+#define	DDR3PHY_DX0DLLCR			(0x1CC)		/* DDR3PHY DATX8 DLL Control Register */
+#define	DDR3PHY_DX1DLLCR			(0x20C)		/* DDR3PHY DATX8 DLL Control Register */
+#define		DDR3PHY_DXDLLCR_DLLDIS		(1 << 31)	/* DLL Disable */
+
 /* UDDRC */
 #define UDDRC_STAT				(0x04)		/* UDDRC Operating Mode Status Register */
 #define		UDDRC_STAT_SELFREF_TYPE_DIS	(0x0 << 4)	/* SDRAM is not in Self-refresh */
-- 
2.34.1


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

* [PATCH 3/9] ARM: at91: pm: fix DDR recalibration when resuming from backup and self-refresh
  2022-08-26  8:39 [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 1/9] ARM: configs: at91: remove CONFIG_MICROCHIP_PIT64B Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 2/9] ARM: at91: pm: fix self-refresh for sama7g5 Claudiu Beznea
@ 2022-08-26  8:39 ` Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 4/9] ARM: dts: at91: sama5d27_wlsom1: specify proper regulator output ranges Claudiu Beznea
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-08-26  8:39 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, claudiu.beznea, robh+dt,
	krzysztof.kozlowski+dt, linux, arnd
  Cc: cristian.birsan, linux-arm-kernel, devicetree, linux-kernel,
	Frederic Schumacher

On SAMA7G5, when resuming from backup and self-refresh, the bootloader
performs DDR PHY recalibration by restoring the value of ZQ0SR0 (stored
in RAM by Linux before going to backup and self-refresh). It has been
discovered that the current procedure doesn't work for all possible values
that might go to ZQ0SR0 due to hardware bug. The workaround to this is to
avoid storing some values in ZQ0SR0. Thus Linux will read the ZQ0SR0
register and cache its value in RAM after processing it (using
modified_gray_code array). The bootloader will restore the processed value.

Fixes: d2d4716d8384 ("ARM: at91: pm: save ddr phy calibration data to securam")
Suggested-by: Frederic Schumacher <frederic.schumacher@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/mach-at91/pm.c      | 36 ++++++++++++++++++++++++++++++++----
 include/soc/at91/sama7-ddr.h |  4 ++++
 2 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index df6d673e83d5..f4501dea98b0 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -541,9 +541,41 @@ extern u32 at91_pm_suspend_in_sram_sz;
 
 static int at91_suspend_finish(unsigned long val)
 {
+	unsigned char modified_gray_code[] = {
+		0x00, 0x01, 0x02, 0x03, 0x06, 0x07, 0x04, 0x05, 0x0c, 0x0d,
+		0x0e, 0x0f, 0x0a, 0x0b, 0x08, 0x09, 0x18, 0x19, 0x1a, 0x1b,
+		0x1e, 0x1f, 0x1c, 0x1d, 0x14, 0x15, 0x16, 0x17, 0x12, 0x13,
+		0x10, 0x11,
+	};
+	unsigned int tmp, index;
 	int i;
 
 	if (soc_pm.data.mode == AT91_PM_BACKUP && soc_pm.data.ramc_phy) {
+		/*
+		 * Bootloader will perform DDR recalibration and will try to
+		 * restore the ZQ0SR0 with the value saved here. But the
+		 * calibration is buggy and restoring some values from ZQ0SR0
+		 * is forbidden and risky thus we need to provide processed
+		 * values for these (modified gray code values).
+		 */
+		tmp = readl(soc_pm.data.ramc_phy + DDR3PHY_ZQ0SR0);
+
+		/* Store pull-down output impedance select. */
+		index = (tmp >> DDR3PHY_ZQ0SR0_PDO_OFF) & 0x1f;
+		soc_pm.bu->ddr_phy_calibration[0] = modified_gray_code[index];
+
+		/* Store pull-up output impedance select. */
+		index = (tmp >> DDR3PHY_ZQ0SR0_PUO_OFF) & 0x1f;
+		soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index];
+
+		/* Store pull-down on-die termination impedance select. */
+		index = (tmp >> DDR3PHY_ZQ0SR0_PDODT_OFF) & 0x1f;
+		soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index];
+
+		/* Store pull-up on-die termination impedance select. */
+		index = (tmp >> DDR3PHY_ZQ0SRO_PUODT_OFF) & 0x1f;
+		soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index];
+
 		/*
 		 * The 1st 8 words of memory might get corrupted in the process
 		 * of DDR PHY recalibration; it is saved here in securam and it
@@ -1066,10 +1098,6 @@ static int __init at91_pm_backup_init(void)
 		of_scan_flat_dt(at91_pm_backup_scan_memcs, &located);
 		if (!located)
 			goto securam_fail;
-
-		/* DDR3PHY_ZQ0SR0 */
-		soc_pm.bu->ddr_phy_calibration[0] = readl(soc_pm.data.ramc_phy +
-							  0x188);
 	}
 
 	return 0;
diff --git a/include/soc/at91/sama7-ddr.h b/include/soc/at91/sama7-ddr.h
index 2706bc48c076..6ce3bd22f6c6 100644
--- a/include/soc/at91/sama7-ddr.h
+++ b/include/soc/at91/sama7-ddr.h
@@ -38,6 +38,10 @@
 #define		DDR3PHY_DSGCR_ODTPDD_ODT0	(1 << 20)	/* ODT[0] Power Down Driver */
 
 #define DDR3PHY_ZQ0SR0				(0x188)		/* ZQ status register 0 */
+#define DDR3PHY_ZQ0SR0_PDO_OFF			(0)		/* Pull-down output impedance select offset */
+#define DDR3PHY_ZQ0SR0_PUO_OFF			(5)		/* Pull-up output impedance select offset */
+#define DDR3PHY_ZQ0SR0_PDODT_OFF		(10)		/* Pull-down on-die termination impedance select offset */
+#define DDR3PHY_ZQ0SRO_PUODT_OFF		(15)		/* Pull-up on-die termination impedance select offset */
 
 #define	DDR3PHY_DX0DLLCR			(0x1CC)		/* DDR3PHY DATX8 DLL Control Register */
 #define	DDR3PHY_DX1DLLCR			(0x20C)		/* DDR3PHY DATX8 DLL Control Register */
-- 
2.34.1


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

* [PATCH 4/9] ARM: dts: at91: sama5d27_wlsom1: specify proper regulator output ranges
  2022-08-26  8:39 [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu Beznea
                   ` (2 preceding siblings ...)
  2022-08-26  8:39 ` [PATCH 3/9] ARM: at91: pm: fix DDR recalibration when resuming from backup and self-refresh Claudiu Beznea
@ 2022-08-26  8:39 ` Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 5/9] ARM: dts: at91: sama5d2_icp: " Claudiu Beznea
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-08-26  8:39 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, claudiu.beznea, robh+dt,
	krzysztof.kozlowski+dt, linux, arnd
  Cc: cristian.birsan, linux-arm-kernel, devicetree, linux-kernel

Min and max output ranges of regulators need to satisfy board
requirements not PMIC requirements. Thus adjust device tree to
cope with this.

Fixes: 5d4c3cfb63fe ("ARM: dts: at91: sama5d27_wlsom1: add SAMA5D27 wlsom1 and wlsom1-ek")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
index 76b2025c67b4..342fcfd974d7 100644
--- a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
+++ b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
@@ -76,8 +76,8 @@ mcp16502@5b {
 		regulators {
 			vdd_3v3: VDD_IO {
 				regulator-name = "VDD_IO";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <3700000>;
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
 				regulator-initial-mode = <2>;
 				regulator-allowed-modes = <2>, <4>;
 				regulator-always-on;
@@ -95,8 +95,8 @@ regulator-state-mem {
 
 			vddio_ddr: VDD_DDR {
 				regulator-name = "VDD_DDR";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1850000>;
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
 				regulator-initial-mode = <2>;
 				regulator-allowed-modes = <2>, <4>;
 				regulator-always-on;
@@ -118,8 +118,8 @@ regulator-state-mem {
 
 			vdd_core: VDD_CORE {
 				regulator-name = "VDD_CORE";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1850000>;
+				regulator-min-microvolt = <1250000>;
+				regulator-max-microvolt = <1250000>;
 				regulator-initial-mode = <2>;
 				regulator-allowed-modes = <2>, <4>;
 				regulator-always-on;
@@ -160,8 +160,8 @@ regulator-state-mem {
 
 			LDO1 {
 				regulator-name = "LDO1";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <3700000>;
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
 				regulator-always-on;
 
 				regulator-state-standby {
@@ -175,8 +175,8 @@ regulator-state-mem {
 
 			LDO2 {
 				regulator-name = "LDO2";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <3700000>;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
 				regulator-always-on;
 
 				regulator-state-standby {
-- 
2.34.1


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

* [PATCH 5/9] ARM: dts: at91: sama5d2_icp: specify proper regulator output ranges
  2022-08-26  8:39 [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu Beznea
                   ` (3 preceding siblings ...)
  2022-08-26  8:39 ` [PATCH 4/9] ARM: dts: at91: sama5d27_wlsom1: specify proper regulator output ranges Claudiu Beznea
@ 2022-08-26  8:39 ` Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 6/9] ARM: dts: at91: sama7g5ek: " Claudiu Beznea
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-08-26  8:39 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, claudiu.beznea, robh+dt,
	krzysztof.kozlowski+dt, linux, arnd
  Cc: cristian.birsan, linux-arm-kernel, devicetree, linux-kernel

Min and max output ranges of regulators need to satisfy board
requirements not PMIC requirements. Thus adjust device tree to
cope with this.

Fixes: 68a95ef72cef ("ARM: dts: at91: sama5d2-icp: add SAMA5D2-ICP")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/boot/dts/at91-sama5d2_icp.dts | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sama5d2_icp.dts b/arch/arm/boot/dts/at91-sama5d2_icp.dts
index 6865be8d7787..6296e3ffd303 100644
--- a/arch/arm/boot/dts/at91-sama5d2_icp.dts
+++ b/arch/arm/boot/dts/at91-sama5d2_icp.dts
@@ -196,8 +196,8 @@ mcp16502@5b {
 			regulators {
 				vdd_io_reg: VDD_IO {
 					regulator-name = "VDD_IO";
-					regulator-min-microvolt = <1200000>;
-					regulator-max-microvolt = <3700000>;
+					regulator-min-microvolt = <3300000>;
+					regulator-max-microvolt = <3300000>;
 					regulator-initial-mode = <2>;
 					regulator-allowed-modes = <2>, <4>;
 					regulator-always-on;
@@ -215,8 +215,8 @@ regulator-state-mem {
 
 				VDD_DDR {
 					regulator-name = "VDD_DDR";
-					regulator-min-microvolt = <600000>;
-					regulator-max-microvolt = <1850000>;
+					regulator-min-microvolt = <1350000>;
+					regulator-max-microvolt = <1350000>;
 					regulator-initial-mode = <2>;
 					regulator-allowed-modes = <2>, <4>;
 					regulator-always-on;
@@ -234,8 +234,8 @@ regulator-state-mem {
 
 				VDD_CORE {
 					regulator-name = "VDD_CORE";
-					regulator-min-microvolt = <600000>;
-					regulator-max-microvolt = <1850000>;
+					regulator-min-microvolt = <1250000>;
+					regulator-max-microvolt = <1250000>;
 					regulator-initial-mode = <2>;
 					regulator-allowed-modes = <2>, <4>;
 					regulator-always-on;
@@ -272,8 +272,8 @@ regulator-state-mem {
 
 				LDO1 {
 					regulator-name = "LDO1";
-					regulator-min-microvolt = <1200000>;
-					regulator-max-microvolt = <3700000>;
+					regulator-min-microvolt = <2500000>;
+					regulator-max-microvolt = <2500000>;
 					regulator-always-on;
 
 					regulator-state-standby {
@@ -287,8 +287,8 @@ regulator-state-mem {
 
 				LDO2 {
 					regulator-name = "LDO2";
-					regulator-min-microvolt = <1200000>;
-					regulator-max-microvolt = <3700000>;
+					regulator-min-microvolt = <3300000>;
+					regulator-max-microvolt = <3300000>;
 					regulator-always-on;
 
 					regulator-state-standby {
-- 
2.34.1


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

* [PATCH 6/9] ARM: dts: at91: sama7g5ek: specify proper regulator output ranges
  2022-08-26  8:39 [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu Beznea
                   ` (4 preceding siblings ...)
  2022-08-26  8:39 ` [PATCH 5/9] ARM: dts: at91: sama5d2_icp: " Claudiu Beznea
@ 2022-08-26  8:39 ` Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 7/9] ARM: dts: at91: sama5d27_wlsom1: don't keep ldo2 enabled all the time Claudiu Beznea
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-08-26  8:39 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, claudiu.beznea, robh+dt,
	krzysztof.kozlowski+dt, linux, arnd
  Cc: cristian.birsan, linux-arm-kernel, devicetree, linux-kernel

Min and max output ranges of regulators need to satisfy board
requirements not PMIC requirements. Thus adjust device tree to
cope with this.

Fixes: 7540629e2fc7 ("ARM: dts: at91: add sama7g5 SoC DT and sama7g5-ek")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/boot/dts/at91-sama7g5ek.dts | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sama7g5ek.dts b/arch/arm/boot/dts/at91-sama7g5ek.dts
index de44da2e4aae..3b25c67795dd 100644
--- a/arch/arm/boot/dts/at91-sama7g5ek.dts
+++ b/arch/arm/boot/dts/at91-sama7g5ek.dts
@@ -244,8 +244,8 @@ mcp16502@5b {
 			regulators {
 				vdd_3v3: VDD_IO {
 					regulator-name = "VDD_IO";
-					regulator-min-microvolt = <1200000>;
-					regulator-max-microvolt = <3700000>;
+					regulator-min-microvolt = <3300000>;
+					regulator-max-microvolt = <3300000>;
 					regulator-initial-mode = <2>;
 					regulator-allowed-modes = <2>, <4>;
 					regulator-always-on;
@@ -264,8 +264,8 @@ regulator-state-mem {
 
 				vddioddr: VDD_DDR {
 					regulator-name = "VDD_DDR";
-					regulator-min-microvolt = <1300000>;
-					regulator-max-microvolt = <1450000>;
+					regulator-min-microvolt = <1350000>;
+					regulator-max-microvolt = <1350000>;
 					regulator-initial-mode = <2>;
 					regulator-allowed-modes = <2>, <4>;
 					regulator-always-on;
@@ -285,8 +285,8 @@ regulator-state-mem {
 
 				vddcore: VDD_CORE {
 					regulator-name = "VDD_CORE";
-					regulator-min-microvolt = <1100000>;
-					regulator-max-microvolt = <1850000>;
+					regulator-min-microvolt = <1150000>;
+					regulator-max-microvolt = <1150000>;
 					regulator-initial-mode = <2>;
 					regulator-allowed-modes = <2>, <4>;
 					regulator-always-on;
@@ -306,7 +306,7 @@ regulator-state-mem {
 				vddcpu: VDD_OTHER {
 					regulator-name = "VDD_OTHER";
 					regulator-min-microvolt = <1050000>;
-					regulator-max-microvolt = <1850000>;
+					regulator-max-microvolt = <1250000>;
 					regulator-initial-mode = <2>;
 					regulator-allowed-modes = <2>, <4>;
 					regulator-ramp-delay = <3125>;
@@ -326,8 +326,8 @@ regulator-state-mem {
 
 				vldo1: LDO1 {
 					regulator-name = "LDO1";
-					regulator-min-microvolt = <1200000>;
-					regulator-max-microvolt = <3700000>;
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <1800000>;
 					regulator-always-on;
 
 					regulator-state-standby {
-- 
2.34.1


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

* [PATCH 7/9] ARM: dts: at91: sama5d27_wlsom1: don't keep ldo2 enabled all the time
  2022-08-26  8:39 [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu Beznea
                   ` (5 preceding siblings ...)
  2022-08-26  8:39 ` [PATCH 6/9] ARM: dts: at91: sama7g5ek: " Claudiu Beznea
@ 2022-08-26  8:39 ` Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 8/9] ARM: dts: at91: sama5d2_icp: don't keep vdd_other " Claudiu Beznea
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-08-26  8:39 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, claudiu.beznea, robh+dt,
	krzysztof.kozlowski+dt, linux, arnd
  Cc: cristian.birsan, linux-arm-kernel, devicetree, linux-kernel

ldo2 is not used by any consumer on sama5d27_wlsom1 board, thus
don't keep it enabled all the time.

Fixes: 5d4c3cfb63fe ("ARM: dts: at91: sama5d27_wlsom1: add SAMA5D27 wlsom1 and wlsom1-ek")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
index 342fcfd974d7..83bcf9fe0152 100644
--- a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
+++ b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
@@ -177,7 +177,6 @@ LDO2 {
 				regulator-name = "LDO2";
 				regulator-min-microvolt = <1800000>;
 				regulator-max-microvolt = <3300000>;
-				regulator-always-on;
 
 				regulator-state-standby {
 					regulator-on-in-suspend;
-- 
2.34.1


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

* [PATCH 8/9] ARM: dts: at91: sama5d2_icp: don't keep vdd_other enabled all the time
  2022-08-26  8:39 [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu Beznea
                   ` (6 preceding siblings ...)
  2022-08-26  8:39 ` [PATCH 7/9] ARM: dts: at91: sama5d27_wlsom1: don't keep ldo2 enabled all the time Claudiu Beznea
@ 2022-08-26  8:39 ` Claudiu Beznea
  2022-08-26  8:39 ` [PATCH 9/9] ARM: dts: at91: sam9x60ek: remove simple-bus for regulators Claudiu Beznea
  2022-08-31  7:45 ` [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu.Beznea
  9 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-08-26  8:39 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, claudiu.beznea, robh+dt,
	krzysztof.kozlowski+dt, linux, arnd
  Cc: cristian.birsan, linux-arm-kernel, devicetree, linux-kernel

VDD_OTHER is not connected to any on board consumer thus it is not
needed to keep it enabled all the time.

Fixes: 68a95ef72cef ("ARM: dts: at91: sama5d2-icp: add SAMA5D2-ICP")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/boot/dts/at91-sama5d2_icp.dts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/boot/dts/at91-sama5d2_icp.dts b/arch/arm/boot/dts/at91-sama5d2_icp.dts
index 6296e3ffd303..dd1dec9d4e07 100644
--- a/arch/arm/boot/dts/at91-sama5d2_icp.dts
+++ b/arch/arm/boot/dts/at91-sama5d2_icp.dts
@@ -257,7 +257,6 @@ VDD_OTHER {
 					regulator-max-microvolt = <1850000>;
 					regulator-initial-mode = <2>;
 					regulator-allowed-modes = <2>, <4>;
-					regulator-always-on;
 
 					regulator-state-standby {
 						regulator-on-in-suspend;
-- 
2.34.1


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

* [PATCH 9/9] ARM: dts: at91: sam9x60ek: remove simple-bus for regulators
  2022-08-26  8:39 [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu Beznea
                   ` (7 preceding siblings ...)
  2022-08-26  8:39 ` [PATCH 8/9] ARM: dts: at91: sama5d2_icp: don't keep vdd_other " Claudiu Beznea
@ 2022-08-26  8:39 ` Claudiu Beznea
  2022-08-31  7:45 ` [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu.Beznea
  9 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-08-26  8:39 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, claudiu.beznea, robh+dt,
	krzysztof.kozlowski+dt, linux, arnd
  Cc: cristian.birsan, linux-arm-kernel, devicetree, linux-kernel

Keep regulators as individual devices. There is no need to have them
under simple bus. This will throw compilation warnings like:
- unnecessary #address-cells/#size-cells without "ranges" or child "reg"
property.
- node has a unit name, but no reg or ranges property.

While at it move it down a bit in the file to keep entries sorted
alphabetically.

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

diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts b/arch/arm/boot/dts/at91-sam9x60ek.dts
index 81c38e101f58..7ade9979e1c6 100644
--- a/arch/arm/boot/dts/at91-sam9x60ek.dts
+++ b/arch/arm/boot/dts/at91-sam9x60ek.dts
@@ -34,48 +34,6 @@ main_xtal {
 		};
 	};
 
-	regulators: regulators {
-		compatible = "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		vdd_1v8: fixed-regulator-vdd_1v8@0 {
-			compatible = "regulator-fixed";
-			regulator-name = "VDD_1V8";
-			regulator-min-microvolt = <1800000>;
-			regulator-max-microvolt = <1800000>;
-			regulator-always-on;
-			status = "okay";
-		};
-
-		vdd_1v15: fixed-regulator-vdd_1v15@1 {
-			compatible = "regulator-fixed";
-			regulator-name = "VDD_1V15";
-			regulator-min-microvolt = <1150000>;
-			regulator-max-microvolt = <1150000>;
-			regulator-always-on;
-			status = "okay";
-		};
-
-		vdd1_3v3: fixed-regulator-vdd1_3v3@2 {
-			compatible = "regulator-fixed";
-			regulator-name = "VDD1_3V3";
-			regulator-min-microvolt = <3300000>;
-			regulator-max-microvolt = <3300000>;
-			regulator-always-on;
-			status = "okay";
-		};
-
-		vdd2_3v3: regulator-fixed-vdd2_3v3@3 {
-			compatible = "regulator-fixed";
-			regulator-name = "VDD2_3V3";
-			regulator-min-microvolt = <3300000>;
-			regulator-max-microvolt = <3300000>;
-			regulator-always-on;
-			status = "okay";
-		};
-	};
-
 	gpio-keys {
 		compatible = "gpio-keys";
 		pinctrl-names = "default";
@@ -111,6 +69,42 @@ blue {
 			linux,default-trigger = "heartbeat";
 		};
 	};
+
+	vdd_1v8: fixed-regulator-vdd_1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-always-on;
+		status = "okay";
+	};
+
+	vdd_1v15: fixed-regulator-vdd_1v15 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_1V15";
+		regulator-min-microvolt = <1150000>;
+		regulator-max-microvolt = <1150000>;
+		regulator-always-on;
+		status = "okay";
+	};
+
+	vdd1_3v3: fixed-regulator-vdd1_3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD1_3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+		status = "okay";
+	};
+
+	vdd2_3v3: regulator-fixed-vdd2_3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD2_3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+		status = "okay";
+	};
 };
 
 &adc {
-- 
2.34.1


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

* Re: [PATCH 0/9] ARM: at91: some fixes and one cleanup
  2022-08-26  8:39 [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu Beznea
                   ` (8 preceding siblings ...)
  2022-08-26  8:39 ` [PATCH 9/9] ARM: dts: at91: sam9x60ek: remove simple-bus for regulators Claudiu Beznea
@ 2022-08-31  7:45 ` Claudiu.Beznea
  9 siblings, 0 replies; 11+ messages in thread
From: Claudiu.Beznea @ 2022-08-31  7:45 UTC (permalink / raw)
  To: Nicolas.Ferre, alexandre.belloni, robh+dt,
	krzysztof.kozlowski+dt, linux, arnd
  Cc: Cristian.Birsan, linux-arm-kernel, devicetree, linux-kernel

On 26.08.2022 11:39, Claudiu Beznea wrote:
> Hi,
> 
> The following series adds some fixes on PM and device trees and a
> cleanup on sam9x60ek device tree.
> 
> Thank you,
> Claudiu Beznea
> 
> Claudiu Beznea (9):
>   ARM: configs: at91: remove CONFIG_MICROCHIP_PIT64B
>   ARM: at91: pm: fix self-refresh for sama7g5
>   ARM: at91: pm: fix DDR recalibration when resuming from backup and
>     self-refresh
>   ARM: dts: at91: sama5d27_wlsom1: specify proper regulator output
>     ranges
>   ARM: dts: at91: sama5d2_icp: specify proper regulator output ranges
>   ARM: dts: at91: sama7g5ek: specify proper regulator output ranges
>   ARM: dts: at91: sama5d27_wlsom1: don't keep ldo2 enabled all the time
>   ARM: dts: at91: sama5d2_icp: don't keep vdd_other enabled all the time

Applied these to at91-fixes.

>   ARM: dts: at91: sam9x60ek: remove simple-bus for regulators

and this to at91-dt, thanks!

> 
>  arch/arm/boot/dts/at91-sam9x60ek.dts        | 78 ++++++++++-----------
>  arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi | 21 +++---
>  arch/arm/boot/dts/at91-sama5d2_icp.dts      | 21 +++---
>  arch/arm/boot/dts/at91-sama7g5ek.dts        | 18 ++---
>  arch/arm/configs/at91_dt_defconfig          |  1 -
>  arch/arm/configs/sama7_defconfig            |  1 -
>  arch/arm/mach-at91/pm.c                     | 36 ++++++++--
>  arch/arm/mach-at91/pm_suspend.S             | 24 +++++--
>  include/soc/at91/sama7-ddr.h                |  8 +++
>  9 files changed, 122 insertions(+), 86 deletions(-)
> 


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

end of thread, other threads:[~2022-08-31  7:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26  8:39 [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu Beznea
2022-08-26  8:39 ` [PATCH 1/9] ARM: configs: at91: remove CONFIG_MICROCHIP_PIT64B Claudiu Beznea
2022-08-26  8:39 ` [PATCH 2/9] ARM: at91: pm: fix self-refresh for sama7g5 Claudiu Beznea
2022-08-26  8:39 ` [PATCH 3/9] ARM: at91: pm: fix DDR recalibration when resuming from backup and self-refresh Claudiu Beznea
2022-08-26  8:39 ` [PATCH 4/9] ARM: dts: at91: sama5d27_wlsom1: specify proper regulator output ranges Claudiu Beznea
2022-08-26  8:39 ` [PATCH 5/9] ARM: dts: at91: sama5d2_icp: " Claudiu Beznea
2022-08-26  8:39 ` [PATCH 6/9] ARM: dts: at91: sama7g5ek: " Claudiu Beznea
2022-08-26  8:39 ` [PATCH 7/9] ARM: dts: at91: sama5d27_wlsom1: don't keep ldo2 enabled all the time Claudiu Beznea
2022-08-26  8:39 ` [PATCH 8/9] ARM: dts: at91: sama5d2_icp: don't keep vdd_other " Claudiu Beznea
2022-08-26  8:39 ` [PATCH 9/9] ARM: dts: at91: sam9x60ek: remove simple-bus for regulators Claudiu Beznea
2022-08-31  7:45 ` [PATCH 0/9] ARM: at91: some fixes and one cleanup Claudiu.Beznea

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).