Commit Graph

18 Commits

Author SHA1 Message Date
Igor Opaniuk 2147a16983 dm: i2c: use CONFIG_IS_ENABLED macro for DM_I2C/DM_I2C_GPIO
Use CONFIG_IS_ENABLED() macro, which provides more convenient
way to check $(SPL)DM_I2C/$(SPL)DM_I2C_GPIO configs
for both SPL and U-Boot proper.

CONFIG_IS_ENABLED(DM_I2C) expands to:
- 1 if CONFIG_SPL_BUILD is undefined and CONFIG_DM_I2C is set to 'y',
- 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_DM_I2C is set to 'y',
- 0 otherwise.

All occurences were replaced automatically using these bash cmds:
$ find . -type f -exec sed -i
     's/ifndef CONFIG_DM_I2C/if !CONFIG_IS_ENABLED(DM_I2C)/g' {} +
$ find . -type f -exec sed -i
    's/ifdef CONFIG_DM_I2C/if CONFIG_IS_ENABLED(DM_I2C)/g' {} +
$ find . -type f -exec sed -i
    's/defined(CONFIG_DM_I2C)/CONFIG_IS_ENABLED(DM_I2C)/g' {} +
$ find . -type f -exec sed -i
    's/ifndef CONFIG_DM_I2C_GPIO/if !CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} +
$ find . -type f -exec sed -i
    's/ifdef CONFIG_DM_I2C_GPIO/if CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} +
$ find . -type f -exec sed -i
    's/defined(CONFIG_DM_I2C_GPIO)/CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} +

Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2021-02-21 06:08:00 +01:00
Jean-Jacques Hiblot fb1b7712ad power: make most tps drivers and the twl4030 driver compatible with DM_I2C
Those driver are not DM drivers per se (not using the PMIC/regulator
framework) and are using the legacy I2C API. Make them compatible with
the DM_I2C API.

This impacts the following drivers:
- palmas (used by am57xx/dra7xx evms)
- tps65218 (used by am43xx evms)
- tps65217 and tps65910 (used by am335x evms and am335x boneblack vboot)
- twl4030 (used by omap3_logicpd)
- tps65217 (used by brppt1)
- twl6030

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2018-12-10 06:17:30 +01:00
Tom Rini 83d290c56f SPDX: Convert all of our single license tags to Linux Kernel style
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from.  So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry.  Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents.  There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07 09:34:12 -04:00
Paul Kocialkowski 461484c27e input: TWL6030 input support for power button, USB and charger
This adds support for detecting a few inputs exported by the TWL6030.
Currently-supported inputs are the power button, USB and charger presence.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2016-03-15 15:12:57 -04:00
Paul Kocialkowski d6a2042dbc power: twl6030: Power off support
This adds support for powering off (the omap SoC) from the twl6030.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2016-03-15 15:12:56 -04:00
Paul Kocialkowski 6313c65004 power: twl6030: Clear VUSB_IN_PMID bit on USB device setup
When booting from USB, the bootrom sets the VUSB_IN_PMID bit of the MISC2
register of the TWL6030. However, U-Boot sets the VUSB_IN_VSYS bit to enable
VBUS input. As both bits are contradictory, enabling both disables the input,
according to the TWL6030 TRM.

Thus, we need to clear the VUSB_IN_PMID bit in case of an USB boot (which could
just as well be a memory boot after USB timed out).

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2016-03-15 15:12:51 -04:00
Paul Kocialkowski 0343f71f09 power: twl6030: Configure VUSB voltage on USB device setup
This explicitly sets VUSB voltage to 3.3V when enabling USB.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2016-03-15 15:12:50 -04:00
Paul Kocialkowski a85362fb3e power: twl6030: Device-index-specific MMC power initialization
Not every device has multiple MMC slots available, so it makes sense to enable
only the required LDOs for the available slots. Generic code in omap_hsmmc will
enable both VMMC and VAUX1, in doubt.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2016-03-15 15:10:51 -04:00
Paul Kocialkowski d7b6a75497 power: twl6030: Enable VAUX1 for eMMC power, depending on BOOT2 value
This enables the VAUX1 supply, used for eMMC power in standard configurations.
Its voltage is determined by the value of the BOOT2 pin of the TWL6030.

Note that the TWL6030 might already have enabled this regulator at startup
(depending on the value of the BOOT3 pin of the TWL6030), according to the
TWL6030 datasheet.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2016-03-15 15:10:51 -04:00
Paul Kocialkowski c5dbae7c19 power: twl6030: Some more explicit registers and values definitions
This makes the twl6030 mmc and usb-related power registers and values
definitions more explicit and clear and adds prefixes to them.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2016-03-15 15:10:50 -04:00
Oleg Kosheliev 340e6c8300 ARMV7: OMAP4: Add twl6032 support
Added chip type detection and twl6032
support in the battery control
and charge functions.

Based on Balaji T K <balajitk@ti.com> patches for TI u-boot.

Signed-off-by: Oleg Kosheliev <oleg.kosheliev@ti.com>
2013-12-04 08:11:28 -05:00
Oleg Kosheliev fc8895035b ARMV7: OMAP4: Add struct for twl603x data
The data struct is used to support different
PMIC chip types. It contains the chip type and
the data (e.g. registers addresses, adc multiplier)
which is different for twl6030 and twl6032.
Replaced some hardcoded values with the
structure vars.

Based on Balaji T K <balajitk@ti.com> patches for TI u-boot.

Signed-off-by: Oleg Kosheliev <oleg.kosheliev@ti.com>
2013-12-04 08:11:28 -05:00
Wolfgang Denk 1a4596601f Add GPL-2.0+ SPDX-License-Identifier to source files
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24 09:44:38 -04:00
Nishanth Menon 502dac5568 twl6030: add header guard
Add an header guard to common header file to prevent multiple includes
messing things up.

Signed-off-by: Nishanth Menon <nm@ti.com>
2013-05-10 08:25:54 -04:00
Nishanth Menon ebce10e5b2 twl6030: move twl6030 register access functions to common header file
twl6030_i2c_[read|write]_u8 can be used else where to access
multi-function device such as twl6030, so move the register access
functions to the common twl6030.h header file.

Signed-off-by: Nishanth Menon <nm@ti.com>
2013-05-10 08:25:54 -04:00
Balaji T K 14fa2dd00f mmc: omap: config VMMC, MMC1_PBIAS
Config VMMC voltage to 3V for MMC/SD card slot
and PBIAS settings needed for OMAP4
Fixes MMC/SD detection on boot from eMMC.

Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Aneesh V <aneesh@ti.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
2011-09-30 22:00:55 +02:00
Balaji T K 3e664f6d50 ARMV7: OMAP4: twl6030 add battery charging support
Add battery charging support twl6030 driver.
Add support for battery voltage and current measurements.
Add command to get battery status and start/stop battery charging from USB.

Signed-off-by: Balaji T K <balajitk@ti.com>
Tested-by: Steve Sakoman <steve.sakoman@linaro.org>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
2010-12-11 10:56:01 -05:00
Steve Sakoman 516799f677 ARMV7: Add support for the TWL6030 I2C power chip used in OMAP4 systems
This patch add the basic infrastructure for the TWL6030 driver and enables
support in the two existing OMAP4 boards, Panda and OMAP4430 SDP

Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
2010-08-05 10:11:30 -04:00