regulator/OMAP: support VC/VP support in dts
Subsystems (2)
cover regulator/OMAP: support VC/VP support in dts
Hi,
Texas Instrument's OMAP Processor have a dedicated hardware module which is customised to operate with Power Management IC(PMIC) over an dedicated I2C. The communication involves a few SoC internal modules as follows:
PMIC - The power management chip on the dedicated I2C (sometimes called I2C_SR) Voltage controller - consists of an hardware i2c controller and interface customized for PMICs. VC consists of multiple VC Channels, each channel representing a variable voltage rail supply to the SoC.
Voltage Processor(VP) - controls the voltage requests to VC channel SmartReflex(Adaptive Voltage control) - (SR/AVS)- specialized hardware block which can dynamically control device voltage without software intervention. This module communicates with VP.
In the simplest view, a simple voltage set operation is as follows:Vp->VC Channel -> VC -> PMIC
Note, there may be dedicated PMIC per variable voltage rail OR PMICs which provide control for multiple SMPS supplying variable rails etc.
In addition, there is an Adaptive Voltage Control (AVS) technique called SmartReflex which can operate (in a configuration called continous monitoring hardware loop or class 3 mode of operation), in which the SmartReflex block communicates with Voltage Processor.
We have an OMAP specific implementation in arch/arm/mach-omap2 which does not tree VC/VP or PMIC as Linux devices, but as data which is configured as needed.
In this series, we introduce replacement approach which has support for only Device Tree as OMAP is transitioning completely away from non-DT approach.
As an overview, the following approach is taken.
PMIC is now the regulator driver - generic omap-pmic-regulator (patch #1) Voltage controller and voltage controller channel is handled by driver/power/avs/omap_vc.c
Voltage processor is handled by driver/power/avs/omap_vp.c
Benefit of using drivers/power/avs is also to set the foundation to convert SmartReflex AVS into device tree based solution. (next stage).
S/w dependency is as follows:
Voltage controller <- Voltage Processor
Voltage Processor registers with OMAP_PMIC it's controller operations OMAP_PMIC uses the controller operations to call vp which in turn calls VC to setup the communication chain.
This allows us to maintain this as a module if needed as well (something our existing implementation was not capable of doing).
The series is also available here:
https://github.com/nmenon/linux-2.6-playground/commits/devel/vc-vp-regulator-rfcgit://github.com/nmenon/linux-2.6-playground.git
branch: devel/vc-vp-regulator-rfc
This depends on a few patches for cpufreq/clock node i added in, merged with 3.10-rc2 master and a intermediate GPIO fix from Dan that I picked up available in branch devel/vc-vp-base
Note:
1. AVS device tree conversion will have to depend on this due to dependency on VP
2. Clock node strategy used here is based on implementation I had posted here:
http://marc.info/?t=136804008400001&r=1&w=2
3. I chose OMAP4460 based PandaBoard ES platform as my development platform and patch #4 in this series is an attempt to showcase how it will look like.
Rationale: weird PMIC configuration was used in PandaBoard ES. Ability to handle that platform makes introduction to other platforms/SoCs trivial. example patch for 4430 sdp: http://pastebin.com/SkAGB273
4. Once this approach is agreed upon, I can do the dts changes for all SoCs OMAP3-5 and will post a formal series.
Related defects:
https://bugzilla.kernel.org/show_bug.cgi?id=58541
https://bugzilla.kernel.org/show_bug.cgi?id=58611
Nishanth Menon (4):
regulator: Introduce OMAP regulator to control PMIC over VC/VP PM / AVS: Introduce support for OMAP Voltage Controller(VC) with
device tree nodes
PM / AVS: Introduce support for OMAP Voltage Processor(VP) with
device tree nodes
HACK: OMAP4460/TPS/TWL/PandaBoardES - Enable VP regulator for cpufreq
.../devicetree/bindings/power/omap-vc.txt | 99 ++ .../devicetree/bindings/power/omap-vp.txt | 39 + .../bindings/regulator/omap-pmic-regulator.txt | 121 ++ arch/arm/boot/dts/omap4-panda-es.dts | 55 +- arch/arm/boot/dts/omap4.dtsi | 84 ++ arch/arm/boot/dts/omap4460.dtsi | 1 + arch/arm/boot/dts/tps62361.dtsi | 90 ++ arch/arm/boot/dts/twl6030.dtsi | 68 + drivers/power/avs/Kconfig | 15 + drivers/power/avs/Makefile | 20 + drivers/power/avs/omap_vc.c | 1508 ++++++++++++++++++++ drivers/power/avs/omap_vc.h | 67 + drivers/power/avs/omap_vp.c | 886 ++++++++++++ drivers/regulator/Kconfig | 12 + drivers/regulator/Makefile | 1 + drivers/regulator/omap-pmic-regulator.c | 554 +++++++ include/linux/regulator/omap-pmic-regulator.h | 147 ++ 17 files changed, 3763 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/power/omap-vc.txt create mode 100644 Documentation/devicetree/bindings/power/omap-vp.txt create mode 100644 Documentation/devicetree/bindings/regulator/omap-pmic-regulator.txt create mode 100644 arch/arm/boot/dts/tps62361.dtsi create mode 100644 drivers/power/avs/omap_vc.c create mode 100644 drivers/power/avs/omap_vc.h create mode 100644 drivers/power/avs/omap_vp.c create mode 100644 drivers/regulator/omap-pmic-regulator.c create mode 100644 include/linux/regulator/omap-pmic-regulator.h
Regards,
Nishanth Menon
Signature · 1 line
1.7.9.5
RFC PATCH 1/4 regulator: Introduce OMAP regulator to control PMIC over VC/VP
Texas Instrument's OMAP SoC generations since OMAP3-5 introduced an TI custom hardware block to better facilitate and standardize integration of Power Management ICs which communicate over I2C.
In fact, many custom PMICs were designed to be usable over this interface. On the other hand, generic PMICs which are compatible to the I2C protocol supported by Voltage controller may also be used.
In general, the following categories of PMICs exist:
a) PMICs which are completely controlled by voltage controller/voltage processor pair - this implies even configuration needs to be done over the same interface. Example: TPS62361 used on PandaBoard-ES and many OMAP4460 based platforms. Few Maxim and Fairchild PMICs used on certain products would fall in this category.
- Note: in this case, there may not even exist/needed to support an "traditional Linux regulator driver"
b) PMICs which provide two views over two I2C interfaces - however, voltage can only be set only on one of them. Example: TWL4030/5030:
allows us to use Voltage controller once we set up a bit over regular I2C - This is used in OMAP3. TWO6030/TWL6032 - configuration *has* to be performed over regular i2c (example smps_offset) and voltage control *has* to be performed by using voltage controller/processor.
- Note: in this case, there may exist "traditional Linux regulator driver" however, it may not support in any form SMPS modelling for that part of the device which is exposed to voltage controller/processor.
c) PMICs which allow voltage and configurations over either i2c interfaces - TWL6035/TWL6037/Palmas family of TI processor
- Note: in this case, there may exist "traditional Linux regulator driver" and, it may support in some form SMPS modelling for that part of the device which is exposed to voltage controller/processor.
d) custom PMICs which are setup so that no configuration is needed to be performed and they operate with preset register offsets and minimal conferability using voltage controller/processor.
- Note: in this case, there may not even exist/needed to support an "traditional Linux regulator driver"
However, no matter the type of PMIC used, the OMAP view of a PMIC is generic when used over voltage controller/processor. We attempt to model this generic view of the regulator represented by OMAP SoC.
Alternative to this approach would be to "hack" into the get voltage/set voltage interfaces of regulator drivers which represent the rest of the PMIC controlled over regular I2C interface and re-route the requests to voltage controller/processor. But, by doing that, we needlessly create additional code which may be abstracted out into device tree node information.
Since the regulator node representing PMIC, voltage controller, processors are probed at varied points in time, probe deferral is used to sequence in the right order. It is expected by the driver to register omap_pmic_register_controller_ops providing mandatory operations at the earliest possible opportunity.
Despite the current SoCs implementing the solution based on voltage controller and voltage processor (which are part of the OMAP SoC modules which enable Adaptive Voltage Scaling class support), the interfaces are generic enough to handle future equivalent modules.
--- .../bindings/regulator/omap-pmic-regulator.txt | 121 +++++ drivers/regulator/Kconfig | 12 + drivers/regulator/Makefile | 1 + drivers/regulator/omap-pmic-regulator.c | 554 ++++++++++++++++++++ include/linux/regulator/omap-pmic-regulator.h | 147 ++++++ 5 files changed, 835 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/omap-pmic-regulator.txt create mode 100644 drivers/regulator/omap-pmic-regulator.c create mode 100644 include/linux/regulator/omap-pmic-regulator.h
Documentation/devicetree/bindings/regulator/omap-pmic-regulator.txt new file +121 -0
@@ -0,0 +1,121 @@ +Generic Power Management IC(PMIC) Regulator for Texas Instruments OMAP SoCs + +Required Properties: +- compatible: Should be: + - "ti,omap-pmic" + +- ti,i2c-slave-address - I2C slave address of the PMIC +- ti,i2c-voltage-register - I2C register address where voltage commands are + to be set. +- ti,i2c-command-register - I2C register address where commands are to be set + when OMAP enters low power state. This may be the same as + ti,i2c-voltage-register depending on the PMIC. +- ti,slew-rate-microvolt - worst case slew rate of rise / fall for voltage + transition in microvolts per microseconds (uV/uS) +- step-size-micro-volts - Step size in micovolts as to what one step in voltage + selector increment translates to. See example. +- regulator-min-microvolt - Minimum voltage in microvolts which is supported by + the PMIC in ti,step-size-microvolt increments. See example. +- regulator-max-microvolt - Maximum voltage in microvolts which is supported + by the PMIC in ti,step-size-microvolt increments. See example. + +Optional Properties: +- gpios: OF device-tree gpio specification - can be an array, will be setup + in the order of definition and set to the flags. +- pinctrl: OF device-tree pinctrl definitions as needed (usually for the GPIOs) +- ti,boot-voltage-micro-volts - voltage in microvolts that bootloader is leaving + over the PMIC at. This may be 'PMIC data manual configuration' if + bootloader does not set an value, or appropritate value. +- ti,voltage-selector-set-bits - what bits to set permenantly for the PMIC + voltage selector - this may have PMIC specific meaning. +- ti,voltage-selector-mask - what mask to use for the vsel value - this is + useful for PMICs where the vsel has to be applied at an offset. +- ti,voltage-selector-offset - what offset to apply to conversion routine when + operating on vsel. +- ti,non-zero-voltage-selector - Special case handling if 0 value does NOT + indicates power-off for PMIC. +- ti,setup_commands - An array of 2-tuples items, and each item consists + of register address and command like <address data> + addr: I2C register address to send the command (over Voltage controller) + data: What data to send + +Example: defining step-size, min/max voltages +NOTE: OMAP can only handle continous voltages. In a case of an PMIC such as the +follows: + vsel- corresponding voltage + 0x1 - 500mV + 0x2 - 800mV + 0x3 - 810mV + 0x4 - 820mV + .. + 0x14 - 1v + 0x15 - 1.5v +OMAP can only suppport voltages for voltage operations when the voltages +are in equal increments. In the above example, it is 800mV to 1v at 10mV steps +This corresponds to the following properties: +step-size-micro-volts = <10000>; +regulator-min-microvolt = <800000>; +regulator-max-microvolt = <1000000>; + +Example: Setup PMIC with PFM mode to be enabled for voltage operations +Lets say that the bit in voltage selector(vsel) is 0x80. in this case, +ti,voltage-selector-set-bits =<0x80>; + +Example: setup PMIC where the vsel bits are set from bits 7:4 +Consider an following example +0x10 - 800mV +0xf0 - 1v +in this case, +ti,voltage-selector-mask = <0xF0>; + +Example: Conversion routine needs an offset +Consider an PMIC with the following behavior for vsel. + 0 - OFF voltage + 1 - 709mV + 2 - 721.66mV + etc.. + regulator-min-microvolt would be 709, however vsel offsets needs to be + accounted for. Hence, we could use +ti,voltage-selector-offset = <1>; /* incremental vsel starts at 1 */ + +On the other hand, when 0 indicates voltage = regulator-min-microvolt, use: +ti,non-zero-voltage-selector; + +Example: Sample PMIC description +omap_tps62361: tps62361 { + compatible = "ti,omap-pmic"; + ti,non-zero-voltage-selector; + + ti,i2c-slave-address = <0x60>; + /* We have only one register to set voltage / low power voltage to */ + ti,i2c-voltage-register = <0x01>; /* Set 1 register */ + ti,i2c-command-register = <0x01>; /* Set 1 register */ + + ti,slew-rate-microvolt = <32000>; + ti,step-size-microvolt = <10000>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1770000>; + + ti,voltage-selector-offset = <0x0>; + ti,voltage-selector-set-bits =<0x80>; /* PFM mode */ + ti,non-zero-voltage-selector; + + ti,setup_commands=< + /* register_addr value */ + /* Setup Slew (ramp) rate (0 - 32mV/uS) */ + 0x06 0x0 + /* Enable thermal shutdown - 0 is enable :( */ + 0x5 0x0 + >; +}; + +/* Board Specific configuration */ +&omap_tps62361 { + pinctrl-names = "default"; + pinctrl-0 = < + &tps62361_wkgpio_pins + >; + gpios = <&gpio1 7 1>; /* gpio_wk7 */ + + ti,boot-voltage-micro-volts=<1200000>; +};
drivers/regulator/Kconfig +12 -0
@@ -472,6 +472,18 @@ config REGULATOR_TWL4030 This driver supports the voltage regulators provided by this family of companion chips. +config REGULATOR_TI_OMAP_PMIC + tristate "TI Generic regulator for Voltage Processor / Controller" + depends on ARCH_OMAP + help + Select this option to support PMICs over Texas Instruments' + custom Voltage Processor + Voltage Controller data interface + used in OMAP SoCs. This is a specific "write-only" interface + designed to interface with I2C based PMICs. + + This option enables the regulator driver representing the PMIC + on the OMAP VC/VP hardware. + config REGULATOR_VEXPRESS tristate "Versatile Express regulators" depends on VEXPRESS_CONFIG
drivers/regulator/Makefile +1 -0
@@ -63,6 +63,7 @@ obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o obj-$(CONFIG_REGULATOR_TPS80031) += tps80031-regulator.o obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o +obj-$(CONFIG_REGULATOR_TI_OMAP_PMIC) += omap-pmic-regulator.o obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o
drivers/regulator/omap-pmic-regulator.c new file +554 -0
554 lines not on this page · raw message
include/linux/regulator/omap-pmic-regulator.h new file +147 -0
147 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 2/4 PM / AVS: Introduce support for OMAP Voltage Controller(VC) with device tree nodes
In reply to Nishanth MenonTexas Instrument's OMAP SoC generations since OMAP3-5 introduced an TI custom hardware block to better facilitate and standardize integration of Power Management ICs which communicate over I2C called Voltage Controller(VC).
This is an specialized hardware block meant to support PMIC chips and is customized to that requirement. Even though it functions as an I2C controller, it is a write-only interface whose configurations are custom to PMICs.
We have an existing implementation in mach-omap2 which has been re factored and moved out as a separate driver. This new driver is DT only and the separation was meant to get a maintainable driver which does not have to deal with legacy platform_data dependencies. The legacy driver is retained to support non-DT boot and functionality will be migrated to the DT-only version as we enable features.
Currently, this implementation considers only the basic steps needed for voltage scaling and exposing voltage controller as a device whose child devices are voltage controller channel devices.
We may need to do additional timing configurations to enable Low power mode voltage transitions, but this will be completed in a following series. We may need a few tweaks to hook the Adaptive Voltage Scaling(AVS) implementation for OMAP which also uses the same voltage controller to talk to PMICs.
This driver is meant to interface with voltage processor when the voltage processor attempts devm_omap_vc_channel_get for the VC channel corresponding to the voltage processor.
--- .../devicetree/bindings/power/omap-vc.txt | 99 ++ drivers/power/avs/Kconfig | 15 + drivers/power/avs/Makefile | 20 + drivers/power/avs/omap_vc.c | 1508 ++++++++++++++++++++ drivers/power/avs/omap_vc.h | 67 + 5 files changed, 1709 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/omap-vc.txt create mode 100644 drivers/power/avs/omap_vc.c create mode 100644 drivers/power/avs/omap_vc.h
Documentation/devicetree/bindings/power/omap-vc.txt new file +99 -0
@@ -0,0 +1,99 @@ +Voltage Controller driver for Texas Instruments OMAP SoCs + +Voltage Controller Properties: +The following are the properties of the voltage controller node +Required Properties: +- compatible: Should be one of: + - "ti,omap3-vc" - for OMAP3 family of devices + - "ti,omap4-vc" - for OMAP4 family of devices + - "ti,omap5-vc" - for OMAP5 family of devices +- reg: Address and length of the register set for the device. It contains + the information of registers in the same order as described by reg-names +- reg-names: Should contain the reg names + - "base-address" - contains base address of VC module +- clocks: should point to the clock node used by VC module, usually sysclk +- ti,i2c-clk-scl-low: is mandatory if ti,i2c-pad-load is not used. contains + hex to represent timing for slow I2C phase low clock time. +- ti,i2c-clk-scl-high: is mandatory if ti,i2c-pad-load is not used. contains + hex to represent timing for slow I2C phase high clock time. +- ti,i2c-clk-hsscl-low: is mandatory if ti,i2c-pad-load is not used and + ti,i2c-high-speed is used, contains hex to represent timing for high speed I2C + phase low clock time. +- ti,i2c-clk-hsscl-high: is mandatory if ti,i2c-pad-load is not used and + ti,i2c-high-speed is used, contains hex to represent timing for high speed I2C + phase high clock time. +- Must contain VC channel nodes which belong to the Voltage controller. + +Optional Properties: +- ti,i2c-high-speed: bool to indicate if VC should operate in high speed I2C + mode. +- ti,i2c-pad-load: if ti,i2c-high-speed, then this is optional to auto load + pre-calculated I2C clock timing configuration. This is denoted in pico-farads. +- ti,i2c-pcb-length: if ti,i2c-pad-load, then this is optional to select the + pre-calculated I2C clock timing configuration. default of '63' is used. + This is denoted in millimeters. +- pinctrl: Most OMAP SoCs do not allow pinctrl option to select VC's I2C path. + it is usually hardcoded by default. Define "default" pinctrl-0 as needed. + +Voltage Controller Channel Properties: +The following are the properties of the voltage controller channel nodes +Required Properties: +- compatible: Should be one of: + - ti,omap3-vc-channel-0 - Channel 0 on OMAP3 family of devices + - ti,omap3-vc-channel-1 - Channel 1 on OMAP3 family of devices + - ti,omap4-vc-channel-mpu - Channel MPU on OMAP4 family of devices + - ti,omap4-vc-channel-iva - Channel IVA on OMAP4 family of devices + - ti,omap4-vc-channel-core - Channel CORE on OMAP4 family of devices + - ti,omap5-vc-channel-mpu - Channel MPU on OMAP5 family of devices + - ti,omap5-vc-channel-mm - Channel MM on OMAP5 family of devices + - ti,omap5-vc-channel-core - Channel CORE on OMAP5 family of devices +- ti,master-channel: bool to mark the "master channel". Only ONE channel is + to be marked as master channel depending on SoC specification. + +Optional Properties: +- ti,retention-micro-volts: retention voltage for the voltage controller in + micro-volts +- ti,off-micro-volts: OFF mode voltage for the voltage controller in micro-volts +- ti,use-master-slave-addr: available only for a "non-master" channel. This + indicates the the channel will use master channel's slave address. Usually + used when the PMIC has the same slave address for all SMPSs. +- ti,use-master-voltage-reg-addr: available only for a "non-master" channel. + channel will use voltage register of the master channel to send voltage + commands - usually used in "ganged" voltage rail configuration - NOTE: this + is useful only when doing voltage transitions alone and not using AVS. +- ti,use-master-command-reg-addr: available only for a "non-master" channel. + channel will use command register of the master channel to send command + values - usually used in "ganged" voltage rail configuration - NOTE: this + is useful only when doing voltage transitions alone and not using AVS. +- ti,use-master-command-reg-val: available only for a "non-master" channel. + channel will use command value of the master channel to send commands + - usually used in "ganged" voltage rail configuration - NOTE: this + is useful only when doing voltage transitions alone and not using AVS. + +Example: +SoC file: (example from OMAP4) +vc: vc at 0x4A307B88 { + compatible = "ti,omap4-vc"; + clocks = <&sysclk_in>; + reg = <0x4A307B88 0x40>; + reg-names = "base-address"; + + vc_mpu: vc_mpu { + compatible = "ti,omap4-vc-channel-mpu"; + ti,master-channel; + ti,retention-micro-volts = <750000>; + ti,off-micro-volts = <0>; + }; + + vc_iva: vc_iva { + compatible = "ti,omap4-vc-channel-iva"; + ti,retention-micro-volts = <750000>; + ti,off-micro-volts = <0>; + }; + + vc_core: vc_core { + compatible = "ti,omap4-vc-channel-core"; + ti,retention-micro-volts = <750000>; + ti,off-micro-volts = <0>; + }; + };
drivers/power/avs/Kconfig +15 -0
@@ -10,3 +10,18 @@ menuconfig POWER_AVS AVS is also called SmartReflex on OMAP devices. Say Y here to enable Adaptive Voltage Scaling class support. + +config POWER_TI_HARDWARE_VOLTAGE_CONTROL + tristate "TI OMAP SoC Voltage Control support" + depends on OF && ARCH_OMAP && REGULATOR_TI_OMAP_PMIC + select REGMAP_MMIO + help + Select this option to support Texas Instruments' custom Voltage + Processor + Voltage Controller data interface used in OMAP SoCs + to enable Adaptive Voltage Scaling(AVS) and Device Frequency and + Voltage Scaling(DVFS). This is a specific "write-only" interface + designed to interface with I2C based PMICs. These two subsystems + in OMAP do not exist independent of each other as they are + practically useless without each other. + + Say Y here to enable TI OMAP SoC Voltage Control support.
drivers/power/avs/Makefile +20 -0
@@ -1 +1,21 @@ obj-$(CONFIG_POWER_AVS_OMAP) += smartreflex.o + +ifneq ($(CONFIG_POWER_TI_HARDWARE_VOLTAGE_CONTROL),) + +# OMAP Common +omap-volt-common = omap_vc.o + +# OMAP SoC specific +ifneq ($(CONFIG_ARCH_OMAP3),) +obj-$(CONFIG_POWER_TI_HARDWARE_VOLTAGE_CONTROL) += $(omap-volt-common) +endif + +ifneq ($(CONFIG_ARCH_OMAP4),) +obj-$(CONFIG_POWER_TI_HARDWARE_VOLTAGE_CONTROL) += $(omap-volt-common) +endif + +ifneq ($(CONFIG_SOC_OMAP5),) +obj-$(CONFIG_POWER_TI_HARDWARE_VOLTAGE_CONTROL) += $(omap-volt-common) +endif + +endif
drivers/power/avs/omap_vc.c new file +1508 -0
1,508 lines not on this page · raw message
drivers/power/avs/omap_vc.h new file +67 -0
67 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 3/4 PM / AVS: Introduce support for OMAP Voltage Processor(VP) with device tree nodes
In reply to Nishanth MenonTexas Instrument's OMAP SoC generations since OMAP3-5 introduced an TI custom hardware block to better facilitate and standardize integration of Power Management ICs which communicate over I2C called Voltage Processor(VP).
This is an specialized hardware block meant to support PMIC chips only over Voltage Controller(VC) interface. This provides an interface for SmartReflex AVS module to send adjustment steps which is converted into voltage values and send onwards by VP to VC. VP is also used to set the voltage of the PMIC by commanding using "forceupdate".
We have an existing implementation in mach-omap2 which has been re factored and moved out as a separate driver. This new driver is DT only and the separation was meant to get a maintainable driver which does not have to deal with legacy platform_data dependencies. The legacy driver is retained to support non-DT boot and functionality will be migrated to the DT-only version as we enable features.
Currently, this implementation considers only the basic steps needed for voltage scaling and exposing voltage processor which hooks on to Voltage Controller driver and OMAP PMIC driver to provide an regulator interface over OMAP PMIC driver.
We may need to do additional timing configurations to enable Low power mode voltage transitions and to hook the Adaptive Voltage Scaling(AVS) implementation for OMAP which also uses the same voltage controller to talk to PMICs. This needs to be addressed in a later series.
This driver is meant to interface with OMAP PMIC driver when the controller driver registers it's operations with OMAP PMIC driver and associates with an voltage controller channel. This enables the full communication path between the OMAP PMIC regulator to the external PMIC hardware over OMAP Voltage Processor and OMAP Voltage Controller.
--- .../devicetree/bindings/power/omap-vp.txt | 39 + drivers/power/avs/Makefile | 2 +- drivers/power/avs/omap_vp.c | 886 ++++++++++++++++++++ 3 files changed, 926 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/power/omap-vp.txt create mode 100644 drivers/power/avs/omap_vp.c
Documentation/devicetree/bindings/power/omap-vp.txt new file +39 -0
@@ -0,0 +1,39 @@ +Voltage Controller driver for Texas Instruments OMAP SoCs + +Voltage Controller Properties: +The following are the properties of the voltage controller node +Required Properties: +- compatible: Should be one of: + - "ti,omap3-vp" - for OMAP3 family of devices + - "ti,omap4-vp" - for OMAP4 family of devices + - "ti,omap5-vp" - for OMAP5 family of devices +- reg: Address and length of the register set for the device. It contains + the information of registers in the same order as described by reg-names +- reg-names: Should contain the reg names + - "base-address" - contains base address of VP module + - "int-address" - contains base address of interrupt register for VP module +- clocks: should point to the clock node used by VC module, usually sysclk +- ti,min-micro-volts - SoC supported min operational voltage in micro-volts +- ti,max-micro-volts - SoC supported max operational voltage in micro-volts +- ti,min-step-micro-volts - SoC supported min operational voltage steps in micro-volts +- ti,max-step-micro-volts - SoC supported max operational voltage steps in micro-volts +- ti,tranxdone-status-mask: Mask to the int-register to write-to-clear mask + indicating VP has completed operation in sending command to Voltage Controller. +- ti,vc-channel - phandle to the Voltage Controller Channel device used by this Voltage + Processor. +Example: +vp_mpu: vp at 0x4a307b58 { + compatible = "ti,omap4-vp"; + + reg = <0x4a307b58 0x18>, <0x4A306014 0x4>; + reg-names = "base-address", "int-address"; + ti,tranxdone-status-mask=<0x20>; + + clocks = <&sysclk_in>; + + ti,vc-channel = <&vc_mpu>; + ti,min-step-micro-volts = <10000>; + ti,max-step-micro-volts = <50000>; + ti,min-micro-volts = <750000>; + ti,max-micro-volts = <1410000>; +};
drivers/power/avs/Makefile +1 -1
@@ -3,7 +3,7 @@ obj-$(CONFIG_POWER_AVS_OMAP) += smartreflex.o ifneq ($(CONFIG_POWER_TI_HARDWARE_VOLTAGE_CONTROL),) # OMAP Common -omap-volt-common = omap_vc.o +omap-volt-common = omap_vc.o omap_vp.o # OMAP SoC specific ifneq ($(CONFIG_ARCH_OMAP3),)
drivers/power/avs/omap_vp.c new file +886 -0
886 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 4/4 HACK: OMAP4460/TPS/TWL/PandaBoardES - Enable VP regulator for cpufreq
In reply to Nishanth MenonThis is just an example patch - Tested on PandaBoard-ES OMAP4460 Connectivity is as follows:VP_MPU -> VC_CH_MPU -> VC -> TPS62361
TPS62631 Voltage register selection is done using GPIO (GPIO_WK 7) VP_IVA -> VC_CH_IVA -> VC -> TWL6030/vcore2VP_CORE -> VC_CH_CORE -> VC -> TWL6030/vcore1
--- arch/arm/boot/dts/omap4-panda-es.dts | 55 +++++++++++++++++++-- arch/arm/boot/dts/omap4.dtsi | 84 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/omap4460.dtsi | 1 + arch/arm/boot/dts/tps62361.dtsi | 90 ++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/twl6030.dtsi | 68 +++++++++++++++++++++++++ 5 files changed, 294 insertions(+), 4 deletions(-) create mode 100644 arch/arm/boot/dts/tps62361.dtsi
arch/arm/boot/dts/omap4-panda-es.dts +51 -4
@@ -43,10 +43,18 @@ }; }; -&led_wkgpio_pins { - pinctrl-single,pins = < - 0x1c 0x3 /* gpio_wk8 OUTPUT | MODE 3 */ - >; +&omap4_pmx_wkup { + led_wkgpio_pins: pinmux_leds_wkpins { + pinctrl-single,pins = < + 0x1c 0x3 /* gpio_wk8 OUTPUT | MODE 3 */ + >; + }; + + tps62361_wkgpio_pins: pinmux_tps62361_wkpins { + pinctrl-single,pins = < + 0x1a 0xa03 /* gpio_wk7 OUTPUT | MODE 3 |OFF_HI */ + >; + }; }; &leds {
@@ -68,3 +76,42 @@ linux,default-trigger = "mmc0"; }; }; + +#define TPS62361_PD_VSEL0 +#include "tps62361.dtsi" + +/* Board Specific configuration */ +&omap_tps62361 { + pinctrl-names = "default"; + pinctrl-0 = < + &tps62361_wkgpio_pins + >; + gpios = <&gpio1 7 1>; /* gpio_wk7 Set to HIGH */ + + ti,boot-voltage-micro-volts=<1203000>; + ti,vp=<&vp_mpu>; +}; + +&omap_twl6030_vcore1 { + ti,boot-voltage-micro-volts=<1200000>; + ti,vp=<&vp_core>; +}; + +&omap_twl6030_vcore2 { + ti,boot-voltage-micro-volts=<1200000>; + ti,vp = <&vp_iva>; +}; + +&omap_twl6030_vcore3 { + status = "disabled"; +}; + +&vc_mpu { + /* Due to potential lifetime impact, OFF voltage is set to RET V: TPS*/ + ti,off-micro-volts = <750000>; +}; + +&vc { + ti,i2c-high-speed; + ti,i2c-pad-load=<3>; +};
arch/arm/boot/dts/omap4.dtsi +84 -0
95 lines not on this page · raw message
arch/arm/boot/dts/omap4460.dtsi +1 -0
@@ -20,6 +20,7 @@ 920000 1313000 >; clock-latency = <300000>; /* From legacy driver */ + cpu0-supply = <&omap_tps62361>; /* HACK: belongs to board file */ }; };
arch/arm/boot/dts/tps62361.dtsi new file +90 -0
90 lines not on this page · raw message
arch/arm/boot/dts/twl6030.dtsi +68 -0
72 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Mark Brown
maintainerRe: [RFC PATCH 1/4] regulator: Introduce OMAP regulator to control PMIC over VC/VP
In reply to Nishanth MenonOn Wed, May 22, 2013 at 01:18:34PM -0500, Nishanth Menon wrote:
So, the biggest problem here has been patch 4 (having to have a hack to deploy this stuff is a bit worrying) plus the general not having a real driver thing.
Quoted 4 lines
+- ti,i2c-slave-address - I2C slave address of the PMIC +- ti,i2c-voltage-register - I2C register address where voltage commands areDocumentation/devicetree/bindings/regulator/omap-pmic-regulator.txt new file +2
-0+ to be set. +- ti,i2c-command-register - I2C register address where commands are to be set
Documentation/devicetree/bindings/regulator/omap-pmic-regulator.txt line 20
Quoted 10 lines
Documentation/devicetree/bindings/regulator/omap-pmic-regulator.txt new file +10
-0+ when OMAP enters low power state. This may be the same as + ti,i2c-voltage-register depending on the PMIC. +- ti,slew-rate-microvolt - worst case slew rate of rise / fall for voltage + transition in microvolts per microseconds (uV/uS) +- step-size-micro-volts - Step size in micovolts as to what one step in voltage + selector increment translates to. See example. +- regulator-min-microvolt - Minimum voltage in microvolts which is supported by + the PMIC in ti,step-size-microvolt increments. See example. +- regulator-max-microvolt - Maximum voltage in microvolts which is supported + by the PMIC in ti,step-size-microvolt increments. See example.
The other thing is this whole business of encoding the properties of the
PMIC in the DT like this. Paul Walmsley has started doing some work for
some similiar hardware where instead of doing this the regulator is in
the DT as normal and then the driver for the offloaded voltage scaling
gets the information about the register layout from the regulator
driver. This is a bit neater overall and would cope with determining
which method to use at runtime.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130610/cc7d9d28/attachment.sig>
Re: [RFC PATCH 1/4] regulator: Introduce OMAP regulator to control PMIC over VC/VP
+Paul.
Quoted 5 lines · Mark Brown
On Wed, May 22, 2013 at 01:18:34PM -0500, Nishanth Menon wrote:
So, the biggest problem here has been patch 4 (having to have a hack to deploy this stuff is a bit worrying) plus the general not having a real driver thing.
Patch #4 in this series was a hack as it was not properly split up and organized as a proper DTS series -it was meant as a proof of concept - not entirely meant to indicate the remaining 1-3 patches were hacks :).
Quoted 16 lines
Quoted 5 lines
+- ti,i2c-slave-address - I2C slave address of the PMIC +- ti,i2c-voltage-register - I2C register address where voltage commands areDocumentation/devicetree/bindings/regulator/omap-pmic-regulator.txt new file +2
-0+ to be set. +- ti,i2c-command-register - I2C register address where commands are to be setDocumentation/devicetree/bindings/regulator/omap-pmic-regulator.txt line 20
Quoted 10 lines
Documentation/devicetree/bindings/regulator/omap-pmic-regulator.txt new file +10
-0+ when OMAP enters low power state. This may be the same as + ti,i2c-voltage-register depending on the PMIC. +- ti,slew-rate-microvolt - worst case slew rate of rise / fall for voltage + transition in microvolts per microseconds (uV/uS) +- step-size-micro-volts - Step size in micovolts as to what one step in voltage + selector increment translates to. See example. +- regulator-min-microvolt - Minimum voltage in microvolts which is supported by + the PMIC in ti,step-size-microvolt increments. See example. +- regulator-max-microvolt - Maximum voltage in microvolts which is supported + by the PMIC in ti,step-size-microvolt increments. See example.
Quoted 7 lines
The other thing is this whole business of encoding the properties of the PMIC in the DT like this. Paul Walmsley has started doing some work for some similiar hardware where instead of doing this the regulator is in the DT as normal and then the driver for the offloaded voltage scaling gets the information about the register layout from the regulator driver. This is a bit neater overall and would cope with determining which method to use at runtime.
I think you mean http://marc.info/?t=137059249100003&r=1&w=2 series. I will dig into it. if it is possible for Tegra and OMAP to use the same framework and strategy to deal with these kind of h/w blocks, all the more better.
Regards,
Nishanth Menon
Mark Brown
maintainerRe: [RFC PATCH 1/4] regulator: Introduce OMAP regulator to control PMIC over VC/VP
Quoted 11 lines · Nishanth Menon
Quoted 5 lines · Mark Brown
On Wed, May 22, 2013 at 01:18:34PM -0500, Nishanth Menon wrote:
So, the biggest problem here has been patch 4 (having to have a hack to deploy this stuff is a bit worrying) plus the general not having a real driver thing.
Patch #4 in this series was a hack as it was not properly split up and organized as a proper DTS series -it was meant as a proof of concept - not entirely meant to indicate the remaining 1-3 patches were hacks :).
The way it reads is that you're building up to a hack - if what you've done isn't enabling a sensible solution there might be a problem with the earlier steps.
Quoted 4 lines
I think you mean http://marc.info/?t=137059249100003&r=1&w=2 series. I will dig into it. if it is possible for Tegra and OMAP to use the same framework and strategy to deal with these kind of h/w blocks, all the more better.
Not just better, if each system doing this sort of thing needs to
reinvent the wheel something is going wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130610/7376fb78/attachment.sig>
Re: [RFC PATCH 1/4] regulator: Introduce OMAP regulator to control PMIC over VC/VP
Quoted 8 lines · Mark Brown
Quoted 6 lines · Nishanth Menon
Quoted 5 lines · Mark Brown
On Wed, May 22, 2013 at 01:18:34PM -0500, Nishanth Menon wrote:
So, the biggest problem here has been patch 4 (having to have a hack to deploy this stuff is a bit worrying) plus the general not having a real driver thing.
Quoted 8 lines
Quoted 4 lines
Patch #4 in this series was a hack as it was not properly split up and organized as a proper DTS series -it was meant as a proof of concept - not entirely meant to indicate the remaining 1-3 patches were hacks :).
The way it reads is that you're building up to a hack - if what you've done isn't enabling a sensible solution there might be a problem with the earlier steps.
Understood, I should have taken extra steps to split up the patch into it's logical series, but wanted to get a quick feel from community about the approach before spending time on it. I apologize for the confusion caused.
Quoted 8 lines
Quoted 5 lines
I think you mean http://marc.info/?t=137059249100003&r=1&w=2 series. I will dig into it. if it is possible for Tegra and OMAP to use the same framework and strategy to deal with these kind of h/w blocks, all the more better.
Not just better, if each system doing this sort of thing needs to reinvent the wheel something is going wrong.
Fair enough, I did spend a short while digging through the discussion in the series, I need to find Tegra TRM to see if there is commonolity between OMAP and what Tegra does at hardware level.
a) Tegra seems to use Lookup Table for sending predefinied voltage values to PMIC. OMAP has no concept of lookup table.
b) Tegra and OMAP h/w blocks seem to use I2C - that is good.
c) How about the i2c slave and register addresses, slew rates, start, end voltages, max voltages that SoC can support etc, I am yet to understand those.
d) OMAP has 3 modules - AVS (SmartReflex), Voltage Processor(VP), Voltage Controller(VC) - I am not yet sure about the Tegra hardware blocks involved.
maybe Paul could comment as well, I suppose if we could take a common approach between Tegra and OMAP.
Regards,
Nishanth Menon
Mark Brown
maintainerRe: [RFC PATCH 1/4] regulator: Introduce OMAP regulator to control PMIC over VC/VP
Quoted 2 lines · Nishanth Menon
a) Tegra seems to use Lookup Table for sending predefinied voltage values to PMIC. OMAP has no concept of lookup table.
They seem to be doing basically the same thing here, you've got a linear map of selector to voltage too AFAICT.
Quoted 7 lines
b) Tegra and OMAP h/w blocks seem to use I2C - that is good.
c) How about the i2c slave and register addresses, slew rates, start, end voltages, max voltages that SoC can support etc, I am yet to understand those.
d) OMAP has 3 modules - AVS (SmartReflex), Voltage Processor(VP), Voltage Controller(VC) - I am not yet sure about the Tegra hardware blocks involved.
This all seems like it's at the implementation detail level - the bit
that seems like we should be able to share it is the big picture bit for
how we describe how the AP side stuff and PMIC are hooked up without
having to have a bunch of completely non-framework stuff for things
like describing the PMIC.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130610/df7b5ca6/attachment.sig>
Re: [RFC PATCH 1/4] regulator: Introduce OMAP regulator to control PMIC over VC/VP
Quoted 16 lines · Mark Brown
Quoted 2 lines · Nishanth Menon
a) Tegra seems to use Lookup Table for sending predefinied voltage values to PMIC. OMAP has no concept of lookup table.
They seem to be doing basically the same thing here, you've got a linear map of selector to voltage too AFAICT.
Quoted 7 lines
b) Tegra and OMAP h/w blocks seem to use I2C - that is good.
c) How about the i2c slave and register addresses, slew rates, start, end voltages, max voltages that SoC can support etc, I am yet to understand those.
d) OMAP has 3 modules - AVS (SmartReflex), Voltage Processor(VP), Voltage Controller(VC) - I am not yet sure about the Tegra hardware blocks involved.
Quoted 5 lines
This all seems like it's at the implementation detail level - the bit that seems like we should be able to share it is the big picture bit for how we describe how the AP side stuff and PMIC are hooked up without having to have a bunch of completely non-framework stuff for things like describing the PMIC.
I am having a bit of a difficulty trying to understand your concern here.
Problem statement:
OMAP has this weird custom h/w where one programs the voltage and that voltage is send over i2c - this is not same as Tegra's lookup table array which automatically sends out entries, in OMAP, software has to trigger the voltage transition
This path is split into 3 different modules - AVS, VC, VP -> This is implementation detail as you already mentioned.
Anyhow, to recap, the overview of the hardware interface is as follows:
PMIC that OMAP interfaces to are of two categories:
a) ones that talk only on the custom OMAP VC path
b) ones that talk both custom OMAP VC and regular i2c (e.g. twl4030,6030,palmas)
The voltage control for a voltage rail (e.g. vdd_mpu) is again PMIC specific
a) 6030 will not allow voltage to be set over regular i2c
b) 4030 allows either custom i2c path OR regular i2c path (only 1 at a time).
c) palmas allows both custom i2c path AND regular i2c path to set voltage!
Quoted 1 line
From a Linux angle, when using regular i2c, it is a piece of cake. Standard
regulator uses regular i2c, vc-vp angle avoided
Example: Palmas: we'd use the regular palmas driver to do this.
When using custom i2c path(vc/vp/avs), it gets a bit complex
We'd like (if possible) drivers like cpufreq to be ignorant of regulator and transfer path used ofcourse as this depends on the board component selection.
E.g. 4030/palmas/6030 vdd_mpu can be represented as a regulator, which in turn uses custom OMAP data transfer path to set voltage
I was trying to understand your statement as to what Paul was doing (which was basically pull out the vsel values and put them in his
hardware lookup table for h/w to auto send the voltage) Vs what I was
attempting to do (describe OMAP's view of the PMIC and provide data path).
In my view, we were trying to do "voltage scale" in two completely different ways depending on the SoC we were working on.
If your concern was describing PMIC parameters in dts, I can easily move them inside the omap_pmic driver and provide required compatible flags. If, on the other hand, the entire approach followed is flawed, I'd like to understand the rationale for the same.
Signature · 2 lines
Regards, Nishanth Menon
Mark Brown
maintainerRe: [RFC PATCH 1/4] regulator: Introduce OMAP regulator to control PMIC over VC/VP
Quoted 2 lines · Nishanth Menon
I am having a bit of a difficulty trying to understand your concern here.
Your device tree for this stuff appears to mostly consist of repeating the description of the PMIC that we already have - this really doesn't seem like a great result.
Quoted 6 lines
Problem statement:
OMAP has this weird custom h/w where one programs the voltage and that voltage is send over i2c - this is not same as Tegra's lookup table array which automatically sends out entries, in OMAP, software has to trigger the voltage transition
The basic idea that's important here is that you need to figure out how to tell the hardware what to write - how those writes get triggered is a separate problem.
Quoted 4 lines
If your concern was describing PMIC parameters in dts, I can easily move them inside the
omap_pmicdriver and provide required compatible flags. If, on the other hand, the entire approach followed is flawed, I'd like to understand the rationale for the same.
That's the biggest problem I saw so far but to be honest I've not
drilled down too much into the specifics. From my point of view the
main thing is how this fits into the frameworks and so on, having the
register information in the DT was an alarm flag that suggested the
overall approach was a concern.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130613/09ae5905/attachment.sig>
Re: [RFC PATCH 1/4] regulator: Introduce OMAP regulator to control PMIC over VC/VP
Quoted 25 lines · Mark Brown
Quoted 2 lines · Nishanth Menon
I am having a bit of a difficulty trying to understand your concern here.
Your device tree for this stuff appears to mostly consist of repeating the description of the PMIC that we already have - this really doesn't seem like a great result.
Quoted 6 lines
Problem statement:
OMAP has this weird custom h/w where one programs the voltage and that voltage is send over i2c - this is not same as Tegra's lookup table array which automatically sends out entries, in OMAP, software has to trigger the voltage transition
The basic idea that's important here is that you need to figure out how to tell the hardware what to write - how those writes get triggered is a separate problem.
Quoted 4 lines
If your concern was describing PMIC parameters in dts, I can easily move them inside the
omap_pmicdriver and provide required compatible flags. If, on the other hand, the entire approach followed is flawed, I'd like to understand the rationale for the same.
Quoted 5 lines
That's the biggest problem I saw so far but to be honest I've not drilled down too much into the specifics. From my point of view the main thing is how this fits into the frameworks and so on, having the register information in the DT was an alarm flag that suggested the overall approach was a concern.
OK. would you be ok with an generic omap_pmic driver if the PMIC specific data set is moved into OF compatible data?
I am proposing moving the following into OF match data. ti,i2c-slave-address
ti,i2c-voltage-register
ti,i2c-command-register
ti,slew-rate-microvolt
ti,step-size-micro-volts
ti,voltage-selector-set-bits
ti,voltage-selector-mask
ti,voltage-selector-offset ti,non-zero-voltage-selector
The only thing I propose to retain is board specific variations - e.g. gpios, boot voltage and standard regulator min,max overrides if any.
I can also do voltage selector based operations while at it.
Signature · 2 lines
Regards, Nishanth Menon
Mark Brown
maintainerRe: [RFC PATCH 1/4] regulator: Introduce OMAP regulator to control PMIC over VC/VP
Quoted 11 lines · Nishanth Menon
I am proposing moving the following into OF match data. ti,i2c-slave-address
ti,i2c-voltage-register ti,i2c-command-register
ti,slew-rate-microvolt ti,step-size-micro-volts ti,voltage-selector-set-bits ti,voltage-selector-mask ti,voltage-selector-offset ti,non-zero-voltage-selector
Quoted 4 lines
The only thing I propose to retain is board specific variations - e.g. gpios, boot voltage and standard regulator min,max overrides if any.
I can also do voltage selector based operations while at it.
OK, this sounds like a step in the right direction.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130613/190167a2/attachment-0001.sig>
Re: [RFC PATCH 1/4] regulator: Introduce OMAP regulator to control PMIC over VC/VP
Quoted 13 lines · Mark Brown
Quoted 10 lines · Nishanth Menon
I am proposing moving the following into OF match data. ti,i2c-slave-address
ti,i2c-voltage-register ti,i2c-command-register
ti,slew-rate-microvolt ti,step-size-micro-volts ti,voltage-selector-set-bits ti,voltage-selector-mask ti,voltage-selector-offset ti,non-zero-voltage-selector
Quoted 6 lines
Quoted 4 lines
The only thing I propose to retain is board specific variations - e.g. gpios, boot voltage and standard regulator min,max overrides if any.
I can also do voltage selector based operations while at it.
OK, this sounds like a step in the right direction.
Thanks for the review and guidance. I will post a new RFC series with the above changes in a day or so.
Regards,
Nishanth Menon