Add a convenience function for configuring the most common characteristics of an LTC3676 buck regulator.
Signed-off-by: Tim Harvey <thar...@gateworks.com> --- drivers/power/pmic/pmic_ltc3676.c | 16 ++++++++++++++++ include/power/ltc3676_pmic.h | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/drivers/power/pmic/pmic_ltc3676.c b/drivers/power/pmic/pmic_ltc3676.c index 9b874cb..af795ea 100644 --- a/drivers/power/pmic/pmic_ltc3676.c +++ b/drivers/power/pmic/pmic_ltc3676.c @@ -30,3 +30,19 @@ int power_ltc3676_init(unsigned char bus) return 0; } + +void power_ltc3676_swconfig(struct pmic *p, enum ltc3676_sw sw, + enum ltc3676_mode mode, enum ltc3676_phase phase, + enum ltc3676_freq freq) +{ + u32 reg; + + pmic_reg_read(p, LTC3676_BUCK1 + sw, ®); + reg &= ~LTC3676_MODE_MASK; + reg |= (mode << LTC3676_MODE); + reg &= ~(1 << LTC3676_PHASE); + reg |= (phase << LTC3676_PHASE); + reg &= ~(1 << LTC3676_FREQ); + reg |= (freq << LTC3676_FREQ); + pmic_reg_write(p, LTC3676_BUCK1 + sw, reg); +} diff --git a/include/power/ltc3676_pmic.h b/include/power/ltc3676_pmic.h index dcaa985..f5b0f3c 100644 --- a/include/power/ltc3676_pmic.h +++ b/include/power/ltc3676_pmic.h @@ -42,10 +42,50 @@ enum { * SW Configuration */ +/* DVB<x> registers */ #define LTC3676_DVB_MASK 0x1f #define LTC3676_PGOOD_MASK (1<<5) #define LTC3676_REF_SELA (0<<5) #define LTC3676_REF_SELB (1<<5) +/* BUCK<x> registers */ +#define LTC3676_MODE_MASK 0x60 +#define LTC3676_MODE 5 +#define LTC3676_STARTUP 4 +#define LTC3676_PHASE 3 +#define LTC3676_FREQ 2 +#define LTC3676_KEEPALIVE 1 +#define LTC3676_RATE 0 + +enum ltc3676_sw { + SW1 = 0, + SW2 = 1, + SW3 = 2, + SW4 = 3 +}; + +enum ltc3676_mode { + PFM = 0, /* pulse-skipping */ + APF = 1, /* burst - auto switches */ + PWM = 2, /* forced continuous */ +}; + +enum ltc3676_phase { + PHASE1 = 0, + PHASE2 = 1, +}; + +enum ltc3676_freq { + F2250KHZ = 0, + F1125KHZ = 1, +}; + +enum ltc3676_rate { + SLOW = 0, + FAST = 1, +}; + int power_ltc3676_init(unsigned char bus); +void power_ltc3676_swconfig(struct pmic *, enum ltc3676_sw, enum ltc3676_mode, + enum ltc3676_phase, enum ltc3676_freq); #endif -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot