Commit Graph

299 Commits

Author SHA1 Message Date
Tom Rini
821560fd8e Merge git://www.denx.de/git/u-boot-imx
Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
	include/configs/imx6qdl_icore_rqs.h
	include/configs/imx6ul_geam.h
	include/configs/imx6ul_isiot.h
2017-06-27 09:32:37 -04:00
Tom Rini
8cb3ce64f9 Merge git://git.denx.de/u-boot-dm 2017-06-10 18:01:22 -04:00
Simon Glass
422f04b68f power: regulator: Add more debugging and fix a missing newline
This file does not report a few possible errors and one message is missing
a newline. Fix these.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2017-06-09 13:39:32 -06:00
Keerthy
2dd9dc02a3 power: regulator: lp87565: add regulator support
The driver provides regulator set/get voltage
enable/disable functions for lp87565 family of PMICs.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2017-06-09 20:25:16 +09:00
Keerthy
cdad57a7c1 power: pmic: lp87565: Add the basic pmic support
Add support to bind the regulators/child nodes with the pmic.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2017-06-09 20:25:16 +09:00
Keerthy
e395b8848a power: pmic: tps65218: Add DCDC3 configuration
Some boards like am437x-gp-evm require dcdc3 also to be configured
as it feeds on to ddr. Hence add the capability as well.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
2017-06-09 20:25:16 +09:00
Keerthy
75bceb22b3 power: regulator: palmas: Add smps12 dual regulator for tps65917
Add smps12 dual regulator for tps65917

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-06-09 20:25:16 +09:00
Mark Kettenis
c40d48bbbc regulator: pwm: Fix handling of missing init voltage
Since priv->init_voltage is an unsigned integer it can never be
negative.  So the current code fails to detect a missing
'regulator-init-microvolt' property and instead misconfigures the
PWM device.  Fix this by making the relevant members of
'struct pwm_regulator_info' signed integers.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2017-06-07 07:29:19 -06:00
Heiko Stübner
d1bf69d822 power: rk808: fix ldo register offset
Till now get_ldo_reg did a return &rk808_ldo[num - 1]; to return
the ldo register offset but didn't take into account that its
calling functions already created the ldo as ldo = dev->driver_data - 1.

This resulted in the setting for ldo8 writing to the register of ldo7
and so on. So fix this and get the correct ldo register data.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>
2017-06-07 07:29:19 -06:00
Kever Yang
7c1fb0a794 rockchip: rk8xx: allocate priv structure for driver
The rk8xx_priv structure need to allocate for driver, or else
it will cause data abort when CPU access it.

This is a bug fix for below patch set:
https://www.mail-archive.com/u-boot@lists.denx.de/msg247345.html

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
2017-06-07 06:57:49 -06:00
Simon Glass
04048d58a8 dm: gpio: power: Convert pm8916 drivers to livetree
This PMIC driver (power and GPIO) is used by the sandbox SPMI tests.
Update the drivers to support a live device tree so that the tests pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01 07:03:17 -06:00
Simon Glass
424b2fe939 dm: power-domain: Update uclass to support livetree
Update the power domain uclass to support livetree. Fix the xlate() method
which has no callers.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01 07:03:15 -06:00
Simon Glass
a5493f828e dm: regulator: Update fixed regulator to support livetree.
Update this driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01 07:03:13 -06:00
Simon Glass
f15cd4f131 dm: regulator: Convert regulator uclass to support livetree
Update the regulator uclass to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01 07:03:13 -06:00
Simon Glass
0402d003e7 sandbox: pmic: Convert pmic emulator to support livetree
Update this driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01 07:03:13 -06:00
Simon Glass
7a869e6cd1 dm: pmic: Convert uclass to livetree
Update the pmic uclass and all pmics to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01 07:03:12 -06:00
Simon Glass
a821c4af79 dm: Rename dev_addr..() functions
These support the flat device tree. We want to use the dev_read_..()
prefix for functions that support both flat tree and live tree. So rename
the existing functions to avoid confusion.

In the end we will have:

   1. dev_read_addr...()    - works on devices, supports flat/live tree
   2. devfdt_get_addr...()  - current functions, flat tree only
   3. of_get_address() etc. - new functions, live tree only

All drivers will be written to use 1. That function will in turn call
either 2 or 3 depending on whether the flat or live tree is in use.

Note this involves changing some dead code - the imx_lpi2c.c file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01 07:03:01 -06:00
Peng Fan
fcdb5319ce regulator: pfuze100: unsigned compared against 0
Fix unsigned compared against 0.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2017-05-31 10:16:06 +02:00
Peng Fan
237868c9c0 regulator: pfuze100: add SPDX License
Add SPDX license

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2017-05-31 10:15:49 +02:00
Keerthy
6183b29559 power: pmic: tps65218: Fix tps65218_voltage_update function
Currently while setting the vsel value for dcdc1 and dcdc2
the driver is wrongly masking the entire 8 bits in the process
clearing PFM (bit7) field as well. Hence describe an appropriate
mask for vsel field and modify only those bits in the vsel
mask.

