Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] Enable USB peripheral on dm365 EVM
From: Greg KH @ 2012-10-03 23:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349301859-31306-1-git-send-email-const@MakeLinux.com>

On Thu, Oct 04, 2012 at 12:04:19AM +0200, const at MakeLinux.com wrote:
> From: Constantine Shulyupin <const@MakeLinux.com>
> 
> From: Miguel Aguilar <miguel.aguilar@ridgerun.com>
> Signed-off-by: Constantine Shulyupin <const@MakeLinux.com>
> ---
> Tested with usb gadget g_zero.
> This patch is based on code from Arago, Angstom, and RidgeRun projects.
> Original patch is three years ago:
> http://www.mail-archive.com/davinci-linux-open-source at linux.davincidsp.com/msg14741.html

You can't have two "From:" lines.

And put the information above, in the changelog entry.

Also, it looks like you are modifying printk lines for no reason, why do
that in this patch?  That shouldn't be needed, right?

greg k-h

^ permalink raw reply

* [PATCH 1/2] ARM: OMAP: hwmod: align the SmartReflex fck names
From: Kevin Hilman @ 2012-10-04  0:33 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121003170059.GD4840@atomide.com>

Tony Lindgren <tony@atomide.com> writes:

> * jean.pihet at newoldbits.com <jean.pihet@newoldbits.com> [121003 08:48]:
>> @@ -1036,8 +1036,8 @@ static struct omap_clk am33xx_clks[] = {
>>  	CLK("davinci-mcasp.1",  NULL,           &mcasp1_fck,    CK_AM33XX),
>>  	CLK("NULL",	"mmc2_fck",		&mmc2_fck,	CK_AM33XX),
>>  	CLK(NULL,	"mmu_fck",		&mmu_fck,	CK_AM33XX),
>> -	CLK(NULL,	"smartreflex0_fck",	&smartreflex0_fck,	CK_AM33XX),
>> -	CLK(NULL,	"smartreflex1_fck",	&smartreflex1_fck,	CK_AM33XX),
>> +	CLK(NULL,	"smartreflex.0",	&smartreflex_mpu_fck,	CK_AM33XX),
>> +	CLK(NULL,	"smartreflex.1",	&smartreflex_core_fck,	CK_AM33XX),
>>  	CLK(NULL,	"timer1_fck",		&timer1_fck,	CK_AM33XX),
>>  	CLK(NULL,	"timer2_fck",		&timer2_fck,	CK_AM33XX),
>>  	CLK(NULL,	"timer3_fck",		&timer3_fck,	CK_AM33XX),
>
> I think this should be something like this instead:
>
> 	CLK("smartreflex.0",	"fck",	&smartreflex_mpu_fck,	CK_AM33XX),
> 	CLK("smartreflex.1",	"fck",	&smartreflex_core_fck,	CK_AM33XX),
>
> Where the first one is the dev name, the second one is the
> alias you want to use in the client driver?

Actually, the omap_device creation will create this kind of alias for
you, with the device name populated etc, so adding device names here
isn't necessary.

For omap_devices where drivers are always using clk_get(dev, ...),
the name in the initial clkdev table here really doesn't matter.

However, for core code that needs to do a clk_get(NULL, "name"), then
this name matters.  In chatting with Paul offline, he mentioned part of
the CCF conversion will be using clk_get(NULL, ...) on the main_clk
listed in each hwmod.  For that reason, it's important that this string
match the name in the hwmod.

I belive the patch below should make this compatible with any future
use.

Jean, can you fold this into $SUBJECT patch?

Thanks,

Kevin


diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c
index 6de3dc7..8a16504 100644
--- a/arch/arm/mach-omap2/clock33xx_data.c
+++ b/arch/arm/mach-omap2/clock33xx_data.c
@@ -1034,8 +1034,8 @@ static struct omap_clk am33xx_clks[] = {
 	CLK("davinci-mcasp.1",  NULL,           &mcasp1_fck,    CK_AM33XX),
 	CLK("NULL",	"mmc2_fck",		&mmc2_fck,	CK_AM33XX),
 	CLK(NULL,	"mmu_fck",		&mmu_fck,	CK_AM33XX),
-	CLK(NULL,	"smartreflex.0",	&smartreflex_mpu_fck,	CK_AM33XX),
-	CLK(NULL,	"smartreflex.1",	&smartreflex_core_fck,	CK_AM33XX),
+	CLK(NULL,	"smartreflex_mpu_fck",	&smartreflex_mpu_fck,	CK_AM33XX),
+	CLK(NULL,	"smartreflex_core_fck",	&smartreflex_core_fck,	CK_AM33XX),
 	CLK(NULL,	"timer1_fck",		&timer1_fck,	CK_AM33XX),
 	CLK(NULL,	"timer2_fck",		&timer2_fck,	CK_AM33XX),
 	CLK(NULL,	"timer3_fck",		&timer3_fck,	CK_AM33XX),
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index a197cf2..191d261 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3447,8 +3447,8 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK(NULL,	"atclk_fck",	&atclk_fck,	CK_3XXX),
 	CLK(NULL,	"traceclk_src_fck", &traceclk_src_fck, CK_3XXX),
 	CLK(NULL,	"traceclk_fck",	&traceclk_fck,	CK_3XXX),
-	CLK(NULL,	"smartreflex.0",	&smartreflex_mpu_iva_fck,	CK_34XX | CK_36XX),
-	CLK(NULL,	"smartreflex.1",	&smartreflex_core_fck,	CK_34XX | CK_36XX),
+	CLK(NULL,	"smartreflex_mpu_iva_fck", &smartreflex_mpu_iva_fck,	CK_34XX | CK_36XX),
+	CLK(NULL,	"smartreflex_core_fck",	&smartreflex_core_fck,	CK_34XX | CK_36XX),
 	CLK(NULL,	"sr_l4_ick",	&sr_l4_ick,	CK_34XX | CK_36XX),
 	CLK(NULL,	"secure_32k_fck", &secure_32k_fck, CK_3XXX),
 	CLK(NULL,	"gpt12_fck",	&gpt12_fck,	CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 9cc1112..19e0c1e 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3224,8 +3224,8 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"slimbus2_fclk_0",		&slimbus2_fclk_0,	CK_443X),
 	CLK(NULL,	"slimbus2_slimbus_clk",		&slimbus2_slimbus_clk,	CK_443X),
 	CLK(NULL,	"slimbus2_fck",			&slimbus2_fck,	CK_443X),
-	CLK(NULL,	"smartreflex.0",		&smartreflex_core_fck,	CK_443X),
-	CLK(NULL,	"smartreflex.1",		&smartreflex_iva_fck,	CK_443X),
+	CLK(NULL,	"smartreflex_core_fck",		&smartreflex_core_fck,	CK_443X),
+	CLK(NULL,	"smartreflex_mpu_fck",		&smartreflex_iva_fck,	CK_443X),
 	CLK(NULL,	"smartreflex.2",		&smartreflex_mpu_fck,	CK_443X),
 	CLK(NULL,	"timer1_fck",			&timer1_fck,	CK_443X),
 	CLK(NULL,	"timer10_fck",			&timer10_fck,	CK_443X),

^ permalink raw reply related

* [RFC][PATCH 0/5] Introduce .get_voltage callback into voltdm
From: Mike Turquette @ 2012-10-04  1:16 UTC (permalink / raw)
  To: linux-arm-kernel

From: Mike Turquette <mturquette@linaro.org>

This series creates a new callback for struct voltagedomain,
.get_voltage.  This fetches the voltage from hardware, if possible, and
returns it to the caller.  We use this call to populate
voltdm->nominal_volt at boot time.

The need for this came out of the Adaptive Body-Bias patches.  There is
a corner case where voltdm->nominal_volt is zero at boot, but the ABB
pre-scale function needs to know the current voltage as a part of its
logic.  Without this series voltdm->nominal_volt will be zero until
after voltdm->scale completes, which is too late for the ABB pre-scale
logic.

It is possible to have ABB without this series.  In the event that
voltdm->nominal_volt is zero then the ABB pre-scale function can simply
return early.  However this opens up a condition that burns power
needlessly:

1) The bootloader enables Forward Body-Bias mode on the ABB ldo and runs
the voltage domain at a high OPP

2) Linux boots and the first transition of that voltage domain is to a
lower OPP.

3) The voltage of that vdd is unknown so the ABB pre-scale function
returns early and FBB is left enabled at an OPP that would otherwise not
need it.

This scenario is not validated and is best avoided.  This series is one
step towards that.

Mike Turquette (5):
  ARM: omap: vc: replace data_shift with data_mask
  ARM: omap: introduce .get_voltage callback
  ARM: omap: vc: .get_voltage callback
  ARM: omap: vp: .get_voltage callback
  ARM: omap: initialize voltdm->nominal_volt

 arch/arm/mach-omap2/vc.c          |   23 ++++++++++++++++++++++-
 arch/arm/mach-omap2/vc.h          |    3 ++-
 arch/arm/mach-omap2/vc3xxx_data.c |    2 +-
 arch/arm/mach-omap2/vc44xx_data.c |    2 +-
 arch/arm/mach-omap2/voltage.c     |   13 +++++++++++++
 arch/arm/mach-omap2/voltage.h     |    1 +
 arch/arm/mach-omap2/vp.c          |   22 ++++++++++++++++++++++
 arch/arm/mach-omap2/vp.h          |    1 +
 8 files changed, 63 insertions(+), 4 deletions(-)

-- 
1.7.9.5

^ permalink raw reply

* [PATCH 1/5] ARM: omap: vc: replace data_shift with data_mask
From: Mike Turquette @ 2012-10-04  1:16 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313365-5262-1-git-send-email-mturquette@ti.com>

From: Mike Turquette <mturquette@linaro.org>

Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/vc.c          |    2 +-
 arch/arm/mach-omap2/vc.h          |    2 +-
 arch/arm/mach-omap2/vc3xxx_data.c |    2 +-
 arch/arm/mach-omap2/vc44xx_data.c |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 84da34f..2bcac64 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -171,7 +171,7 @@ int omap_vc_bypass_scale(struct voltagedomain *voltdm,
 
 	vc_valid = vc->common->valid;
 	vc_bypass_val_reg = vc->common->bypass_val_reg;
-	vc_bypass_value = (target_vsel << vc->common->data_shift) |
+	vc_bypass_value = (target_vsel << __ffs(vc->common->data_mask)) |
 		(vc->volt_reg_addr << vc->common->regaddr_shift) |
 		(vc->i2c_slave_addr << vc->common->slaveaddr_shift);
 
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
index 478bf6b..84a61b1 100644
--- a/arch/arm/mach-omap2/vc.h
+++ b/arch/arm/mach-omap2/vc.h
@@ -43,8 +43,8 @@ struct voltagedomain;
 struct omap_vc_common {
 	u32 cmd_on_mask;
 	u32 valid;
+	u32 data_mask;
 	u8 bypass_val_reg;
-	u8 data_shift;
 	u8 slaveaddr_shift;
 	u8 regaddr_shift;
 	u8 cmd_on_shift;
diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c
index 5d8eaf3..2b35e82 100644
--- a/arch/arm/mach-omap2/vc3xxx_data.c
+++ b/arch/arm/mach-omap2/vc3xxx_data.c
@@ -31,7 +31,7 @@
  */
 static struct omap_vc_common omap3_vc_common = {
 	.bypass_val_reg	 = OMAP3_PRM_VC_BYPASS_VAL_OFFSET,
-	.data_shift	 = OMAP3430_DATA_SHIFT,
+	.data_mask	 = OMAP3430_DATA_MASK,
 	.slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT,
 	.regaddr_shift	 = OMAP3430_REGADDR_SHIFT,
 	.valid		 = OMAP3430_VALID_MASK,
diff --git a/arch/arm/mach-omap2/vc44xx_data.c b/arch/arm/mach-omap2/vc44xx_data.c
index d70b930..598edc9 100644
--- a/arch/arm/mach-omap2/vc44xx_data.c
+++ b/arch/arm/mach-omap2/vc44xx_data.c
@@ -32,7 +32,7 @@
  */
 static const struct omap_vc_common omap4_vc_common = {
 	.bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET,
-	.data_shift = OMAP4430_DATA_SHIFT,
+	.data_mask = OMAP4430_DATA_MASK,
 	.slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT,
 	.regaddr_shift = OMAP4430_REGADDR_SHIFT,
 	.valid = OMAP4430_VALID_MASK,
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 2/5] ARM: omap: introduce .get_voltage callback
From: Mike Turquette @ 2012-10-04  1:16 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313365-5262-1-git-send-email-mturquette@ti.com>

From: Mike Turquette <mturquette@linaro.org>

Introduces a new callback to struct voltagedomain for retrieving the
voltage of the voltage domain from the hardware.  This will be used to
populate voltdm->nominal_volt during initialization of the voltage code
instead of waiting for the first call to voltdm_scale.

In the event of an error or the inability to determine voltage the
callback must return zero.  It is the callers responsibility to
gracefully degrade when presented with a voltage of zero.

Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/voltage.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 0ac2caf..0ded54f 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -85,6 +85,7 @@ struct voltagedomain {
 		u32 rate;
 	} sys_clk;
 
+	unsigned long (*get_voltage) (struct voltagedomain *voltdm);
 	int (*scale) (struct voltagedomain *voltdm,
 		      unsigned long target_volt);
 
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 3/5] ARM: omap: vc: .get_voltage callback
From: Mike Turquette @ 2012-10-04  1:16 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313365-5262-1-git-send-email-mturquette@ti.com>

From: Mike Turquette <mturquette@linaro.org>

Implement the voltdm->get_voltage callback for the voltage controller
driver.  This reads the DATA field corresponding to each VC and returns
the voltage, after converting it from vsel format.

If DATA is zero (the reset value) then the caller must interpret this as
the PMIC running at the default power-on voltage.  In such a case DT
data for the PMIC is necessary to know the voltage.

Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/vc.c |   21 +++++++++++++++++++++
 arch/arm/mach-omap2/vc.h |    1 +
 2 files changed, 22 insertions(+)

diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 2bcac64..90a9ea6 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -101,6 +101,27 @@ static int omap_vc_config_channel(struct voltagedomain *voltdm)
 }
 
 /* Voltage scale and accessory APIs */
+unsigned long omap_vc_get_bypass_data(struct voltagedomain *voltdm)
+{
+	struct omap_vc_channel *vc = voltdm->vc;
+	u32 vc_bypass_value;
+	u8 vsel;
+	unsigned long volt;
+
+	/* sanity */
+	if (!voltdm->pmic || !voltdm->pmic->vsel_to_uv ||
+			!voltdm->read || !voltdm->write)
+		return 0;
+
+	vc_bypass_value = voltdm->read(vc->common->bypass_val_reg);
+	vc_bypass_value &= vc->common->data_mask;
+	vsel = vc_bypass_value >> __ffs(vc->common->data_mask);
+
+	volt = voltdm->pmic->vsel_to_uv(vsel);
+
+	return volt;
+}
+
 int omap_vc_pre_scale(struct voltagedomain *voltdm,
 		      unsigned long target_volt,
 		      u8 *target_vsel, u8 *current_vsel)
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
index 84a61b1..e7d4719 100644
--- a/arch/arm/mach-omap2/vc.h
+++ b/arch/arm/mach-omap2/vc.h
@@ -112,6 +112,7 @@ extern struct omap_vc_channel omap4_vc_iva;
 extern struct omap_vc_channel omap4_vc_core;
 
 void omap_vc_init_channel(struct voltagedomain *voltdm);
+unsigned long omap_vc_get_bypass_data(struct voltagedomain *voltdm);
 int omap_vc_pre_scale(struct voltagedomain *voltdm,
 		      unsigned long target_volt,
 		      u8 *target_vsel, u8 *current_vsel);
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 4/5] ARM: omap: vp: .get_voltage callback
From: Mike Turquette @ 2012-10-04  1:16 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313365-5262-1-git-send-email-mturquette@ti.com>

From: Mike Turquette <mturquette@linaro.org>

Implement the voltdm->get_voltage callback for the voltage processor
driver.  This reads the INITVOLTAGE field corresponding to each VP and
returns the voltage, after converting it from vsel format.

If INITVOLTAGE is zero (the reset value) then the caller must interpret
this as the PMIC running at the default power-on voltage.  In such a
case DT data for the PMIC is necessary to know the voltage.

Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/vp.c |   22 ++++++++++++++++++++++
 arch/arm/mach-omap2/vp.h |    1 +
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
index f95c1ba..63dc03e 100644
--- a/arch/arm/mach-omap2/vp.c
+++ b/arch/arm/mach-omap2/vp.c
@@ -9,6 +9,28 @@
 #include "prm-regbits-44xx.h"
 #include "prm44xx.h"
 
+unsigned long omap_vp_get_init_voltage(struct voltagedomain *voltdm)
+{
+	struct omap_vp_instance *vp = voltdm->vp;
+	u32 vpconfig;
+	u8 vsel;
+	unsigned long volt;
+
+	/* sanity */
+	if (!voltdm->pmic || !voltdm->pmic->vsel_to_uv
+			|| !voltdm->read || !voltdm->write)
+		return 0;
+
+	vpconfig = voltdm->read(vp->vpconfig);
+	vpconfig &= vp->common->vpconfig_initvoltage_mask;
+
+	vsel = vpconfig >> __ffs(vp->common->vpconfig_initvoltage_mask);
+
+	volt = voltdm->pmic->vsel_to_uv(vsel);
+
+	return volt;
+}
+
 static u32 _vp_set_init_voltage(struct voltagedomain *voltdm, u32 volt)
 {
 	struct omap_vp_instance *vp = voltdm->vp;
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h
index 7c155d2..0747a78 100644
--- a/arch/arm/mach-omap2/vp.h
+++ b/arch/arm/mach-omap2/vp.h
@@ -120,6 +120,7 @@ extern struct omap_vp_instance omap4_vp_core;
 void omap_vp_init(struct voltagedomain *voltdm);
 void omap_vp_enable(struct voltagedomain *voltdm);
 void omap_vp_disable(struct voltagedomain *voltdm);
+unsigned long omap_vp_get_init_voltage(struct voltagedomain *voltdm);
 int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
 			      unsigned long target_volt);
 int omap_vp_update_errorgain(struct voltagedomain *voltdm,
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 5/5] ARM: omap: initialize voltdm->nominal_volt
From: Mike Turquette @ 2012-10-04  1:16 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313365-5262-1-git-send-email-mturquette@ti.com>

From: Mike Turquette <mturquette@linaro.org>

Populate the .get_voltage callbacks for VC & VP.  Use these callbacks to
populate voltdm->nominal_volt during boot sequence.

This is useful for the Adaptive Body-Bias sequence coming in a
subsequent series.  Without this patch voltdm->nominal will not be
populated until after the first call to voltdm_scale.  This is too late
to be useful to the pre-scale sequence in the ABB series since that
sequence needs to know the voltage prior to the first transition.

Note that the .get_voltage callback will return zero for the corner case
wherein the bootloader has not scaling the voltage.  In this case it is
safe to assume that we are running at the PMIC's default power-on
voltage.  DT data providing the default voltage for each PMIC is needed
in this case.

Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/voltage.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 4dc60e8..f45716c 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -244,9 +244,11 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
 	switch (voltscale_method) {
 	case VOLTSCALE_VPFORCEUPDATE:
 		voltdm->scale = omap_vp_forceupdate_scale;
+		voltdm->get_voltage = omap_vp_get_init_voltage;
 		return;
 	case VOLTSCALE_VCBYPASS:
 		voltdm->scale = omap_vc_bypass_scale;
+		voltdm->get_voltage = omap_vc_get_bypass_data;
 		return;
 	default:
 		pr_warning("%s: Trying to change the method of voltage scaling"
@@ -288,13 +290,24 @@ int __init omap_voltage_late_init(void)
 
 		if (voltdm->vc) {
 			voltdm->scale = omap_vc_bypass_scale;
+			voltdm->get_voltage = omap_vc_get_bypass_data;
 			omap_vc_init_channel(voltdm);
 		}
 
 		if (voltdm->vp) {
 			voltdm->scale = omap_vp_forceupdate_scale;
+			voltdm->get_voltage = omap_vp_get_init_voltage;
 			omap_vp_init(voltdm);
 		}
+
+		/*
+		 * XXX If voltdm->nominal_volt is zero after calling
+		 * voltdm->get_voltage then we are likely running this
+		 * voltage domain at the default boot voltage of the
+		 * PMIC.  In such a case it would be best to load this
+		 * value from DT.
+		 */
+		voltdm->nominal_volt = voltdm->get_voltage(voltdm);
 	}
 
 	return 0;
-- 
1.7.9.5

^ permalink raw reply related

* [RFC][PATCH v4? 0/7] Adaptive Body-Bias for OMAP
From: Mike Turquette @ 2012-10-04  1:26 UTC (permalink / raw)
  To: linux-arm-kernel

From: Mike Turquette <mturquette@linaro.org>

Adaptive Body-Bias ldos are present for some voltage domains starting
with OMAP3630.  They have three modes of operation:

 * Bypass - the default, it just follows the vdd voltage
 * Foward Body-Bias - applies voltage bias to increase transistor
   performance at the cost of power.  Used to operate safely at high
   OPPs
 * Reverse Body-Bias - applies voltage bias to decrease leakage and save
   power.  Used to save power at lower OPPs

This series adds the ABB code and per-voltage domain data for OMAP3630
and OMAP4430.  Newer OMAP4 chips and OMAP5 will need this data populated
once those platforms have OPP and voltage tables.  The voltage domain
scaling sequence is modified use these new functions.

This series build on top my previous series, "Introduce .get_voltage
callback into voltdm"[1].  While not strictly necessary that series does
take some steps to eliminate one combination of ABB and VP/VC modes that
is out-of-spec.

[1] http://marc.info/?l=linux-omap&m=134931341818379&w=2

Mike Turquette (7):
  ARM: omap: add 3630 PRM register definitions
  ARM: omap: add ABB PRM_IRQSTATUS handlers
  ARM: omap: Adaptive Body-Bias structures & data
  ARM: omap: opp: add ABB data to voltage tables
  ARM: omap: voltage: per-voltage domain ABB data
  ARM: omap: abb: init & transition functions
  ARM: omap: voltage: add ABB to voltage scaling

 arch/arm/mach-omap2/Makefile                  |    8 +-
 arch/arm/mach-omap2/abb.c                     |  322 +++++++++++++++++++++++++
 arch/arm/mach-omap2/abb.h                     |   94 ++++++++
 arch/arm/mach-omap2/abb36xx_data.c            |   39 +++
 arch/arm/mach-omap2/abb44xx_data.c            |   45 ++++
 arch/arm/mach-omap2/omap_opp_data.h           |    5 +-
 arch/arm/mach-omap2/opp3xxx_data.c            |   37 +--
 arch/arm/mach-omap2/opp4xxx_data.c            |   25 +-
 arch/arm/mach-omap2/prm-regbits-34xx.h        |   34 +++
 arch/arm/mach-omap2/prm2xxx_3xxx.c            |   36 +++
 arch/arm/mach-omap2/prm2xxx_3xxx.h            |    8 +
 arch/arm/mach-omap2/prm44xx.c                 |   44 ++++
 arch/arm/mach-omap2/prm44xx.h                 |    4 +
 arch/arm/mach-omap2/voltage.c                 |   28 ++-
 arch/arm/mach-omap2/voltage.h                 |    1 +
 arch/arm/mach-omap2/voltagedomains3xxx_data.c |    2 +
 arch/arm/mach-omap2/voltagedomains44xx_data.c |    3 +
 arch/arm/plat-omap/include/plat/voltage.h     |    1 +
 18 files changed, 699 insertions(+), 37 deletions(-)
 create mode 100644 arch/arm/mach-omap2/abb.c
 create mode 100644 arch/arm/mach-omap2/abb.h
 create mode 100644 arch/arm/mach-omap2/abb36xx_data.c
 create mode 100644 arch/arm/mach-omap2/abb44xx_data.c

-- 
1.7.9.5

^ permalink raw reply

* [PATCH 1/7] ARM: omap: add 3630 PRM register definitions
From: Mike Turquette @ 2012-10-04  1:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313974-5473-1-git-send-email-mturquette@ti.com>

OMAP3630 supports an Adaptive Body-Bias ldo as well as some MPU
interrupts related to voltage control that are not present on OMAP34XX.
This patch adds the offsets, register addresses, bitfield shifts and
masks to support this feature.

Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/prm-regbits-34xx.h |   34 ++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prm2xxx_3xxx.h     |    4 ++++
 2 files changed, 38 insertions(+)

diff --git a/arch/arm/mach-omap2/prm-regbits-34xx.h b/arch/arm/mach-omap2/prm-regbits-34xx.h
index 64c087a..0309ff6 100644
--- a/arch/arm/mach-omap2/prm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-34xx.h
@@ -216,6 +216,12 @@
 /* PRM_SYSCONFIG specific bits */
 
 /* PRM_IRQSTATUS_MPU specific bits */
+#define OMAP3630_VC_BYPASS_ACK_ST_SHIFT			28
+#define OMAP3630_VC_BYPASS_ACK_ST_MASK			(1 << 28)
+#define OMAP3630_VC_VP1_ACK_ST_SHIFT			27
+#define OMAP3630_VC_VP1_ACK_ST_MASK			(1 << 27)
+#define OMAP3630_ABB_LDO_TRANXDONE_ST_SHIFT		26
+#define OMAP3630_ABB_LDO_TRANXDONE_ST_MASK		(1 << 26)
 #define OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT		25
 #define OMAP3430ES2_SND_PERIPH_DPLL_ST_MASK		(1 << 25)
 #define OMAP3430_VC_TIMEOUTERR_ST_MASK			(1 << 24)
@@ -248,6 +254,12 @@
 #define OMAP3430_FS_USB_WKUP_ST_MASK			(1 << 1)
 
 /* PRM_IRQENABLE_MPU specific bits */
+#define OMAP3630_VC_BYPASS_ACK_EN_SHIFT				28
+#define OMAP3630_VC_BYPASS_ACK_EN_MASK				(1 << 28)
+#define OMAP3630_VC_VP1_ACK_EN_SHIFT				27
+#define OMAP3630_VC_VP1_ACK_EN_MASK				(1 << 27)
+#define OMAP3630_ABB_LDO_TRANXDONE_EN_SHIFT			26
+#define OMAP3630_ABB_LDO_TRANXDONE_EN_MASK			(1 << 26)
 #define OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT		25
 #define OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_MASK		(1 << 25)
 #define OMAP3430_VC_TIMEOUTERR_EN_MASK				(1 << 24)
@@ -587,6 +599,28 @@
 
 /* PRM_VP2_STATUS specific bits */
 
+/* PRM_LDO_ABB_SETUP specific bits */
+#define OMAP3630_SR2_IN_TRANSITION_SHIFT		6
+#define OMAP3630_SR2_IN_TRANSITION_MASK			(1 << 6)
+#define OMAP3630_SR2_STATUS_SHIFT			3
+#define OMAP3630_SR2_STATUS_MASK			(3 << 3)
+#define OMAP3630_OPP_CHANGE_SHIFT			2
+#define OMAP3630_OPP_CHANGE_MASK			(1 << 2)
+#define OMAP3630_OPP_SEL_SHIFT				0
+#define OMAP3630_OPP_SEL_MASK				(3 << 0)
+
+/* PRM_LDO_ABB_CTRL specific bits */
+#define OMAP3630_SR2_WTCNT_VALUE_SHIFT			8
+#define OMAP3630_SR2_WTCNT_VALUE_MASK			(0xff << 8)
+#define OMAP3630_SLEEP_RBB_SEL_SHIFT			3
+#define OMAP3630_SLEEP_RBB_SEL_MASK			(1 << 3)
+#define OMAP3630_ACTIVE_FBB_SEL_SHIFT			2
+#define OMAP3630_ACTIVE_FBB_SEL_MASK			(1 << 2)
+#define OMAP3630_ACTIVE_RBB_SEL_SHIFT			1
+#define OMAP3630_ACTIVE_RBB_SEL_MASK			(1 << 1)
+#define OMAP3630_SR2EN_SHIFT				0
+#define OMAP3630_SR2EN_MASK				(1 << 0)
+
 /* RM_RSTST_NEON specific bits */
 
 /* PM_WKDEP_NEON specific bits */
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index c19d249..c9eea9a 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -167,6 +167,10 @@
 #define OMAP3430_PRM_VP2_VOLTAGE	OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0)
 #define OMAP3_PRM_VP2_STATUS_OFFSET	0x00e4
 #define OMAP3430_PRM_VP2_STATUS		OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4)
+#define OMAP3_PRM_LDO_ABB_SETUP_OFFSET	0x00f0
+#define OMAP3630_PRM_LDO_ABB_SETUP	OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00f0)
+#define OMAP3_PRM_LDO_ABB_CTRL_OFFSET	0x00f4
+#define OMAP3630_PRM_LDO_ABB_CTRL	OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00f4)
 
 #define OMAP3_PRM_CLKSEL_OFFSET	0x0040
 #define OMAP3430_PRM_CLKSEL		OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040)
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 2/7] ARM: omap: add ABB PRM_IRQSTATUS handlers
From: Mike Turquette @ 2012-10-04  1:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313974-5473-1-git-send-email-mturquette@ti.com>

Some PRM_IRQSTATUS registers contain a bit to signal that an ABB LDO
transition has completed.  These tranxdone bits exist for every instance
of an ABB LDO; thus these tranxdone bits are supported on 36xx variants
for the MPU voltage domain, and on 44xx variants for the MPU and IVA
voltage domains.

This patch introduces some data structures and helper functions for
checking on and clearing the TRANXDONE bits.  They are a copy-paste of
existing VP functions of similar nature and will be used in forthcoming
patches that control the ABB programming sequence during a DVFS
transition.

Some previous discussion on the design of the ABB PRM handlers can be
found here:
http://article.gmane.org/gmane.linux.ports.arm.omap/63609

Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/prm2xxx_3xxx.c |   36 +++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prm2xxx_3xxx.h |    4 ++++
 arch/arm/mach-omap2/prm44xx.c      |   44 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prm44xx.h      |    4 ++++
 4 files changed, 88 insertions(+)

diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index a0309de..8d3c63f 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -364,3 +364,39 @@ static int __init omap3xxx_prcm_init(void)
 	return ret;
 }
 subsys_initcall(omap3xxx_prcm_init);
+
+/* PRM ABB */
+
+/*
+ * struct omap36xx_abb - OMAP3 ABB register access description
+ * @tranxdone_status: ABB_xxx_DONE_ST bitmask in PRM_IRQSTATUS reg
+ */
+struct omap36xx_abb {
+	u32 tranxdone_status;
+};
+
+static struct omap36xx_abb omap36xx_abb[] = {
+	[OMAP3_VP_VDD_MPU_ID] = {
+		.tranxdone_status = OMAP3630_ABB_LDO_TRANXDONE_ST_MASK,
+	},
+};
+
+#define MAX_ABB_ID ARRAY_SIZE(omap36xx_abb);
+
+u32 omap3_prm_abb_check_txdone(u8 abb_id)
+{
+	struct omap36xx_abb *abb = &omap36xx_abb[abb_id];
+	u32 irqstatus;
+
+	irqstatus = omap2_prm_read_mod_reg(OCP_MOD,
+					   OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
+	return irqstatus & abb->tranxdone_status;
+}
+
+void omap3_prm_abb_clear_txdone(u8 abb_id)
+{
+	struct omap36xx_abb *abb = &omap36xx_abb[abb_id];
+
+	omap2_prm_write_mod_reg(abb->tranxdone_status,
+				OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
+}
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index c9eea9a..c24c039 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -249,6 +249,10 @@ extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift);
 u32 omap3_prm_vp_check_txdone(u8 vp_id);
 void omap3_prm_vp_clear_txdone(u8 vp_id);
 
+/* OMAP36xx-specific ABB functions */
+u32 omap3_prm_abb_check_txdone(u8 vp_id);
+void omap3_prm_abb_clear_txdone(u8 vp_id);
+
 /*
  * OMAP3 access functions for voltage controller (VC) and
  * voltage proccessor (VP) in the PRM.
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index bb727c2..9b820d4 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -301,3 +301,47 @@ static int __init omap4xxx_prcm_init(void)
 	return 0;
 }
 subsys_initcall(omap4xxx_prcm_init);
+
+/* PRM ABB */
+
+/*
+ * struct omap4_vp - OMAP4 VP register access description.
+ * @irqstatus_mpu: offset to IRQSTATUS_MPU register for VP
+ * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
+ */
+struct omap4_abb {
+	u32 irqstatus_mpu;
+	u32 tranxdone_status;
+};
+
+static struct omap4_abb omap4_abb[] = {
+	[OMAP4_VP_VDD_MPU_ID] = {
+		.irqstatus_mpu = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
+		.tranxdone_status = OMAP4430_ABB_MPU_DONE_ST_MASK,
+	},
+	[OMAP4_VP_VDD_IVA_ID] = {
+		.irqstatus_mpu = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
+		.tranxdone_status = OMAP4430_ABB_IVA_DONE_ST_MASK,
+	},
+};
+
+u32 omap4_prm_abb_check_txdone(u8 abb_id)
+{
+	struct omap4_abb *abb = &omap4_abb[abb_id];
+	u32 irqstatus;
+
+	irqstatus = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
+						OMAP4430_PRM_OCP_SOCKET_INST,
+						abb->irqstatus_mpu);
+	return irqstatus & abb->tranxdone_status;
+}
+
+void omap4_prm_abb_clear_txdone(u8 abb_id)
+{
+	struct omap4_abb *abb = &omap4_abb[abb_id];
+
+	omap4_prminst_write_inst_reg(abb->tranxdone_status,
+				     OMAP4430_PRM_PARTITION,
+				     OMAP4430_PRM_OCP_SOCKET_INST,
+				     abb->irqstatus_mpu);
+};
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
index ee72ae6..6a0a00c 100644
--- a/arch/arm/mach-omap2/prm44xx.h
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -755,6 +755,10 @@ extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
 u32 omap4_prm_vp_check_txdone(u8 vp_id);
 void omap4_prm_vp_clear_txdone(u8 vp_id);
 
+/* OMAP4-specific ABB functions */
+u32 omap4_prm_abb_check_txdone(u8 abb_id);
+void omap4_prm_abb_clear_txdone(u8 abb_id);
+
 /*
  * OMAP4 access functions for voltage controller (VC) and
  * voltage proccessor (VP) in the PRM.
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 3/7] ARM: omap: Adaptive Body-Bias structures & data
From: Mike Turquette @ 2012-10-04  1:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313974-5473-1-git-send-email-mturquette@ti.com>

Starting with OMAP36XX, some voltage domains have an ldo for biasing
voltage to the transistors within that domain.

This ldo has three modes of operation.  The first is Forward Body-Bias
mode (FBB) which boosts performance of transistors at high OPPs by
providng a positive voltage bias.  This comes at a cost of power.

The second mode is Reverse Body-Bias or RBB.  This mode provides a
negative voltage bias which saves on static leakage at lower OPPs.

Finally ABB can also be bypassed (the default state) in which case it
will just follow the voltage of the VP/VC.

This patch introduces the data structures needed to represent the ABB
ldo's in the voltage layer, and populates the appropriate data for 3630
and OMAP4.

Not all voltage domains have an ABB ldo; on OMAP36XX the CORE voltage
domain does not have an ABB ldo, and there are none on OMAP34xx.  In
such cases the voltage data will be marked with OMAP_ABB_NO_LDO.

Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/Makefile       |    6 ++-
 arch/arm/mach-omap2/abb.h          |   85 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/abb36xx_data.c |   39 +++++++++++++++++
 arch/arm/mach-omap2/abb44xx_data.c |   45 +++++++++++++++++++
 4 files changed, 173 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-omap2/abb.h
 create mode 100644 arch/arm/mach-omap2/abb36xx_data.c
 create mode 100644 arch/arm/mach-omap2/abb44xx_data.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 34c2c7f..57e053e 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -95,11 +95,13 @@ endif
 # PRCM
 omap-prcm-4-5-common			=  prcm.o cminst44xx.o cm44xx.o \
 					   prcm_mpu44xx.o prminst44xx.o \
-					   vc44xx_data.o vp44xx_data.o
+					   vc44xx_data.o vp44xx_data.o \
+					   abb44xx_data.o
 obj-y					+= prm_common.o
 obj-$(CONFIG_ARCH_OMAP2)		+= prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
 obj-$(CONFIG_ARCH_OMAP3)		+= prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
-obj-$(CONFIG_ARCH_OMAP3)		+= vc3xxx_data.o vp3xxx_data.o
+obj-$(CONFIG_ARCH_OMAP3)		+= vc3xxx_data.o vp3xxx_data.o \
+					   abb36xx_data.o
 obj-$(CONFIG_SOC_AM33XX)		+= prcm.o prm33xx.o cm33xx.o
 obj-$(CONFIG_ARCH_OMAP4)		+= $(omap-prcm-4-5-common) prm44xx.o
 obj-$(CONFIG_SOC_OMAP5)			+= $(omap-prcm-4-5-common)
diff --git a/arch/arm/mach-omap2/abb.h b/arch/arm/mach-omap2/abb.h
new file mode 100644
index 0000000..2acc187
--- /dev/null
+++ b/arch/arm/mach-omap2/abb.h
@@ -0,0 +1,85 @@
+/*
+ * OMAP Adaptive Body-Bias structure and macro definitions
+ *
+ * Copyright (C) 2011 Texas Instruments, Inc.
+ * Mike Turquette <mturquette@ti.com>
+ *
+ * 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.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_ABB_H
+#define __ARCH_ARM_MACH_OMAP2_ABB_H
+
+#include <linux/kernel.h>
+
+#include "voltage.h"
+
+/* NOMINAL_OPP bypasses the ABB ldo, FAST_OPP sets it to Forward Body-Bias */
+#define OMAP_ABB_NOMINAL_OPP	0
+#define OMAP_ABB_FAST_OPP	1
+#define OMAP_ABB_NO_LDO		(~0)
+
+/* Time for the ABB ldo to settle after transition (in micro-seconds) */
+#define ABB_TRANXDONE_TIMEOUT	50
+
+/*
+ * struct omap_abb_ops - per-OMAP operations needed for ABB transition
+ *
+ * @check_tranxdone: return status of ldo transition from PRM_IRQSTATUS
+ * @clear_tranxdone: clear ABB transition status bit from PRM_IRQSTATUS
+ */
+struct omap_abb_ops {
+	u32 (*check_tranxdone)(u8 irq_id);
+	void (*clear_tranxdone)(u8 irq_id);
+};
+
+/*
+ * struct omap_abb_common - ABB data common to an OMAP family
+ *
+ * @opp_sel_mask: CTRL reg uses this to program next state of ldo
+ * @opp_change_mask: CTRL reg uses this to initiate ldo state change
+ * @sr2_wtcnt_value_mask: SETUP reg uses this to program ldo settling time
+ * @sr2en_mask: SETUP reg uses this to enable/disable ldo
+ * @active_fbb_sel_mask: SETUP reg uses this to enable/disable FBB operation
+ * @settling_time: number of micro-seconds it takes for ldo to transition
+ * @clock_cycles: settling_time is counted in multiples of clock cycles
+ * @ops: pointer to common ops for manipulating PRM_IRQSTATUS bits
+ */
+struct omap_abb_common {
+	u32 opp_sel_mask;
+	u32 opp_change_mask;
+	u32 sr2_wtcnt_value_mask;
+	u32 sr2en_mask;
+	u32 active_fbb_sel_mask;
+	unsigned long settling_time;
+	unsigned long clock_cycles;
+	const struct omap_abb_ops *ops;
+};
+
+/*
+ * struct omap_abb_instance - data for each instance of ABB ldo
+ *
+ * @setup_offs: PRM register offset for initial configuration of ABB ldo
+ * @ctrl_offs: PRM register offset for active programming of ABB ldo
+ * @prm_irq_id: IRQ handle used to resolve IRQSTATUS offset & masks
+ * @enabled: track whether ABB ldo is enabled or disabled
+ * @common: pointer to common data for all ABB ldo's
+ * @_opp_sel: internally track last programmed state of ABB ldo.  DO NOT USE
+ */
+struct omap_abb_instance {
+	u8 setup_offs;
+	u8 ctrl_offs;
+	u8 prm_irq_id;
+	bool enabled;
+	const struct omap_abb_common *common;
+	u8 _opp_sel;
+};
+
+extern struct omap_abb_instance omap36xx_abb_mpu;
+
+extern struct omap_abb_instance omap4_abb_mpu;
+extern struct omap_abb_instance omap4_abb_iva;
+
+#endif
diff --git a/arch/arm/mach-omap2/abb36xx_data.c b/arch/arm/mach-omap2/abb36xx_data.c
new file mode 100644
index 0000000..21c9267
--- /dev/null
+++ b/arch/arm/mach-omap2/abb36xx_data.c
@@ -0,0 +1,39 @@
+/*
+ * OMAP36xx Adaptive Body-Bias (ABB) data
+ *
+ * Copyright (C) 2011 Texas Instruments, Inc.
+ * Mike Turquette <mturquette@ti.com>
+ *
+ * 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.
+ */
+
+#include "abb.h"
+#include "vp.h"
+#include "prm2xxx_3xxx.h"
+#include "prm-regbits-34xx.h"
+
+static const struct omap_abb_ops omap36xx_abb_ops = {
+	.check_tranxdone   = &omap3_prm_abb_check_txdone,
+	.clear_tranxdone   = &omap3_prm_abb_clear_txdone,
+};
+
+static const struct omap_abb_common omap36xx_abb_common = {
+	.opp_sel_mask		= OMAP3630_OPP_SEL_MASK,
+	.opp_change_mask	= OMAP3630_OPP_CHANGE_MASK,
+	.sr2en_mask		= OMAP3630_SR2EN_MASK,
+	.active_fbb_sel_mask	= OMAP3630_ACTIVE_FBB_SEL_MASK,
+	.sr2_wtcnt_value_mask	= OMAP3630_SR2_WTCNT_VALUE_MASK,
+	.settling_time		= 30,
+	.clock_cycles		= 8,
+	.ops			= &omap36xx_abb_ops,
+};
+
+/* SETUP & CTRL registers swapped names in OMAP4; thus 36xx looks strange */
+struct omap_abb_instance omap36xx_abb_mpu = {
+	.setup_offs		= OMAP3_PRM_LDO_ABB_CTRL_OFFSET,
+	.ctrl_offs		= OMAP3_PRM_LDO_ABB_SETUP_OFFSET,
+	.prm_irq_id		= OMAP3_VP_VDD_MPU_ID,
+	.common			= &omap36xx_abb_common,
+};
diff --git a/arch/arm/mach-omap2/abb44xx_data.c b/arch/arm/mach-omap2/abb44xx_data.c
new file mode 100644
index 0000000..d7ff0c5
--- /dev/null
+++ b/arch/arm/mach-omap2/abb44xx_data.c
@@ -0,0 +1,45 @@
+/*
+ * OMAP44xx Adaptive Body-Bias (ABB) data
+ *
+ * Copyright (C) 2011 Texas Instruments, Inc.
+ * Mike Turquette <mturquette@ti.com>
+ *
+ * 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.
+ */
+
+#include "abb.h"
+#include "vp.h"
+#include "prm44xx.h"
+#include "prm-regbits-44xx.h"
+
+static const struct omap_abb_ops omap4_abb_ops = {
+	.check_tranxdone   = &omap4_prm_abb_check_txdone,
+	.clear_tranxdone   = &omap4_prm_abb_clear_txdone,
+};
+
+static const struct omap_abb_common omap4_abb_common = {
+	.opp_sel_mask		= OMAP4430_OPP_SEL_MASK,
+	.opp_change_mask	= OMAP4430_OPP_CHANGE_MASK,
+	.sr2en_mask		= OMAP4430_SR2EN_MASK,
+	.active_fbb_sel_mask	= OMAP4430_ACTIVE_FBB_SEL_MASK,
+	.sr2_wtcnt_value_mask	= OMAP4430_SR2_WTCNT_VALUE_MASK,
+	.settling_time		= 50,
+	.clock_cycles		= 16,
+	.ops			= &omap4_abb_ops,
+};
+
+struct omap_abb_instance omap4_abb_mpu = {
+	.setup_offs		= OMAP4_PRM_LDO_ABB_MPU_SETUP_OFFSET,
+	.ctrl_offs		= OMAP4_PRM_LDO_ABB_MPU_CTRL_OFFSET,
+	.prm_irq_id		= OMAP4_VP_VDD_MPU_ID,
+	.common			= &omap4_abb_common,
+};
+
+struct omap_abb_instance omap4_abb_iva = {
+	.setup_offs		= OMAP4_PRM_LDO_ABB_IVA_SETUP_OFFSET,
+	.ctrl_offs		= OMAP4_PRM_LDO_ABB_IVA_CTRL_OFFSET,
+	.prm_irq_id		= OMAP4_VP_VDD_IVA_ID,
+	.common			= &omap4_abb_common,
+};
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 4/7] ARM: omap: opp: add ABB data to voltage tables
From: Mike Turquette @ 2012-10-04  1:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313974-5473-1-git-send-email-mturquette@ti.com>

The operating mode of the Adaptive Body-Bias ldo is a function of the
voltage at which the VDD is operating and silicon characteristics.

NOMINAL_OPP causes the ABB ldo to be in bypass at that specific voltage.
FAST_OPP causes the ldo to operate in Forward Body-Bias mode.  SLOW_OPP
puts the ldo in Reverse Body-Bias mode.

This patch models this relationship by adding an opp_sel paramter to
struct omap_volt_data and populates this data in the 3630 and 4430
voltage tables.

Not all voltage domains have an ABB ldo and 3430 doesn't have one at
all.  In such cases voltages are marked with OMAP_ABB_NO_LDO.

Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/omap_opp_data.h       |    5 ++--
 arch/arm/mach-omap2/opp3xxx_data.c        |   37 +++++++++++++++--------------
 arch/arm/mach-omap2/opp4xxx_data.c        |   25 +++++++++----------
 arch/arm/plat-omap/include/plat/voltage.h |    1 +
 4 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_opp_data.h b/arch/arm/mach-omap2/omap_opp_data.h
index c784c12..1facc52 100644
--- a/arch/arm/mach-omap2/omap_opp_data.h
+++ b/arch/arm/mach-omap2/omap_opp_data.h
@@ -71,12 +71,13 @@ struct omap_opp_def {
  * Initialization wrapper used to define SmartReflex process data
  * XXX Is this needed?  Just use C99 initializers in data files?
  */
-#define VOLT_DATA_DEFINE(_v_nom, _efuse_offs, _errminlimit, _errgain)  \
+#define VOLT_DATA_DEFINE(_v_nom, _efuse_offs, _errminlimit, _errgain, _opp_sel) \
 {								       \
 	.volt_nominal	= _v_nom,				       \
 	.sr_efuse_offs	= _efuse_offs,				       \
 	.sr_errminlimit = _errminlimit,				       \
-	.vp_errgain	= _errgain				       \
+	.vp_errgain	= _errgain,				       \
+	.opp_sel	= _opp_sel,				       \
 }
 
 /* Use this to initialize the default table */
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c
index d95f3f9..12fc2da 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -24,6 +24,7 @@
 #include "control.h"
 #include "omap_opp_data.h"
 #include "pm.h"
+#include "abb.h"
 
 /* 34xx */
 
@@ -36,12 +37,12 @@
 #define OMAP3430_VDD_MPU_OPP5_UV		1350000
 
 struct omap_volt_data omap34xx_vddmpu_volt_data[] = {
-	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD1, 0xf4, 0x0c),
-	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD1, 0xf4, 0x0c),
-	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD1, 0xf9, 0x18),
-	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP4_UV, OMAP343X_CONTROL_FUSE_OPP4_VDD1, 0xf9, 0x18),
-	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP5_UV, OMAP343X_CONTROL_FUSE_OPP5_VDD1, 0xf9, 0x18),
-	VOLT_DATA_DEFINE(0, 0, 0, 0),
+	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD1, 0xf4, 0x0c, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD1, 0xf4, 0x0c, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD1, 0xf9, 0x18, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP4_UV, OMAP343X_CONTROL_FUSE_OPP4_VDD1, 0xf9, 0x18, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP5_UV, OMAP343X_CONTROL_FUSE_OPP5_VDD1, 0xf9, 0x18, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(0, 0, 0, 0, 0),
 };
 
 /* VDD2 */
@@ -51,10 +52,10 @@ struct omap_volt_data omap34xx_vddmpu_volt_data[] = {
 #define OMAP3430_VDD_CORE_OPP3_UV		1150000
 
 struct omap_volt_data omap34xx_vddcore_volt_data[] = {
-	VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD2, 0xf4, 0x0c),
-	VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD2, 0xf4, 0x0c),
-	VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD2, 0xf9, 0x18),
-	VOLT_DATA_DEFINE(0, 0, 0, 0),
+	VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD2, 0xf4, 0x0c, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD2, 0xf4, 0x0c, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD2, 0xf9, 0x18, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(0, 0, 0, 0, 0),
 };
 
 /* 36xx */
@@ -67,11 +68,11 @@ struct omap_volt_data omap34xx_vddcore_volt_data[] = {
 #define OMAP3630_VDD_MPU_OPP1G_UV		1375000
 
 struct omap_volt_data omap36xx_vddmpu_volt_data[] = {
-	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD1, 0xf4, 0x0c),
-	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD1, 0xf9, 0x16),
-	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP120_UV, OMAP3630_CONTROL_FUSE_OPP120_VDD1, 0xfa, 0x23),
-	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP1G_UV, OMAP3630_CONTROL_FUSE_OPP1G_VDD1, 0xfa, 0x27),
-	VOLT_DATA_DEFINE(0, 0, 0, 0),
+	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD1, 0xf4, 0x0c, OMAP_ABB_NOMINAL_OPP),
+	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD1, 0xf9, 0x16, OMAP_ABB_NOMINAL_OPP),
+	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP120_UV, OMAP3630_CONTROL_FUSE_OPP120_VDD1, 0xfa, 0x23, OMAP_ABB_NOMINAL_OPP),
+	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP1G_UV, OMAP3630_CONTROL_FUSE_OPP1G_VDD1, 0xfa, 0x27, OMAP_ABB_FAST_OPP),
+	VOLT_DATA_DEFINE(0, 0, 0, 0, 0),
 };
 
 /* VDD2 */
@@ -80,9 +81,9 @@ struct omap_volt_data omap36xx_vddmpu_volt_data[] = {
 #define OMAP3630_VDD_CORE_OPP100_UV		1200000
 
 struct omap_volt_data omap36xx_vddcore_volt_data[] = {
-	VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD2, 0xf4, 0x0c),
-	VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD2, 0xf9, 0x16),
-	VOLT_DATA_DEFINE(0, 0, 0, 0),
+	VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD2, 0xf4, 0x0c, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD2, 0xf9, 0x16, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(0, 0, 0, 0, 0),
 };
 
 /* OPP data */
diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-omap2/opp4xxx_data.c
index c95415d..c9b8e8a 100644
--- a/arch/arm/mach-omap2/opp4xxx_data.c
+++ b/arch/arm/mach-omap2/opp4xxx_data.c
@@ -25,6 +25,7 @@
 #include "control.h"
 #include "omap_opp_data.h"
 #include "pm.h"
+#include "abb.h"
 
 /*
  * Structures containing OMAP4430 voltage supported and various
@@ -37,11 +38,11 @@
 #define OMAP4430_VDD_MPU_OPPNITRO_UV		1375000
 
 struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = {
-	VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c),
-	VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16),
-	VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23),
-	VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO, 0xfa, 0x27),
-	VOLT_DATA_DEFINE(0, 0, 0, 0),
+	VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c, OMAP_ABB_NOMINAL_OPP),
+	VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16, OMAP_ABB_NOMINAL_OPP),
+	VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23, OMAP_ABB_NOMINAL_OPP),
+	VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO, 0xfa, 0x27, OMAP_ABB_FAST_OPP),
+	VOLT_DATA_DEFINE(0, 0, 0, 0, 0),
 };
 
 #define OMAP4430_VDD_IVA_OPP50_UV		1013000
@@ -49,19 +50,19 @@ struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = {
 #define OMAP4430_VDD_IVA_OPPTURBO_UV		1300000
 
 struct omap_volt_data omap44xx_vdd_iva_volt_data[] = {
-	VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c),
-	VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16),
-	VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23),
-	VOLT_DATA_DEFINE(0, 0, 0, 0),
+	VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c, OMAP_ABB_NOMINAL_OPP),
+	VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16, OMAP_ABB_NOMINAL_OPP),
+	VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23, OMAP_ABB_NOMINAL_OPP),
+	VOLT_DATA_DEFINE(0, 0, 0, 0, 0),
 };
 
 #define OMAP4430_VDD_CORE_OPP50_UV		1025000
 #define OMAP4430_VDD_CORE_OPP100_UV		1200000
 
 struct omap_volt_data omap44xx_vdd_core_volt_data[] = {
-	VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c),
-	VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16),
-	VOLT_DATA_DEFINE(0, 0, 0, 0),
+	VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16, OMAP_ABB_NO_LDO),
+	VOLT_DATA_DEFINE(0, 0, 0, 0, 0),
 };
 
 
diff --git a/arch/arm/plat-omap/include/plat/voltage.h b/arch/arm/plat-omap/include/plat/voltage.h
index 5be4d5d..dd7b1f8 100644
--- a/arch/arm/plat-omap/include/plat/voltage.h
+++ b/arch/arm/plat-omap/include/plat/voltage.h
@@ -28,6 +28,7 @@ struct omap_volt_data {
 	u32	sr_efuse_offs;
 	u8	sr_errminlimit;
 	u8	vp_errgain;
+	u8	opp_sel;
 };
 struct voltagedomain;
 
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 5/7] ARM: omap: voltage: per-voltage domain ABB data
From: Mike Turquette @ 2012-10-04  1:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313974-5473-1-git-send-email-mturquette@ti.com>

This patch adds struct omap_abb_instance to struct voltagedomain and
populates the data for those voltage domains that have an ABB ldo on
both 36xx and 44xx silicon.

Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/voltage.h                 |    1 +
 arch/arm/mach-omap2/voltagedomains3xxx_data.c |    2 ++
 arch/arm/mach-omap2/voltagedomains44xx_data.c |    3 +++
 3 files changed, 6 insertions(+)

diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 0ded54f..546b3d7 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -73,6 +73,7 @@ struct voltagedomain {
 	struct omap_vc_channel *vc;
 	const struct omap_vfsm_instance *vfsm;
 	struct omap_vp_instance *vp;
+	struct omap_abb_instance *abb;
 	struct omap_voltdm_pmic *pmic;
 
 	/* VC/VP register access functions: SoC specific */
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index d0103c8..f6c8a59 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -26,6 +26,7 @@
 #include "voltage.h"
 #include "vc.h"
 #include "vp.h"
