public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCHv10 0/4] omap smps regulator support
@ 2012-02-20 10:26 Tero Kristo
  2012-02-20 10:26 ` [PATCHv10 1/4] TEMP: OMAP3: beagle rev-c4: enable OPP6 Tero Kristo
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCHv10 1/4] TEMP: OMAP3: beagle rev-c4: enable OPP6
  2012-02-20 10:26 [PATCHv10 0/4] omap smps regulator support Tero Kristo
@ 2012-02-20 10:26 ` Tero Kristo
  2012-02-20 10:26 ` [PATCHv10 2/4] omap3: voltage: fix channel configuration Tero Kristo
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw)
  To: linux-arm-kernel

Beagleboard rev-c4 has a speed sorted OMAP3530 chip which can run at 720MHz.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |   29 +++++++++++++++++++++++++++++
 arch/arm/mach-omap2/opp3xxx_data.c      |    4 ++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 7ffcd28..97678e5 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -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;
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c
index d95f3f9..a0f5fe1 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -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[] = {
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCHv10 2/4] omap3: voltage: fix channel configuration
  2012-02-20 10:26 [PATCHv10 0/4] omap smps regulator support Tero Kristo
  2012-02-20 10:26 ` [PATCHv10 1/4] TEMP: OMAP3: beagle rev-c4: enable OPP6 Tero Kristo
@ 2012-02-20 10:26 ` Tero Kristo
  2012-02-20 10:26 ` [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 Tero Kristo
  2012-02-20 10:26 ` [PATCHv10 4/4] omap3: twl: add external controllers for core voltage regulators Tero Kristo
  3 siblings, 0 replies; 8+ messages in thread
From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw)
  To: linux-arm-kernel

OMAP3 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.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 arch/arm/mach-omap2/vc3xxx_data.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c
index a5ec7f8f..5d8eaf3 100644
--- a/arch/arm/mach-omap2/vc3xxx_data.c
+++ b/arch/arm/mach-omap2/vc3xxx_data.c
@@ -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,
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2
  2012-02-20 10:26 [PATCHv10 0/4] omap smps regulator support Tero Kristo
  2012-02-20 10:26 ` [PATCHv10 1/4] TEMP: OMAP3: beagle rev-c4: enable OPP6 Tero Kristo
  2012-02-20 10:26 ` [PATCHv10 2/4] omap3: voltage: fix channel configuration Tero Kristo
@ 2012-02-20 10:26 ` Tero Kristo
  2012-02-22  0:00   ` Kevin Hilman
  2012-02-20 10:26 ` [PATCHv10 4/4] omap3: twl: add external controllers for core voltage regulators Tero Kristo
  3 siblings, 1 reply; 8+ messages in thread
From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 arch/arm/mach-omap2/twl-common.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 10b20c6..5f62e51 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -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)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCHv10 4/4] omap3: twl: add external controllers for core voltage regulators
  2012-02-20 10:26 [PATCHv10 0/4] omap smps regulator support Tero Kristo
                   ` (2 preceding siblings ...)
  2012-02-20 10:26 ` [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 Tero Kristo
@ 2012-02-20 10:26 ` Tero Kristo
  3 siblings, 0 replies; 8+ messages in thread
From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw)
  To: linux-arm-kernel

VDD1 and VDD2 now use voltage processor for controlling the regulators.
This is done by passing additional voltdm data during the regulator init.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 arch/arm/mach-omap2/twl-common.c |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 5f62e51..0c453e7 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -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)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2
  2012-02-20 10:26 ` [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 Tero Kristo
@ 2012-02-22  0:00   ` Kevin Hilman
  2012-02-22 10:47     ` Tero Kristo
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin Hilman @ 2012-02-22  0:00 UTC (permalink / raw)
  To: linux-arm-kernel

Tero Kristo <t-kristo@ti.com> writes:

> 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
>
> Signed-off-by: Tero Kristo <t-kristo@ti.com>

Do you have a similar patch for OMAP4 support?

Kevin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2
  2012-02-22  0:00   ` Kevin Hilman
@ 2012-02-22 10:47     ` Tero Kristo
  2012-02-22 19:16       ` Kevin Hilman
  0 siblings, 1 reply; 8+ messages in thread
From: Tero Kristo @ 2012-02-22 10:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2012-02-21 at 16:00 -0800, Kevin Hilman wrote:
> Tero Kristo <t-kristo@ti.com> writes:
> 
> > 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
> >
> > Signed-off-by: Tero Kristo <t-kristo@ti.com>
> 
> 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>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2
  2012-02-22 10:47     ` Tero Kristo
@ 2012-02-22 19:16       ` Kevin Hilman
  0 siblings, 0 replies; 8+ messages in thread
From: Kevin Hilman @ 2012-02-22 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

Tero Kristo <t-kristo@ti.com> writes:

> On Tue, 2012-02-21 at 16:00 -0800, Kevin Hilman wrote:
>> Tero Kristo <t-kristo@ti.com> writes:
>> 
>> > 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
>> >
>> > Signed-off-by: Tero Kristo <t-kristo@ti.com>
>> 
>> 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.

> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-02-22 19:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-20 10:26 [PATCHv10 0/4] omap smps regulator support Tero Kristo
2012-02-20 10:26 ` [PATCHv10 1/4] TEMP: OMAP3: beagle rev-c4: enable OPP6 Tero Kristo
2012-02-20 10:26 ` [PATCHv10 2/4] omap3: voltage: fix channel configuration Tero Kristo
2012-02-20 10:26 ` [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 Tero Kristo
2012-02-22  0:00   ` Kevin Hilman
2012-02-22 10:47     ` Tero Kristo
2012-02-22 19:16       ` Kevin Hilman
2012-02-20 10:26 ` [PATCHv10 4/4] omap3: twl: add external controllers for core voltage regulators Tero Kristo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox