Skip to contentSkip to conversation

omap3: pm: Generic TRITON power scripts for OMAP3 based boards

PATCH Superseded Lesly A M 2 participants 5 messages Apr 19, 2010 – May 18, 2010

Subsystems (3)

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Lesly A M

author
#0 lore raw

PATCH v5 3/5 omap3: pm: Generic TRITON power scripts for OMAP3 based boards

This pacth will create the generic TRITON power scripts which can be used by different OMAP3 boards with the same power companion chip (TWL4030 series).

Added the api(twl4030_get_scripts/twl4030_get_vc_timings) to update the sleep/wakeup/warm_rest sequence & voltsetup_time in the board file.

Cc Nishanth Menon <[email protected]>
Cc David Derrick <[email protected]>
Cc Samuel Ortiz <[email protected]>
---
 arch/arm/mach-omap2/twl4030.c |  154 +++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/twl4030.h |   15 ++++
 arch/arm/mach-omap2/voltage.c |    5 +-
 3 files changed, 171 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-omap2/twl4030.c
 create mode 100644 arch/arm/mach-omap2/twl4030.h
arch/arm/mach-omap2/twl4030.c new file +154 -0
new file mode 100644
index 0000000..6647156
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ * Lesly A M <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifdef CONFIG_TWL4030_POWER
+
+#include "twl4030.h"
+
+static struct prm_setup_vc twl4030_voltsetup_time = {
+	/* VOLT SETUPTIME for RET */
+	.ret = {
+		.voltsetup1_vdd1 = 0x005B,
+		.voltsetup1_vdd2 = 0x0055,
+		.voltsetup2 = 0x0,
+		.voltoffset = 0x0,
+	},
+	/* VOLT SETUPTIME for OFF */
+	.off = {
+		.voltsetup1_vdd1 = 0x00B3,
+		.voltsetup1_vdd2 = 0x00A0,
+		.voltsetup2 = 0x118,
+		.voltoffset = 0x32,
+	},
+};
+
+/*
+ * Sequence to control the TRITON Power resources,
+ * when the system goes into sleep.
+ * Executed upon P1_P2/P3 transition for sleep.
+ */
+static struct twl4030_ins __initdata sleep_on_seq[] = {
+	/* Broadcast message to put res to sleep */
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+							RES_STATE_SLEEP), 2},
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+							RES_STATE_SLEEP), 2},
+};
+
+static struct twl4030_script sleep_on_script __initdata = {
+	.script	= sleep_on_seq,
+	.size	= ARRAY_SIZE(sleep_on_seq),
+	.flags	= TWL4030_SLEEP_SCRIPT,
+};
+
+/*
+ * Sequence to control the TRITON Power resources,
+ * when the system wakeup from sleep.
+ * Executed upon P1_P2 transition for wakeup.
+ */
+static struct twl4030_ins wakeup_p12_seq[] __initdata = {
+	/* Broadcast message to put res to active */
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+							RES_STATE_ACTIVE), 2},
+};
+
+static struct twl4030_script wakeup_p12_script __initdata = {
+	.script	= wakeup_p12_seq,
+	.size	= ARRAY_SIZE(wakeup_p12_seq),
+	.flags	= TWL4030_WAKEUP12_SCRIPT,
+};
+
+/*
+ * Sequence to control the TRITON Power resources,
+ * when the system wakeup from sleep.
+ * Executed upon P3 transition for wakeup.
+ */
+static struct twl4030_ins wakeup_p3_seq[] __initdata = {
+	/* Broadcast message to put res to active */
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+							RES_STATE_ACTIVE), 2},
+};
+
+static struct twl4030_script wakeup_p3_script __initdata = {
+	.script = wakeup_p3_seq,
+	.size   = ARRAY_SIZE(wakeup_p3_seq),
+	.flags  = TWL4030_WAKEUP3_SCRIPT,
+};
+
+/*
+ * Sequence to reset the TRITON Power resources,
+ * when the system gets warm reset.
+ * Executed upon warm reset signal.
+ */
+static struct twl4030_ins wrst_seq[] __initdata = {
+/*
+ * Reset twl4030.
+ * Reset Main_Ref.
+ * Reset All type2_group2.
+ * Reset VUSB_3v1.
+ * Reset All type2_group1.
+ * Reset RC.
+ * Reenable twl4030.
+ */
+	{MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
+	{MSG_SINGULAR(DEV_GRP_NULL, RES_Main_Ref, RES_STATE_WRST), 2},
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+							RES_STATE_WRST), 2},
+	{MSG_SINGULAR(DEV_GRP_NULL, RES_VUSB_3V1, RES_STATE_WRST), 2},
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+							RES_STATE_WRST), 2},
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_RC, RES_TYPE_ALL, RES_TYPE2_R0,
+							RES_STATE_WRST), 2},
+	{MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
+};
+
+static struct twl4030_script wrst_script __initdata = {
+	.script = wrst_seq,
+	.size   = ARRAY_SIZE(wrst_seq),
+	.flags  = TWL4030_WRST_SCRIPT,
+};
+
+/* TRITON script for sleep, wakeup & warm_reset */
+static struct twl4030_script *twl4030_scripts[] __initdata = {
+	&sleep_on_script,
+	&wakeup_p12_script,
+	&wakeup_p3_script,
+	&wrst_script,
+};
+
+static struct twl4030_power_data twl4030_generic_script __initdata = {
+	.scripts	= twl4030_scripts,
+	.num		= ARRAY_SIZE(twl4030_scripts),
+};
+
+void twl4030_get_scripts(struct twl4030_power_data *t2scripts_data)
+{
+	t2scripts_data->scripts = twl4030_generic_script.scripts;
+	t2scripts_data->num = twl4030_generic_script.num;
+}
+
+void twl4030_get_vc_timings(struct prm_setup_vc *setup_vc)
+{
+	/* copies new voltsetup time for RERT */
+	setup_vc->ret.voltsetup1_vdd1 =
+				twl4030_voltsetup_time.ret.voltsetup1_vdd1;
+	setup_vc->ret.voltsetup1_vdd2 =
+				twl4030_voltsetup_time.ret.voltsetup1_vdd2;
+	setup_vc->ret.voltsetup2 = twl4030_voltsetup_time.ret.voltsetup2;
+	setup_vc->ret.voltoffset = twl4030_voltsetup_time.ret.voltoffset;
+
+	/* copies new voltsetup time for OFF */
+	setup_vc->off.voltsetup1_vdd1 =
+				twl4030_voltsetup_time.off.voltsetup1_vdd1;
+	setup_vc->off.voltsetup1_vdd2 =
+				twl4030_voltsetup_time.off.voltsetup1_vdd2;
+	setup_vc->off.voltsetup2 = twl4030_voltsetup_time.off.voltsetup2;
+	setup_vc->off.voltoffset = twl4030_voltsetup_time.off.voltoffset;
+}
+#endif
arch/arm/mach-omap2/twl4030.h new file +15 -0
new file mode 100644
index 0000000..3a7da2d
@@ -0,0 +1,15 @@
+#ifndef __ARCH_ARM_MACH_OMAP3_TWL4030_SCRIPT_H
+#define __ARCH_ARM_MACH_OMAP3_TWL4030_SCRIPT_H
+
+#include <linux/i2c/twl.h>
+#include "voltage.h"
+
+#ifdef CONFIG_TWL4030_POWER
+extern void twl4030_get_scripts(struct twl4030_power_data *t2scripts_data);
+extern void twl4030_get_vc_timings(struct prm_setup_vc *setup_vc);
+#else
+extern void twl4030_get_scripts(struct twl4030_power_data *t2scripts_data) {}
+extern void twl4030_get_vc_timings(struct prm_setup_vc *setup_vc) {}
+#endif
+
+#endif
arch/arm/mach-omap2/voltage.c +2 -3
index bb80631..fba7007 100644
@@ -888,9 +888,8 @@ void __init omap_voltage_init_vc(struct prm_setup_vc *setup_vc)
 	if (!setup_vc)
 		return;
 