+#include "abb.h"
 
 /*
  * VDD data
@@ -112,6 +113,7 @@ void __init omap3xxx_voltagedomains_init(void)
 	if (cpu_is_omap3630()) {
 		omap3_voltdm_mpu.volt_data = omap36xx_vddmpu_volt_data;
 		omap3_voltdm_core.volt_data = omap36xx_vddcore_volt_data;
+		omap3_voltdm_mpu.abb = &omap36xx_abb_mpu;
 	} else {
 		omap3_voltdm_mpu.volt_data = omap34xx_vddmpu_volt_data;
 		omap3_voltdm_core.volt_data = omap34xx_vddcore_volt_data;
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index c3115f6..da4c70b 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -31,6 +31,7 @@
 #include "omap_opp_data.h"
 #include "vc.h"
 #include "vp.h"
+#include "abb.h"
 
 static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = {
 	.voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
@@ -53,6 +54,7 @@ static struct voltagedomain omap4_voltdm_mpu = {
 	.vc = &omap4_vc_mpu,
 	.vfsm = &omap4_vdd_mpu_vfsm,
 	.vp = &omap4_vp_mpu,
+	.abb = &omap4_abb_mpu,
 };
 
 static struct voltagedomain omap4_voltdm_iva = {
@@ -64,6 +66,7 @@ static struct voltagedomain omap4_voltdm_iva = {
 	.vc = &omap4_vc_iva,
 	.vfsm = &omap4_vdd_iva_vfsm,
 	.vp = &omap4_vp_iva,
+	.abb = &omap4_abb_iva,
 };
 
 static struct voltagedomain omap4_voltdm_core = {
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 6/7] ARM: omap: abb: init & transition functions
From: Mike Turquette @ 2012-10-04  1:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313974-5473-1-git-send-email-mturquette@ti.com>

The Adaptive Body-Bias ldo can be set to bypass, Forward Body-Bias or
Reverse Body-Bias during a voltage transition.  The ABB programming
sequence depends on whether voltage is scaling up or down.

This patch implements the Adaptive Body-Bias ldo initialization routine
and the transition sequence which is needed after any voltage scaling
operation.

Note that this sequence will need to be revisited someday when the
various SmartReflex AVS features, fixes and improvements are upstreamed
and enabled for OMAP2+ kernels.

Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/Makefile |    2 +-
 arch/arm/mach-omap2/abb.c    |  322 ++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/abb.h    |    9 ++
 3 files changed, 332 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-omap2/abb.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 57e053e..a262aaa 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -107,7 +107,7 @@ obj-$(CONFIG_ARCH_OMAP4)		+= $(omap-prcm-4-5-common) prm44xx.o
 obj-$(CONFIG_SOC_OMAP5)			+= $(omap-prcm-4-5-common)
 
 # OMAP voltage domains
-voltagedomain-common			:= voltage.o vc.o vp.o
+voltagedomain-common			:= voltage.o vc.o vp.o abb.o
 obj-$(CONFIG_ARCH_OMAP2)		+= $(voltagedomain-common)
 obj-$(CONFIG_ARCH_OMAP2)		+= voltagedomains2xxx_data.o
 obj-$(CONFIG_ARCH_OMAP3)		+= $(voltagedomain-common)
diff --git a/arch/arm/mach-omap2/abb.c b/arch/arm/mach-omap2/abb.c
new file mode 100644
index 0000000..e8a3ae0
--- /dev/null
+++ b/arch/arm/mach-omap2/abb.c
@@ -0,0 +1,322 @@
+/*
+ * OMAP Adaptive Body-Bias core
+ *
+ * Copyright (C) 2011 Texas Instruments, Inc.
+ * Mike Turquette <mturquette@ti.com>
+ *
+ * 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.
+ */
+
+#include <linux/init.h>
+#include <linux/delay.h>
+
+#include "abb.h"
+#include "voltage.h"
+
+/**
+ * omap_abb_set_opp - program ABB ldo based on new voltage
+ *
+ * @voltdm - voltage domain that just finished scaling voltage
+ * @opp_sel - target ABB ldo operating mode
+ *
+ * Program the ABB ldo to the new state (if necessary), clearing the
+ * PRM_IRQSTATUS bit before and after the transition.  Returns 0 on
+ * success, -ETIMEDOUT otherwise.
+ */
+int omap_abb_set_opp(struct voltagedomain *voltdm, u8 opp_sel)
+{
+	struct omap_abb_instance *abb = voltdm->abb;
+	int ret, timeout;
+
+	/* bail early if no transition is necessary */
+	if (opp_sel == abb->_opp_sel)
+		return 0;
+
+	/* clear interrupt status */
+	timeout = 0;
+	while (timeout++ < ABB_TRANXDONE_TIMEOUT) {
+		abb->common->ops->clear_tranxdone(abb->prm_irq_id);
+
+		ret = abb->common->ops->check_tranxdone(abb->prm_irq_id);
+		if (!ret)
+			break;
+
+		udelay(1);
+	}
+
+	if (timeout >= ABB_TRANXDONE_TIMEOUT) {
+		pr_warn("%s: vdd_%s ABB TRANXDONE timeout\n",
+				__func__, voltdm->name);
+		return -ETIMEDOUT;
+	}
+
+	/* program the setup register */
+	switch (opp_sel) {
+	case OMAP_ABB_NOMINAL_OPP:
+		voltdm->rmw(abb->common->active_fbb_sel_mask,
+				0x0,
+				abb->setup_offs);
+		break;
+	case OMAP_ABB_FAST_OPP:
+		voltdm->rmw(abb->common->active_fbb_sel_mask,
+				abb->common->active_fbb_sel_mask,
+				abb->setup_offs);
+		break;
+	}
+
+	/* program next state of ABB ldo */
+	voltdm->rmw(abb->common->opp_sel_mask,
+			opp_sel << __ffs(abb->common->opp_sel_mask),
+			abb->ctrl_offs);
+
+	/* initiate ABB ldo change */
+	voltdm->rmw(abb->common->opp_change_mask,
+			abb->common->opp_change_mask,
+			abb->ctrl_offs);
+
+	/* clear interrupt status */
+	timeout = 0;
+	while (timeout++ < ABB_TRANXDONE_TIMEOUT) {
+		abb->common->ops->clear_tranxdone(abb->prm_irq_id);
+
+		ret = abb->common->ops->check_tranxdone(abb->prm_irq_id);
+		if (!ret)
+			break;
+
+		udelay(1);
+	}
+
+	if (timeout >= ABB_TRANXDONE_TIMEOUT) {
+		pr_warn("%s: vdd_%s ABB TRANXDONE timeout\n",
+				__func__, voltdm->name);
+		return -ETIMEDOUT;
+	}
+
+	/* track internal state */
+	abb->_opp_sel = opp_sel;
+
+	return 0;
+}
+
+/**
+ * omap_abb_pre_scale - ABB transition pre-voltage scale, if needed
+ *
+ * @voltdm - voltage domain that is about to scale
+ * @target_volt - voltage that voltdm is scaling towards
+ *
+ * Changes the ABB ldo mode prior to scaling the voltage domain.
+ * Returns 0 on success, otherwise an error code.
+ */
+int omap_abb_pre_scale(struct voltagedomain *voltdm,
+		unsigned long target_volt)
+{
+	struct omap_abb_instance *abb = voltdm->abb;
+	struct omap_volt_data *cur_volt_data;
+	struct omap_volt_data *target_volt_data;
+	u8 opp_sel;
+
+	/* sanity */
+	if (!voltdm)
+		return -EINVAL;
+
+	if (!abb)
+		return 0;
+
+	/*
+	 * XXX boot-time corner case: voltdm->nominal volt might be zero
+	 *
+	 * This implies that we're running at the default PMIC voltage,
+	 * since voltdm->nominal_volt should have been populated in
+	 * omap_voltage_late_init if the voltage had been scaled
+	 * previously.  The best way to fix this is for DT data to pass
+	 * in PMIC boot voltage.
+	 *
+	 * For now, handle this by returning success (0) to not block
+	 * the rest of the transition.
+	 */
+	if (!voltdm->nominal_volt)
+		return 0;
+
+	cur_volt_data = omap_voltage_get_voltdata(voltdm, voltdm->nominal_volt);
+	target_volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
+
+	if (IS_ERR(cur_volt_data))
+		return PTR_ERR(cur_volt_data);
+
+	if (IS_ERR(target_volt_data))
+		return PTR_ERR(target_volt_data);
+
+	/* bail if the sequence is wrong */
+	if (target_volt_data->volt_nominal > cur_volt_data->volt_nominal)
+		return 0;
+
+	opp_sel = target_volt_data->opp_sel;
+
+	/* bail early if no transition is necessary */
+	if (opp_sel == abb->_opp_sel)
+		return 0;
+
+	return omap_abb_set_opp(voltdm, opp_sel);
+}
+
+/**
+ * omap_abb_post_scale - ABB transition post-voltage scale, if needed
+ * @voltdm - voltage domain that just finished scaling
+ * @target_volt - voltage that voltdm is scaling towards
+ *
+ * Changes the ABB ldo mode prior to scaling the voltage domain.
+ * Returns 0 on success, otherwise an error code.
+ */
+int omap_abb_post_scale(struct voltagedomain *voltdm,
+		unsigned long target_volt)
+{
+	struct omap_abb_instance *abb = voltdm->abb;
+	struct omap_volt_data *cur_volt_data;
+	struct omap_volt_data *target_volt_data;
+	u8 opp_sel;
+
+	/* sanity */
+	if (!voltdm)
+		return -EINVAL;
+
+	if (!abb)
+		return 0;
+
+	cur_volt_data = omap_voltage_get_voltdata(voltdm, voltdm->nominal_volt);
+	if (IS_ERR(cur_volt_data))
+		return PTR_ERR(cur_volt_data);
+
+	target_volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
+	if (IS_ERR(target_volt_data))
+		return PTR_ERR(target_volt_data);
+
+	/* bail if the sequence is wrong */
+	if (target_volt_data->volt_nominal < cur_volt_data->volt_nominal)
+		return 0;
+
+	opp_sel = target_volt_data->opp_sel;
+
+	/* bail early if no transition is necessary */
+	if (opp_sel == abb->_opp_sel)
+		return 0;
+
+	return omap_abb_set_opp(voltdm, opp_sel);
+}
+
+/*
+ * omap_abb_enable - enable ABB ldo on a particular voltage domain
+ *
+ * @voltdm - pointer to particular voltage domain
+ */
+void omap_abb_enable(struct voltagedomain *voltdm)
+{
+	struct omap_abb_instance *abb = voltdm->abb;
+
+	if (abb->enabled)
+		return;
+
+	abb->enabled = true;
+
+	voltdm->rmw(abb->common->sr2en_mask, abb->common->sr2en_mask,
+			abb->setup_offs);
+}
+
+/*
+ * omap_abb_disable - disable ABB ldo on a particular voltage domain
+ *
+ * @voltdm - pointer to particular voltage domain
+ *
+ * Included for completeness.  Not currently used but will be needed in the
+ * future if ABB is converted to a loadable module.
+ */
+void omap_abb_disable(struct voltagedomain *voltdm)
+{
+	struct omap_abb_instance *abb = voltdm->abb;
+
+	if (!abb->enabled)
+		return;
+
+	abb->enabled = false;
+
+	voltdm->rmw(abb->common->sr2en_mask,
+			(0 << __ffs(abb->common->sr2en_mask)),
+			abb->setup_offs);
+}
+
+/*
+ * omap_abb_init - Initialize an ABB ldo instance
+ *
+ * @voltdm: voltage domain upon which ABB ldo resides
+ *
+ * Initializes an individual ABB ldo for Forward Body-Bias.  FBB is used to
+ * insure stability at higher voltages.  Note that some older OMAP chips have a
+ * Reverse Body-Bias mode meant to save power at low voltage, but that mode is
+ * unsupported and phased out on newer chips.
+ */
+void __init omap_abb_init(struct voltagedomain *voltdm)
+{
+	struct omap_abb_instance *abb = voltdm->abb;
+	u32 sys_clk_rate;
+	u32 sr2_wt_cnt_val;
+	u32 clock_cycles;
+	u32 settling_time;
+	u32 val;
+
+	if (IS_ERR_OR_NULL(abb))
+		return;
+
+	/*
+	 * SR2_WTCNT_VALUE is the settling time for the ABB ldo after a
+	 * transition and must be programmed with the correct time at boot.
+	 * The value programmed into the register is the number of SYS_CLK
+	 * clock cycles that match a given wall time profiled for the ldo.
+	 * This value depends on:
+	 * settling time of ldo in micro-seconds (varies per OMAP family)
+	 * # of clock cycles per SYS_CLK period (varies per OMAP family)
+	 * the SYS_CLK frequency in MHz (varies per board)
+	 * The formula is:
+	 *
+	 *                      ldo settling time (in micro-seconds)
+	 * SR2_WTCNT_VALUE = ------------------------------------------
+	 *                   (# system clock cycles) * (sys_clk period)
+	 *
+	 * Put another way:
+	 *
+	 * SR2_WTCNT_VALUE = settling time / (# SYS_CLK cycles / SYS_CLK rate))
+	 *
+	 * To avoid dividing by zero multiply both "# clock cycles" and
+	 * "settling time" by 10 such that the final result is the one we want.
+	 */
+
+	/* convert SYS_CLK rate to MHz & prevent divide by zero */
+	sys_clk_rate = DIV_ROUND_CLOSEST(voltdm->sys_clk.rate, 1000000);
+	clock_cycles = abb->common->clock_cycles * 10;
+	settling_time = abb->common->settling_time * 10;
+
+	/* calculate cycle rate */
+	clock_cycles = DIV_ROUND_CLOSEST(clock_cycles, sys_clk_rate);
+
+	/* calulate SR2_WTCNT_VALUE */
+	sr2_wt_cnt_val = DIV_ROUND_CLOSEST(settling_time, clock_cycles);
+
+	voltdm->rmw(abb->common->sr2_wtcnt_value_mask,
+			(sr2_wt_cnt_val << __ffs(abb->common->sr2_wtcnt_value_mask)),
+			abb->setup_offs);
+
+	/* did bootloader set OPP_SEL? */
+	val = voltdm->read(abb->ctrl_offs);
+	val &= abb->common->opp_sel_mask;
+	abb->_opp_sel = val >> __ffs(abb->common->opp_sel_mask);
+
+	/* enable the ldo if not done by bootloader */
+	val = voltdm->read(abb->setup_offs);
+	val &= abb->common->sr2en_mask;
+	if (val)
+		abb->enabled = true;
+	else
+		omap_abb_enable(voltdm);
+
+	return;
+}
diff --git a/arch/arm/mach-omap2/abb.h b/arch/arm/mach-omap2/abb.h
index 2acc187..b18305f 100644
--- a/arch/arm/mach-omap2/abb.h
+++ b/arch/arm/mach-omap2/abb.h
@@ -82,4 +82,13 @@ extern struct omap_abb_instance omap36xx_abb_mpu;
 extern struct omap_abb_instance omap4_abb_mpu;
 extern struct omap_abb_instance omap4_abb_iva;
 
