Skip to contentSkip to conversation

mfd: twl4030-power: Enable off-idle configuration when booted with device tree

PATCH Superseded Tony Lindgren 2 participants 29 messages May 14, 2014 – May 28, 2014

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

v2 cover mfd: twl4030-power: Enable off-idle configuration when booted with device tree

Hi,

Here's an updated set of patches to enable low-power idle modes for some omap3 boards when booted with device tree.

This series when applied on top of the patches in tread "[PATCH 00/11] Fixes for omap PM for making omap3 DT only", or omap-for-v3.16/pm branch.

Lee, if these patches look OK to you, please feel free to pick them, preferrably to the immutable branch you already have set up so I can also merge them in to be able to have things working in my branch properly for PM.

Regards,

Tony

Tony Lindgren (7):
mfd: twl4030-power: Fix hang on reboot if sleep configuration was
loaded earlier
mfd: twl4030-power: Fix some defines for SW_EVENTS
mfd: twl4030-power: Add generic reset configuration
mfd: twl4030-power: Add recommended idle configuration
mfd: twl4030-power: Add support for board specific configuration
mfd: twl4030power: Add a configuration to turn off oscillator during
off-idle
ARM: dts: Enable twl4030 off-idle configuration for selected omaps

 .../devicetree/bindings/mfd/twl4030-power.txt      |  17 +-
 arch/arm/boot/dts/omap3-beagle-xm.dts              |   6 +
 arch/arm/boot/dts/omap3-evm-common.dtsi            |   7 +
 arch/arm/boot/dts/omap3-n900.dts                   |   5 +
 drivers/mfd/twl4030-power.c                        | 269 +++++++++++++++++++--
 include/linux/i2c/twl.h                            |   4 +
 6 files changed, 284 insertions(+), 24 deletions(-)
Signature · 1 line
1.8.1.1
author maintainer
#1 lore raw

PATCH v2 1/7 mfd: twl4030-power: Fix hang on reboot if sleep configuration was loaded earlier

Looks like we can still hit the issue of wrong load order of twl4030 configuration. If we have a sleep configuration loaded, and do a warm reset, the device can hang while initializing the wakeup12 sequence. We do have a warning message about wrong order of twl4030 configuration, but in this case it does not help as the sleep configuration was loaded during the previous boot and the state of twl4030 is maintained throughout the warm reset.

Fix the issue by clearing any existing sleep configuration before we load the warm reset configuration.

---
 drivers/mfd/twl4030-power.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/mfd/twl4030-power.c +6 -0
index 96162b6..1b30d8a 100644
@@ -421,6 +421,12 @@ static int load_twl4030_script(struct twl4030_script *tscript,
 			goto out;
 	}
 	if (tscript->flags & TWL4030_WAKEUP12_SCRIPT) {
+		/* Reset any existing sleep script to avoid hangs on reboot */
+		err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, END_OF_SCRIPT,
+				       R_SEQ_ADD_A2S);
+		if (err)
+			goto out;
+
 		err = twl4030_config_wakeup12_sequence(address);
 		if (err)
 			goto out;
Signature · 1 line
1.8.1.1
#2 lore raw

PATCH v2 1/7 mfd: twl4030-power: Fix hang on reboot if sleep configuration was loaded earlier

Quoted 8 lines · Tony Lindgren

Looks like we can still hit the issue of wrong load order of twl4030 configuration. If we have a sleep configuration loaded, and do a warm reset, the device can hang while initializing the wakeup12 sequence. We do have a warning message about wrong order of twl4030 configuration, but in this case it does not help as the sleep configuration was loaded during the previous boot and the state of twl4030 is maintained throughout the warm reset.

Quoted 8 lines

Fix the issue by clearing any existing sleep configuration before we load the warm reset configuration.

---
 drivers/mfd/twl4030-power.c | 6 ++++++
 1 file changed, 6 insertions(+)

Can't vouch for the semantics of the patch, but the code looks good.

Can I just apply this, or would you like Peter to review it first?

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#3 lore raw

PATCH v2 1/7 mfd: twl4030-power: Fix hang on reboot if sleep configuration was loaded earlier

Quoted 19 lines · Lee Jones
Quoted 8 lines · Tony Lindgren

Looks like we can still hit the issue of wrong load order of twl4030 configuration. If we have a sleep configuration loaded, and do a warm reset, the device can hang while initializing the wakeup12 sequence. We do have a warning message about wrong order of twl4030 configuration, but in this case it does not help as the sleep configuration was loaded during the previous boot and the state of twl4030 is maintained throughout the warm reset.

Quoted 8 lines

Fix the issue by clearing any existing sleep configuration before we load the warm reset configuration.

---
 drivers/mfd/twl4030-power.c | 6 ++++++
 1 file changed, 6 insertions(+)
Quoted 5 lines

Can't vouch for the semantics of the patch, but the code looks good.

Can I just apply this, or would you like Peter to review it first?

As far as I'm concerned you can go ahead an apply, it's been floating on the list for a while and Peter is probably busy with other things.

Regards,

Tony

#4 lore raw

PATCH v2 1/7 mfd: twl4030-power: Fix hang on reboot if sleep configuration was loaded earlier

Quoted 19 lines
Quoted 19 lines
Quoted 8 lines

Looks like we can still hit the issue of wrong load order of twl4030 configuration. If we have a sleep configuration loaded, and do a warm reset, the device can hang while initializing the wakeup12 sequence. We do have a warning message about wrong order of twl4030 configuration, but in this case it does not help as the sleep configuration was loaded during the previous boot and the state of twl4030 is maintained throughout the warm reset.

Quoted 8 lines

Fix the issue by clearing any existing sleep configuration before we load the warm reset configuration.

---
 drivers/mfd/twl4030-power.c | 6 ++++++
 1 file changed, 6 insertions(+)

Can't vouch for the semantics of the patch, but the code looks good.

Quoted 7 lines
Quoted 3 lines

Can I just apply this, or would you like Peter to review it first?

As far as I'm concerned you can go ahead an apply, it's been floating on the list for a while and Peter is probably busy with other things.

No problem. Just a couple of things for you to look at in the other patches, then we can go ahead and apply for v3.16.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#5 lore raw

PATCH v2 1/7 mfd: twl4030-power: Fix hang on reboot if sleep configuration was loaded earlier

Quoted 21 lines · Lee Jones
Quoted 21 lines
Quoted 21 lines
Quoted 8 lines

Looks like we can still hit the issue of wrong load order of twl4030 configuration. If we have a sleep configuration loaded, and do a warm reset, the device can hang while initializing the wakeup12 sequence. We do have a warning message about wrong order of twl4030 configuration, but in this case it does not help as the sleep configuration was loaded during the previous boot and the state of twl4030 is maintained throughout the warm reset.

Quoted 8 lines

Fix the issue by clearing any existing sleep configuration before we load the warm reset configuration.

---
 drivers/mfd/twl4030-power.c | 6 ++++++
 1 file changed, 6 insertions(+)

Can't vouch for the semantics of the patch, but the code looks good.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Can I just apply this, or would you like Peter to review it first?

As far as I'm concerned you can go ahead an apply, it's been floating on the list for a while and Peter is probably busy with other things.

No problem. Just a couple of things for you to look at in the other patches, then we can go ahead and apply for v3.16.

