]> code.ossystems Code Review - meta-freescale.git/blob
cf733544dcd9f4061457445810ac508ef64b87d8
[meta-freescale.git] /
1 From 15675c7082f3a80ee2a67b436fdbb6bc800e6662 Mon Sep 17 00:00:00 2001
2 From: Fabio Estevam <fabio.estevam@freescale.com>
3 Date: Tue, 20 Mar 2012 11:40:06 +0000
4 Subject: [PATCH 07/56] pmic: Add support for the Dialog DA9053 PMIC
5
6 Add support for the Dialog DA9053 PMIC.
7
8 Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
9 ---
10  drivers/misc/Makefile      |    1 +
11  drivers/misc/pmic_dialog.c |   37 +++++++++
12  include/dialog_pmic.h      |  187 ++++++++++++++++++++++++++++++++++++++++++++
13  3 files changed, 225 insertions(+)
14  create mode 100644 drivers/misc/pmic_dialog.c
15  create mode 100644 include/dialog_pmic.h
16
17 diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
18 index a709707..29d768b 100644
19 --- a/drivers/misc/Makefile
20 +++ b/drivers/misc/Makefile
21 @@ -35,6 +35,7 @@ COBJS-$(CONFIG_PDSP188x) += pdsp188x.o
22  COBJS-$(CONFIG_STATUS_LED) += status_led.o
23  COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
24  COBJS-$(CONFIG_PMIC) += pmic_core.o
25 +COBJS-$(CONFIG_DIALOG_PMIC) += pmic_dialog.o
26  COBJS-$(CONFIG_PMIC_FSL) += pmic_fsl.o
27  COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o
28  COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o
29 diff --git a/drivers/misc/pmic_dialog.c b/drivers/misc/pmic_dialog.c
30 new file mode 100644
31 index 0000000..7242073
32 --- /dev/null
33 +++ b/drivers/misc/pmic_dialog.c
34 @@ -0,0 +1,37 @@
35 +/*
36 + *  Copyright (C) 2011 Samsung Electronics
37 + *  Lukasz Majewski <l.majewski@samsung.com>
38 + *
39 + * See file CREDITS for list of people who contributed to this
40 + * project.
41 + *
42 + * This program is free software; you can redistribute it and/or
43 + * modify it under the terms of the GNU General Public License as
44 + * published by the Free Software Foundation; either version 2 of
45 + * the License, or (at your option) any later version.
46 + *
47 + * This program is distributed in the hope that it will be useful,
48 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
49 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50 + * GNU General Public License for more details.
51 + */
52 +
53 +#include <common.h>
54 +#include <pmic.h>
55 +#include <dialog_pmic.h>
56 +
57 +int pmic_init(void)
58 +{
59 +       struct pmic *p = get_pmic();
60 +       static const char name[] = "DIALOG_PMIC";
61 +
62 +       p->name = name;
63 +       p->number_of_regs = PMIC_NUM_OF_REGS;
64 +
65 +       p->interface = PMIC_I2C;
66 +       p->hw.i2c.addr = CONFIG_SYS_DIALOG_PMIC_I2C_ADDR;
67 +       p->hw.i2c.tx_num = 1;
68 +       p->bus = I2C_PMIC;
69 +
70 +       return 0;
71 +}
72 diff --git a/include/dialog_pmic.h b/include/dialog_pmic.h
73 new file mode 100644
74 index 0000000..b0925f5
75 --- /dev/null
76 +++ b/include/dialog_pmic.h
77 @@ -0,0 +1,187 @@
78 +/*
79 + * da9053 register declarations.
80 + *
81 + * Copyright(c) 2009 Dialog Semiconductor Ltd.
82 + *
83 + * This program is free software; you can redistribute it and/or modify
84 + * it under the terms of the GNU General Public License as published by
85 + * the Free Software Foundation; either version 2 of the License, or
86 + * (at your option) any later version.
87 + *
88 + * This program is distributed in the hope that it will be useful,
89 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
90 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
91 + * GNU General Public License for more details.
92 + *
93 + * You should have received a copy of the GNU General Public License
94 + * along with this program; if not, write to the Free Software
95 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
96 + *
97 + */
98 +
99 +#ifndef __DIALOG_PMIC_H__
100 +#define __DIALOG_PMIC_H__
101 +
102 +enum {
103 +       DA9053_PAGECON0_REG = 0,
104 +       DA9053_STATUSA_REG,
105 +       DA9053_STATUSB_REG,
106 +       DA9053_STATUSC_REG,
107 +       DA9053_STATUSD_REG,
108 +       DA9053_EVENTA_REG,
109 +       DA9053_EVENTB_REG,
110 +       DA9053_EVENTC_REG,
111 +       DA9053_EVENTD_REG,
112 +       DA9053_FAULTLOG_REG,
113 +       DA9053_IRQMASKA_REG,
114 +       DA9053_IRQMASKB_REG,
115 +       DA9053_IRQMASKC_REG,
116 +       DA9053_IRQMASKD_REG,
117 +       DA9053_CONTROLA_REG,
118 +       DA9053_CONTROLB_REG,
119 +       DA9053_CONTROLC_REG,
120 +       DA9053_CONTROLD_REG,
121 +       DA9053_PDDIS_REG,
122 +       DA9053_INTERFACE_REG,
123 +       DA9053_RESET_REG,
124 +       DA9053_GPIO0001_REG,
125 +       DA9053_GPIO0203_REG,
126 +       DA9053_GPIO0405_REG,
127 +       DA9053_GPIO0607_REG,
128 +       DA9053_GPIO0809_REG,
129 +       DA9053_GPIO1011_REG,
130 +       DA9053_GPIO1213_REG,
131 +       DA9053_GPIO1415_REG,
132 +       DA9053_ID01_REG,
133 +       DA9053_ID23_REG,
134 +       DA9053_ID45_REG,
135 +       DA9053_ID67_REG,
136 +       DA9053_ID89_REG,
137 +       DA9053_ID1011_REG,
138 +       DA9053_ID1213_REG,
139 +       DA9053_ID1415_REG,
140 +       DA9053_ID1617_REG,
141 +       DA9053_ID1819_REG,
142 +       DA9053_ID2021_REG,
143 +       DA9053_SEQSTATUS_REG,
144 +       DA9053_SEQA_REG,
145 +       DA9053_SEQB_REG,
146 +       DA9053_SEQTIMER_REG,
147 +       DA9053_BUCKA_REG,
148 +       DA9053_BUCKB_REG,
149 +       DA9053_BUCKCORE_REG,
150 +       DA9053_BUCKPRO_REG,
151 +       DA9053_BUCKMEM_REG,
152 +       DA9053_BUCKPERI_REG,
153 +       DA9053_LDO1_REG,
154 +       DA9053_LDO2_REG,
155 +       DA9053_LDO3_REG,
156 +       DA9053_LDO4_REG,
157 +       DA9053_LDO5_REG,
158 +       DA9053_LDO6_REG,
159 +       DA9053_LDO7_REG,
160 +       DA9053_LDO8_REG,
161 +       DA9053_LDO9_REG,
162 +       DA9053_LDO10_REG,
163 +       DA9053_SUPPLY_REG,
164 +       DA9053_PULLDOWN_REG,
165 +       DA9053_CHGBUCK_REG,
166 +       DA9053_WAITCONT_REG,
167 +       DA9053_ISET_REG,
168 +       DA9053_BATCHG_REG,
169 +       DA9053_CHGCONT_REG,
170 +       DA9053_INPUTCONT_REG,
171 +       DA9053_CHGTIME_REG,
172 +       DA9053_BBATCONT_REG,
173 +       DA9053_BOOST_REG,
174 +       DA9053_LEDCONT_REG,
175 +       DA9053_LEDMIN123_REG,
176 +       DA9053_LED1CONF_REG,
177 +       DA9053_LED2CONF_REG,
178 +       DA9053_LED3CONF_REG,
179 +       DA9053_LED1CONT_REG,
180 +       DA9053_LED2CONT_REG,
181 +       DA9053_LED3CONT_REG,
182 +       DA9053_LED4CONT_REG,
183 +       DA9053_LED5CONT_REG,
184 +       DA9053_ADCMAN_REG,
185 +       DA9053_ADCCONT_REG,
186 +       DA9053_ADCRESL_REG,
187 +       DA9053_ADCRESH_REG,
188 +       DA9053_VDDRES_REG,
189 +       DA9053_VDDMON_REG,
190 +       DA9053_ICHGAV_REG,
191 +       DA9053_ICHGTHD_REG,
192 +       DA9053_ICHGEND_REG,
193 +       DA9053_TBATRES_REG,
194 +       DA9053_TBATHIGHP_REG,
195 +       DA9053_TBATHIGHIN_REG,
196 +       DA9053_TBATLOW_REG,
197 +       DA9053_TOFFSET_REG,
198 +       DA9053_ADCIN4RES_REG,
199 +       DA9053_AUTO4HIGH_REG,
200 +       DA9053_AUTO4LOW_REG,
201 +       DA9053_ADCIN5RES_REG,
202 +       DA9053_AUTO5HIGH_REG,
203 +       DA9053_AUTO5LOW_REG,
204 +       DA9053_ADCIN6RES_REG,
205 +       DA9053_AUTO6HIGH_REG,
206 +       DA9053_AUTO6LOW_REG,
207 +       DA9053_TJUNCRES_REG,
208 +       DA9053_TSICONTA_REG,
209 +       DA9053_TSICONTB_REG,
210 +       DA9053_TSIXMSB_REG,
211 +       DA9053_TSIYMSB_REG,
212 +       DA9053_TSILSB_REG,
213 +       DA9053_TSIZMSB_REG,
214 +       DA9053_COUNTS_REG,
215 +       DA9053_COUNTMI_REG,
216 +       DA9053_COUNTH_REG,
217 +       DA9053_COUNTD_REG,
218 +       DA9053_COUNTMO_REG,
219 +       DA9053_COUNTY_REG,
220 +       DA9053_ALARMMI_REG,
221 +       DA9053_ALARMH_REG,
222 +       DA9053_ALARMD_REG,
223 +       DA9053_ALARMMO_REG,
224 +       DA9053_ALARMY_REG,
225 +       DA9053_SECONDA_REG,
226 +       DA9053_SECONDB_REG,
227 +       DA9053_SECONDC_REG,
228 +       DA9053_SECONDD_REG,
229 +       DA9053_PAGECON128_REG,
230 +       DA9053_CHIPID_REG,
231 +       DA9053_CONFIGID_REG,
232 +       DA9053_OTPCONT_REG,
233 +       DA9053_OSCTRIM_REG,
234 +       DA9053_GPID0_REG,
235 +       DA9053_GPID1_REG,
236 +       DA9053_GPID2_REG,
237 +       DA9053_GPID3_REG,
238 +       DA9053_GPID4_REG,
239 +       DA9053_GPID5_REG,
240 +       DA9053_GPID6_REG,
241 +       DA9053_GPID7_REG,
242 +       DA9053_GPID8_REG,
243 +       DA9053_GPID9_REG,
244 +       PMIC_NUM_OF_REGS,
245 +};
246 +
247 +#define DA_BUCKCORE_VBCORE_1_250V              0x1E
248 +
249 +/* BUCKCORE REGISTER */
250 +#define DA9052_BUCKCORE_BCORECONF               (1 << 7)
251 +#define DA9052_BUCKCORE_BCOREEN                 (1 << 6)
252 +#define DA9052_BUCKCORE_VBCORE                  63
253 +
254 +/* SUPPLY REGISTER */
255 +#define DA9052_SUPPLY_VLOCK                     (1 << 7)
256 +#define DA9052_SUPPLY_VMEMSWEN                  (1 << 6)
257 +#define DA9052_SUPPLY_VPERISWEN                 (1 << 5)
258 +#define DA9052_SUPPLY_VLDO3GO                   (1 << 4)
259 +#define DA9052_SUPPLY_VLDO2GO                   (1 << 3)
260 +#define DA9052_SUPPLY_VBMEMGO                   (1 << 2)
261 +#define DA9052_SUPPLY_VBPROGO                   (1 << 1)
262 +#define DA9052_SUPPLY_VBCOREGO                  (1 << 0)
263 +
264 +#endif /* __DIALOG_PMIC_H__ */
265 -- 
266 1.7.10
267