]> git.ipfire.org Git - people/ms/u-boot.git/blame - include/palmas.h
ARM: uniphier: clean up board_init
[people/ms/u-boot.git] / include / palmas.h
CommitLineData
21144298 1/*
cb199102 2 * (C) Copyright 2012-2013
21144298
S
3 * Texas Instruments, <www.ti.com>
4 *
1a459660 5 * SPDX-License-Identifier: GPL-2.0+
21144298 6 */
da2cc454
NM
7#ifndef PALMAS_H
8#define PALMAS_H
21144298
S
9
10#include <common.h>
11#include <i2c.h>
12
e9090fa4
LP
13/* I2C chip addresses, TW6035/37 */
14#define TWL603X_CHIP_P1 0x48 /* Page 1 */
15#define TWL603X_CHIP_P2 0x49 /* Page 2 */
16#define TWL603X_CHIP_P3 0x4a /* Page 3 */
21144298 17
e9090fa4
LP
18/* TPS659038/39 */
19#define TPS65903X_CHIP_P1 0x58 /* Page 1 */
20
21/* Page 1 registers (0x1XY translates to page 1, reg addr 0xXY): */
22
23/* LDO1 control/voltage */
24#define LDO1_CTRL 0x50
25#define LDO1_VOLTAGE 0x51
26
b4b06006
LV
27/* LDO1 control/voltage for LP873x */
28#define LP873X_LDO1_ADDR 0x60
29#define LP873X_LDO1_CTRL 0x9
30#define LP873X_LDO1_VOLTAGE 0xa
31#define LP873X_LDO_VOLT_3V0 0x19
32#define LP873X_LDO_VOLT_1V8 0xa
33#define LP873X_LDO_CTRL_EN (0x1 << 0)
34#define LP873X_LDO_CTRL_EN_PINCTRL (0x1 << 1)
35#define LP873X_LDO_CTRL_RDIS_EN (0x1 << 2)
36
35fe1cb0
DL
37/* LDO2 control/voltage */
38#define LDO2_CTRL 0x52
39#define LDO2_VOLTAGE 0x53
40
cd43b516
LV
41/* LDO2 control/voltage */
42#define LDO4_CTRL 0x5e
43#define LDO4_VOLTAGE 0x5f
44
e9090fa4 45/* LDO9 control/voltage */
21144298
S
46#define LDO9_CTRL 0x60
47#define LDO9_VOLTAGE 0x61
48
e9090fa4
LP
49/* LDOUSB control/voltage */
50#define LDOUSB_CTRL 0x64
51#define LDOUSB_VOLTAGE 0x65
1bd435bc 52#define LDO_CTRL 0x6a
e9090fa4
LP
53
54/* Control of 32 kHz audio clock */
55#define CLK32KGAUDIO_CTRL 0xd5
56
57/* SYSEN2_CTRL for VCC_3v3_AUX supply on the sEVM */
58#define SYSEN2_CTRL 0xd9
59
60/*
61 * Bit field definitions for LDOx_CTRL, SYSENx_CTRL
62 * and some other xxx_CTRL resources:
63 */
64#define LDO9_BYP_EN (1 << 6) /* LDO9 only! */
65#define RSC_STAT_ON (1 << 4) /* RO status bit! */
66#define RSC_MODE_SLEEP (1 << 2)
67#define RSC_MODE_ACTIVE (1 << 0)
68
69/* Some LDO voltage values */
70#define LDO_VOLT_OFF 0
71#define LDO_VOLT_1V8 0x13
72#define LDO_VOLT_3V0 0x2b
73#define LDO_VOLT_3V3 0x31
74/* Request bypass, LDO9 only */
75#define LDO9_BYPASS 0x3f
76
77/* SMPS7_CTRL */
78#define SMPS7_CTRL 0x30
79
80/* SMPS9_CTRL */
81#define SMPS9_CTRL 0x38
82#define SMPS9_VOLTAGE 0x3b
83
1bd435bc
DM
84/* SMPS10_CTRL */
85#define SMPS10_CTRL 0x3c
86#define SMPS10_MODE_ACTIVE_D 0x0d
87
e9090fa4
LP
88/* Bit field definitions for SMPSx_CTRL */
89#define SMPS_MODE_ACT_AUTO 1
90#define SMPS_MODE_ACT_ECO 2
91#define SMPS_MODE_ACT_FPWM 3
92#define SMPS_MODE_SLP_AUTO (1 << 2)
93#define SMPS_MODE_SLP_ECO (2 << 2)
94#define SMPS_MODE_SLP_FPWM (3 << 2)
95
96/*
97 * Some popular SMPS voltages, all with RANGE=1; note
98 * that RANGE cannot be changed on the fly
99 */
100#define SMPS_VOLT_OFF 0
101#define SMPS_VOLT_1V2 0x90
102#define SMPS_VOLT_1V8 0xae
103#define SMPS_VOLT_2V1 0xbd
104#define SMPS_VOLT_3V0 0xea
105#define SMPS_VOLT_3V3 0xf9
106
107/* Backup Battery & VRTC Control */
108#define BB_VRTC_CTRL 0xa8
109/* Bit definitions for BB_VRTC_CTRL */
110#define VRTC_EN_SLP (1 << 6)
111#define VRTC_EN_OFF (1 << 5)
112#define VRTC_PWEN (1 << 4)
113#define BB_LOW_ICHRG (1 << 3)
114#define BB_HIGH_ICHRG (0 << 3)
115#define BB_VSEL_3V0 (0 << 1)
116#define BB_VSEL_2V5 (1 << 1)
117#define BB_VSEL_3V15 (2 << 1)
118#define BB_VSEL_VBAT (3 << 1)
119#define BB_CHRG_EN (1 << 0)
21144298 120
ff2d57ea
NM
121/*
122 * Functions to read and write from TPS659038/TWL6035/TWL6037
123 * or other Palmas family of TI PMICs
124 */
125static inline int palmas_i2c_write_u8(u8 chip_no, u8 reg, u8 val)
126{
127 return i2c_write(chip_no, reg, 1, &val, 1);
128}
129
130static inline int palmas_i2c_read_u8(u8 chip_no, u8 reg, u8 *val)
131{
132 return i2c_read(chip_no, reg, 1, val, 1);
133}
134
12733881 135void palmas_init_settings(void);
db4fce8f 136int palmas_mmc1_poweron_ldo(uint ldo_volt, uint ldo_ctrl, uint voltage);
b4b06006 137int lp873x_mmc1_poweron_ldo(uint voltage);
e9090fa4
LP
138int twl603x_mmc1_set_ldo9(u8 vsel);
139int twl603x_audio_power(u8 on);
140int twl603x_enable_bb_charge(u8 bb_fields);
1bd435bc 141int palmas_enable_ss_ldo(void);
da2cc454
NM
142
143#endif /* PALMAS_H */