Support TPS65023 with AM35x
v2 cover Support TPS65023 with AM35x
This is a revised set of patches for getting the current AM3517 with TPS65023 working.
The patch may not apply cleanly on the latest master; but should be able to give clear list of changes (and hacks) that were necessary to make the combination work.
Since, there is a parallel effort for clean-up of voltage layer, attempt to rebase against new baseline would only delay the intended feedback.
Sanjeev Premi (2):
OMAP3: Add support for TPS65023 (AM35x only)
AM35x: voltage: Basic initialization
arch/arm/mach-omap2/Makefile | 3 +- arch/arm/mach-omap2/pm.c | 1 + arch/arm/mach-omap2/pm.h | 9 +++ arch/arm/mach-omap2/pmic_tps65023.c | 82 ++++++++++++++++++++++++++ arch/arm/mach-omap2/voltage.c | 110 ++++++++++++++++++++++++++++++++++- 5 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-omap2/pmic_tps65023.c
Signature · 1 line
1.7.2.2
RFC v2 1/2 OMAP3: Add support for TPS65023 (AM35x only)
This patch adds support for TPS65023 used with
OMAP3 devices. The PMIC is currently hooked to
AM35x devices, but can easily be extended for
other OMAP3 devices.
--- arch/arm/mach-omap2/Makefile | 3 +- arch/arm/mach-omap2/pm.c | 1 + arch/arm/mach-omap2/pm.h | 9 ++++ arch/arm/mach-omap2/pmic_tps65023.c | 82 +++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-omap2/pmic_tps65023.c
arch/arm/mach-omap2/Makefile +2 -1
@@ -19,7 +19,8 @@ obj-$(CONFIG_ARCH_TI81XX) += $(omap-2-3-common) $(hwmod-common) obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o -obj-$(CONFIG_TWL4030_CORE) += omap_twl.o +obj-$(CONFIG_TWL4030_CORE) += omap_twl.o +obj-$(CONFIG_REGULATOR_TPS65023) += pmic_tps65023.o # SMP support ONLY available for OMAP4 obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o
arch/arm/mach-omap2/pm.c +1 -0
@@ -366,6 +366,7 @@ static int __init omap2_common_pm_late_init(void)/* Init the OMAP TWL parameters */ omap3_twl_init ();omap4_twl_init (); +omap3_tps65023_init ();/* Init the voltage layer */ omap_voltage_late_init ();
arch/arm/mach-omap2/pm.h +9 -0
@@ -139,6 +139,15 @@ static inline int omap4_twl_init(void) }#endif +#ifdef CONFIG_REGULATOR_TPS65023 +extern int omap3_tps65023_init (void ); +#else +static inline int omap3_tps65023_init (void ) +{ +return -EINVAL ; +} +#endif +#ifndef CONFIG_SUSPEND #define omap_pm_ops NULL#endif
arch/arm/mach-omap2/pmic_tps65023.c new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
1.7.2.2
RFC v2 2/2 AM35x: voltage: Basic initialization
In reply to Sanjeev PremiThis patch adds the basic initialization of voltage layer for AM35x. Since AM35x doesn't support voltage scaling, Many functions emply fucntions have been defined to plug into existing voltage layer.
--- arch/arm/mach-omap2/voltage.c | 110 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 109 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/voltage.c +109 -1
@@ -260,6 +260,40 @@ static struct omap_vdd_info omap3_vdd_info[] = {#define OMAP3_NR_SCALABLE_VDD ARRAY_SIZE(omap3_vdd_info) +/* +* AM35x VDD structures +* +* In AM35x there neither scalable voltage domain nor any hook-up with +* voltage controller/processor. However, when trying to re-use the hwmod +* database for OMAP3, definition of "core" voltage domain is necessary. +* Else, changes in hwmod data structures grow spirally. +* +* As a workaround, "core" voltage domain is defined below. The definition +* doesn't lead to any side-effects. +*/ +static struct omap_vdd_info am3517_vdd_info[] = { + { + .dep_vdd_info =NULL , + .nr_dep_vdd =0 , + .vp_enabled = false, + + .voltdm = { + .name ="mpu" , + }, + }, + { + .dep_vdd_info =NULL , + .nr_dep_vdd =0 , + .vp_enabled = false, + + .voltdm = { + .name ="core" , + }, + }, +}; + +#define AM3517_NR_SCALABLE_VDD ARRAY_SIZE(am3517_vdd_info) +/* OMAP4 VDD sturctures */ static struct omap_vdd_info omap4_vdd_info[] = { {
@@ -374,6 +408,15 @@ static struct omap_volt_data omap44xx_vdd_core_volt_data[] = { VOLT_DATA_DEFINE(0, 0, 0, 0), }; +/* AM35x +* +* Fields related to SmartReflex and Voltage Processor are set to 0. +*/ +static struct omap_volt_data am35xx_vdd_volt_data[] = { +VOLT_DATA_DEFINE (OMAP3430_VDD_MPU_OPP3_UV ,0x0 ,0x0 ,0x0 ), +VOLT_DATA_DEFINE (0 ,0 ,0 ,0 ), +}; +/* OMAP 3430 MPU Core VDD dependency table */ static struct omap_vdd_dep_volt omap34xx_vdd1_vdd2_data[] = { {.main_vdd_volt =975000 , .dep_vdd_volt =1050000 },
@@ -399,6 +442,12 @@ static void (*vp_init) (struct omap_vdd_info *vdd);static int (*vdd_data_configure) (struct omap_vdd_info *vdd); +static int volt_scale_nop (struct omap_vdd_info *vdd, +unsigned long target_volt) +{ +return 0 ; +} +static u32 omap3_voltage_read_reg (u16 mod,u8 offset) {return omap2_prm_read_mod_reg (mod, offset);
@@ -1019,6 +1068,45 @@ static int __init omap3_vdd_data_configure(struct omap_vdd_info *vdd)return 0 ; } +/** +*Setup VDD related information for AM35x processors +*/ +static int __init am3517_vdd_data_configure (struct omap_vdd_info *vdd) +{ +if (!vdd->pmic_info) { +pr_err ("%s: PMIC info requried to configure vdd_%s not" +"populated.Hence cannot initialize vdd_%s\n" , + __func__, vdd->voltdm.name, vdd->voltdm.name); +return -EINVAL ; + } + +if (!strcmp (vdd->voltdm.name,"mpu" ) || + !strcmp (vdd->voltdm.name,"core" )) { + vdd->volt_data = am35xx_vdd_volt_data; + }else { +pr_warning ("%s: vdd_%s does not exist in AM35x\n" , + __func__, vdd->voltdm.name); +return -EINVAL ; + } + +/* Generic voltage parameters */ + vdd->curr_volt =OMAP3430_VDD_MPU_OPP3_UV ; + vdd->ocp_mod =OCP_MOD ; + vdd->prm_irqst_reg =OMAP3_PRM_IRQSTATUS_MPU_OFFSET ; + vdd->read_reg = omap3_voltage_read_reg; + vdd->write_reg = omap3_voltage_write_reg; + vdd->volt_scale = volt_scale_nop; + +/* Init the plist */ +spin_lock_init (&vdd->user_lock); +plist_head_init (&vdd->user_list, &vdd->user_lock); + +/* Init the DVFS mutex */ +mutex_init (&vdd->scaling_mutex); + +return 0 ; +} +/* OMAP4 specific voltage init functions */ static void __init omap4_vc_init (struct omap_vdd_info *vdd) {
@@ -1908,13 +1996,33 @@ int __init omap_voltage_late_init(void) }/** +* AM35x - Empty initialization of voltage controller +*/ +static void __init am3517_vc_init (struct omap_vdd_info *vdd) +{ +} + +/** +* AM35x - Empty initialization of voltage processor +*/ +static void __init am3517_vp_init (struct omap_vdd_info *vdd) +{ +} + +/** * omap_voltage_early_init()- Volatage driver early init */ static int __init omap_voltage_early_init (void ) {int i; -if (cpu_is_omap34xx ()) { +if (cpu_is_omap3505 () ||cpu_is_omap3517 ()) { + vdd_info = am3517_vdd_info; + nr_scalable_vdd =AM3517_NR_SCALABLE_VDD ; + vc_init = am3517_vc_init; + vp_init = am3517_vp_init; + vdd_data_configure = am3517_vdd_data_configure; + }else if (cpu_is_omap34xx ()) { vdd_info = omap3_vdd_info; nr_scalable_vdd =OMAP3_NR_SCALABLE_VDD ; vc_init = omap3_vc_init;
Signature · 1 line
1.7.2.2
RE: [RFCv2 2/2] AM35x: voltage: Basic initialization
Quoted 170 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Sanjeev Premi
Sent: Wednesday, March 16, 2011 1:02 PM
To: [email protected]
Cc: Sanjeev Premi
Subject: [RFCv2 2/2] AM35x: voltage: Basic initializationThis patch adds the basic initialization of voltage layer for AM35x. Since AM35x doesn't support voltage scaling, Many functions emply fucntions have been defined to plug into existing voltage layer.
Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/voltage.c | 110 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 109 insertions(+), 1 deletions(-)arch/arm/mach- renamed from arch/arm/mach-omap2/voltage.c +0
-0
omap2/voltage.c
index 2017dc0..a82a55f 100644arch/arm/mach-omap2/voltage.c +4
-0@@ -260,6 +260,40 @@ static struct omap_vdd_info omap3_vdd_info[] = {#define OMAP3_NR_SCALABLE_VDD ARRAY_SIZE(omap3_vdd_info) +/* +* AM35x VDD structures +* +* In AM35x there neither scalable voltage domain nor any hook-up with
+ * voltage controller/processor. However, when trying to re-use the hwmod
+ * database for OMAP3, definition of "core" voltage domain is necessary.
+ * Else, changes in hwmod data structures grow spirally.
+ *
+ * As a workaround, "core" voltage domain is defined below. The definition
+ * doesn't lead to any side-effects.
+ */arch/arm/mach-omap2/voltage.c +32
-0+static struct omap_vdd_info am3517_vdd_info[] = { + { + .dep_vdd_info =NULL , + .nr_dep_vdd =0 , + .vp_enabled = false, + + .voltdm = { + .name ="mpu" , + }, + }, + { + .dep_vdd_info =NULL , + .nr_dep_vdd =0 , + .vp_enabled = false, + + .voltdm = { + .name ="core" , + }, + }, +}; + +#define AM3517_NR_SCALABLE_VDD ARRAY_SIZE(am3517_vdd_info) +/* OMAP4 VDD sturctures */ static struct omap_vdd_info omap4_vdd_info[] = { {@@ -374,6 +408,15 @@ static struct omap_volt_data omap44xx_vdd_core_volt_data[] = {VOLT_DATA_DEFINE (0 ,0 ,0 ,0 ), }; +/* AM35x +* +* Fields related to SmartReflex and Voltage Processor are set to 0. +*/ +static struct omap_volt_data am35xx_vdd_volt_data[] = { +VOLT_DATA_DEFINE (OMAP3430_VDD_MPU_OPP3_UV ,0x0 ,0x0 ,0x0 ), +VOLT_DATA_DEFINE (0 ,0 ,0 ,0 ), +}; +/* OMAP 3430 MPU Core VDD dependency table */ static struct
omap_vdd_dep_voltomap34xx_vdd1_vdd2_data[] = {arch/arm/mach-omap2/voltage.c +6
-0{.main_vdd_volt = 975000, .dep_vdd_volt = 1050000},@@ -399,6 +442,12 @@ static void (*vp_init) (struct omap_vdd_info *vdd);static int (*vdd_data_configure) (struct omap_vdd_info *vdd); +static int volt_scale_nop (struct omap_vdd_info *vdd, +unsigned long target_volt) +{ +return 0 ; +} +static u32 omap3_voltage_read_reg (u16 mod,u8 offset) {arch/arm/mach-omap2/voltage.c +39
-0return omap2_prm_read_mod_reg (mod, offset);@@ -1019,6 +1068,45 @@ static int __init omap3_vdd_data_configure(struct omap_vdd_info *vdd) return 0; } +/** +*Setup VDD related information for AM35x processors +*/ +static int __init am3517_vdd_data_configure (struct omap_vdd_info *vdd) +{ +if (!vdd->pmic_info) { +pr_err ("%s: PMIC info requried to configure vdd_%s not" +"populated.Hence cannot initialize vdd_%s\n" , + __func__, vdd->voltdm.name, vdd- >voltdm.name); +return -EINVAL ; + } + +if (!strcmp (vdd->voltdm.name,"mpu" ) || + !strcmp (vdd->voltdm.name,"core" )) { + vdd->volt_data = am35xx_vdd_volt_data; + }else { +pr_warning ("%s: vdd_%s does not exist in AM35x\n" , + __func__, vdd->voltdm.name); +return -EINVAL ; + } + +/* Generic voltage parameters */ + vdd->curr_volt =OMAP3430_VDD_MPU_OPP3_UV ; + vdd->ocp_mod =OCP_MOD ; + vdd->prm_irqst_reg =OMAP3_PRM_IRQSTATUS_MPU_OFFSET ; + vdd->read_reg = omap3_voltage_read_reg; + vdd->write_reg = omap3_voltage_write_reg; + vdd->volt_scale = volt_scale_nop; + +/* Init the plist */ +spin_lock_init (&vdd->user_lock); +plist_head_init (&vdd->user_list, &vdd->user_lock); + +/* Init the DVFS mutex */ +mutex_init (&vdd->scaling_mutex); + +return 0 ; +} +/* OMAP4 specific voltage init functions */ static void
__initomap4_vc_init(struct omap_vdd_info *vdd){arch/arm/mach-omap2/voltage.c +14
-0@@ -1908,13 +1996,33 @@ int __init omap_voltage_late_init(void) }/** +* AM35x - Empty initialization of voltage controller +*/ +static void __init am3517_vc_init (struct omap_vdd_info *vdd) +{ +} + +/** +* AM35x - Empty initialization of voltage processor +*/ +static void __init am3517_vp_init (struct omap_vdd_info *vdd) +{ +} + +/** * omap_voltage_early_init()- Volatage driver early init
arch/arm/mach-omap2/voltage.c int __init omap_voltage_late_init(void) · line 2022
Quoted 10 lines
arch/arm/mach-omap2/voltage.c +3
-1*/ static int __init omap_voltage_early_init (void ) {int i; -if (cpu_is_omap34xx ()) { +if (cpu_is_omap3505 () ||cpu_is_omap3517 ()) { + vdd_info = am3517_vdd_info; + nr_scalable_vdd =AM3517_NR_SCALABLE_VDD ;
As you have mentioned that there is no voltage scaling supported, then shoudn't nr_scalable_vdd = 0?
If nr_scalable_vdd is 0, then you probably would not need any other TPS specific changes in Voltage.c as VP and VC initialization itself is skipped.
Vishwa
Quoted 14 lines
arch/arm/mach-omap2/voltage.c +4
-0+ vc_init = am3517_vc_init; + vp_init = am3517_vp_init; + vdd_data_configure = am3517_vdd_data_configure; + }else if (cpu_is_omap34xx ()) { vdd_info = omap3_vdd_info; nr_scalable_vdd =OMAP3_NR_SCALABLE_VDD ;
vc_init=omap3_vc_init;
--
1.7.2.2--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [RFCv2 2/2] AM35x: voltage: Basic initialization
Quoted 21 lines
-----Original Message-----
From: Sripathy, Vishwanath
Sent: Wednesday, March 16, 2011 4:33 PM
To: Premi, Sanjeev; [email protected]
Subject: RE: [RFCv2 2/2] AM35x: voltage: Basic initializationQuoted 15 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Sanjeev Premi
Sent: Wednesday, March 16, 2011 1:02 PM
To: [email protected]
Cc: Sanjeev Premi
Subject: [RFCv2 2/2] AM35x: voltage: Basic initializationThis patch adds the basic initialization of voltage layer for AM35x. Since AM35x doesn't support voltage scaling, Many functions emply fucntions have been defined to plug into existing voltage layer.
Signed-off-by Sanjeev Premi <[email protected]>---
[snip]...[snip]
Quoted 14 lines
Quoted 14 lines
arch/arm/mach-omap2/voltage.c +8
-0+/** +* AM35x - Empty initialization of voltage processor +*/ +static void __init am3517_vp_init (struct omap_vdd_info *vdd) +{ +} + +/** * omap_voltage_early_init()- Volatage driver early init */ static int __init omap_voltage_early_init (void ) {int i;
Quoted 11 lines
Quoted 5 lines
arch/arm/mach-omap2/voltage.c +3
-1-if (cpu_is_omap34xx ()) { +if (cpu_is_omap3505 () ||cpu_is_omap3517 ()) { + vdd_info = am3517_vdd_info; + nr_scalable_vdd =
AM3517_NR_SCALABLE_VDD;As you have mentioned that there is no voltage scaling supported, then shoudn't
nr_scalable_vdd= 0?
Ifnr_scalable_vddis 0, then you probably would not need any other TPS
specific changes inVoltage.cas VP and VC initialization itself is skipped.
[sp] Yes, there is no voltage scaling; but there are two problems in the
flow.
Notice I had this value 0 in previous RFC; and yes I expected the vp and vc to be excluded as you say; however, code isn't really meant to do so.
Few loops using "nr_scalable_vdd" fail as value "0" doesn't meet the entry criteria. This problem is/was easily fixes by an additional if statement.
The things, however, get stuck in HWMOD again when the parent of omap3xxx_l3_main_hwmod is set as "core". Changing this causes another cascade of changes leading to almost duplicating the complete hwmod structure for AM35x.
Easy solution was to set use "core". Rest of the changes in the patch ensure that code flows properly - and there is no scaling.
~sanjeev
Quoted 10 lines
Vishwa
Quoted 8 lines
arch/arm/mach-omap2/voltage.c +4
-1+ vc_init = am3517_vc_init; + vp_init = am3517_vp_init; + vdd_data_configure = am3517_vdd_data_configure; + }else if (cpu_is_omap34xx ()) { vdd_info = omap3_vdd_info; nr_scalable_vdd =OMAP3_NR_SCALABLE_VDD ; vc_init = omap3_vc_init; --
RE: [RFCv2 2/2] AM35x: voltage: Basic initialization
Quoted 70 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Premi, Sanjeev
Sent: Thursday, March 17, 2011 2:01 PM
To: Sripathy, Vishwanath; [email protected]
Cc: Cousson, Benoit; [email protected]
Subject: RE: [RFCv2 2/2] AM35x: voltage: Basic initializationQuoted 21 lines
-----Original Message-----
From: Sripathy, Vishwanath
Sent: Wednesday, March 16, 2011 4:33 PM
To: Premi, Sanjeev; [email protected]
Subject: RE: [RFCv2 2/2] AM35x: voltage: Basic initializationQuoted 15 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Sanjeev Premi
Sent: Wednesday, March 16, 2011 1:02 PM
To: [email protected]
Cc: Sanjeev Premi
Subject: [RFCv2 2/2] AM35x: voltage: Basic initializationThis patch adds the basic initialization of voltage layer for AM35x. Since AM35x doesn't support voltage scaling, Many functions emply fucntions have been defined to plug into existing voltage layer.
Signed-off-by Sanjeev Premi <[email protected]>---
[snip]...[snip]
Quoted 14 lines
Quoted 14 lines
arch/arm/mach-omap2/voltage.c +8
-0+/** +* AM35x - Empty initialization of voltage processor +*/ +static void __init am3517_vp_init (struct omap_vdd_info *vdd) +{ +} + +/** * omap_voltage_early_init()- Volatage driver early init */ static int __init omap_voltage_early_init (void ) {int i;Quoted 6 lines
Quoted 5 lines
arch/arm/mach-omap2/voltage.c +3
-1-if (cpu_is_omap34xx ()) { +if (cpu_is_omap3505 () ||cpu_is_omap3517 ()) { + vdd_info = am3517_vdd_info; + nr_scalable_vdd =
AM3517_NR_SCALABLE_VDD;As you have mentioned that there is no voltage scaling
supported, then
Quoted 5 lines
shoudn't
nr_scalable_vdd= 0?
Ifnr_scalable_vddis 0, then you probably would not need any other TPS
specific changes inVoltage.cas VP and VC initialization itself is skipped.[sp] Yes, there is no voltage scaling; but there are two problems in the
flow.
Notice I had this value 0 in previous RFC; and yes I expected the vp and vc to be excluded as you say; however, code isn't really meant to do so.
Few loops using "nr_scalable_vdd" fail as value "0"
doesn't meet the
entry criteria. This problem is/was easily fixes by an additional if statement.
Quoted 1 line
The things, however, get stuck in HWMOD again when the parent of
[sp] Being more specific:
The parent here refers to "parent" vdd i.e. "vdd_name".
~sanjeev
Quoted 28 lines
omap3xxx_l3_main_hwmodis set as "core". Changing this causes another cascade of changes leading to almost duplicating
the complete
hwmod structure for AM35x.Easy solution was to set use "core". Rest of the changes
in the patch
ensure that code flows properly - and there is no scaling.~sanjeev
Quoted 10 lines
Vishwa
arch/arm/mach-omap2/voltage.c int __init omap_voltage_late_init(void)
Quoted 8 lines
arch/arm/mach-omap2/voltage.c +4
-1+ vc_init = am3517_vc_init; + vp_init = am3517_vp_init; + vdd_data_configure = am3517_vdd_data_configure; + }else if (cpu_is_omap34xx ()) { vdd_info = omap3_vdd_info; nr_scalable_vdd =OMAP3_NR_SCALABLE_VDD ; vc_init = omap3_vc_init; ----
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [RFCv2 2/2] AM35x: voltage: Basic initialization
Quoted 11 lines · Sanjeev
Quoted 1 line
The things, however, get stuck in HWMOD again when the parent of
[sp] Being more specific:
The parent here refers to "parent" vdd i.e. "vdd_name".~sanjeev
Quoted 4 lines
omap3xxx_l3_main_hwmodis set as "core". Changing this causes another cascade of changes leading to almost duplicating
the complete
hwmod structure for AM35x.
There shouldn't be any vdd_name entries set in the hwmod data. That struct omap_hwmod field will be removed.
Instead, voltage domain data should be associated with the powerdomain.
Kevin has patches for some of this forthcoming.
- Paul