OK thanks yeah saw those. Will fix them up and test today. Then maybe you can apply them to the immutable branch we set earlier or I can send you a pull request against that branch whichever you prefer.

Regards,

Tony

#6 lore raw

PATCH v2 1/7 mfd: twl4030-power: Fix hang on reboot if sleep configuration was loaded earlier

Quoted 27 lines
Quoted 27 lines
Quoted 26 lines
Quoted 17 lines
Quoted 8 lines

Looks like we can still hit the issue of wrong load order of twl4030 configuration. If we have a sleep configuration loaded, and do a warm reset, the device can hang while initializing the wakeup12 sequence. We do have a warning message about wrong order of twl4030 configuration, but in this case it does not help as the sleep configuration was loaded during the previous boot and the state of twl4030 is maintained throughout the warm reset.

Quoted 8 lines

Fix the issue by clearing any existing sleep configuration before we load the warm reset configuration.

---
 drivers/mfd/twl4030-power.c | 6 ++++++
 1 file changed, 6 insertions(+)
Quoted 5 lines

Can't vouch for the semantics of the patch, but the code looks good.

Can I just apply this, or would you like Peter to review it first?

As far as I'm concerned you can go ahead an apply, it's been floating on the list for a while and Peter is probably busy with other things.

Quoted 7 lines
Quoted 2 lines

No problem. Just a couple of things for you to look at in the other patches, then we can go ahead and apply for v3.16.

OK thanks yeah saw those. Will fix them up and test today. Then maybe you can apply them to the immutable branch we set earlier or I can send you a pull request against that branch whichever you prefer.

Probably be easier if I update and re-tag the original one.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#7 lore raw

PATCH v2 2/7 mfd: twl4030-power: Fix some defines for SW_EVENTS

In reply to Tony Lindgren

We have these bits partially defined in two different places, so let's fix them up and add defines for the missing bits. These bits are the same for P1_SW_EVENTS, P2_SW_EVENTS and P3_SW_EVENTS.

---
 drivers/mfd/twl4030-power.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/mfd/twl4030-power.c +13 -10
index 1b30d8a..c0e4fc3 100644
@@ -35,7 +35,14 @@
 static u8 twl4030_start_script_address = 0x2b;
 
 #define PWR_P1_SW_EVENTS	0x10
+#define PWR_STOPON_PRWON	(1 << 6)
+#define PWR_STOPON_SYSEN	(1 << 5)
+#define PWR_ENABLE_WARMRESET	(1 << 4)
+#define PWR_LVL_WAKEUP		(1 << 3)
+#define PWR_DEVACT		(1 << 2)
+#define PWR_DEVSLP		(1 << 1)
 #define PWR_DEVOFF		(1 << 0)
+
 #define SEQ_OFFSYNC		(1 << 0)
 
 #define PHY_TO_OFF_PM_MASTER(p)		(p - 0x36)
@@ -52,10 +59,6 @@ static u8 twl4030_start_script_address = 0x2b;
 #define R_CFG_P2_TRANSITION	PHY_TO_OFF_PM_MASTER(0x37)
 #define R_CFG_P3_TRANSITION	PHY_TO_OFF_PM_MASTER(0x38)
 
-#define LVL_WAKEUP	0x08
-
-#define ENABLE_WARMRESET (1<<4)
-
 #define END_OF_SCRIPT		0x3f
 
 #define R_SEQ_ADD_A2S		PHY_TO_OFF_PM_MASTER(0x55)
@@ -196,7 +199,7 @@ static int twl4030_config_wakeup3_sequence(u8 address)
 	err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &data, R_P3_SW_EVENTS);
 	if (err)
 		goto out;
-	data |= LVL_WAKEUP;
+	data |= PWR_LVL_WAKEUP;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, data, R_P3_SW_EVENTS);
 out:
 	if (err)
@@ -219,7 +222,7 @@ static int twl4030_config_wakeup12_sequence(u8 address)
 	if (err)
 		goto out;
 
-	data |= LVL_WAKEUP;
+	data |= PWR_LVL_WAKEUP;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, data, R_P1_SW_EVENTS);
 	if (err)
 		goto out;
@@ -228,7 +231,7 @@ static int twl4030_config_wakeup12_sequence(u8 address)
 	if (err)
 		goto out;
 
-	data |= LVL_WAKEUP;
+	data |= PWR_LVL_WAKEUP;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, data, R_P2_SW_EVENTS);
 	if (err)
 		goto out;
@@ -281,7 +284,7 @@ static int twl4030_config_warmreset_sequence(u8 address)
 	if (err)
 		goto out;
 
-	rd_data |= ENABLE_WARMRESET;
+	rd_data |= PWR_ENABLE_WARMRESET;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, rd_data, R_P1_SW_EVENTS);
 	if (err)
 		goto out;
@@ -290,7 +293,7 @@ static int twl4030_config_warmreset_sequence(u8 address)
 	if (err)
 		goto out;
 
-	rd_data |= ENABLE_WARMRESET;
+	rd_data |= PWR_ENABLE_WARMRESET;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, rd_data, R_P2_SW_EVENTS);
 	if (err)
 		goto out;
@@ -299,7 +302,7 @@ static int twl4030_config_warmreset_sequence(u8 address)
 	if (err)
 		goto out;
 
-	rd_data |= ENABLE_WARMRESET;
+	rd_data |= PWR_ENABLE_WARMRESET;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, rd_data, R_P3_SW_EVENTS);
 out:
 	if (err)
Signature · 1 line
1.8.1.1
#8 lore raw

PATCH v2 2/7 mfd: twl4030-power: Fix some defines for SW_EVENTS

Quoted 16 lines

We have these bits partially defined in two different places, so let's fix them up and add defines for the missing bits. These bits are the same for P1_SW_EVENTS, P2_SW_EVENTS and P3_SW_EVENTS.

---
 drivers/mfd/twl4030-power.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/mfd/twl4030-power.c +0 -0
index 1b30d8a..c0e4fc3 100644

drivers/mfd/twl4030-power.c line 37

Quoted 3 lines
drivers/mfd/twl4030-power.c +0 -0
@@ -35,7 +35,14 @@
 static u8 twl4030_start_script_address = 0x2b;
 
 #define PWR_P1_SW_EVENTS	0x10

BIT(4)?

drivers/mfd/twl4030-power.c line 46

Quoted 9 lines
drivers/mfd/twl4030-power.c +7 -0
+#define PWR_STOPON_PRWON	(1 << 6)
+#define PWR_STOPON_SYSEN	(1 << 5)
+#define PWR_ENABLE_WARMRESET	(1 << 4)
+#define PWR_LVL_WAKEUP		(1 << 3)
+#define PWR_DEVACT		(1 << 2)
+#define PWR_DEVSLP		(1 << 1)
 #define PWR_DEVOFF		(1 << 0)
+
 #define SEQ_OFFSYNC		(1 << 0)

Please use the BIT() macro for these.

[...]

Once fixed, apply my Acked-by on re-submission.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#9 lore raw

PATCH v2 2/7 mfd: twl4030-power: Fix some defines for SW_EVENTS

Quoted 18 lines · Lee Jones
Quoted 18 lines

We have these bits partially defined in two different places, so let's fix them up and add defines for the missing bits. These bits are the same for P1_SW_EVENTS, P2_SW_EVENTS and P3_SW_EVENTS.

---
 drivers/mfd/twl4030-power.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/mfd/twl4030-power.c +0 -0
