ARM: omap: vc: replace data_shift with data_mask

Signed-off-by: Mike Turquette <mturquette@linaro.org>
ARM: omap: introduce .get_voltage callback

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>
ARM: omap: vc: .get_voltage callback

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>
ARM: omap: vp: .get_voltage callback

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>
ARM: omap: initialize voltdm->nominal_volt

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>
ARM: omap: add 3630 PRM register definitions

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>
ARM: omap: add ABB PRM_IRQSTATUS handlers

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>
ARM: omap: Adaptive Body-Bias structures & data

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>
ARM: omap: opp: add ABB data to voltage tables

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>
ARM: omap: voltage: per-voltage domain ABB data

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>
ARM: omap: abb: init & transition functions

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>
ARM: omap: voltage: add ABB to voltage scaling

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>