-	/* CLK SETUPTIME for RET & OFF */
-	vc_config.ret.clksetup = setup_vc->ret.clksetup;
-	vc_config.off.clksetup = setup_vc->off.clksetup;
+	/* CLK & VOLT SETUPTIME for RET & OFF */
+	memcpy(&vc_config, setup_vc, 2 * sizeof(struct setuptime_vc));
 }
 
 void omap_voltage_vc_update(int core_next_state)
Signature · 1 line
1.6.0.4
#1 lore raw
Quoted 6 lines · ext Lesly A M

This pacth will create the generic TRITON power scripts which can be used by different OMAP3 boards with the same power companion chip (TWL4030 series).

Added the api(twl4030_get_scripts/twl4030_get_vc_timings) to update the sleep/wakeup/warm_rest sequence & voltsetup_time in the board file.

any reason why you use a different type for the messages sent for P3 and P1/P2 transitions ?

Quoted 25 lines
arch/arm/mach-omap2/twl4030.c new file +25 -0
+/*
+ * Sequence to control the TRITON Power resources,
+ * when the system goes into sleep.
+ * Executed upon P1_P2/P3 transition for sleep.
+ */
+static struct twl4030_ins __initdata sleep_on_seq[] = {
+	/* Broadcast message to put res to sleep */
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+							RES_STATE_SLEEP), 2},
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+							RES_STATE_SLEEP), 2},
+};
+
+static struct twl4030_script sleep_on_script __initdata = {
+	.script	= sleep_on_seq,
+	.size	= ARRAY_SIZE(sleep_on_seq),
+	.flags	= TWL4030_SLEEP_SCRIPT,
+};
+
+/*
+ * Sequence to control the TRITON Power resources,
+ * when the system wakeup from sleep.
+ * Executed upon P1_P2 transition for wakeup.
+ */
+static struct twl4030_ins wakeup_p12_seq[] __initdata = {

arch/arm/mach-omap2/twl4030.c line 65

Quoted 10 lines
arch/arm/mach-omap2/twl4030.c new file +10 -0
+	/* Broadcast message to put res to active */
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+							RES_STATE_ACTIVE), 2},
+};
+
+static struct twl4030_script wakeup_p12_script __initdata = {
+	.script	= wakeup_p12_seq,
+	.size	= ARRAY_SIZE(wakeup_p12_seq),
+	.flags	= TWL4030_WAKEUP12_SCRIPT,
+};

