omap smps regulator support
Subsystems (3)
v10 cover omap smps regulator support
Hi,
Just some cosmetic changes compared to previous version:
- dropped out '[patchv9 4/5] regulator: twl4030: add support for external controller', as this was accepted for merge by Mark
- changed names of regulators from VDD1 / VDD2 -> vdd_mpu_iva / vdd_core in patch 3
- added document codes for TWL data manuals used as reference to commit log in patch 3
-Tero
PATCH v10 1/4 TEMP: OMAP3: beagle rev-c4: enable OPP6
Beagleboard rev-c4 has a speed sorted OMAP3530 chip which can run at 720MHz.
--- arch/arm/mach-omap2/board-omap3beagle.c | 29 +++++++++++++++++++++++++++++ arch/arm/mach-omap2/opp3xxx_data.c | 4 ++++ 2 files changed, 33 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-omap3beagle.c +29 -0
@@ -484,6 +484,35 @@ static void __init beagle_opp_init(void)return ; } +if (omap3_beagle_version ==OMAP3BEAGLE_BOARD_C4 ) { +struct device *mpu_dev, *iva_dev; + + mpu_dev =omap_device_get_by_hwmod_name ("mpu" ); + iva_dev =omap_device_get_by_hwmod_name ("iva" ); + +if (!mpu_dev || !iva_dev) { +pr_err ("%s: Aiee.. no mpu/dsp devices? %p %p\n" , + __func__, mpu_dev, iva_dev); +return ; + } +/* Enable MPU 720MHz opp */ + r =opp_enable (mpu_dev,720000000 ); + +/* Enable IVA 520MHz opp */ + r |=opp_enable (iva_dev,520000000 ); + +if (r) { +pr_err ("%s: failed to enable higher opp %d\n" , + __func__, r); +/* +* Cleanup - disable the higher freqs - we dont care +* about the results +*/ +opp_disable (mpu_dev,720000000 ); +opp_disable (iva_dev,520000000 ); + } + } +/* Custom OPP enabled for all xM versions */ if (cpu_is_omap3630 ()) {struct device *mpu_dev, *iva_dev;
arch/arm/mach-omap2/opp3xxx_data.c +4 -0
@@ -98,6 +98,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {OPP_INITIALIZER ("mpu" , true,550000000 ,OMAP3430_VDD_MPU_OPP4_UV ),/* MPU OPP5 */ OPP_INITIALIZER ("mpu" , true,600000000 ,OMAP3430_VDD_MPU_OPP5_UV ), +/* MPU OPP6 : omap3530 high speed grade only */ + OPP_INITIALIZER("mpu", false, 720000000, OMAP3430_VDD_MPU_OPP5_UV),/* * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
@@ -123,6 +125,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {OPP_INITIALIZER ("iva" , true,400000000 ,OMAP3430_VDD_MPU_OPP4_UV ),/* DSP OPP5 */ OPP_INITIALIZER ("iva" , true,430000000 ,OMAP3430_VDD_MPU_OPP5_UV ), +/* DSP OPP6 : omap3530 high speed grade only */ + OPP_INITIALIZER("iva", false, 520000000, OMAP3430_VDD_MPU_OPP5_UV), }; static struct omap_opp_def __initdata omap36xx_opp_def_list[] = {
Signature · 1 line
1.7.4.1
PATCH v10 2/4 omap3: voltage: fix channel configuration
In reply to Tero KristoOMAP3 uses the default settings for VDD1 channel, otherwise the settings will overlap with VDD2 and attempting to modify VDD1 voltage will actually change VDD2 voltage.
--- arch/arm/mach-omap2/vc3xxx_data.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/vc3xxx_data.c +1 -0
@@ -46,6 +46,7 @@ static struct omap_vc_common omap3_vc_common = { };struct omap_vc_channel omap3_vc_mpu = { + .flags =OMAP_VC_CHANNEL_DEFAULT , .common = &omap3_vc_common, .smps_sa_reg =OMAP3_PRM_VC_SMPS_SA_OFFSET , .smps_volra_reg =OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET ,
Signature · 1 line
1.7.4.1
PATCH v10 3/4 omap3: add common twl configurations for vdd1 and vdd2
In reply to Tero KristoVDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators are needed by DVFS.
Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals:
- SWCS019L : TWL4030 ES3.1 Data Manual rev L
- SWCS030E : TWL5030 ES1.2 Data Manual rev E
--- arch/arm/mach-omap2/twl-common.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/twl-common.c +36 -0
@@ -126,6 +126,38 @@ static struct regulator_init_data omap3_vpll2_idata = { .consumer_supplies = omap3_vpll2_supplies, }; +static struct regulator_consumer_supply omap3_vdd1_supply[] = { +REGULATOR_SUPPLY ("vcc" ,"mpu.0" ), +}; + +static struct regulator_consumer_supply omap3_vdd2_supply[] = { +REGULATOR_SUPPLY ("vcc" ,"l3_main.0" ), +}; + +static struct regulator_init_data omap3_vdd1 = { + .constraints = { + .name ="vdd_mpu_iva" , + .min_uV =600000 , + .max_uV =1450000 , + .valid_modes_mask =REGULATOR_MODE_NORMAL , + .valid_ops_mask =REGULATOR_CHANGE_VOLTAGE , + }, + .num_consumer_supplies =ARRAY_SIZE (omap3_vdd1_supply), + .consumer_supplies = omap3_vdd1_supply, +}; + +static struct regulator_init_data omap3_vdd2 = { + .constraints = { + .name ="vdd_core" , + .min_uV =600000 , + .max_uV =1450000 , + .valid_modes_mask =REGULATOR_MODE_NORMAL , + .valid_ops_mask =REGULATOR_CHANGE_VOLTAGE , + }, + .num_consumer_supplies =ARRAY_SIZE (omap3_vdd2_supply), + .consumer_supplies = omap3_vdd2_supply, +}; +void __init omap3_pmic_get_config (struct twl4030_platform_data *pmic_data,u32 pdata_flags,u32 regulators_flags) {
@@ -133,6 +165,10 @@ void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, pmic_data->irq_base =TWL4030_IRQ_BASE ;if (!pmic_data->irq_end) pmic_data->irq_end =TWL4030_IRQ_END ; +if (!pmic_data->vdd1) + pmic_data->vdd1 = &omap3_vdd1; +if (!pmic_data->vdd2) + pmic_data->vdd2 = &omap3_vdd2;/* Common platform data configurations */ if (pdata_flags &TWL_COMMON_PDATA_USB && !pmic_data->usb)
Signature · 1 line
1.7.4.1
PATCH v10 3/4 omap3: add common twl configurations for vdd1 and vdd2
Quoted 9 lines · Tero Kristo
VDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators are needed by DVFS.
Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals:
- SWCS019L : TWL4030 ES3.1 Data Manual rev L
- SWCS030E : TWL5030 ES1.2 Data Manual rev ESigned-off-by Tero Kristo <[email protected]>
Do you have a similar patch for OMAP4 support?
Kevin
PATCH v10 3/4 omap3: add common twl configurations for vdd1 and vdd2
Quoted 6 lines · Kevin Hilman
Quoted 4 lines · Tero Kristo
VDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators are needed by DVFS.
Quoted 7 lines
Quoted 5 lines
Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals:
- SWCS019L : TWL4030 ES3.1 Data Manual rev L
- SWCS030E : TWL5030 ES1.2 Data Manual rev ESigned-off-by Tero Kristo <[email protected]>Do you have a similar patch for OMAP4 support?
It looks like OMAP4 support requires some changes to the twl-regulator / twl-core in addition to the twl-common.c. I have these available (just created them), should I post these out? Attached here for reference in case you need to test something quickly.
-Tero
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-regulator-twl6030-add-support-for-vdd1-vdd2-and-vdd3.patch
Type: text/x-patch
Size: 4563 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120222/46cb4716/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-arm-omap4-add-common-twl-configurations-for-vdd1-vdd.patch
Type: text/x-patch
Size: 3691 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120222/46cb4716/attachment-0003.bin>
PATCH v10 3/4 omap3: add common twl configurations for vdd1 and vdd2
Quoted 11 lines · Tero Kristo
Quoted 10 lines · Kevin Hilman
Quoted 8 lines · Tero Kristo
VDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators are needed by DVFS.
Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals:
- SWCS019L : TWL4030 ES3.1 Data Manual rev L
- SWCS030E : TWL5030 ES1.2 Data Manual rev E
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Tero Kristo <[email protected]>Do you have a similar patch for OMAP4 support?
It looks like OMAP4 support requires some changes to the twl-regulator / twl-core in addition to the
twl-common.c. I have these available (just created them), should I post these out?
Yes please.
Quoted 2 lines
Attached here for reference in case you need to test something quickly.
Thanks, it's easier for me to validate actual voltage scaling on OMAP4 since I have a setup to easily measure voltage rails.
Thanks for these, I verified they work using my v2 CPUfreq driver on OMAP4430.
Kevin
PATCH v10 4/4 omap3: twl: add external controllers for core voltage regulators
In reply to Tero KristoVDD1 and VDD2 now use voltage processor for controlling the regulators. This is done by passing additional voltdm data during the regulator init.
--- arch/arm/mach-omap2/twl-common.c | 33 +++++++++++++++++++++++++++++++-- 1 files changed, 31 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/twl-common.c +31 -2
@@ -31,12 +31,25 @@#include "twl-common.h" #include "pm.h" +#include "voltage.h" static struct i2c_board_info __initdata pmic_i2c_board_info = { .addr =0x48 , .flags =I2C_CLIENT_WAKE , }; +static int twl_set_voltage (void *data,int target_uV) +{ +struct voltagedomain *voltdm = (struct voltagedomain *)data; +return voltdm_scale (voltdm, target_uV); +} + +static int twl_get_voltage (void *data) +{ +struct voltagedomain *voltdm = (struct voltagedomain *)data; +return voltdm_get_voltage (voltdm); +} +void __init omap_pmic_init (int bus,u32 clkrate,const char *pmic_type,int pmic_irq,struct twl4030_platform_data *pmic_data)
@@ -158,6 +171,16 @@ static struct regulator_init_data omap3_vdd2 = { .consumer_supplies = omap3_vdd2_supply, }; +static struct twl_regulator_driver_data omap3_vdd1_drvdata = { + .get_voltage = twl_get_voltage, + .set_voltage = twl_set_voltage, +}; + +static struct twl_regulator_driver_data omap3_vdd2_drvdata = { + .get_voltage = twl_get_voltage, + .set_voltage = twl_set_voltage, +}; +void __init omap3_pmic_get_config (struct twl4030_platform_data *pmic_data,u32 pdata_flags,u32 regulators_flags) {
@@ -165,10 +188,16 @@ void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, pmic_data->irq_base =TWL4030_IRQ_BASE ;if (!pmic_data->irq_end) pmic_data->irq_end =TWL4030_IRQ_END ; -if (!pmic_data->vdd1) +if (!pmic_data->vdd1) { + omap3_vdd1.driver_data = &omap3_vdd1_drvdata; + omap3_vdd1_drvdata.data =voltdm_lookup ("mpu_iva" ); pmic_data->vdd1 = &omap3_vdd1; -if (!pmic_data->vdd2) + } +if (!pmic_data->vdd2) { + omap3_vdd2.driver_data = &omap3_vdd2_drvdata; + omap3_vdd2_drvdata.data =voltdm_lookup ("core" ); pmic_data->vdd2 = &omap3_vdd2; + }/* Common platform data configurations */ if (pdata_flags &TWL_COMMON_PDATA_USB && !pmic_data->usb)
Signature · 1 line
1.7.4.1