[U-Boot] [[PATCH v2 2/6] ARM: OMAP5: Power: Add USB LDO9 enable interface

Dan Murphy
2013-07-10T20:05:05Z

Add an interface to the palmas driver to enable the
LDO9 power supply for the USB hub IC.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
drivers/power/palmas.c | 34 ++++++++++++++++++++++++++++++++++
include/palmas.h | 1 +
2 files changed, 35 insertions(+)

diff --git a/drivers/power/palmas.c b/drivers/power/palmas.c
index 2d275a7..b800dd4 100644
--- a/drivers/power/palmas.c
+++ b/drivers/power/palmas.c
@@ -143,6 +143,40 @@ int twl603x_audio_power(u8 on)
}
#endif

+#ifdef CONFIG_PALMAS_USBPWR
+int palmas_usb_poweron_ldo(void)
+{
+ u8 val = 0;
+ int err;
+
+ /* TURN ON LDO's needed */
+ val = RSC_STAT_ON | RSC_MODE_SLEEP | RSC_MODE_ACTIVE;
+ err = palmas_i2c_write_u8(TWL603X_CHIP_P1, SYSEN2_CTRL, val);
+ if (err) {
+ printf("palmas: could not turn 3v3 %s: err = %d\n",
+ val ? "on" : "off", err);
+ return err;
+ }
+
+ /* set to 3.3V */
+ val = LDO9_BYPASS;
+ err = palmas_i2c_write_u8(TWL603X_CHIP_P1, LDOUSB_VOLTAGE, val);
+ if (err) {
+ printf("palmas: could not set 3v3 %s: err = %d\n",
+ val ? "on" : "off", err);
+ return err;
+ }
+
+ /* enable LDO USB */
+ err = palmas_i2c_write_u8(TWL603X_CHIP_P1, LDOUSB_CTRL, val);
+ if (err) {
+ printf("palmas: could not enable 3v3 %s: err = %d\n",
+ val ? "on" : "off", err);
+ return err;
+ }
+}
+#endif
+
/*
* Enable/disable back-up battery (or super cap) charging on TWL6035/37.
* Please use defined BB_xxx values.
diff --git a/include/palmas.h b/include/palmas.h
index aff48b5..43887c2 100644
--- a/include/palmas.h
+++ b/include/palmas.h
@@ -130,5 +130,6 @@ int palmas_mmc1_poweron_ldo(void);
int twl603x_mmc1_set_ldo9(u8 vsel);
int twl603x_audio_power(u8 on);
int twl603x_enable_bb_charge(u8 bb_fields);
+int palmas_usb_poweron_ldo(void);

#endif /* PALMAS_H */
--
1.7.9.5