+void omap_abb_init(struct voltagedomain *voltdm);
+void omap_abb_enable(struct voltagedomain *voltdm);
+void omap_abb_disble(struct voltagedomain *voltdm);
+int omap_abb_set_opp(struct voltagedomain *voltdm, u8 opp_sel);
+int omap_abb_pre_scale(struct voltagedomain *voltdm,
+		unsigned long target_volt);
+int omap_abb_post_scale(struct voltagedomain *voltdm,
+		unsigned long target_volt);
+
 #endif
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 7/7] ARM: omap: voltage: add ABB to voltage scaling
From: Mike Turquette @ 2012-10-04  1:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313974-5473-1-git-send-email-mturquette@ti.com>

Adaptive Body-Bias ldo state should be transitioned (if necessary)
during any voltage scaling operation.

This patch initializes ABB LDO's as a part of the greater voltage domain
initialization sequence and adds the ABB transition callbacks to the
primary voltage domain scaling function, voltdm_scale().

Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
 arch/arm/mach-omap2/voltage.c |   28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index f45716c..9cac9fe 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -41,6 +41,7 @@
 
 #include "vc.h"
 #include "vp.h"
+#include "abb.h"
 
 static LIST_HEAD(voltdm_list);
 
@@ -101,10 +102,30 @@ int voltdm_scale(struct voltagedomain *voltdm,
 		return -EINVAL;
 	}
 
+	ret = omap_abb_pre_scale(voltdm, volt);
+	if (ret) {
+		pr_err("%s: abb prescale failed for vdd%s: %d\n",
+				__func__, voltdm->name, ret);
+		goto out;
+	}
+
 	ret = voltdm->scale(voltdm, volt);
-	if (!ret)
-		voltdm->nominal_volt = volt;
+	if (ret) {
+		pr_err("%s: vdd_%s failed to scale: %d\n",
+				__func__, voltdm->name, ret);
+		goto out;
+	}
+
+	voltdm->nominal_volt = volt;
 
+	ret = omap_abb_post_scale(voltdm, volt);
+	if (ret) {
+		pr_err("%s: abb postscale failed for vdd%s: %d\n",
+				__func__, voltdm->name, ret);
+		goto out;
+	}
+
+out:
 	return ret;
 }
 
@@ -300,6 +321,9 @@ int __init omap_voltage_late_init(void)
 			omap_vp_init(voltdm);
 		}
 
+		if (voltdm->abb)
+			omap_abb_init(voltdm);
+
 		/*
 		 * XXX If voltdm->nominal_volt is zero after calling
 		 * voltdm->get_voltage then we are likely running this
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 6/7] ARM: omap: abb: init & transition functions
From: Dimitar Dimitrov @ 2012-10-04  2:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1349313974-5473-7-git-send-email-mturquette@ti.com>

On Wed, Oct 3, 2012 at 6:26 PM, Mike Turquette <mturquette@ti.com> wrote:
> The Adaptive Body-Bias ldo can be set to bypass, Forward Body-Bias or
> Reverse Body-Bias during a voltage transition.  The ABB programming
> sequence depends on whether voltage is scaling up or down.
>
> This patch implements the Adaptive Body-Bias ldo initialization routine
> and the transition sequence which is needed after any voltage scaling
> operation.
>
> Note that this sequence will need to be revisited someday when the
> various SmartReflex AVS features, fixes and improvements are upstreamed
> and enabled for OMAP2+ kernels.
>
> Signed-off-by: Mike Turquette <mturquette@ti.com>
> Signed-off-by: Mike Turquette <mturquette@linaro.org>
> ---
>  arch/arm/mach-omap2/Makefile |    2 +-
>  arch/arm/mach-omap2/abb.c    |  322 ++++++++++++++++++++++++++++++++++++++++++
>  arch/arm/mach-omap2/abb.h    |    9 ++
>  3 files changed, 332 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/mach-omap2/abb.c
>
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index 57e053e..a262aaa 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -107,7 +107,7 @@ obj-$(CONFIG_ARCH_OMAP4)            += $(omap-prcm-4-5-common) prm44xx.o
>  obj-$(CONFIG_SOC_OMAP5)                        += $(omap-prcm-4-5-common)
>
>  # OMAP voltage domains
> -voltagedomain-common                   := voltage.o vc.o vp.o
> +voltagedomain-common                   := voltage.o vc.o vp.o abb.o
>  obj-$(CONFIG_ARCH_OMAP2)               += $(voltagedomain-common)
>  obj-$(CONFIG_ARCH_OMAP2)               += voltagedomains2xxx_data.o
>  obj-$(CONFIG_ARCH_OMAP3)               += $(voltagedomain-common)
> diff --git a/arch/arm/mach-omap2/abb.c b/arch/arm/mach-omap2/abb.c
> new file mode 100644
> index 0000000..e8a3ae0
> --- /dev/null
> +++ b/arch/arm/mach-omap2/abb.c
> @@ -0,0 +1,322 @@
> +/*
> + * OMAP Adaptive Body-Bias core
> + *
> + * Copyright (C) 2011 Texas Instruments, Inc.
> + * Mike Turquette <mturquette@ti.com>
> + *
> + * 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.
> + */
> +
> +#include <linux/init.h>
> +#include <linux/delay.h>
> +
> +#include "abb.h"
> +#include "voltage.h"
> +
> +/**
> + * omap_abb_set_opp - program ABB ldo based on new voltage
> + *
> + * @voltdm - voltage domain that just finished scaling voltage
> + * @opp_sel - target ABB ldo operating mode
> + *
> + * Program the ABB ldo to the new state (if necessary), clearing the
> + * PRM_IRQSTATUS bit before and after the transition.  Returns 0 on
> + * success, -ETIMEDOUT otherwise.
> + */
> +int omap_abb_set_opp(struct voltagedomain *voltdm, u8 opp_sel)
> +{
> +       struct omap_abb_instance *abb = voltdm->abb;
> +       int ret, timeout;
> +
> +       /* bail early if no transition is necessary */
> +       if (opp_sel == abb->_opp_sel)
> +               return 0;
> +
> +       /* clear interrupt status */
> +       timeout = 0;
> +       while (timeout++ < ABB_TRANXDONE_TIMEOUT) {
> +               abb->common->ops->clear_tranxdone(abb->prm_irq_id);
> +
> +               ret = abb->common->ops->check_tranxdone(abb->prm_irq_id);
> +               if (!ret)
> +                       break;
> +
> +               udelay(1);
> +       }
> +
> +       if (timeout >= ABB_TRANXDONE_TIMEOUT) {
> +               pr_warn("%s: vdd_%s ABB TRANXDONE timeout\n",
> +                               __func__, voltdm->name);
> +               return -ETIMEDOUT;
> +       }
> +
> +       /* program the setup register */
> +       switch (opp_sel) {
> +       case OMAP_ABB_NOMINAL_OPP:
> +               voltdm->rmw(abb->common->active_fbb_sel_mask,
> +                               0x0,
> +                               abb->setup_offs);
> +               break;
> +       case OMAP_ABB_FAST_OPP:
> +               voltdm->rmw(abb->common->active_fbb_sel_mask,
> +                               abb->common->active_fbb_sel_mask,
> +                               abb->setup_offs);
> +               break;
> +       }
> +
> +       /* program next state of ABB ldo */
> +       voltdm->rmw(abb->common->opp_sel_mask,
> +                       opp_sel << __ffs(abb->common->opp_sel_mask),
> +                       abb->ctrl_offs);
> +
> +       /* initiate ABB ldo change */
> +       voltdm->rmw(abb->common->opp_change_mask,
> +                       abb->common->opp_change_mask,
> +                       abb->ctrl_offs);
> +
> +       /* clear interrupt status */
> +       timeout = 0;
> +       while (timeout++ < ABB_TRANXDONE_TIMEOUT) {
> +               abb->common->ops->clear_tranxdone(abb->prm_irq_id);
> +
> +               ret = abb->common->ops->check_tranxdone(abb->prm_irq_id);
> +               if (!ret)
> +                       break;
> +
> +               udelay(1);
> +       }
> +
> +       if (timeout >= ABB_TRANXDONE_TIMEOUT) {
> +               pr_warn("%s: vdd_%s ABB TRANXDONE timeout\n",
> +                               __func__, voltdm->name);
> +               return -ETIMEDOUT;
> +       }
> +
> +       /* track internal state */
> +       abb->_opp_sel = opp_sel;
> +
> +       return 0;
> +}
> +
> +/**
> + * omap_abb_pre_scale - ABB transition pre-voltage scale, if needed
> + *
> + * @voltdm - voltage domain that is about to scale
> + * @target_volt - voltage that voltdm is scaling towards
> + *
> + * Changes the ABB ldo mode prior to scaling the voltage domain.
> + * Returns 0 on success, otherwise an error code.
> + */
> +int omap_abb_pre_scale(struct voltagedomain *voltdm,
> +               unsigned long target_volt)
> +{
> +       struct omap_abb_instance *abb = voltdm->abb;
> +       struct omap_volt_data *cur_volt_data;
> +       struct omap_volt_data *target_volt_data;
> +       u8 opp_sel;
> +
> +       /* sanity */
> +       if (!voltdm)
> +               return -EINVAL;
> +
> +       if (!abb)
> +               return 0;
> +
> +       /*
> +        * XXX boot-time corner case: voltdm->nominal volt might be zero
> +        *
> +        * This implies that we're running at the default PMIC voltage,
> +        * since voltdm->nominal_volt should have been populated in
> +        * omap_voltage_late_init if the voltage had been scaled
> +        * previously.  The best way to fix this is for DT data to pass
> +        * in PMIC boot voltage.
> +        *
> +        * For now, handle this by returning success (0) to not block
> +        * the rest of the transition.
> +        */
> +       if (!voltdm->nominal_volt)
> +               return 0;
> +
> +       cur_volt_data = omap_voltage_get_voltdata(voltdm, voltdm->nominal_volt);
> +       target_volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
> +
> +       if (IS_ERR(cur_volt_data))
> +               return PTR_ERR(cur_volt_data);
> +
> +       if (IS_ERR(target_volt_data))
> +               return PTR_ERR(target_volt_data);
> +
> +       /* bail if the sequence is wrong */
> +       if (target_volt_data->volt_nominal > cur_volt_data->volt_nominal)
> +               return 0;
> +
> +       opp_sel = target_volt_data->opp_sel;
> +
> +       /* bail early if no transition is necessary */
> +       if (opp_sel == abb->_opp_sel)
> +               return 0;
> +
> +       return omap_abb_set_opp(voltdm, opp_sel);
> +}
> +
> +/**
> + * omap_abb_post_scale - ABB transition post-voltage scale, if needed
> + * @voltdm - voltage domain that just finished scaling
> + * @target_volt - voltage that voltdm is scaling towards
> + *
> + * Changes the ABB ldo mode prior to scaling the voltage domain.
> + * Returns 0 on success, otherwise an error code.
> + */
> +int omap_abb_post_scale(struct voltagedomain *voltdm,
> +               unsigned long target_volt)
> +{
> +       struct omap_abb_instance *abb = voltdm->abb;
> +       struct omap_volt_data *cur_volt_data;
> +       struct omap_volt_data *target_volt_data;
> +       u8 opp_sel;
> +
> +       /* sanity */
> +       if (!voltdm)
> +               return -EINVAL;
> +
> +       if (!abb)
> +               return 0;
> +
> +       cur_volt_data = omap_voltage_get_voltdata(voltdm, voltdm->nominal_volt);
> +       if (IS_ERR(cur_volt_data))
> +               return PTR_ERR(cur_volt_data);
> +
> +       target_volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
> +       if (IS_ERR(target_volt_data))
> +               return PTR_ERR(target_volt_data);
> +
> +       /* bail if the sequence is wrong */
> +       if (target_volt_data->volt_nominal < cur_volt_data->volt_nominal)
> +               return 0;
> +
> +       opp_sel = target_volt_data->opp_sel;
> +
> +       /* bail early if no transition is necessary */
> +       if (opp_sel == abb->_opp_sel)
> +               return 0;
> +
> +       return omap_abb_set_opp(voltdm, opp_sel);
> +}
> +
> +/*
> + * omap_abb_enable - enable ABB ldo on a particular voltage domain
> + *
> + * @voltdm - pointer to particular voltage domain
> + */
> +void omap_abb_enable(struct voltagedomain *voltdm)
> +{
> +       struct omap_abb_instance *abb = voltdm->abb;
> +
> +       if (abb->enabled)
> +               return;
> +
> +       abb->enabled = true;
> +
> +       voltdm->rmw(abb->common->sr2en_mask, abb->common->sr2en_mask,
> +                       abb->setup_offs);
> +}
> +
> +/*
> + * omap_abb_disable - disable ABB ldo on a particular voltage domain
> + *
> + * @voltdm - pointer to particular voltage domain
> + *
> + * Included for completeness.  Not currently used but will be needed in the
> + * future if ABB is converted to a loadable module.
> + */
> +void omap_abb_disable(struct voltagedomain *voltdm)
> +{
> +       struct omap_abb_instance *abb = voltdm->abb;
> +
> +       if (!abb->enabled)
> +               return;
> +
> +       abb->enabled = false;
> +
> +       voltdm->rmw(abb->common->sr2en_mask,
> +                       (0 << __ffs(abb->common->sr2en_mask)),
> +                       abb->setup_offs);
> +}
> +
> +/*
> + * omap_abb_init - Initialize an ABB ldo instance
> + *
> + * @voltdm: voltage domain upon which ABB ldo resides
> + *
> + * Initializes an individual ABB ldo for Forward Body-Bias.  FBB is used to
> + * insure stability at higher voltages.  Note that some older OMAP chips have a
> + * Reverse Body-Bias mode meant to save power at low voltage, but that mode is
> + * unsupported and phased out on newer chips.
> + */
> +void __init omap_abb_init(struct voltagedomain *voltdm)
> +{
> +       struct omap_abb_instance *abb = voltdm->abb;
> +       u32 sys_clk_rate;
> +       u32 sr2_wt_cnt_val;
> +       u32 clock_cycles;
> +       u32 settling_time;
> +       u32 val;
> +
> +       if (IS_ERR_OR_NULL(abb))
> +               return;
> +
> +       /*
> +        * SR2_WTCNT_VALUE is the settling time for the ABB ldo after a
> +        * transition and must be programmed with the correct time at boot.
> +        * The value programmed into the register is the number of SYS_CLK
> +        * clock cycles that match a given wall time profiled for the ldo.
> +        * This value depends on:
> +        * settling time of ldo in micro-seconds (varies per OMAP family)
> +        * # of clock cycles per SYS_CLK period (varies per OMAP family)
> +        * the SYS_CLK frequency in MHz (varies per board)
> +        * The formula is:
> +        *
> +        *                      ldo settling time (in micro-seconds)
> +        * SR2_WTCNT_VALUE = ------------------------------------------
> +        *                   (# system clock cycles) * (sys_clk period)
> +        *
> +        * Put another way:
> +        *
> +        * SR2_WTCNT_VALUE = settling time / (# SYS_CLK cycles / SYS_CLK rate))
> +        *
> +        * To avoid dividing by zero multiply both "# clock cycles" and
> +        * "settling time" by 10 such that the final result is the one we want.
> +        */
> +
> +       /* convert SYS_CLK rate to MHz & prevent divide by zero */
> +       sys_clk_rate = DIV_ROUND_CLOSEST(voltdm->sys_clk.rate, 1000000);
There is a possible small rounding error here. Depending on
SYS_CLK_rate value, you might loose significant digits when converting
from Hz to MHz.

Also, wouldn't it be safer to do all multiplications first and then
divisions, like:
SR2_WTCNT_VALUE = ((settling time * SYS_CLK_rate_kHz) / # SYS_CLK
cycles  ) / 1000

> +       clock_cycles = abb->common->clock_cycles * 10;
> +       settling_time = abb->common->settling_time * 10;
> +
> +       /* calculate cycle rate */
> +       clock_cycles = DIV_ROUND_CLOSEST(clock_cycles, sys_clk_rate);
> +
> +       /* calulate SR2_WTCNT_VALUE */
> +       sr2_wt_cnt_val = DIV_ROUND_CLOSEST(settling_time, clock_cycles);
> +
> +       voltdm->rmw(abb->common->sr2_wtcnt_value_mask,
> +                       (sr2_wt_cnt_val << __ffs(abb->common->sr2_wtcnt_value_mask)),
> +                       abb->setup_offs);
> +
> +       /* did bootloader set OPP_SEL? */
> +       val = voltdm->read(abb->ctrl_offs);
> +       val &= abb->common->opp_sel_mask;
> +       abb->_opp_sel = val >> __ffs(abb->common->opp_sel_mask);
> +
> +       /* enable the ldo if not done by bootloader */
> +       val = voltdm->read(abb->setup_offs);
> +       val &= abb->common->sr2en_mask;
> +       if (val)
> +               abb->enabled = true;
> +       else
> +               omap_abb_enable(voltdm);
> +
> +       return;
> +}
> diff --git a/arch/arm/mach-omap2/abb.h b/arch/arm/mach-omap2/abb.h
> index 2acc187..b18305f 100644
> --- a/arch/arm/mach-omap2/abb.h
> +++ b/arch/arm/mach-omap2/abb.h
> @@ -82,4 +82,13 @@ extern struct omap_abb_instance omap36xx_abb_mpu;
>  extern struct omap_abb_instance omap4_abb_mpu;
>  extern struct omap_abb_instance omap4_abb_iva;
>
> +void omap_abb_init(struct voltagedomain *voltdm);
> +void omap_abb_enable(struct voltagedomain *voltdm);
> +void omap_abb_disble(struct voltagedomain *voltdm);
> +int omap_abb_set_opp(struct voltagedomain *voltdm, u8 opp_sel);
> +int omap_abb_pre_scale(struct voltagedomain *voltdm,
> +               unsigned long target_volt);
> +int omap_abb_post_scale(struct voltagedomain *voltdm,
> +               unsigned long target_volt);
> +
>  #endif
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* linux-next: manual merge of the arm-soc tree with the modules tree
From: Stephen Rothwell @ 2012-10-04  4:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

Today's linux-next merge of the arm-soc tree got conflicts in
arch/cris/include/asm/Kbuild, arch/h8300/include/asm/Kbuild and
arch/m32r/include/asm/Kbuild between commit 786d35d45cc4 ("Make most arch
asm/module.h files use asm-generic/module.h") from the modules tree and
commit e7a570ff7dff ("asm-generic: Add default clkdev.h") from the
arm-soc tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au

diff --cc arch/cris/include/asm/Kbuild
index 28b690d,a8eab26..0000000
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@@ -8,4 -8,4 +8,5 @@@ header-y += etraxgpio.
  header-y += rs485.h
  header-y += sync_serial.h
  
 +generic-y += module.h
+ generic-y += clkdev.h
diff --cc arch/h8300/include/asm/Kbuild
index 871382d,0e152a9..0000000
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@@ -1,3 -1,3 +1,4 @@@
  include include/asm-generic/Kbuild.asm
  
 +generic-y	+= module.h
+ generic-y	+= clkdev.h
diff --cc arch/m32r/include/asm/Kbuild
index 871382d,0e152a9..0000000
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@@ -1,3 -1,3 +1,4 @@@
  include include/asm-generic/Kbuild.asm
  
 +generic-y	+= module.h
+ generic-y	+= clkdev.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121004/dcfb7b18/attachment.sig>

^ permalink raw reply

* linux-next: manual merge of the arm-soc tree with Linus' tree
From: Stephen Rothwell @ 2012-10-04  4:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

Today's linux-next merge of the arm-soc tree got a conflict in
arch/x86/include/asm/Kbuild between commit 10b63956fce7 ("UAPI: Plumb the
UAPI Kbuilds into the user header installation and checking") from Linus'
tree and commit e7a570ff7dff ("asm-generic: Add default clkdev.h") from
the arm-soc tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au

diff --cc arch/x86/include/asm/Kbuild
index 1595d68,66e5f0e..0000000
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@@ -22,3 -22,9 +22,5 @@@ header-y += sigcontext32.
  header-y += ucontext.h
  header-y += vm86.h
  header-y += vsyscall.h
+ 
 -genhdr-y += unistd_32.h
 -genhdr-y += unistd_64.h
 -genhdr-y += unistd_x32.h
 -
+ generic-y += clkdev.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121004/0c841f55/attachment.sig>

^ permalink raw reply

* [PATCH 1/1] Fix segfault in DTC
From: David Gibson @ 2012-10-04  4:49 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <506CAF2A.204@wwwdotorg.org>

On Wed, Oct 03, 2012 at 03:33:30PM -0600, Stephen Warren wrote:
> On 10/01/2012 06:08 PM, David Gibson wrote:
> > On Mon, Oct 01, 2012 at 10:41:09AM -0600, Stephen Warren wrote:
> >> On 10/01/2012 12:46 AM, David Gibson wrote:
> >>> On Sun, Sep 30, 2012 at 11:34:50PM -0600, Stephen Warren wrote:
> >>>> On 09/29/2012 05:53 PM, David Gibson wrote:
> >>>>> On Fri, Sep 28, 2012 at 01:05:33PM -0600, Stephen Warren wrote:
> >>>>>> On 09/28/2012 12:53 PM, Jon Loeliger wrote:
> >>>>>>>>>
> >>>>>>>>> Yeah, seems like the kernel DTC is quite old.
> >>>>>>>>
> >>>>>>>> FYI, I'm working on a patch to the kernel to bring in the latest dtc.
> >>>>>>>
> >>>>>>> Awesome.  Thank you.
> >>>>>>>
> >>>>>>>> I've run a regression test vs. the old dtc in the kernel ...
> >>>>>>>
> >>>>>>> Which is the icky step.  Again, thank you.
> >>>>>>>
> >>>>>>>> ... and found that
> >>>>>>>> some of the PowerPC .dts files don't compile with the new dtc (but did
> >>>>>>>> with the old), all due to non-existent labels/paths being referenced.
> >>>>>>>> I'll try and track down whether this is a regression in dtc, or simply
> >>>>>>>> buggy .dts files that weren't noticed before.
> >>>>>>>
> >>>>>>> I think you should just smack the PowerPC guys. :-)
> >>>>>>
> >>>>>> For the record in this thread, it was a regression I introduced into dtc
> >>>>>> - the patch I just sent was for this.
> >>>>>
> >>>>> I would be nice to add a testcase for this regression into dtc.
> >>>>
> >>>> The issue here was caused by uninitialized memory, so it would, I think,
> >>>> be basically impossible to create a test-case that would be guaranteed
> >>>> to fail because of this; it'd depend on the internal details of the
> >>>> malloc library and how/when it re-used previously free()d memory blocks.
> >>>
> >>> It doesn't have to be guaranteed to fail to be useful.  Plus, we
> >>> already have the infrastructure to run the tests under valgrind, which
> >>> would catch it.
> >>
> >> I certainly disagree here; the absolute worst kind of test is one which
> >> gives different results each time it's run, or statically gives
> >> different results to different people. People will either ignore the
> >> test because it's flaky, or it'll end up blaming the wrong person due to
> >> some entirely unrelated and correct change just happening to tickle the
> >> test.
> > 
> > I'd agree 100% if the test could give false failures.  But in this
> > case it can only give false passes.
> 
> That is true. I still dislike flaky tests irrespective of
> false-{negative,positive} though.

I don't love it, but I think a test which can generate false-negatives
is better than no test.

> > If the test fails there is a bug
> > *somewhere*, even if it's not actually in whatever changed last.  The
> > test framework actually has a "PASS (inconclusive)" result for exactly
> > this sort of case.
> > 
> >> If we were to force any such new test to always run under valgrind, then
> >> hopefully the test would always fail (assuming the test harness triggers
> >> failure if valgrind finds problems).
> > 
> > Aside: it's supposed to;  if it doesn't, that's a bug.  You can try it
> > easily enough with "make checkm".
> 
> Ah, I didn't know about that make target (or even "make check"; I'd
> always run run_tests.sh manually).
> 
> Incidentally, before commit 317a5d9 "dtc: zero out new label objects"
> the following two tests fail under make checkm:
> 
> dtc -I dts -O dtb -o multilabel.test.dtb multilabel.dts:        FAIL
> Returned error code 126
> 
> dtc -I dts -O dtb -o multilabel_merge.test.dtb multilabel_merge.dts:
> FAIL Returned error code 126
> 
> However, they pass at/after that commit.

Ah, interesting.  Goes to show that neither Jon nor I runs the
valgrind check as often as we probably should.

> Equally, those failures were introduced with commit 45013d8 "dtc: Add
> ability to delete nodes and properties", which is exactly what I'd
> expect given the fix was a fix for that commit.
> 
> So, it seems like we already have tests that catch this problem. Do we
> need to do anything given that?

Hm, I guess not.

> I am slightly surprised that the problem didn't cause all tests to fail
> make checkm though (I'd expect any usage of a label to trigger the
> problem); I'll have to think about why some more...

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* [PATCH] ARM: davinci: dm644x: fix out range signal for ED
From: Prabhakar Lad @ 2012-10-04  4:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <506C158D.4000906@ti.com>

Hi Sekhar,

On Wed, Oct 3, 2012 at 4:08 PM, Sekhar Nori <nsekhar@ti.com> wrote:
> On 10/3/2012 12:05 PM, Prabhakar wrote:
>> From: Lad, Prabhakar <prabhakar.lad@ti.com>
>>
>> while testing display on dm644x, for ED out-range signals
>> was observed. This patch fixes appropriate clock setting
>> for ED.
>
> Can you please clarify what you mean by "out range signal"? Are there
> any user visible artifacts on the display? What was the clock being
> provided earlier and what is the value after this patch?
>
> Also, is the issue severe enough that this patch should be applied to
> stable tree as well?
>
Ideally a clock of 54Mhz is required for  enhanced definition to
work, which it was actually set to but while testing I noticed
out-of-range signal. The out-of-range signal is often caused
when the field rate is above the rate that the television will handle.
When this is the case the TV or monitor displays "Out-Of-Range Signal".

Reducing the clock fixed it. now the clock is set to 27Mhz.

Regards,
--Prabhakar

> Thanks,
> Sekhar

^ permalink raw reply

* linux-next: manual merge of the signal tree with the modules and arm-soc trees
From: Stephen Rothwell @ 2012-10-04  4:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Al,