Cheers,

Peter.

Signature · 1 line
goa is a state of mind
#2 lore raw

RE: [PATCH v5 3/5] omap3: pm: Generic TRITON power scripts forOMAP3 based boards

Quoted 24 lines

-----Original Message-----
From: Peter 'p2' De Schrijver [mailto:[email protected]]
Sent: Monday, May 10, 2010 8:01 PM
To: Lesly A M
Cc: [email protected]; Lesly A M; Nishanth Menon; David Derrick; Samuel Ortiz
Subject: Re: [PATCH v5 3/5] omap3: pm: Generic TRITON power scripts forOMAP3 based boards

Quoted 1 line · ext Lesly A M

This pacth will create the generic TRITON power scripts which can be

used

Quoted 1 line

by different OMAP3 boards with the same power companion chip (TWL4030

series).

Quoted 4 lines

Added the api(twl4030_get_scripts/twl4030_get_vc_timings) to update the sleep/wakeup/warm_rest sequence & voltsetup_time in the board file.

any reason why you use a different type for the messages sent for P3 and P1/P2
transitions ?

Quoted 9 lines

arch/arm/mach-omap2/twl4030.c

Quoted 9 lines
arch/arm/mach-omap2/twl4030.c new file +9 -0
+/*
+ * Sequence to control the TRITON Power resources,
+ * when the system goes into sleep.
+ * Executed upon P1_P2/P3 transition for sleep.
+ */
+static struct twl4030_ins __initdata sleep_on_seq[] = {
+	/* Broadcast message to put res to sleep */
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+							RES_STATE_SLEEP),

2},

Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+							RES_STATE_SLEEP),

2},

Quoted 9 lines
Quoted 9 lines
arch/arm/mach-omap2/twl4030.c new file +9 -0
+};
+
+static struct twl4030_script sleep_on_script __initdata = {
+	.script	= sleep_on_seq,
+	.size	= ARRAY_SIZE(sleep_on_seq),
+	.flags	= TWL4030_SLEEP_SCRIPT,
+};
+
+/*
Quoted 8 lines

arch/arm/mach-omap2/twl4030.c

Quoted 8 lines

+ * Sequence to control the TRITON Power resources,
+ * when the system wakeup from sleep.
+ * Executed upon P1_P2 transition for wakeup.
+ */

arch/arm/mach-omap2/twl4030.c new file +4 -0
+static struct twl4030_ins wakeup_p12_seq[] __initdata = {
+	/* Broadcast message to put res to active */
+	{MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+							RES_STATE_ACTIVE),

2},

Quoted 10 lines

arch/arm/mach-omap2/twl4030.c line 65