index 1b30d8a..c0e4fc3 100644
@@ -35,7 +35,14 @@
 static u8 twl4030_start_script_address = 0x2b;
 
Quoted 3 lines

drivers/mfd/twl4030-power.c line 37

Quoted 1 line
drivers/mfd/twl4030-power.c +0 -0
 #define PWR_P1_SW_EVENTS	0x10

BIT(4)?

Seems actually unused to so removed.

Quoted 12 lines

drivers/mfd/twl4030-power.c line 46

Quoted 9 lines
drivers/mfd/twl4030-power.c +7 -0
+#define PWR_STOPON_PRWON	(1 << 6)
+#define PWR_STOPON_SYSEN	(1 << 5)
+#define PWR_ENABLE_WARMRESET	(1 << 4)
+#define PWR_LVL_WAKEUP		(1 << 3)
+#define PWR_DEVACT		(1 << 2)
+#define PWR_DEVSLP		(1 << 1)
 #define PWR_DEVOFF		(1 << 0)
+
 #define SEQ_OFFSYNC		(1 << 0)

Please use the BIT() macro for these.

Quoted 3 lines

[...]

Once fixed, apply my Acked-by on re-submission.

OK updated patch below with your ack added.

Regards,

Tony

8< --------------------
From: Tony Lindgren <[email protected]>
Date: Tue, 20 May 2014 11:17:53 -0700
Subject: [PATCH] mfd: twl4030-power: Fix some defines for SW_EVENTS

We have these bits partially defined in two different places, so let's fix them up and add defines for the missing bits. These bits are the same for P1_SW_EVENTS, P2_SW_EVENTS and P3_SW_EVENTS.

drivers/mfd/twl4030-power.c +15 -12
@@ -34,8 +34,15 @@
 
 static u8 twl4030_start_script_address = 0x2b;
 
-#define PWR_P1_SW_EVENTS	0x10
-#define PWR_DEVOFF		(1 << 0)
+/* Register bits for P1, P2 and P3_SW_EVENTS */
+#define PWR_STOPON_PRWON	BIT(6)
+#define PWR_STOPON_SYSEN	BIT(5)
+#define PWR_ENABLE_WARMRESET	BIT(4)
+#define PWR_LVL_WAKEUP		BIT(3)
+#define PWR_DEVACT		BIT(2)
+#define PWR_DEVSLP		BIT(1)
+#define PWR_DEVOFF		BIT(0)
+
 #define SEQ_OFFSYNC		(1 << 0)
 
 #define PHY_TO_OFF_PM_MASTER(p)		(p - 0x36)
@@ -52,10 +59,6 @@ static u8 twl4030_start_script_address = 0x2b;
 #define R_CFG_P2_TRANSITION	PHY_TO_OFF_PM_MASTER(0x37)
 #define R_CFG_P3_TRANSITION	PHY_TO_OFF_PM_MASTER(0x38)
 
-#define LVL_WAKEUP	0x08
-
-#define ENABLE_WARMRESET (1<<4)
-
 #define END_OF_SCRIPT		0x3f
 
 #define R_SEQ_ADD_A2S		PHY_TO_OFF_PM_MASTER(0x55)
@@ -196,7 +199,7 @@ static int twl4030_config_wakeup3_sequence(u8 address)
 	err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &data, R_P3_SW_EVENTS);
 	if (err)
 		goto out;
-	data |= LVL_WAKEUP;
+	data |= PWR_LVL_WAKEUP;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, data, R_P3_SW_EVENTS);
 out:
 	if (err)
@@ -219,7 +222,7 @@ static int twl4030_config_wakeup12_sequence(u8 address)
 	if (err)
 		goto out;
 
-	data |= LVL_WAKEUP;
+	data |= PWR_LVL_WAKEUP;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, data, R_P1_SW_EVENTS);
 	if (err)
 		goto out;
@@ -228,7 +231,7 @@ static int twl4030_config_wakeup12_sequence(u8 address)
 	if (err)
 		goto out;
 
-	data |= LVL_WAKEUP;
+	data |= PWR_LVL_WAKEUP;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, data, R_P2_SW_EVENTS);
 	if (err)
 		goto out;
@@ -281,7 +284,7 @@ static int twl4030_config_warmreset_sequence(u8 address)
 	if (err)
 		goto out;
 
-	rd_data |= ENABLE_WARMRESET;
+	rd_data |= PWR_ENABLE_WARMRESET;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, rd_data, R_P1_SW_EVENTS);
 	if (err)
 		goto out;
@@ -290,7 +293,7 @@ static int twl4030_config_warmreset_sequence(u8 address)
 	if (err)
 		goto out;
 
-	rd_data |= ENABLE_WARMRESET;
+	rd_data |= PWR_ENABLE_WARMRESET;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, rd_data, R_P2_SW_EVENTS);
 	if (err)
 		goto out;
@@ -299,7 +302,7 @@ static int twl4030_config_warmreset_sequence(u8 address)
 	if (err)
 		goto out;
 
-	rd_data |= ENABLE_WARMRESET;
+	rd_data |= PWR_ENABLE_WARMRESET;
 	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, rd_data, R_P3_SW_EVENTS);
 out:
 	if (err)
author maintainer
#10 lore raw

PATCH v2 3/7 mfd: twl4030-power: Add generic reset configuration

In reply to Tony Lindgren

The twl4030 PMIC needs to be configured properly for things like warm reset and deeper idle states so the PMIC manages the regulators properly based on the hardware triggers from the SoC.

For example, when rebooting an OMAP3530 at 125 MHz, it hangs. With this patch, TWL4030 will be reset when a warm reset occures. This way the OMAP3530 does not hang on reboot.

Let's use this as the default when compatible = "ti,twl4030-power". Other more complicated configurations can be added to the driver based on other compatible flags.

Based on earlier patch by Matthias Brugger <[email protected]>:

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-January/144165.html

And Lesly A M <[email protected]>:

https://github.com/openembedded/openembedded/blob/master/recipes/linux/linux-omap-2.6.39/mfd/0010-MFD-TWL4030-power-scripts-for-OMAP3-boards.patch

For more information about twl4030 configuration for the "power scripts" see:

http://www.omappedia.com/wiki/TWL4030_power_scripts

Cc Matthias Brugger <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Peter De Schrijver <[email protected]>
Cc Samuel Ortiz <[email protected]>
Cc Lee Jones <[email protected]>
---
 .../devicetree/bindings/mfd/twl4030-power.txt      |  7 +-
 drivers/mfd/twl4030-power.c                        | 99 +++++++++++++++++++---
 include/linux/i2c/twl.h                            |  3 +
 3 files changed, 95 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/mfd/twl4030-power.txt +6 -1
index 8e15ec3..b906116 100644
@@ -5,7 +5,12 @@ to control the power resources, including power scripts. For now, the
 binding only supports the complete shutdown of the system after poweroff.
 
 Required properties:
-- compatible : must be "ti,twl4030-power"
+- compatible : must be one of the following
+	"ti,twl4030-power"
+	"ti,twl4030-power-reset"
+
+The use of ti,twl4030-power-reset is recommended at least on
+3530 that needs a special configuration for warm reset to work.
 
 Optional properties:
 - ti,use_poweroff: With this flag, the chip will initiates an ACTIVE-to-OFF or