Today's linux-next merge of the signal tree got conflicts in
arch/avr32/include/asm/Kbuild, arch/cris/include/asm/Kbuild,
arch/frv/include/asm/Kbuild, arch/h8300/include/asm/Kbuild,
arch/ia64/include/asm/Kbuild, arch/m32r/include/asm/Kbuild,
arch/microblaze/include/asm/Kbuild, arch/mn10300/include/asm/Kbuild and
arch/xtensa/include/asm/Kbuild between commit e7a570ff7dff ("asm-generic:
Add default clkdev.h") from the arm-soc tree, commit 786d35d45cc4 ("Make
most arch asm/module.h files use asm-generic/module.h") from the modules
tree and commit ddd03a1f7591 ("get rid of generic instances of
asm/exec.h") from the signal tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au

diff --cc arch/avr32/include/asm/Kbuild
index e3ba7bc,aa47fff..0000000
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@@ -1,5 -1,4 +1,6 @@@
  include include/asm-generic/Kbuild.asm
  
 +generic-y	+= clkdev.h
+ generic-y	+= exec.h
 +
  header-y	+= cachectl.h
diff --cc arch/cris/include/asm/Kbuild
index 6900bbf,b68ad4b..0000000
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@@ -8,5 -8,4 +8,6 @@@ header-y += etraxgpio.
  header-y += rs485.h
  header-y += sync_serial.h
  
 +generic-y += module.h
 +generic-y += clkdev.h
+ generic-y += exec.h
diff --cc arch/frv/include/asm/Kbuild
index 13cd044,32c1646..0000000
--- a/arch/frv/include/asm/Kbuild
+++ b/arch/frv/include/asm/Kbuild
@@@ -2,4 -2,4 +2,6 @@@ include include/asm-generic/Kbuild.as
  
  header-y += registers.h
  header-y += termios.h
++
 +generic-y += clkdev.h
+ generic-y += exec.h
diff --cc arch/h8300/include/asm/Kbuild
index 98477e9,3a2af1a..0000000
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@@ -1,4 -1,2 +1,5 @@@
  include include/asm-generic/Kbuild.asm
 +
 +generic-y	+= module.h
 +generic-y	+= clkdev.h
+ generic-y += exec.h
diff --cc arch/ia64/include/asm/Kbuild
index 58f3d14,98efd48..0000000
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@@ -13,4 -13,4 +13,6 @@@ header-y += ptrace_offsets.
  header-y += rse.h
  header-y += ucontext.h
  header-y += ustack.h
++
 +generic-y += clkdev.h
+ generic-y += exec.h
diff --cc arch/m32r/include/asm/Kbuild
index 98477e9,7083403..0000000
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@@ -1,4 -1,3 +1,5 @@@
  include include/asm-generic/Kbuild.asm
  
 +generic-y	+= module.h
 +generic-y	+= clkdev.h
+ generic-y += exec.h
diff --cc arch/microblaze/include/asm/Kbuild
index 48510f6,5a0e72b..0000000
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@@ -1,4 -1,4 +1,6 @@@
  include include/asm-generic/Kbuild.asm
  
  header-y  += elf.h
++
 +generic-y += clkdev.h
+ generic-y += exec.h
diff --cc arch/mn10300/include/asm/Kbuild
index 0d20f55,7083403..0000000
--- a/arch/mn10300/include/asm/Kbuild
+++ b/arch/mn10300/include/asm/Kbuild
@@@ -1,3 -1,3 +1,4 @@@
  include include/asm-generic/Kbuild.asm
  
 +generic-y += clkdev.h
+ generic-y += exec.h
diff --cc arch/xtensa/include/asm/Kbuild
index 0d20f55,7083403..0000000
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@@ -1,3 -1,3 +1,4 @@@
  include include/asm-generic/Kbuild.asm
  
 +generic-y += clkdev.h
+ generic-y += exec.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121004/c14c4154/attachment.sig>

^ permalink raw reply

* [PATCH] ARM: kirkwood: DT board setup for Network Space v2 and parents
From: Andrew Lunn @ 2012-10-04  5:17 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121003220916.GW31897@kw.sim.vm.gnt>

On Thu, Oct 04, 2012 at 12:09:16AM +0200, Simon Guinot wrote:
> On Wed, Oct 03, 2012 at 05:43:10PM +0200, Andrew Lunn wrote:
> > On Wed, Oct 03, 2012 at 05:14:30PM +0200, Simon Guinot wrote:
> > > This patch adds DT board setup for LaCie Network Space v2 and parents,
> > > based the Marvell Kirkwood 6281 SoC. This includes Network Space (Max)
> > > v2 and Internet Space v2.
> > 
> > Hi Simon
> > 
> > At a first look, this looks good. Also nice to see you use the new
> > gpio-fan binding.
> 
> Hi Andrew,
> 
> It is nice to have this binding. It works fine.

It good to hear that it works. There is one other board which could
use it. I plan to convert it over for 3.8.

I will take a look at other DT boards and see if there is any patterns
which might help here, for naming of a shared compatibility string.

> > Have you thought about adding a DT binding for this driver?
> 
> Yes. I am on it.

Great. Please include my CC: when you post it.

> > It would be nice if you could respin the patches for -rc1, when it
> > comes out. There are changes to Makefile.boot at least required.
> 
> OK. I will.
> 
> Note that this patch is based against the branch kirkwood/boards from
> the git repository git://git.infradead.org/users/jcooper/linux.git. Is
> that correct ?

Its a good start. However, the Makefile.boot changes were merged in in
arm-soc, and not by the Marvell maintainers in our trees. So changes
across multiple arm platforms are not in Jason's tree. -rc1 will have
all these changes, and forms the best base for a new board.

    Thanks
	Andrew

^ permalink raw reply

* [PATCH] ARM: kirkwood: DT board setup for Network Space v2 and parents
From: Andrew Lunn @ 2012-10-04  5:54 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121003220916.GW31897@kw.sim.vm.gnt>

> > > --- a/arch/arm/mach-kirkwood/board-dt.c
> > > +++ b/arch/arm/mach-kirkwood/board-dt.c
> > > @@ -96,6 +96,11 @@ static void __init kirkwood_dt_init(void)
> > >  	if (of_machine_is_compatible("keymile,km_kirkwood"))
> > >  		km_kirkwood_init();
> > >  
> > > +	if (of_machine_is_compatible("lacie,inetspace_v2") ||
> > > +	    of_machine_is_compatible("lacie,netspace_v2") ||
> > > +	    of_machine_is_compatible("lacie,netspace_max_v2"))
> > > +		ns2_init();
> > > +
> > >  	of_platform_populate(NULL, kirkwood_dt_match_table,
> > >  			     kirkwood_auxdata_lookup, NULL);
> > 
> > I'm not a DT policy expert. Could this be one compatibility string for
> > all the boards? Maybe ask on the DT mainline list?
> 
> Maybe I could use "lacie,ns2_common" as a compatibility string. But this
> does not match any existing device. I don't know if it is correct.

Hi Simon

I did a bit of looking around. For kirkwood, we already have two
boards sharing the same compatibility string. kirkwood-dns320.dts and
kirkwood-dns325.dts both have dlink,dns-kirkwood and this is what the
board-dt.c matches on.

For the tegra20 soc, all boards match on nvidia,tegra20, and that is the only
compatibility string in board-dt-tegra20.c.

So i don't see any problem having just one compatibility string here.

The question is, what is the appropriate name. How common is this
common C code? Are there ns2 where this C code is not appropriate. One
thing to remember is that most of this C code will soon disappear and
become DT. All the mpp will be replaced with pinctrl in 3.8. I hope we
can get the Ethernet setup in DT as well. You are working on ns2_led,
so all the C code will be replaced by DT. So all we are really left
with is power off GPIO handling.

So i think the danger of using lacie,ns2_common, and then finding it
does not work with some other ns2 device is quite low.

What do you think?

     Thanks
	Andrew

^ permalink raw reply

* [PATCH] pwm: Get rid of HAVE_PWM
From: Thierry Reding @ 2012-10-04  6:06 UTC (permalink / raw)
  To: linux-arm-kernel

Now that all drivers have been moved to the PWM subsystem, remove the
legacy HAVE_PWM symbol and replace it with the new PWM symbol. While at
it, select the PWM subsystem and corresponding PWM driver on boards that
require PWM functionality.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Bryan Wu <bryan.wu@canonical.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Ashish Jangam <ashish.jangam@kpitcummins.com>
Cc: Andrew Jones <drjones@redhat.com>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Cc: linux-mips at linux-mips.org
Cc: linux-input at vger.kernel.org
Cc: linux-leds at vger.kernel.org
---
 arch/arm/Kconfig           |  6 ++----
 arch/arm/mach-mxs/Kconfig  |  6 ++++--
 arch/arm/mach-pxa/Kconfig  | 42 ++++++++++++++++++++++++++++--------------
 arch/mips/Kconfig          |  3 ++-
 drivers/input/misc/Kconfig |  4 ++--
 drivers/leds/Kconfig       |  2 +-
 include/linux/pwm.h        |  2 +-
 7 files changed, 40 insertions(+), 25 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e91c7cd..a0cebf8 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -69,9 +69,6 @@ config ARM_DMA_USE_IOMMU
 	select ARM_HAS_SG_CHAIN
 	bool
 
-config HAVE_PWM
-	bool
-
 config MIGHT_HAVE_PCI
 	bool
 
@@ -610,7 +607,8 @@ config ARCH_LPC32XX
 	select CLKDEV_LOOKUP
 	select GENERIC_CLOCKEVENTS
 	select USE_OF
-	select HAVE_PWM
+	select PWM
+	select PWM_LPC32XX
 	help
 	  Support for the NXP LPC32XX family of processors
 
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index 9a8bbda..2fc01bd 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -6,7 +6,8 @@ config SOC_IMX23
 	bool
 	select ARM_AMBA
 	select CPU_ARM926T
-	select HAVE_PWM
+	select PWM
+	select PWM_MXS
 	select PINCTRL_IMX23
 
 config SOC_IMX28
@@ -14,7 +15,8 @@ config SOC_IMX28
 	select ARM_AMBA
 	select CPU_ARM926T
 	select HAVE_CAN_FLEXCAN if CAN
-	select HAVE_PWM
+	select PWM
+	select PWM_MXS
 	select PINCTRL_IMX28
 
 comment "MXS platforms:"
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index fe2d1f8..14f41c3 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -33,12 +33,14 @@ config ARCH_LUBBOCK
 config MACH_MAINSTONE
 	bool "Intel HCDDBBVA0 Development Platform (aka Mainstone)"
 	select PXA27x
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 
 config MACH_ZYLONITE
 	bool
 	select PXA3xx
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 
 config MACH_ZYLONITE300
 	bool "PXA3xx Development Platform (aka Zylonite) PXA300/310"
@@ -78,7 +80,8 @@ config ARCH_VIPER
 	select PXA25x
 	select ISA
 	select I2C_GPIO
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 	select PXA_HAVE_ISA_IRQS
 	select ARCOM_PCMCIA
 
@@ -128,7 +131,8 @@ config MACH_CM_X300
 	select PXA3xx
 	select CPU_PXA300
 	select CPU_PXA310
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 
 config MACH_CAPC7117
 	bool "Embedian CAPC-7117 evaluation kit based on the MXM-8x10 CoM"
@@ -220,7 +224,8 @@ config TRIZEPS_PCMCIA
 config MACH_LOGICPD_PXA270
 	bool "LogicPD PXA270 Card Engine Development Platform"
 	select PXA27x
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 
 config MACH_PCM027
 	bool "Phytec phyCORE-PXA270 CPU module (PCM-027)"
@@ -229,7 +234,8 @@ config MACH_PCM027
 
 config MACH_PCM990_BASEBOARD
 	bool "PHYTEC PCM-990 development board"
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 	depends on MACH_PCM027
 
 choice
@@ -255,7 +261,8 @@ config MACH_COLIBRI_PXA270_INCOME
 	bool "Income s.r.o. PXA270 SBC"
 	depends on MACH_COLIBRI
 	select PXA27x
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 
 config MACH_COLIBRI300
 	bool "Toradex Colibri PXA300/310"
@@ -285,7 +292,8 @@ config MACH_H4700
 	bool "HP iPAQ hx4700"
 	select PXA27x
 	select IWMMXT
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 
 config MACH_H5000
 	bool "HP iPAQ h5000"
@@ -299,13 +307,15 @@ config MACH_MAGICIAN
 	bool "Enable HTC Magician Support"
 	select PXA27x
 	select IWMMXT
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 
 config MACH_MIOA701
 	bool "Mitac Mio A701 Support"
 	select PXA27x
 	select IWMMXT
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 	select GPIO_SYSFS
 	help
 	  Say Y here if you intend to run this kernel on a
@@ -316,7 +326,8 @@ config PXA_EZX
 	bool "Motorola EZX Platform"
 	select PXA27x
 	select IWMMXT
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 
 config MACH_EZX_A780
 	bool "Motorola EZX A780"
@@ -354,7 +365,8 @@ config MACH_MP900C
 
 config ARCH_PXA_PALM
 	bool "PXA based Palm PDAs"
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 
 config MACH_PALM27X
 	bool
@@ -454,7 +466,8 @@ config MACH_RAUMFELD_RC
 	select PXA3xx
 	select CPU_PXA300
 	select POWER_SUPPLY
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 
 config MACH_RAUMFELD_CONNECTOR
 	bool "Raumfeld Connector"
@@ -617,7 +630,8 @@ config MACH_E800
 config MACH_ZIPIT2
 	bool "Zipit Z2 Handheld"
 	select PXA27x
-	select HAVE_PWM
+	select PWM
+	select PWM_PXA
 endif
 endmenu
 
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 331d574..b38f23d 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -219,7 +219,8 @@ config MACH_JZ4740
 	select GENERIC_GPIO
 	select ARCH_REQUIRE_GPIOLIB
 	select SYS_HAS_EARLY_PRINTK
-	select HAVE_PWM
+	select PWM
+	select PWM_JZ4740
 	select HAVE_CLK
 	select GENERIC_IRQ_CHIP
 
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 7c0f1ec..af6188b 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -146,7 +146,7 @@ config INPUT_MAX8925_ONKEY
 
 config INPUT_MAX8997_HAPTIC
 	tristate "MAXIM MAX8997 haptic controller support"
-	depends on HAVE_PWM && MFD_MAX8997
+	depends on PWM && MFD_MAX8997
 	select INPUT_FF_MEMLESS
 	help
 	  This option enables device driver support for the haptic controller
@@ -444,7 +444,7 @@ config INPUT_PCF8574
 
 config INPUT_PWM_BEEPER
 	tristate "PWM beeper support"
-	depends on HAVE_PWM
+	depends on PWM
 	help
 	  Say Y here to get support for PWM based beeper devices.
 
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index c96bbaa..a720d99 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -298,7 +298,7 @@ config LEDS_DAC124S085
 config LEDS_PWM
 	tristate "PWM driven LED Support"
 	depends on LEDS_CLASS
-	depends on HAVE_PWM
+	depends on PWM
 	help
 	  This option enables support for pwm driven LEDs
 
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 112b314..eea3f26 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -7,7 +7,7 @@
 struct pwm_device;
 struct seq_file;
 
-#if IS_ENABLED(CONFIG_PWM) || IS_ENABLED(CONFIG_HAVE_PWM)
+#if IS_ENABLED(CONFIG_PWM)
 /*
  * pwm_request - request a PWM device
  */
-- 
1.7.12.2

^ permalink raw reply related


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