Source: http://www.ti.com/lit/ds/symlink/tps65218.pdf

Signed-off-by: Keerthy <j-keerthy@ti.com>
Fixes: 86db550b38 ("power: Add support for the TPS65218 PMIC")
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2017-05-29 17:28:52 +09:00
Tom Rini
aae78fa774 drivers/power/regulator/max77686.c: Fix comparisons of unsigned expressions
Inside of
max77686_buck_volt2hex/max77686_buck_hex2volt/max77686_ldo_volt2hex we
check that the value we calculate is >= 0 however we declare 'hex' as
unsigned int making these always true.  Mark these as 'int' instead.  We
also move hex_max to int as they are constants that are 0x3f/0xff.
Given that the above functions are marked as returning an int, make the
variables we assign their return value to also be int to be able to
catch the error condition now.  Reported by clang-3.8.

Cc: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-05-29 17:28:52 +09:00
Adam Ford
df7fafd13f power: twl4030: Add imply CMD_POWEROFF when TWL4030 is enabled
Now that CMD_POWEROFF can turn off the twl4030, let's imply that
just incase someone wants to disable it.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2017-05-15 13:00:27 -04:00
Tom Rini
1f5541c881 Merge git://git.denx.de/u-boot-rockchip
This adds a new firefly-rk3399 board, MIPI support for rk3399 and
rk3288, rk818 pmic support, mkimage improvements for rockchip and a few
other things.
2017-05-10 17:40:11 -04:00
Tom Rini
102d86552a Merge branch 'master' of git://git.denx.de/u-boot-mips 2017-05-10 15:50:21 -04:00
Jacob Chen
453c5a927c power: rk808: rename to rk8xx
Since this driver can be used for rk8xx series pmic,
let's rename rk808 to rk8xx, to make it clear.

Configs parts are done by sed -i "s/RK808/RK8XX/g" `grep RK808 -lr ./`

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
2017-05-10 13:37:22 -06:00
Jacob Chen
eff4ca7285 power: regulator: rk808: add rk818 support
Add support for the rk818 regulator. The regulator module consists
of 4 DCDCs, 9 LDOs, 1 switch and 1 BOOST converter which is used to
power OTG and HDMI5V.

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-10 13:37:22 -06:00
Jacob Chen
b049acc902 power: regulator: rk808: replace vsel_bits with vsel_mask
Using mask is more flexible than bits.

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-10 13:37:22 -06:00
Jacob Chen
d77af8a8c9 power: pmic: rk808: add RK818 support
The RK818 chip is a Power Management IC (PMIC) for multimedia and handheld
devices.

For boards use rk818, the input current should be set in the early stage, before
ddr initialization.

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
2017-05-10 13:37:22 -06:00
Jacob Chen
1daa93c0b4 power: pmic: append rk818 regs to rk808
Both RK808 and RK818 chips are using a similar register map,
so we can reuse them.

I have also add reg prefix to exist registers, to keep them same style.

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-10 13:37:22 -06:00
Kever Yang
0b60111aa6 power: regulator: pwm: support pwm polarity setting
The latest kernel PWM drivers enable the polarity settings. When system
run from U-Boot to kerenl, if there are differences in polarity set or
duty cycle, the PMW will re-init:
  close -> set polarity and duty cycle -> enable the PWM.
The power supply controled by pwm regulator may have voltage shaking,
which lead to the system not stable.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
2017-05-10 13:37:21 -06:00
Álvaro Fernández Rojas
7810fb9547 dm: power: domain: add BCM6328 power domain driver
This allows controlling MISC IDDQ register on BCM6328 SoCs.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2017-05-10 16:16:09 +02:00
Adam Ford
7815c709ab power: twl4030: Move CONFIG_TWL4030_POWER to Kconfig
As requested, I added the CONFIG_TWL4030_POWER to Kconfig and made it
the implied default when selecting OMAP34XX as a platform.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-09 20:35:38 -04:00
Adam Ford
4c2fb5fcc8 power: twl4030: Add CONFIG_CMD_POWEROFF support
With the addition of twl4030_power_off(), let's allow the 'poweroff' command
to run this function when CONFIG_CMD_POWEROFF is enabled.