drivers/mfd/twl4030-power.c +86 -13

151 lines not on this page · raw message

include/linux/i2c/twl.h +3 -0
index ade1c06..5fe0313 100644
@@ -486,7 +486,10 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
 #define RES_GRP_ALL		0x7	/* All resource groups */
 
 #define RES_TYPE2_R0		0x0
+#define RES_TYPE2_R1		0x1
+#define RES_TYPE2_R2		0x2
 
+#define RES_TYPE_R0		0x0
 #define RES_TYPE_ALL		0x7
 
 /* Resource states */
Signature · 1 line
1.8.1.1
#11 lore raw

PATCH v2 3/7 mfd: twl4030-power: Add generic reset configuration

Quoted 17 lines

The twl4030 PMIC needs to be configured properly for things like warm reset and deeper idle states so the PMIC manages the regulators properly based on the hardware triggers from the SoC.

For example, when rebooting an OMAP3530 at 125 MHz, it hangs. With this patch, TWL4030 will be reset when a warm reset occures. This way the OMAP3530 does not hang on reboot.

Let's use this as the default when compatible = "ti,twl4030-power". Other more complicated configurations can be added to the driver based on other compatible flags.

Based on earlier patch by Matthias Brugger <[email protected]>:

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-January/144165.html

Quoted 8 lines

And Lesly A M <[email protected]>:

https://github.com/openembedded/openembedded/blob/master/recipes/linux/linux-omap-2.6.39/mfd/0010-MFD-TWL4030-power-scripts-for-OMAP3-boards.patch

For more information about twl4030 configuration for the "power scripts" see:

http://www.omappedia.com/wiki/TWL4030_power_scripts

Do you really want this bumph in the commit log?

Quoted 48 lines
Cc Matthias Brugger <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Peter De Schrijver <[email protected]>
Cc Samuel Ortiz <[email protected]>
Cc Lee Jones <[email protected]>
---
 .../devicetree/bindings/mfd/twl4030-power.txt      |  7 +-
 drivers/mfd/twl4030-power.c                        | 99 +++++++++++++++++++---
 include/linux/i2c/twl.h                            |  3 +
 3 files changed, 95 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/mfd/twl4030-power.txt +6 -1
index 8e15ec3..b906116 100644
@@ -5,7 +5,12 @@ to control the power resources, including power scripts. For now, the
 binding only supports the complete shutdown of the system after poweroff.
 
 Required properties:
-- compatible : must be "ti,twl4030-power"
+- compatible : must be one of the following
+	"ti,twl4030-power"
+	"ti,twl4030-power-reset"
+
+The use of ti,twl4030-power-reset is recommended at least on
+3530 that needs a special configuration for warm reset to work.
 
 Optional properties:
 - ti,use_poweroff: With this flag, the chip will initiates an ACTIVE-to-OFF or
drivers/mfd/twl4030-power.c +3 -0
index c0e4fc3..b61b725 100644
@@ -29,6 +29,7 @@
 #include <linux/i2c/twl.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 
 #include <asm/mach-types.h>
 
@@ -128,6 +129,30 @@ static u8 res_config_addrs[] = {
 	[RES_MAIN_REF]	= 0x94,
 };
 
+/*
+ * Usable values for .remap_sleep and .remap_off

drivers/mfd/twl4030-power.c static u8 res_config_addrs[] = { · line 143

Quoted 10 lines
drivers/mfd/twl4030-power.c +10 -0
+ * Based on table "5.3.3 Resource Operating modes"
+ */
+enum {
+	TWL_REMAP_OFF = 0,
+	TWL_REMAP_SLEEP = 8,
+	TWL_REMAP_ACTIVE = 9,
+};
+
+#define TWL_RESOURCE_ON(res)						\
+	{ MSG_SINGULAR(DEV_GRP_NULL, (res), RES_STATE_ACTIVE), 0x02 }

Was ist das? Magic, floating, fluffy numbers.

Quoted 16 lines
drivers/mfd/twl4030-power.c +12 -0
+#define TWL_RESOURCE_OFF(res)						\
+	{ MSG_SINGULAR(DEV_GRP_NULL, (res), RES_STATE_OFF), 0x02 }
+#define TWL_RESOURCE_RESET(res)						\
+	{ MSG_SINGULAR(DEV_GRP_NULL, (res), RES_STATE_WRST), 0x02 }
+#define TWL_RESOURCE_GROUP_RESET(group, type1, type2)			\
+	{ MSG_BROADCAST(DEV_GRP_NULL, (group), (type1), (type2),	\
+		RES_STATE_WRST), 0x02 }
+#define TWL_REMAP_SLEEP(res, devgrp, typ, typ2)				\
+	{ .resource = (res), .devgroup = (devgrp),			\
+	  .type = (typ), .type2 = (typ2),				\
+	  .remap_off = TWL_REMAP_OFF, .remap_sleep = TWL_REMAP_SLEEP, }
+
 static int twl4030_write_script_byte(u8 address, u8 byte)
 {
 	int err;

drivers/mfd/twl4030-power.c int twl4030_remove_script(u8 flags) · line 531

Quoted 6 lines
drivers/mfd/twl4030-power.c +2 -1
@@ -502,7 +527,8 @@ int twl4030_remove_script(u8 flags)
 	return err;
 }
 
-static int twl4030_power_configure_scripts(struct twl4030_power_data *pdata)
+static int
+twl4030_power_configure_scripts(const struct twl4030_power_data *pdata)

Is this doing anything besides some sneaky clean-up? If not, it might be worth mentioning that you're taking advantage of these changes to conduct such activities.

drivers/mfd/twl4030-power.c static int twl4030_power_configure_scripts(struct twl4030_power_data *pdata) · line 548

Quoted 10 lines
drivers/mfd/twl4030-power.c +2 -1
 {
 	int err;
 	int i;
@@ -518,7 +544,8 @@ static int twl4030_power_configure_scripts(struct twl4030_power_data *pdata)
 	return 0;
 }
 
-static int twl4030_power_configure_resources(struct twl4030_power_data *pdata)
+static int
+twl4030_power_configure_resources(const struct twl4030_power_data *pdata)

Ditto.

drivers/mfd/twl4030-power.c void twl4030_power_off(void) · line 581

Quoted 10 lines
drivers/mfd/twl4030-power.c +1 -1
 {
 	struct twl4030_resconfig *resconfig = pdata->resource_config;
 	int err;
@@ -550,7 +577,7 @@ void twl4030_power_off(void)
 		pr_err("TWL4030 Unable to power off\n");
 }
 
