* [PATCH v4] ARM: omap2: twl-common: Add default power configuration
@ 2013-04-03 12:31 Peter Ujfalusi
2013-04-03 15:43 ` Tony Lindgren
0 siblings, 1 reply; 2+ messages in thread
From: Peter Ujfalusi @ 2013-04-03 12:31 UTC (permalink / raw)
To: Tony Lindgren; +Cc: linux-omap, linux-arm-kernel, Matthias Brugger
From: Matthias Brugger <matthias.bgg@gmail.com>
This patch adds a generic power script configuration.
When rebooting an OMAP3530 at 125 MHz, the reboot hangs.
With the generic power script, TWL4030 will be reset
when a warm reset occures. This way the OMAP3530 does not
hang on reboot.
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
Tony, Matthias,
Changes since v3:
- remove the __initdata from all the structures introduced by this patch
If it is OK, I'll send a pull with this patch.
Regards,
Peter
arch/arm/mach-omap2/twl-common.c | 38 ++++++++++++++++++++++++++++++++++++++
arch/arm/mach-omap2/twl-common.h | 1 +
2 files changed, 39 insertions(+)
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 51e138c..a85531e 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -121,6 +121,41 @@ static struct twl4030_audio_data omap3_audio_pdata = {
.codec = &omap3_codec,
};
+static struct twl4030_ins 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},
+};
+
+static struct twl4030_script wrst_script = {
+ .script = wrst_seq,
+ .size = ARRAY_SIZE(wrst_seq),
+ .flags = TWL4030_WRST_SCRIPT,
+};
+
+static struct twl4030_script *omap3_power_scripts[] = {
+ &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,
+ .type2 = -1 },
+ { 0, 0},
+};
+
+static struct twl4030_power_data omap3_power_pdata = {
+ .scripts = omap3_power_scripts,
+ .num = ARRAY_SIZE(omap3_power_scripts),
+ .resource_config = omap3_rconfig,
+};
+
static struct regulator_consumer_supply omap3_vdda_dac_supplies[] = {
REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
};
@@ -225,6 +260,9 @@ void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->audio)
pmic_data->audio = &omap3_audio_pdata;
+ if (pdata_flags & TWL_COMMON_PDATA_POWER && !pmic_data->power)
+ pmic_data->power = &omap3_power_pdata;
+
/* Common regulator configurations */
if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
pmic_data->vdac = &omap3_vdac_idata;
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h
index 24b65d0..b64590b8 100644
--- a/arch/arm/mach-omap2/twl-common.h
+++ b/arch/arm/mach-omap2/twl-common.h
@@ -7,6 +7,7 @@
#define TWL_COMMON_PDATA_BCI (1 << 1)
#define TWL_COMMON_PDATA_MADC (1 << 2)
#define TWL_COMMON_PDATA_AUDIO (1 << 3)
+#define TWL_COMMON_PDATA_POWER (1 << 4)
/* Common LDO regulators for TWL4030/TWL6030 */
#define TWL_COMMON_REGULATOR_VDAC (1 << 0)
--
1.8.1.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v4] ARM: omap2: twl-common: Add default power configuration
2013-04-03 12:31 [PATCH v4] ARM: omap2: twl-common: Add default power configuration Peter Ujfalusi
@ 2013-04-03 15:43 ` Tony Lindgren
0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2013-04-03 15:43 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: linux-omap, linux-arm-kernel, Matthias Brugger
* Peter Ujfalusi <peter.ujfalusi@ti.com> [130403 05:36]:
> From: Matthias Brugger <matthias.bgg@gmail.com>
>
> This patch adds a generic power script configuration.
> When rebooting an OMAP3530 at 125 MHz, the reboot hangs.
> With the generic power script, TWL4030 will be reset
> when a warm reset occures. This way the OMAP3530 does not
> hang on reboot.
>
> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> Tony, Matthias,
>
> Changes since v3:
> - remove the __initdata from all the structures introduced by this patch
>
> If it is OK, I'll send a pull with this patch.
Well I was wondering if you have checked what happens if you re-init
the driver via /sys? Is this safe to do?
Regards,
Tony
> arch/arm/mach-omap2/twl-common.c | 38 ++++++++++++++++++++++++++++++++++++++
> arch/arm/mach-omap2/twl-common.h | 1 +
> 2 files changed, 39 insertions(+)
>
> diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
> index 51e138c..a85531e 100644
> --- a/arch/arm/mach-omap2/twl-common.c
> +++ b/arch/arm/mach-omap2/twl-common.c
> @@ -121,6 +121,41 @@ static struct twl4030_audio_data omap3_audio_pdata = {
> .codec = &omap3_codec,
> };
>
> +static struct twl4030_ins 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},
> +};
> +
> +static struct twl4030_script wrst_script = {
> + .script = wrst_seq,
> + .size = ARRAY_SIZE(wrst_seq),
> + .flags = TWL4030_WRST_SCRIPT,
> +};
> +
> +static struct twl4030_script *omap3_power_scripts[] = {
> + &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,
> + .type2 = -1 },
> + { 0, 0},
> +};
> +
> +static struct twl4030_power_data omap3_power_pdata = {
> + .scripts = omap3_power_scripts,
> + .num = ARRAY_SIZE(omap3_power_scripts),
> + .resource_config = omap3_rconfig,
> +};
> +
> static struct regulator_consumer_supply omap3_vdda_dac_supplies[] = {
> REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
> };
> @@ -225,6 +260,9 @@ void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
> if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->audio)
> pmic_data->audio = &omap3_audio_pdata;
>
> + if (pdata_flags & TWL_COMMON_PDATA_POWER && !pmic_data->power)
> + pmic_data->power = &omap3_power_pdata;
> +
> /* Common regulator configurations */
> if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
> pmic_data->vdac = &omap3_vdac_idata;
> diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h
> index 24b65d0..b64590b8 100644
> --- a/arch/arm/mach-omap2/twl-common.h
> +++ b/arch/arm/mach-omap2/twl-common.h
> @@ -7,6 +7,7 @@
> #define TWL_COMMON_PDATA_BCI (1 << 1)
> #define TWL_COMMON_PDATA_MADC (1 << 2)
> #define TWL_COMMON_PDATA_AUDIO (1 << 3)
> +#define TWL_COMMON_PDATA_POWER (1 << 4)
>
> /* Common LDO regulators for TWL4030/TWL6030 */
> #define TWL_COMMON_REGULATOR_VDAC (1 << 0)
> --
> 1.8.1.5
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-03 15:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-03 12:31 [PATCH v4] ARM: omap2: twl-common: Add default power configuration Peter Ujfalusi
2013-04-03 15:43 ` Tony Lindgren
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).