Tested on a DM3730 with twl4030 PMIC.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2017-05-09 20:35:38 -04:00
Tom Rini
a6d4cd4778 Merge branch 'master' of git://git.denx.de/u-boot-sunxi 2017-05-08 15:44:44 -04:00
Simon Glass
bdf25a5e04 power: Convert CONFIG_PMIC_AS3722 to Kconfig
This converts the following to Kconfig:
   CONFIG_PMIC_AS3722

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-04-30 10:29:50 -04:00
Simon Glass
2838c07f47 power: Move as3722 pmic to pmic/ directory
Most of the PMICs are in the drivers/power/pmic/ directory. Move this one
there.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-04-30 10:29:49 -04:00
Simon Glass
56aceaf282 power: Rename CONFIG_AS3722_POWER to CONFIG_PMIC_AS3722
Before converting this to Kconfig, rename it to match the other PMICs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-04-30 10:29:47 -04:00
Jernej Skrabec
ae4e4dde52 sunxi: power: Compile sy8106a driver only during SPL build
Driver for that regulator is used only in SPL and it uses old I2C
interface. If we want to use DM I2C in U-Boot proper, compilation of
this driver has to be limited only to SPL.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-04-28 09:18:54 +02:00
Chen-Yu Tsai
409677ec17 sunxi: Enable AXP221s in I2C mode with the R40 SoC
The R40 SoC uses the AXP221s in I2C mode to supply power.

Some regulator's common usages have changed, and also the recommended
voltage for existing usages have changed. Update the defaults to match.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-04-20 13:30:00 +02:00
Andre Przywara
7b82a229e5 sunxi: prepare for sharing MACH_SUN8I_H3 config symbol
The Allwinner H5 is very close to the H3 SoC, but has ARMv8 cores.
To allow sharing the clocks, GPIO and driver code easily, create an
architecture agnostic MACH_SUNXI_H3_H5 Kconfig symbol.
Rename the existing symbol to MACH_SUNXI_H3_H5 where code is shared and
let it be selected by a new shared Kconfig option.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-04-05 15:03:17 +05:30
Rask Ingemann Lambertsen
3cc293e26f sunxi: power: axp809.c: Fix aldo1-2 being disabled for mvolt != 0
The execution flow is currently like this for aldo_num == 1 or 2:

int axp_set_aldo(int aldo_num, unsigned int mvolt)
{
...
	if (mvolt == 0)
		return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
				AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));
...
	return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
 				AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));
 }

I.e. aldo1 and aldo2 will always be disabled. This patch fixes it by
setting (rather than clearing) the enable bit when mvolt != 0.

Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
Fixes: 795857df41 ("sunxi: power: add AXP809 support")
2017-03-09 11:26:02 +09:00
Jaehoon Chung
1a5a05dade power: pmic: add the max8997 controller for DM
Add the max8997 controller for Driver model.
Exynos4210 is using max8997 pmic controller.
(pmic_max8997.c should be deprecated.)

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-02-09 14:28:37 +09:00
Tom Rini
21342d4aed Merge git://git.denx.de/u-boot-dm 2017-02-08 16:24:44 -05:00
Keerthy
3064aa7009 regulator: palmas: Fix smps6 - smps9 indices
The array indices used currently are dispalaced by 1 for
SMPS6 through SMPS10 in the respective places of voltage and ctrl
arrays hence fix the same as to assign the right voltage and ctrl
registers.

Signed-off-by: Keerthy <j-keerthy@ti.com>
2017-02-08 16:24:27 -05:00
Simon Glass
e160f7d430 dm: core: Replace of_offset with accessor
At present devices use a simple integer offset to record the device tree
node associated with the device. In preparation for supporting a live
device tree, which uses a node pointer instead, refactor existing code to
access this field through an inline function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-02-08 06:12:14 -07:00
Tom Rini
0675f992db Merge git://git.denx.de/u-boot-fsl-qoriq 2017-01-19 12:22:23 -05:00
Hou Zhiqiang
762161b04a pmic: pmic_mc34vr500: Add a driver for the mc34vr500 pmic
This patch adds a simple pmic driver for the mc34vr500 pmic which
is used in conjunction with the fsl T1 and LS1 series SoC.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: York Sun <york.sun@nxp.com>
2017-01-18 09:28:53 -08:00
Tom Rini
c8ac644979 power_i2c.c: Fix unused variable warning
The variable ret was added but never set as we did not make calls to
other functions that we needed to check the return value on.

Fixes: 505cf4750a ("power: change from meaningless value to error number")
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-01-11 09:16:05 -05:00
Jaehoon Chung
505cf4750a power: change from meaningless value to error number
'-1' is absolutely meaningless value.
This patch changed from meaningless value to error number.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-01-11 19:40:14 +09:00
Vignesh R
bd2e9714c8 regulator: fixed: Add support to handle enable-active-high DT property
Add support to handle enable-active-high DT property. This property is
used to drive the gpio controlling fixed regulator as active high when
claiming gpio line.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-12-27 08:22:57 -05:00