mfd: twl4030-power: Enable off-idle configuration when booted with device tree
Subsystems (3)
Tony Lindgren
maintainercover mfd: twl4030-power: Enable off-idle configuration when booted with device tree
Hi all,
One of the major blockers for making omap3 to boot in device tree mode has been the fact that power management has not been working as well as when booted in legacy mode.
This series when applied on top of the patches in tread "[PATCH 00/11] Fixes for omap PM for making omap3 DT only".
This series makes the twl4030 PMIC configurations generic so that most boards can just use one of the configurations based on the compatible flag alone. This allows us to drop all the related platform data once omap3 boots in device tree only mode.
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 (4):
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 | 10 + arch/arm/boot/dts/omap3-evm-common.dtsi | 7 + arch/arm/boot/dts/omap3-n900.dts | 5 + drivers/mfd/twl4030-power.c | 205 +++++++++++++++++++++ include/linux/i2c/twl.h | 1 + 5 files changed, 228 insertions(+)
Signature · 1 line
1.8.1.1
Tony Lindgren
maintainerPATCH 1/4 mfd: twl4030-power: Add recommended idle configuration
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 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. That can be added later on after it has been tested.
--- .../devicetree/bindings/mfd/twl4030-power.txt | 4 + drivers/mfd/twl4030-power.c | 165 +++++++++++++++++++++ 2 files changed, 169 insertions(+)
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 +165 -0
176 lines not on this page · raw message
Signature · 1 line
1.8.1.1
PATCH 1/4 mfd: twl4030-power: Add recommended idle configuration
Quoted 8 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 cuts off VDD1 and VDD2 during off-idle as Linux cannot do it.
Linux does it becuase Linux can't do it. Eh?
Quoted 7 lines
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. That can be added later on after it has been tested.
Quoted 7 lines
Cc Peter De Schrijver <[email protected]>Cc Samuel Ortiz <[email protected]>Cc Lee Jones <[email protected]>Signed-off-by Tony Lindgren <[email protected]>--- .../devicetree/bindings/mfd/twl4030-power.txt | 4 + drivers/mfd/twl4030-power.c | 165 +++++++++++++++++++++
driver/mfd changes look good to me:
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Tony Lindgren
maintainerPATCH 1/4 mfd: twl4030-power: Add recommended idle configuration
Quoted 10 lines · Lee Jones
Quoted 8 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 cuts off VDD1 and VDD2 during off-idle as Linux cannot do it.
Linux does it becuase Linux can't do it. Eh?
Heh yeah that's confusing, will update to:
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.
Regards,
Tony
PATCH 1/4 mfd: twl4030-power: Add recommended idle configuration
Quoted 10 lines · Tony Lindgren
Quoted 9 lines · Lee Jones
Quoted 8 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 cuts off VDD1 and VDD2 during off-idle as Linux cannot do it.
Quoted 7 lines
Quoted 1 line
Linux does it becuase Linux can't do it. Eh?
Heh yeah that's confusing, will update to:
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.
+1, thanks.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Tony Lindgren
maintainerPATCH 2/4 mfd: twl4030-power: Add support for board specific configuration
In reply to Tony LindgrenWith the recommended twl4030 configuration added, we can now add board specific changes as modifications to the recommended configuration.
--- drivers/mfd/twl4030-power.c | 21 +++++++++++++++++++++ include/linux/i2c/twl.h | 1 + 2 files changed, 22 insertions(+)
drivers/mfd/twl4030-power.c +21 -0
@@ -511,13 +511,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
@@ -659,6 +659,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
PATCH 2/4 mfd: twl4030-power: Add support for board specific configuration
Quoted 27 lines
With the recommended twl4030 configuration added, we can now add board specific changes as modifications to the recommended configuration.
Cc Peter De Schrijver <[email protected]>Cc Samuel Ortiz <[email protected]>Cc Lee Jones <[email protected]>Signed-off-by Tony Lindgren <[email protected]>--- drivers/mfd/twl4030-power.c | 21 +++++++++++++++++++++ include/linux/i2c/twl.h | 1 + 2 files changed, 22 insertions(+)drivers/mfd/twl4030-power.c +6
-0@@ -511,13 +511,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; +
drivers/mfd/twl4030-power.c twl4030_power_configure_scripts(const struct twl4030_power_data *pdata) · line 529
Quoted 10 lines
drivers/mfd/twl4030-power.c +10
-0+while (b->resource) { +if (b->resource == common->resource) { + *common = *b; +break ; + } + b++; + } + common++; + } +}
Forgive my ignorance, as I don't know how 'common' is setup, but we appear to move to the next 'common' reference them immediately dereference it without checking to see if it actually exists. Same with 'b'. What happens if we reach the end of the array? NULL dereference or does the final element always have a NULLed resource attribute?
Quoted 26 lines
drivers/mfd/twl4030-power.c +4
-0static 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@@ -659,6 +659,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
Tony Lindgren
maintainerPATCH 2/4 mfd: twl4030-power: Add support for board specific configuration
Quoted 36 lines · Lee Jones
Quoted 36 lines
With the recommended twl4030 configuration added, we can now add board specific changes as modifications to the recommended configuration.
Cc Peter De Schrijver <[email protected]>Cc Samuel Ortiz <[email protected]>Cc Lee Jones <[email protected]>Signed-off-by Tony Lindgren <[email protected]>--- drivers/mfd/twl4030-power.c | 21 +++++++++++++++++++++ include/linux/i2c/twl.h | 1 + 2 files changed, 22 insertions(+)drivers/mfd/twl4030-power.c +15
-0@@ -511,13 +511,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++; + }
Quoted 8 lines
drivers/mfd/twl4030-power.c twl4030_power_configure_scripts(const struct twl4030_power_data *pdata) · line 529
Quoted 1 line
drivers/mfd/twl4030-power.c +1
-0+}Forgive my ignorance, as I don't know how 'common' is setup, but we appear to move to the next 'common' reference them immediately dereference it without checking to see if it actually exists. Same with 'b'. What happens if we reach the end of the array? NULL dereference or does the final element always have a NULLed resource attribute?
Yes there's always a NULL entry at the end of the list always in this case, and the configured lists are always static in the driver.
Regards,
Tony
Tony Lindgren
maintainerPATCH 3/4 mfd: twl4030power: Add a configuration to turn off oscillator during off-idle
In reply to Tony LindgrenSome 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.
--- .../devicetree/bindings/mfd/twl4030-power.txt | 6 ++++++ drivers/mfd/twl4030-power.c | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+)
Documentation/devicetree/bindings/mfd/twl4030-power.txt +6 -0
@@ -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 +19 -0
@@ -777,6 +777,21 @@ 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[] = { + { .resource =RES_CLKEN , .devgroup =DEV_GRP_P1 |DEV_GRP_P3 , + .type =3 , .type2 =2 , .remap_off =TWL_REMAP_OFF , + .remap_sleep =TWL_REMAP_SLEEP , }, + {/* 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" ,
@@ -786,6 +801,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
PATCH 3/4 mfd: twl4030power: Add a configuration to turn off oscillator during off-idle
Quoted 7 lines
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.
Quoted 7 lines
Cc Peter De Schrijver <[email protected]>Cc Samuel Ortiz <[email protected]>Cc Lee Jones <[email protected]>Signed-off-by Tony Lindgren <[email protected]>--- .../devicetree/bindings/mfd/twl4030-power.txt | 6 ++++++ drivers/mfd/twl4030-power.c | 19 +++++++++++++++++++
Code in drivers/mfd looks scruffy but fine:
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Tony Lindgren
maintainerPATCH 4/4 ARM: dts: Enable twl4030 off-idle configuration for selected omaps
In reply to Tony LindgrenAt least N900 now seems to shut down the external oscillator when hitting off-idle.
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-evm-common.dtsi | 7 +++++++ arch/arm/boot/dts/omap3-n900.dts | 5 +++++ 2 files changed, 12 insertions(+)
arch/arm/boot/dts/omap3-evm-common.dtsi +7 -0
@@ -45,6 +45,13 @@ #include "twl4030.dtsi" #include "twl4030_omap3.dtsi" +&twl { + twl_power: power { + compatible = "ti,twl4030-power-idle"; + ti,use_poweroff; + }; +}; + &i2c2 { clock-frequency = <400000>; };
arch/arm/boot/dts/omap3-n900.dts +5 -0
@@ -269,6 +269,11 @@ compatible = "ti,twl4030-audio"; ti,enable-vibra = <1>; }; + + twl_power: power { + compatible = "ti,twl4030-power-idle-osc-off"; + ti,use_poweroff; + }; }; &twl_gpio {
Signature · 1 line
1.8.1.1
Tony Lindgren
maintainerPATCH 1/1 mfd: twl4030-power: Add generic reset configuration
In reply to Tony LindgrenThe 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/144161.html
For more information about twl4030 configuration for the "power scripts" see:
http://www.omappedia.com/wiki/TWL4030_power_scripts
---
Sorry this got accidentally left out, should be the first patch in the series.
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 +62 -13
121 lines not on this page · raw message
PATCH 1/1 mfd: twl4030-power: Add generic reset configuration
Quoted 38 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/144161.html
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]>Signed-off-by Tony Lindgren <[email protected]>---
Sorry this got accidentally left out, should be the first patch in the series.
Documentation/devicetree/bindings/mfd/twl4030-power.txt +0
-0
Documentation/devicetree/bindings/mfd/twl4030-power.txt to control the power resources, including power scripts. For now, the · line 11
Quoted 8 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt +4
-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" +
I think it'll be sensible to wait for a DT Ack for this kind of change.
Documentation/devicetree/bindings/mfd/twl4030-power.txt to control the power resources, including power scripts. For now, the
Quoted 12 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt +12
-0+#ifdef CONFIG_OF + +/* Generic warm reset configuration for omap3 */ + +static struct twl4030_ins omap3_wrst_seq[] = { + { MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_OFF), 2 }, + { MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_WRST), 15 }, + { MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_WRST), 15 }, + { MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_WRST), 0x60 }, + { MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 2 }, + { MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_ACTIVE), 2 }, +};
Nit: I'd prefer the number formatting to be unified here i.e. all in the same base, all <0x10 with leading zero.
Quoted 9 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt +9
-0+static struct twl4030_script omap3_wrst_script = { + .script = omap3_wrst_seq, + .size = ARRAY_SIZE(omap3_wrst_seq), + .flags = TWL4030_WRST_SCRIPT, +}; + +static struct twl4030_script *omap3_reset_scripts[] = { + &omap3_wrst_script, +};
Documentation/devicetree/bindings/mfd/twl4030-power.txt
Quoted 10 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt +10
-0+ +static struct twl4030_resconfig omap3_rconfig[] = { + { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3, .type = -1, + .type2 = -1 }, + { .resource = RES_VDD1, .devgroup = DEV_GRP_P1, .type = -1, + .type2 = -1 }, + { .resource = RES_VDD2, .devgroup = DEV_GRP_P1, .type = -1, + .type2 = -1 }, + { 0, 0}, +};
Nit: May be just my OCD, but this looks a little messy. Perhaps a simple MACRO might tidy things up, although that seems a little over-kill for such a small sturct[]. At the very least least please even up the brackets in the sentinel.
/me goes to organise his soup tins into alphabetical order.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Tony Lindgren
maintainerPATCH 1/1 mfd: twl4030-power: Add generic reset configuration
Quoted 40 lines · Lee Jones
Quoted 40 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/144161.html
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]>Signed-off-by Tony Lindgren <[email protected]>---
Sorry this got accidentally left out, should be the first patch in the series.
Documentation/devicetree/bindings/mfd/twl4030-power.txt +0
-0@@ -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.
Quoted 9 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt to control the power resources, including power scripts. For now, the · line 11
Quoted 6 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt +4
-1Required properties: -- compatible : must be "ti,twl4030-power" +- compatible : must be one of the following + "ti,twl4030-power" + "ti,twl4030-power-reset" +I think it'll be sensible to wait for a DT Ack for this kind of change.
Sure. This could also be board specific, for example something like ti,twl4030-power-n900, ti,twl4030-power-panda-es and so on. But I think we can get away with just a few generic configurations.
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt +7
-0+#ifdef CONFIG_OF + +/* Generic warm reset configuration for omap3 */ + +static struct twl4030_ins omap3_wrst_seq[] = { + { MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_OFF), 2 }, + { MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_WRST), 15 },
Quoted 8 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt
Quoted 5 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt +5
-0+ { MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_WRST), 15 }, + { MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_WRST), 0x60 }, + { MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 2 }, + { MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_ACTIVE), 2 }, +};Nit: I'd prefer the number formatting to be unified here i.e. all in the same base, all <
0x10with leading zero.
Thanks will check those.
Quoted 16 lines
Quoted 16 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt +16
-0+static struct twl4030_script omap3_wrst_script = { + .script = omap3_wrst_seq, + .size = ARRAY_SIZE(omap3_wrst_seq), + .flags = TWL4030_WRST_SCRIPT, +}; + +static struct twl4030_script *omap3_reset_scripts[] = { + &omap3_wrst_script, +}; + +static struct twl4030_resconfig omap3_rconfig[] = { + { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3, .type = -1, + .type2 = -1 }, + { .resource = RES_VDD1, .devgroup = DEV_GRP_P1, .type = -1, + .type2 = -1 }, + { .resource = RES_VDD2, .devgroup = DEV_GRP_P1, .type = -1,
Quoted 8 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt
Quoted 3 lines
Documentation/devicetree/bindings/mfd/twl4030-power.txt +3
-0+ .type2 = -1 }, + { 0, 0}, +};Nit: May be just my OCD, but this looks a little messy. Perhaps a simple MACRO might tidy things up, although that seems a little over-kill for such a small sturct[]. At the very least least please even up the brackets in the sentinel.
Yeah I was thinking about that too, but from configuring things point of view it's essential to see what each entry is doing. Having a macro with lots of parameters would make it a bit hard to read the actual configuration. The macro would be something like for the above:
RCONFIG(RES_HFCLKOUT, DEV_GRP_P3, -1, -1, 0, 0);RCONFIG(RES_VDD1, DEV_GRP_P1, -1, -1, 0, 0);RCONFIG(RES_VDD2, DEV_GRP_P1, -1, -1, 0, 0);
and something like this for other entries:
RCONFIG(RES_VAUX1, DEV_GRP_NULL, 0, 0, TWL_REMAP_OFF, TWL_REMAP_SLEEP);
Personally I think it actually makes it harder to figure out what is getting configured for the twl4030 as then it does not relate to the documentation any longer, but I'm fine doing that if people prefer macros here. Using macros could also be done later without as it's all private to the driver.
Quoted 1 line
/me goes to organise his soup tins into alphabetical order.
I think using macros is a good comment, I always found the twl4030 configuration confusing. So if anybody has good macro ideas, I'm open to it for sure. In this it's more like adding custom labels to soup tins about their list of ingredients instead of sorting the tins :) And it does not make the contents taste much better..
Regards,
Tony