Quoted 7 lines
arch/arm/mach-omap2/twl4030.c new file +7 -0
+};
+
+static struct twl4030_script wakeup_p12_script __initdata = {
+	.script	= wakeup_p12_seq,
+	.size	= ARRAY_SIZE(wakeup_p12_seq),
+	.flags	= TWL4030_WAKEUP12_SCRIPT,
+};

Cheers,
Peter.

Hi Peter,

The RES_TYPE field is same for all messages.

The resource which can go to low-power mode with clk_req sig de-asserting is configured as RES_TYPE2 = '2'. And the resource which can go to low-power mode with sys_off sig de-asserting is configured as RES_TYPE2 = '1'.

The RES_TYPE2 is '2' for P3 wakeup and the msg will applicable for Resource which have their TYPE2 field configured '2' (RES_VINTANA1, RES_VINTANA2, RES_VINTDIG, VIO, RES_CLKEN, RES_HFCLKOUT).

RES_TYPE2 = '1' for P1_P2 wakeup.
(Applicable for res: RES_VPLL1, RES_VDD1, RES_VDD2, RES_REGEN, RES_NRES_PWRON, RES_SYSEN)

Regards,
Lesly A M

#3 lore raw

Re: [PATCH v5 3/5] omap3: pm: Generic TRITON power scripts forOMAP3 based boards

Hi,

Quoted 9 lines

Hi Peter,

The RES_TYPE field is same for all messages.

The resource which can go to low-power mode with clk_req sig de-asserting is configured as RES_TYPE2 = '2'. And the resource which can go to low-power mode with sys_off sig de-asserting is configured as RES_TYPE2 = '1'.

Quoted 8 lines

The RES_TYPE2 is '2' for P3 wakeup and the msg will applicable for Resource which have their TYPE2 field configured '2' (RES_VINTANA1, RES_VINTANA2, RES_VINTDIG, VIO, RES_CLKEN, RES_HFCLKOUT).

RES_TYPE2 = '1' for P1_P2 wakeup.
(Applicable for res: RES_VPLL1, RES_VDD1, RES_VDD2, RES_REGEN, RES_NRES_PWRON, RES_SYSEN)

Ok. But why not just assign the resources to the appropriate groups ? Eg. assign VIO to P3 and assign VPLL1 to P1_P2 ? Then you only need one message type. Also, why are you using RES_TYPE2 instead of RES_TYPE ?

Cheers,

Peter.

Signature · 1 line
goa is a state of mind
#4 lore raw

RE: [PATCH v5 3/5] omap3: pm: Generic TRITON power scriptsforOMAP3 based boards

Quoted 29 lines

-----Original Message-----
From: Peter 'p2' De Schrijver [mailto:[email protected]]
Sent: Monday, May 17, 2010 4:29 PM
To: ext Lesly Arackal Manuel
Cc: [email protected]; 'Lesly A M'; 'Nishanth Menon'; 'David Derrick'; 'Samuel Ortiz'
Subject: Re: [PATCH v5 3/5] omap3: pm: Generic TRITON power scriptsforOMAP3 based boards

Hi,

Quoted 6 lines

Hi Peter,

The RES_TYPE field is same for all messages.

The resource which can go to low-power mode with clk_req sig de-

asserting is

Quoted 1 line

configured as RES_TYPE2 = '2'. And the resource which can go to low-

power

Quoted 3 lines

mode with sys_off sig de-asserting is configured as RES_TYPE2 = '1'.

The RES_TYPE2 is '2' for P3 wakeup and the msg will applicable for

Resource

Quoted 3 lines

which have their TYPE2 field configured '2' (RES_VINTANA1, RES_VINTANA2, RES_VINTDIG, VIO, RES_CLKEN, RES_HFCLKOUT).

Quoted 9 lines
Quoted 4 lines

RES_TYPE2 = '1' for P1_P2 wakeup.
(Applicable for res: RES_VPLL1, RES_VDD1, RES_VDD2, RES_REGEN, RES_NRES_PWRON, RES_SYSEN)

Ok. But why not just assign the resources to the appropriate groups ? Eg. assign VIO to P3 and assign VPLL1 to P1_P2 ? Then you only need one message type. Also, why are you using RES_TYPE2 instead of RES_TYPE ?

Hi Peter,

This sequence is recommended by the Hardware team.

Because some resource have non-zero reset values for RES_TYPE, and may be used in some other seq (eg: power_up).

Regards,
Lesly A M