-static bool twl4030_power_use_poweroff(struct twl4030_power_data *pdata,
+static bool twl4030_power_use_poweroff(const struct twl4030_power_data *pdata,
 					struct device_node *node)

Etc.

[...]

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#12 lore raw

PATCH v2 3/7 mfd: twl4030-power: Add generic reset configuration

Quoted 4 lines · Lee Jones
Quoted 2 lines

http://www.omappedia.com/wiki/TWL4030_power_scripts

Do you really want this bumph in the commit log?

Removed the links from the commit log.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+#define TWL_RESOURCE_ON(res)						\
+	{ MSG_SINGULAR(DEV_GRP_NULL, (res), RES_STATE_ACTIVE), 0x02 }

Was ist das? Magic, floating, fluffy numbers.

Ja, I added some comments and combined them further with defines to make the configuration more readable.

Quoted 7 lines

Review

Quoted 3 lines
(quoted diff) +2 -1
-static int twl4030_power_configure_scripts(struct twl4030_power_data *pdata)
+static int
+twl4030_power_configure_scripts(const struct twl4030_power_data *pdata)

Is this doing anything besides some sneaky clean-up? If not, it might be worth mentioning that you're taking advantage of these changes to conduct such activities.

Added a note about that too..

Quoted 20 lines

Review static int twl4030_power_configure_scripts(struct twl4030_power_data *pdata) · line 548

Quoted 10 lines

{

(quoted diff) +2 -1
 	int err;
 	int i;
@@ -518,7 +544,8 @@ static int twl4030_power_configure_scripts(struct twl4030_power_data *pdata)
 	return 0;
 }
 
-static int twl4030_power_configure_resources(struct twl4030_power_data *pdata)
+static int
+twl4030_power_configure_resources(const struct twl4030_power_data *pdata)

Ditto.

Quoted 7 lines
(quoted diff) +0 -0
 {
 	struct twl4030_resconfig *resconfig = pdata->resource_config;
 	int err;
@@ -550,7 +577,7 @@ void twl4030_power_off(void)
 		pr_err("TWL4030 Unable to power off\n");
 }
 
Quoted 5 lines

Review void twl4030_power_off(void) · line 581

Quoted 3 lines
(quoted diff) +1 -1
-static bool twl4030_power_use_poweroff(struct twl4030_power_data *pdata,
+static bool twl4030_power_use_poweroff(const struct twl4030_power_data *pdata,
 					struct device_node *node)

Etc.

..regarding all of these so we can use it also for match->data. Updated patch below.

Regards,

Tony

8< ----------------------------
From: Tony Lindgren <[email protected]>
Date: Tue, 20 May 2014 11:17:54 -0700
Subject: [PATCH] mfd: twl4030-power: Add generic reset configuration

The twl4030 PMIC needs to be configured properly for things like warm reset and deeper idle states so the PMIC manages the regulators properly based on the hardware triggers from the SoC. Earlier we have configured twl4030 using platform data, but we want to do it for device tree based booting also.

In some cases configuring twl4030 is needed for things to work. For example, when rebooting an OMAP3530 at 125 MHz, it hangs. With this patch, TWL4030 will be reset when a warm reset occures, and OMAP3530 does not hang on reboot.

Let's add device tree support and configure things for warm reset as the default when compatible = "ti,twl4030-power". More complicated configurations can be added to the driver based on other compatible flags.

Note we now also make the pdata const like it should be. This allows use it for match->data with the device tree related functions.

Based on earlier patch by Matthias Brugger <[email protected]> and Lesly A M <[email protected]>.

Cc Matthias Brugger <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Peter De Schrijver <[email protected]>
Cc Samuel Ortiz <[email protected]>
Cc Lee Jones <[email protected]>
Documentation/devicetree/bindings/mfd/twl4030-power.txt +6 -1
@@ -5,7 +5,12 @@ to control the power resources, including power scripts. For now, the
 binding only supports the complete shutdown of the system after poweroff.
 
 Required properties:
-- compatible : must be "ti,twl4030-power"
+- compatible : must be one of the following
+	"ti,twl4030-power"
+	"ti,twl4030-power-reset"
+
+The use of ti,twl4030-power-reset is recommended at least on
+3530 that needs a special configuration for warm reset to work.
 
 Optional properties:
 - ti,use_poweroff: With this flag, the chip will initiates an ACTIVE-to-OFF or
drivers/mfd/twl4030-power.c +96 -13

161 lines not on this page · raw message

include/linux/i2c/twl.h +3 -0
index d2b1670..36e5496 100644
@@ -498,7 +498,10 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
 #define RES_GRP_ALL		0x7	/* All resource groups */
 
 #define RES_TYPE2_R0		0x0
+#define RES_TYPE2_R1		0x1
+#define RES_TYPE2_R2		0x2
 
+#define RES_TYPE_R0		0x0
 #define RES_TYPE_ALL		0x7
 
 /* Resource states */
author maintainer
#13 lore raw

PATCH v2 4/7 mfd: twl4030-power: Add recommended idle configuration

In reply to Tony Lindgren

These settings are based on the "Recommended Sleep Sequences for the Zoom Platform" pdf at:

http://omappedia.com/wiki/File:Recommended_Sleep_Sequences_Zoom.pdf

These settings assume most of the regulators are under control of Linux, and twl4030 only cuts off VDD1 and VDD2 during off-idle as Linux cannot do it.

For any board specific changes to these, let's patch them in as changes to the generic data in the follow-up patches. This keeps the board specific changes small.

Note that this does not consider the twl5030 errata 27 and 28. That can be added later on after it has been tested. For more information about errata 27 and 28, please see:

https://github.com/openembedded/openembedded/blob/master/recipes/linux/linux-omap-2.6.39/mfd/0012-MFD-TWL4030-workaround-changes-for-Erratum-27.patch

---
 .../devicetree/bindings/mfd/twl4030-power.txt      |   4 +
 drivers/mfd/twl4030-power.c                        | 103 +++++++++++++++++++++
 2 files changed, 107 insertions(+)
Documentation/devicetree/bindings/mfd/twl4030-power.txt +4 -0
index b906116..bbd6603 100644
@@ -8,10 +8,14 @@ Required properties:
 - compatible : must be one of the following
 	"ti,twl4030-power"
 	"ti,twl4030-power-reset"
+	"ti,twl4030-power-idle"
 
 The use of ti,twl4030-power-reset is recommended at least on
 3530 that needs a special configuration for warm reset to work.
 
+When using ti,twl4030-power-idle, the TI recommended configuration
+for idle modes is loaded to the tlw4030 PMIC.
+
 Optional properties:
 - ti,use_poweroff: With this flag, the chip will initiates an ACTIVE-to-OFF or
 		   SLEEP-to-OFF transition when the system poweroffs.
drivers/mfd/twl4030-power.c +103 -0

133 lines not on this page · raw message

Signature · 1 line
1.8.1.1
#14 lore raw

PATCH v2 4/7 mfd: twl4030-power: Add recommended idle configuration

Quoted 19 lines

These settings are based on the "Recommended Sleep Sequences for the Zoom Platform" pdf at:

http://omappedia.com/wiki/File:Recommended_Sleep_Sequences_Zoom.pdf

These settings assume most of the regulators are under control of Linux, and twl4030 only cuts off VDD1 and VDD2 during off-idle as Linux cannot do it.

For any board specific changes to these, let's patch them in as changes to the generic data in the follow-up patches. This keeps the board specific changes small.

Note that this does not consider the twl5030 errata 27 and 28. That can be added later on after it has been tested. For more information about errata 27 and 28, please see:

https://github.com/openembedded/openembedded/blob/master/recipes/linux/linux-omap-2.6.39/mfd/0012-MFD-TWL4030-workaround-changes-for-Erratum-27.patch

Quoted 8 lines
---
 .../devicetree/bindings/mfd/twl4030-power.txt      |   4 +
 drivers/mfd/twl4030-power.c                        | 103 +++++++++++++++++++++
 2 files changed, 107 insertions(+)

Assuming the magic numbers are replaced by transparent #defines:

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#15 lore raw

PATCH v2 4/7 mfd: twl4030-power: Add recommended idle configuration

Quoted 4 lines · Lee Jones

Assuming the magic numbers are replaced by transparent #defines:

Updated the defines to use a define for the default delay. Did not touch the number for resource group init order but added some comments for those. Updated patch below.

Regards,

Tony

8< --------------------------
From: Tony Lindgren <[email protected]>
Date: Tue, 20 May 2014 11:17:54 -0700
Subject: [PATCH] mfd: twl4030-power: Add recommended idle configuration

These settings are based on the "Recommended Sleep Sequences for the Zoom Platform".

The settings assume most of the regulators are under control of Linux, and twl4030 only cuts off VDD1 and VDD2 during off-idle as Linux cannot do it.

For any board specific changes to these, let's patch them in as changes to the generic data in the follow-up patches. This keeps the board specific changes small.

Note that this does not consider the twl5030 errata 27 and 28. That can be added later on after it has been tested. For more information about errata 27 and 28.

Documentation/devicetree/bindings/mfd/twl4030-power.txt +4 -0
@@ -8,10 +8,14 @@ Required properties:
 - compatible : must be one of the following
 	"ti,twl4030-power"
 	"ti,twl4030-power-reset"
+	"ti,twl4030-power-idle"
 
 The use of ti,twl4030-power-reset is recommended at least on
 3530 that needs a special configuration for warm reset to work.
 
+When using ti,twl4030-power-idle, the TI recommended configuration
+for idle modes is loaded to the tlw4030 PMIC.
+
 Optional properties:
 - ti,use_poweroff: With this flag, the chip will initiates an ACTIVE-to-OFF or
 		   SLEEP-to-OFF transition when the system poweroffs.
drivers/mfd/twl4030-power.c +106 -0

137 lines not on this page · raw message

author maintainer
#16 lore raw

PATCH v2 5/7 mfd: twl4030-power: Add support for board specific configuration

In reply to Tony Lindgren

With the recommended twl4030 configuration added, we can now add board specific changes as modifications to the recommended configuration.

Note that the data is private to this driver, and the data must always have a NULL resource in the sentinel.

Cc Peter De Schrijver <[email protected]>
Cc Samuel Ortiz <[email protected]>
Cc Lee Jones <[email protected]>
---
 drivers/mfd/twl4030-power.c | 21 +++++++++++++++++++++
 include/linux/i2c/twl.h     |  1 +
 2 files changed, 22 insertions(+)
drivers/mfd/twl4030-power.c +21 -0
index 39eeee2..4b3f192 100644
@@ -557,13 +557,34 @@ twl4030_power_configure_scripts(const struct twl4030_power_data *pdata)
 	return 0;
 }
 
+static void twl4030_patch_rconfig(struct twl4030_resconfig *common,
+				  struct twl4030_resconfig *board)
+{
+	while (common->resource) {
+		struct twl4030_resconfig *b = board;
+
+		while (b->resource) {
+			if (b->resource == common->resource) {
+				*common = *b;
+				break;
+			}
+			b++;
+		}
+		common++;
+	}
+}
+
 static int
 twl4030_power_configure_resources(const struct twl4030_power_data *pdata)
 {
 	struct twl4030_resconfig *resconfig = pdata->resource_config;
+	struct twl4030_resconfig *boardconf = pdata->board_config;
 	int err;
 
 	if (resconfig) {
+		if (boardconf)
+			twl4030_patch_rconfig(resconfig, boardconf);
+
 		while (resconfig->resource) {
 			err = twl4030_configure_resource(resconfig);
 			if (err)
include/linux/i2c/twl.h +1 -0
index 5fe0313..57fe782 100644
@@ -662,6 +662,7 @@ struct twl4030_power_data {
 	struct twl4030_script **scripts;
 	unsigned num;
 	struct twl4030_resconfig *resource_config;
+	struct twl4030_resconfig *board_config;
 #define TWL4030_RESCONFIG_UNDEF	((u8)-1)
 	bool use_poweroff;	/* Board is wired for TWL poweroff */
 };
Signature · 1 line
1.8.1.1
#17 lore raw

PATCH v2 5/7 mfd: twl4030-power: Add support for board specific configuration

Quoted 7 lines · Tony Lindgren

With the recommended twl4030 configuration added, we can now add board specific changes as modifications to the recommended configuration.

Note that the data is private to this driver, and the data must always have a NULL resource in the sentinel.

Quoted 8 lines
Cc Peter De Schrijver <[email protected]>
Cc Samuel Ortiz <[email protected]>
Cc Lee Jones <[email protected]>
---
 drivers/mfd/twl4030-power.c | 21 +++++++++++++++++++++
 include/linux/i2c/twl.h     |  1 +
 2 files changed, 22 insertions(+)

Ah, I forgot to Ack this last time, didn't I?

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#18 lore raw

PATCH v2 5/7 mfd: twl4030-power: Add support for board specific configuration

Quoted 4 lines · Lee Jones

Ah, I forgot to Ack this last time, didn't I?

Yeah, here's this one updated with your ack.

Regards,

Tony

8< ---------------------------
From: Tony Lindgren <[email protected]>
Date: Tue, 20 May 2014 11:17:54 -0700
Subject: [PATCH] mfd: twl4030-power: Add support for board specific configuration

With the recommended twl4030 configuration added, we can now add board specific changes as modifications to the recommended configuration.

Note that the data is private to this driver, and the data must always have a NULL resource in the sentinel.

drivers/mfd/twl4030-power.c +21 -0
@@ -567,13 +567,34 @@ twl4030_power_configure_scripts(const struct twl4030_power_data *pdata)
 	return 0;
 }
 
+static void twl4030_patch_rconfig(struct twl4030_resconfig *common,
+				  struct twl4030_resconfig *board)
+{
+	while (common->resource) {
+		struct twl4030_resconfig *b = board;
+
+		while (b->resource) {
+			if (b->resource == common->resource) {
+				*common = *b;
+				break;
+			}
+			b++;
+		}
+		common++;
+	}
+}
+
 static int
 twl4030_power_configure_resources(const struct twl4030_power_data *pdata)
 {
 	struct twl4030_resconfig *resconfig = pdata->resource_config;
+	struct twl4030_resconfig *boardconf = pdata->board_config;
 	int err;
 
 	if (resconfig) {
+		if (boardconf)
+			twl4030_patch_rconfig(resconfig, boardconf);
+
 		while (resconfig->resource) {
 			err = twl4030_configure_resource(resconfig);
 			if (err)
include/linux/i2c/twl.h +1 -0
@@ -674,6 +674,7 @@ struct twl4030_power_data {
 	struct twl4030_script **scripts;
 	unsigned num;
 	struct twl4030_resconfig *resource_config;
+	struct twl4030_resconfig *board_config;
 #define TWL4030_RESCONFIG_UNDEF	((u8)-1)
 	bool use_poweroff;	/* Board is wired for TWL poweroff */
 };
#19 lore raw

PATCH v2 5/7 mfd: twl4030-power: Add support for board specific configuration

Quoted 7 lines · Tony Lindgren
Quoted 4 lines · Lee Jones

Ah, I forgot to Ack this last time, didn't I?

Yeah, here's this one updated with your ack.

Has the code changed at all, or are you just reposting with my Ack applied?

Quoted 64 lines

8< ---------------------------
From: Tony Lindgren <[email protected]>
Date: Tue, 20 May 2014 11:17:54 -0700
Subject: [PATCH] mfd: twl4030-power: Add support for board specific configuration

With the recommended twl4030 configuration added, we can now add board specific changes as modifications to the recommended configuration.

Note that the data is private to this driver, and the data must always have a NULL resource in the sentinel.

drivers/mfd/twl4030-power.c +21 -0
@@ -567,13 +567,34 @@ twl4030_power_configure_scripts(const struct twl4030_power_data *pdata)
 	return 0;
 }
 
+static void twl4030_patch_rconfig(struct twl4030_resconfig *common,
+				  struct twl4030_resconfig *board)
+{
+	while (common->resource) {
+		struct twl4030_resconfig *b = board;
+
+		while (b->resource) {
+			if (b->resource == common->resource) {
+				*common = *b;
+				break;
+			}
+			b++;
+		}
+		common++;
+	}
+}
+
 static int
 twl4030_power_configure_resources(const struct twl4030_power_data *pdata)
 {
 	struct twl4030_resconfig *resconfig = pdata->resource_config;
+	struct twl4030_resconfig *boardconf = pdata->board_config;
 	int err;
 
 	if (resconfig) {
+		if (boardconf)
+			twl4030_patch_rconfig(resconfig, boardconf);
+
 		while (resconfig->resource) {
 			err = twl4030_configure_resource(resconfig);
 			if (err)
include/linux/i2c/twl.h +1 -0
@@ -674,6 +674,7 @@ struct twl4030_power_data {
 	struct twl4030_script **scripts;
 	unsigned num;
 	struct twl4030_resconfig *resource_config;
+	struct twl4030_resconfig *board_config;
 #define TWL4030_RESCONFIG_UNDEF	((u8)-1)
 	bool use_poweroff;	/* Board is wired for TWL poweroff */
 };
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#20 lore raw

PATCH v2 5/7 mfd: twl4030-power: Add support for board specific configuration

Quoted 4 lines · Lee Jones
Quoted 2 lines · Tony Lindgren
Quoted 1 line · Lee Jones
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Ah, I forgot to Ack this last time, didn't I?

Yeah, here's this one updated with your ack.

Has the code changed at all, or are you just reposting with my Ack applied?

No changes, I just reposted this with your ack as you seemed to prefer for some of the other patches :)

Regards,

Tony

#21 lore raw

PATCH v2 5/7 mfd: twl4030-power: Add support for board specific configuration

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Lee Jones
Quoted 4 lines

Ah, I forgot to Ack this last time, didn't I?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Yeah, here's this one updated with your ack.

Has the code changed at all, or are you just reposting with my Ack applied?

No changes, I just reposted this with your ack as you seemed to prefer for some of the other patches :)

Only for whole series re-submissions. I'm not that lazy. :)

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#22 lore raw

PATCH v2 6/7 mfd: twl4030power: Add a configuration to turn off oscillator during off-idle

In reply to Tony Lindgren

Some oscillators can be turned off during off-idle saving few a little bit power at the cost of the oscillator start up latency.

If you board can do this, you can now enable it by using the ti,twl4030-power-idle-osc-off compatible flag.

---
 Documentation/devicetree/bindings/mfd/twl4030-power.txt |  6 ++++++
 drivers/mfd/twl4030-power.c                             | 17 +++++++++++++++++
 2 files changed, 23 insertions(+)
Documentation/devicetree/bindings/mfd/twl4030-power.txt +6 -0
index bbd6603..b9ee7b9 100644
@@ -9,6 +9,7 @@ Required properties:
 	"ti,twl4030-power"
 	"ti,twl4030-power-reset"
 	"ti,twl4030-power-idle"
+	"ti,twl4030-power-idle-osc-off"
 
 The use of ti,twl4030-power-reset is recommended at least on
 3530 that needs a special configuration for warm reset to work.
@@ -16,6 +17,11 @@ The use of ti,twl4030-power-reset is recommended at least on
 When using ti,twl4030-power-idle, the TI recommended configuration
 for idle modes is loaded to the tlw4030 PMIC.
 
+When using ti,twl4030-power-idle-osc-off, the TI recommended
+configuration is used with the external oscillator being shut
+down during off-idle. Note that this does not work on all boards
+depending on how the external oscillator is wired.
+
 Optional properties:
 - ti,use_poweroff: With this flag, the chip will initiates an ACTIVE-to-OFF or
 		   SLEEP-to-OFF transition when the system poweroffs.
drivers/mfd/twl4030-power.c +17 -0
index 4b3f192..4341961 100644
@@ -748,6 +748,19 @@ static struct twl4030_power_data omap3_idle = {
 	.resource_config	= omap3_idle_rconfig,
 };
 
+/* Disable 32 KiHz oscillator during idle */
+static struct twl4030_resconfig osc_off_rconfig[] = {
+	TWL_REMAP_OFF(RES_CLKEN, DEV_GRP_P1 | DEV_GRP_P3, 3, 2),
+	{ /* Terminator */ },
+};
+
+static struct twl4030_power_data osc_off_idle = {
+	.scripts		= omap3_idle_scripts,
+	.num			= ARRAY_SIZE(omap3_idle_scripts),
+	.resource_config	= omap3_idle_rconfig,
+	.board_config		= osc_off_rconfig,
+};
+
 static struct of_device_id twl4030_power_of_match[] = {
 	{
 		.compatible = "ti,twl4030-power-reset",
@@ -757,6 +770,10 @@ static struct of_device_id twl4030_power_of_match[] = {
 		.compatible = "ti,twl4030-power-idle",
 		.data = &omap3_idle,
 	},
+	{
+		.compatible = "ti,twl4030-power-idle-osc-off",
+		.data = &osc_off_idle,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, twl4030_power_of_match);
Signature · 1 line
1.8.1.1
author maintainer
#23 lore raw

PATCH v2 7/7 ARM: dts: Enable twl4030 off-idle configuration for selected omaps

In reply to Tony Lindgren

N900 now seems to shut down the external oscillator when hitting off-idle.

And Beagle XM seems to have OSC_EN pin connected to allow shutting down the oscillator looking at the schematics. The oscillator output is cut off in off-idle and you can monitor it from R56 on the bottom side of the board near the power jack. Note that for beagle we need to also enable the UART wake-up event, the others have that enabled in earlier patches.

OMAP37XX EVM (TMDSEVM3730) does not seem to have twl4030 clken pin connected, so there is no point trying to enable shutting down of the oscillator on it for the extra latency it adds.

---
 arch/arm/boot/dts/omap3-beagle-xm.dts   | 6 ++++++
 arch/arm/boot/dts/omap3-evm-common.dtsi | 7 +++++++
 arch/arm/boot/dts/omap3-n900.dts        | 5 +++++
 3 files changed, 18 insertions(+)
arch/arm/boot/dts/omap3-beagle-xm.dts +6 -0
index 447e714..b05814b 100644
@@ -152,6 +152,11 @@
 			codec {
 			};
 		};
+
+		twl_power: power {
+			compatible = "ti,twl4030-power-beagleboard-xm", "ti,twl4030-power-idle-osc-off";
+			ti,use_poweroff;
+		};
 	};
 };
 
@@ -211,6 +216,7 @@
 };
 
 &uart3 {
+	interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart3_pins>;
 };
arch/arm/boot/dts/omap3-evm-common.dtsi +7 -0
index 3007e79..7e44e29 100644
@@ -45,6 +45,13 @@
 #include "twl4030.dtsi"
 #include "twl4030_omap3.dtsi"
 
+&twl {
+	twl_power: power {
+		compatible = "ti,twl4030-power-omap3-evm", "ti,twl4030-power-idle";
+		ti,use_poweroff;
+	};
+};
+
 &i2c2 {
 	clock-frequency = <400000>;
 };
arch/arm/boot/dts/omap3-n900.dts +5 -0
index 869bdd9..09ae615 100644
@@ -277,6 +277,11 @@
 		compatible = "ti,twl4030-audio";
 		ti,enable-vibra = <1>;
 	};
+
+	twl_power: power {
+		compatible = "ti,twl4030-power-n900", "ti,twl4030-power-idle-osc-off";
+		ti,use_poweroff;
+	};
 };
 
 &twl_gpio {
Signature · 1 line
1.8.1.1
#24 lore raw

v2 cover mfd: twl4030-power: Enable off-idle configuration when booted with device tree

In reply to Tony Lindgren
Quoted 11 lines

Here's an updated set of patches to enable low-power idle modes for some omap3 boards when booted with device tree.

This series when applied on top of the patches in tread "[PATCH 00/11] Fixes for omap PM for making omap3 DT only", or omap-for-v3.16/pm branch.

Lee, if these patches look OK to you, please feel free to pick them, preferrably to the immutable branch you already have set up so I can also merge them in to be able to have things working in my branch properly for PM.

Okay, it looks like this series is good to go now. If you believe so too, give me the nod and I'll apply.

Quoted 19 lines

Tony Lindgren (7):
mfd: twl4030-power: Fix hang on reboot if sleep configuration was
loaded earlier
mfd: twl4030-power: Fix some defines for SW_EVENTS
mfd: twl4030-power: Add generic reset configuration
mfd: twl4030-power: Add recommended idle configuration
mfd: twl4030-power: Add support for board specific configuration
mfd: twl4030power: Add a configuration to turn off oscillator during
off-idle
ARM: dts: Enable twl4030 off-idle configuration for selected omaps

 .../devicetree/bindings/mfd/twl4030-power.txt      |  17 +-
 arch/arm/boot/dts/omap3-beagle-xm.dts              |   6 +
 arch/arm/boot/dts/omap3-evm-common.dtsi            |   7 +
 arch/arm/boot/dts/omap3-n900.dts                   |   5 +
 drivers/mfd/twl4030-power.c                        | 269 +++++++++++++++++++--
 include/linux/i2c/twl.h                            |   4 +
 6 files changed, 284 insertions(+), 24 deletions(-)
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#25 lore raw

v2 cover mfd: twl4030-power: Enable off-idle configuration when booted with device tree

Quoted 7 lines · Lee Jones
Quoted 7 lines

Here's an updated set of patches to enable low-power idle modes for some omap3 boards when booted with device tree.

This series when applied on top of the patches in tread "[PATCH 00/11] Fixes for omap PM for making omap3 DT only", or omap-for-v3.16/pm branch.

Quoted 7 lines
Quoted 4 lines

Lee, if these patches look OK to you, please feel free to pick them, preferrably to the immutable branch you already have set up so I can also merge them in to be able to have things working in my branch properly for PM.

Okay, it looks like this series is good to go now. If you believe so too, give me the nod and I'll apply.

Yes feel free to apply and merge the branch for v3.16. The last patch in this series I can apply a bit later on as a follow-up patch.

BTW, with these patches applied I've so far caught three PM related regressions in other drivers ;) Was seeing much lower power consumption with v3.14 compared to v3.15-rc so that's why I preferred doing the patches against v3.14 in case you were wondering. Anyways, fix is in the works to make v3.15-rc power consumption to behave as well.

Regards,

Tony

#26 lore raw

v2 cover mfd: twl4030-power: Enable off-idle configuration when booted with device tree

In reply to Tony Lindgren
Quoted 11 lines

Here's an updated set of patches to enable low-power idle modes for some omap3 boards when booted with device tree.

This series when applied on top of the patches in tread "[PATCH 00/11] Fixes for omap PM for making omap3 DT only", or omap-for-v3.16/pm branch.

Lee, if these patches look OK to you, please feel free to pick them, preferrably to the immutable branch you already have set up so I can also merge them in to be able to have things working in my branch properly for PM.

Whoops, nearly forgot about this patchset.

Tony, can you resend it with all your fix-ups please. The 8< doesn't work well with my patch application 'system'.

Quoted 19 lines

Tony Lindgren (7):
mfd: twl4030-power: Fix hang on reboot if sleep configuration was
loaded earlier
mfd: twl4030-power: Fix some defines for SW_EVENTS
mfd: twl4030-power: Add generic reset configuration
mfd: twl4030-power: Add recommended idle configuration
mfd: twl4030-power: Add support for board specific configuration
mfd: twl4030power: Add a configuration to turn off oscillator during
off-idle
ARM: dts: Enable twl4030 off-idle configuration for selected omaps

 .../devicetree/bindings/mfd/twl4030-power.txt      |  17 +-
 arch/arm/boot/dts/omap3-beagle-xm.dts              |   6 +
 arch/arm/boot/dts/omap3-evm-common.dtsi            |   7 +
 arch/arm/boot/dts/omap3-n900.dts                   |   5 +
 drivers/mfd/twl4030-power.c                        | 269 +++++++++++++++++++--
 include/linux/i2c/twl.h                            |   4 +
 6 files changed, 284 insertions(+), 24 deletions(-)
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#27 lore raw

v2 cover mfd: twl4030-power: Enable off-idle configuration when booted with device tree

Quoted 12 lines · Lee Jones
Quoted 11 lines

Here's an updated set of patches to enable low-power idle modes for some omap3 boards when booted with device tree.

This series when applied on top of the patches in tread "[PATCH 00/11] Fixes for omap PM for making omap3 DT only", or omap-for-v3.16/pm branch.

Lee, if these patches look OK to you, please feel free to pick them, preferrably to the immutable branch you already have set up so I can also merge them in to be able to have things working in my branch properly for PM.

Quoted 4 lines

Whoops, nearly forgot about this patchset.

Tony, can you resend it with all your fix-ups please. The 8< doesn't work well with my patch application 'system'.

Sure I'll do that. FYI, these kind of patches should apply just fine when piped to git-am --scissors.

Regards,

Tony

#28 lore raw

v2 cover mfd: twl4030-power: Enable off-idle configuration when booted with device tree

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

Here's an updated set of patches to enable low-power idle modes for some omap3 boards when booted with device tree.

This series when applied on top of the patches in tread "[PATCH 00/11] Fixes for omap PM for making omap3 DT only", or omap-for-v3.16/pm branch.

Lee, if these patches look OK to you, please feel free to pick them, preferrably to the immutable branch you already have set up so I can also merge them in to be able to have things working in my branch properly for PM.

Quoted 7 lines
Quoted 4 lines

Whoops, nearly forgot about this patchset.

Tony, can you resend it with all your fix-ups please. The 8< doesn't work well with my patch application 'system'.

Sure I'll do that. FYI, these kind of patches should apply just fine when piped to git-am --scissors.

It's not that - the patches would apply just fine individually. However my mailer stores the patches in date order, so when I use git am <mbox-folder> it attempts to apply them OoO.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog