root / hw / omap2.c @ 00914b7d
History | View | Annotate | Download (82.4 kB)
1 | 827df9f3 | balrog | /*
|
---|---|---|---|
2 | 827df9f3 | balrog | * TI OMAP processors emulation.
|
3 | 827df9f3 | balrog | *
|
4 | 827df9f3 | balrog | * Copyright (C) 2007-2008 Nokia Corporation
|
5 | 827df9f3 | balrog | * Written by Andrzej Zaborowski <andrew@openedhand.com>
|
6 | 827df9f3 | balrog | *
|
7 | 827df9f3 | balrog | * This program is free software; you can redistribute it and/or
|
8 | 827df9f3 | balrog | * modify it under the terms of the GNU General Public License as
|
9 | 827df9f3 | balrog | * published by the Free Software Foundation; either version 2 or
|
10 | 827df9f3 | balrog | * (at your option) version 3 of the License.
|
11 | 827df9f3 | balrog | *
|
12 | 827df9f3 | balrog | * This program is distributed in the hope that it will be useful,
|
13 | 827df9f3 | balrog | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 | 827df9f3 | balrog | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 | 827df9f3 | balrog | * GNU General Public License for more details.
|
16 | 827df9f3 | balrog | *
|
17 | fad6cb1a | aurel32 | * You should have received a copy of the GNU General Public License along
|
18 | 8167ee88 | Blue Swirl | * with this program; if not, see <http://www.gnu.org/licenses/>.
|
19 | 827df9f3 | balrog | */
|
20 | 666daa68 | Markus Armbruster | |
21 | 666daa68 | Markus Armbruster | #include "blockdev.h" |
22 | 827df9f3 | balrog | #include "hw.h" |
23 | 827df9f3 | balrog | #include "arm-misc.h" |
24 | 827df9f3 | balrog | #include "omap.h" |
25 | 827df9f3 | balrog | #include "sysemu.h" |
26 | 827df9f3 | balrog | #include "qemu-timer.h" |
27 | 827df9f3 | balrog | #include "qemu-char.h" |
28 | 827df9f3 | balrog | #include "flash.h" |
29 | afbb5194 | balrog | #include "soc_dma.h" |
30 | 99570a40 | balrog | #include "audio/audio.h" |
31 | 827df9f3 | balrog | |
32 | 99570a40 | balrog | /* Enhanced Audio Controller (CODEC only) */
|
33 | 99570a40 | balrog | struct omap_eac_s {
|
34 | 99570a40 | balrog | qemu_irq irq; |
35 | 99570a40 | balrog | |
36 | 99570a40 | balrog | uint16_t sysconfig; |
37 | 99570a40 | balrog | uint8_t config[4];
|
38 | 99570a40 | balrog | uint8_t control; |
39 | 99570a40 | balrog | uint8_t address; |
40 | 99570a40 | balrog | uint16_t data; |
41 | 99570a40 | balrog | uint8_t vtol; |
42 | 99570a40 | balrog | uint8_t vtsl; |
43 | 99570a40 | balrog | uint16_t mixer; |
44 | 99570a40 | balrog | uint16_t gain[4];
|
45 | 99570a40 | balrog | uint8_t att; |
46 | 99570a40 | balrog | uint16_t max[7];
|
47 | 99570a40 | balrog | |
48 | 99570a40 | balrog | struct {
|
49 | 99570a40 | balrog | qemu_irq txdrq; |
50 | 99570a40 | balrog | qemu_irq rxdrq; |
51 | 99570a40 | balrog | uint32_t (*txrx)(void *opaque, uint32_t, int); |
52 | 99570a40 | balrog | void *opaque;
|
53 | 99570a40 | balrog | |
54 | 99570a40 | balrog | #define EAC_BUF_LEN 1024 |
55 | 99570a40 | balrog | uint32_t rxbuf[EAC_BUF_LEN]; |
56 | ab17b46d | balrog | int rxoff;
|
57 | 99570a40 | balrog | int rxlen;
|
58 | 99570a40 | balrog | int rxavail;
|
59 | 99570a40 | balrog | uint32_t txbuf[EAC_BUF_LEN]; |
60 | 99570a40 | balrog | int txlen;
|
61 | 99570a40 | balrog | int txavail;
|
62 | 99570a40 | balrog | |
63 | 99570a40 | balrog | int enable;
|
64 | 99570a40 | balrog | int rate;
|
65 | 99570a40 | balrog | |
66 | 99570a40 | balrog | uint16_t config[4];
|
67 | 99570a40 | balrog | |
68 | 99570a40 | balrog | /* These need to be moved to the actual codec */
|
69 | 99570a40 | balrog | QEMUSoundCard card; |
70 | 99570a40 | balrog | SWVoiceIn *in_voice; |
71 | 99570a40 | balrog | SWVoiceOut *out_voice; |
72 | 99570a40 | balrog | int hw_enable;
|
73 | 99570a40 | balrog | } codec; |
74 | 99570a40 | balrog | |
75 | 99570a40 | balrog | struct {
|
76 | 99570a40 | balrog | uint8_t control; |
77 | 99570a40 | balrog | uint16_t config; |
78 | 99570a40 | balrog | } modem, bt; |
79 | 99570a40 | balrog | }; |
80 | 99570a40 | balrog | |
81 | 99570a40 | balrog | static inline void omap_eac_interrupt_update(struct omap_eac_s *s) |
82 | 99570a40 | balrog | { |
83 | 99570a40 | balrog | qemu_set_irq(s->irq, (s->codec.config[1] >> 14) & 1); /* AURDI */ |
84 | 99570a40 | balrog | } |
85 | 99570a40 | balrog | |
86 | 99570a40 | balrog | static inline void omap_eac_in_dmarequest_update(struct omap_eac_s *s) |
87 | 99570a40 | balrog | { |
88 | ab17b46d | balrog | qemu_set_irq(s->codec.rxdrq, (s->codec.rxavail || s->codec.rxlen) && |
89 | 99570a40 | balrog | ((s->codec.config[1] >> 12) & 1)); /* DMAREN */ |
90 | 99570a40 | balrog | } |
91 | 99570a40 | balrog | |
92 | 99570a40 | balrog | static inline void omap_eac_out_dmarequest_update(struct omap_eac_s *s) |
93 | 99570a40 | balrog | { |
94 | 99570a40 | balrog | qemu_set_irq(s->codec.txdrq, s->codec.txlen < s->codec.txavail && |
95 | 99570a40 | balrog | ((s->codec.config[1] >> 11) & 1)); /* DMAWEN */ |
96 | 99570a40 | balrog | } |
97 | 99570a40 | balrog | |
98 | 99570a40 | balrog | static inline void omap_eac_in_refill(struct omap_eac_s *s) |
99 | 99570a40 | balrog | { |
100 | ab17b46d | balrog | int left = MIN(EAC_BUF_LEN - s->codec.rxlen, s->codec.rxavail) << 2; |
101 | ab17b46d | balrog | int start = ((s->codec.rxoff + s->codec.rxlen) & (EAC_BUF_LEN - 1)) << 2; |
102 | ab17b46d | balrog | int leftwrap = MIN(left, (EAC_BUF_LEN << 2) - start); |
103 | ab17b46d | balrog | int recv = 1; |
104 | ab17b46d | balrog | uint8_t *buf = (uint8_t *) s->codec.rxbuf + start; |
105 | ab17b46d | balrog | |
106 | ab17b46d | balrog | left -= leftwrap; |
107 | ab17b46d | balrog | start = 0;
|
108 | ab17b46d | balrog | while (leftwrap && (recv = AUD_read(s->codec.in_voice, buf + start,
|
109 | ab17b46d | balrog | leftwrap)) > 0) { /* Be defensive */ |
110 | ab17b46d | balrog | start += recv; |
111 | ab17b46d | balrog | leftwrap -= recv; |
112 | ab17b46d | balrog | } |
113 | ab17b46d | balrog | if (recv <= 0) |
114 | ab17b46d | balrog | s->codec.rxavail = 0;
|
115 | ab17b46d | balrog | else
|
116 | ab17b46d | balrog | s->codec.rxavail -= start >> 2;
|
117 | ab17b46d | balrog | s->codec.rxlen += start >> 2;
|
118 | ab17b46d | balrog | |
119 | ab17b46d | balrog | if (recv > 0 && left > 0) { |
120 | ab17b46d | balrog | start = 0;
|
121 | ab17b46d | balrog | while (left && (recv = AUD_read(s->codec.in_voice,
|
122 | ab17b46d | balrog | (uint8_t *) s->codec.rxbuf + start, |
123 | ab17b46d | balrog | left)) > 0) { /* Be defensive */ |
124 | ab17b46d | balrog | start += recv; |
125 | ab17b46d | balrog | left -= recv; |
126 | ab17b46d | balrog | } |
127 | ab17b46d | balrog | if (recv <= 0) |
128 | ab17b46d | balrog | s->codec.rxavail = 0;
|
129 | ab17b46d | balrog | else
|
130 | ab17b46d | balrog | s->codec.rxavail -= start >> 2;
|
131 | ab17b46d | balrog | s->codec.rxlen += start >> 2;
|
132 | ab17b46d | balrog | } |
133 | 99570a40 | balrog | } |
134 | 99570a40 | balrog | |
135 | 99570a40 | balrog | static inline void omap_eac_out_empty(struct omap_eac_s *s) |
136 | 99570a40 | balrog | { |
137 | ab17b46d | balrog | int left = s->codec.txlen << 2; |
138 | ab17b46d | balrog | int start = 0; |
139 | ab17b46d | balrog | int sent = 1; |
140 | ab17b46d | balrog | |
141 | ab17b46d | balrog | while (left && (sent = AUD_write(s->codec.out_voice,
|
142 | ab17b46d | balrog | (uint8_t *) s->codec.txbuf + start, |
143 | ab17b46d | balrog | left)) > 0) { /* Be defensive */ |
144 | ab17b46d | balrog | start += sent; |
145 | ab17b46d | balrog | left -= sent; |
146 | ab17b46d | balrog | } |
147 | 99570a40 | balrog | |
148 | ab17b46d | balrog | if (!sent) {
|
149 | ab17b46d | balrog | s->codec.txavail = 0;
|
150 | ab17b46d | balrog | omap_eac_out_dmarequest_update(s); |
151 | ab17b46d | balrog | } |
152 | 99570a40 | balrog | |
153 | ab17b46d | balrog | if (start)
|
154 | ab17b46d | balrog | s->codec.txlen = 0;
|
155 | 99570a40 | balrog | } |
156 | 99570a40 | balrog | |
157 | 99570a40 | balrog | static void omap_eac_in_cb(void *opaque, int avail_b) |
158 | 99570a40 | balrog | { |
159 | 99570a40 | balrog | struct omap_eac_s *s = (struct omap_eac_s *) opaque; |
160 | 99570a40 | balrog | |
161 | 99570a40 | balrog | s->codec.rxavail = avail_b >> 2;
|
162 | ab17b46d | balrog | omap_eac_in_refill(s); |
163 | 99570a40 | balrog | /* TODO: possibly discard current buffer if overrun */
|
164 | ab17b46d | balrog | omap_eac_in_dmarequest_update(s); |
165 | 99570a40 | balrog | } |
166 | 99570a40 | balrog | |
167 | 99570a40 | balrog | static void omap_eac_out_cb(void *opaque, int free_b) |
168 | 99570a40 | balrog | { |
169 | 99570a40 | balrog | struct omap_eac_s *s = (struct omap_eac_s *) opaque; |
170 | 99570a40 | balrog | |
171 | 99570a40 | balrog | s->codec.txavail = free_b >> 2;
|
172 | ab17b46d | balrog | if (s->codec.txlen)
|
173 | ab17b46d | balrog | omap_eac_out_empty(s); |
174 | ab17b46d | balrog | else
|
175 | ab17b46d | balrog | omap_eac_out_dmarequest_update(s); |
176 | 99570a40 | balrog | } |
177 | 99570a40 | balrog | |
178 | 99570a40 | balrog | static void omap_eac_enable_update(struct omap_eac_s *s) |
179 | 99570a40 | balrog | { |
180 | 99570a40 | balrog | s->codec.enable = !(s->codec.config[1] & 1) && /* EACPWD */ |
181 | 99570a40 | balrog | (s->codec.config[1] & 2) && /* AUDEN */ |
182 | 99570a40 | balrog | s->codec.hw_enable; |
183 | 99570a40 | balrog | } |
184 | 99570a40 | balrog | |
185 | 99570a40 | balrog | static const int omap_eac_fsint[4] = { |
186 | 99570a40 | balrog | 8000,
|
187 | 99570a40 | balrog | 11025,
|
188 | 99570a40 | balrog | 22050,
|
189 | 99570a40 | balrog | 44100,
|
190 | 99570a40 | balrog | }; |
191 | 99570a40 | balrog | |
192 | 99570a40 | balrog | static const int omap_eac_fsint2[8] = { |
193 | 99570a40 | balrog | 8000,
|
194 | 99570a40 | balrog | 11025,
|
195 | 99570a40 | balrog | 22050,
|
196 | 99570a40 | balrog | 44100,
|
197 | 99570a40 | balrog | 48000,
|
198 | 99570a40 | balrog | 0, 0, 0, |
199 | 99570a40 | balrog | }; |
200 | 99570a40 | balrog | |
201 | 99570a40 | balrog | static const int omap_eac_fsint3[16] = { |
202 | 99570a40 | balrog | 8000,
|
203 | 99570a40 | balrog | 11025,
|
204 | 99570a40 | balrog | 16000,
|
205 | 99570a40 | balrog | 22050,
|
206 | 99570a40 | balrog | 24000,
|
207 | 99570a40 | balrog | 32000,
|
208 | 99570a40 | balrog | 44100,
|
209 | 99570a40 | balrog | 48000,
|
210 | 99570a40 | balrog | 0, 0, 0, 0, 0, 0, 0, 0, |
211 | 99570a40 | balrog | }; |
212 | 99570a40 | balrog | |
213 | 99570a40 | balrog | static void omap_eac_rate_update(struct omap_eac_s *s) |
214 | 99570a40 | balrog | { |
215 | 99570a40 | balrog | int fsint[3]; |
216 | 99570a40 | balrog | |
217 | 99570a40 | balrog | fsint[2] = (s->codec.config[3] >> 9) & 0xf; |
218 | 99570a40 | balrog | fsint[1] = (s->codec.config[2] >> 0) & 0x7; |
219 | 99570a40 | balrog | fsint[0] = (s->codec.config[0] >> 6) & 0x3; |
220 | 99570a40 | balrog | if (fsint[2] < 0xf) |
221 | 99570a40 | balrog | s->codec.rate = omap_eac_fsint3[fsint[2]];
|
222 | 99570a40 | balrog | else if (fsint[1] < 0x7) |
223 | 99570a40 | balrog | s->codec.rate = omap_eac_fsint2[fsint[1]];
|
224 | 99570a40 | balrog | else
|
225 | 99570a40 | balrog | s->codec.rate = omap_eac_fsint[fsint[0]];
|
226 | 99570a40 | balrog | } |
227 | 99570a40 | balrog | |
228 | 99570a40 | balrog | static void omap_eac_volume_update(struct omap_eac_s *s) |
229 | 99570a40 | balrog | { |
230 | 99570a40 | balrog | /* TODO */
|
231 | 99570a40 | balrog | } |
232 | 99570a40 | balrog | |
233 | 99570a40 | balrog | static void omap_eac_format_update(struct omap_eac_s *s) |
234 | 99570a40 | balrog | { |
235 | 1ea879e5 | malc | struct audsettings fmt;
|
236 | 99570a40 | balrog | |
237 | ab17b46d | balrog | /* The hardware buffers at most one sample */
|
238 | ab17b46d | balrog | if (s->codec.rxlen)
|
239 | ab17b46d | balrog | s->codec.rxlen = 1;
|
240 | 99570a40 | balrog | |
241 | 99570a40 | balrog | if (s->codec.in_voice) {
|
242 | 99570a40 | balrog | AUD_set_active_in(s->codec.in_voice, 0);
|
243 | 99570a40 | balrog | AUD_close_in(&s->codec.card, s->codec.in_voice); |
244 | b9d38e95 | Blue Swirl | s->codec.in_voice = NULL;
|
245 | 99570a40 | balrog | } |
246 | 99570a40 | balrog | if (s->codec.out_voice) {
|
247 | ab17b46d | balrog | omap_eac_out_empty(s); |
248 | 99570a40 | balrog | AUD_set_active_out(s->codec.out_voice, 0);
|
249 | 99570a40 | balrog | AUD_close_out(&s->codec.card, s->codec.out_voice); |
250 | b9d38e95 | Blue Swirl | s->codec.out_voice = NULL;
|
251 | ab17b46d | balrog | s->codec.txavail = 0;
|
252 | 99570a40 | balrog | } |
253 | ab17b46d | balrog | /* Discard what couldn't be written */
|
254 | ab17b46d | balrog | s->codec.txlen = 0;
|
255 | 99570a40 | balrog | |
256 | 99570a40 | balrog | omap_eac_enable_update(s); |
257 | 99570a40 | balrog | if (!s->codec.enable)
|
258 | 99570a40 | balrog | return;
|
259 | 99570a40 | balrog | |
260 | 99570a40 | balrog | omap_eac_rate_update(s); |
261 | 99570a40 | balrog | fmt.endianness = ((s->codec.config[0] >> 8) & 1); /* LI_BI */ |
262 | 99570a40 | balrog | fmt.nchannels = ((s->codec.config[0] >> 10) & 1) ? 2 : 1; /* MN_ST */ |
263 | 99570a40 | balrog | fmt.freq = s->codec.rate; |
264 | 99570a40 | balrog | /* TODO: signedness possibly depends on the CODEC hardware - or
|
265 | 99570a40 | balrog | * does I2S specify it? */
|
266 | 99570a40 | balrog | /* All register writes are 16 bits so we we store 16-bit samples
|
267 | 99570a40 | balrog | * in the buffers regardless of AGCFR[B8_16] value. */
|
268 | 99570a40 | balrog | fmt.fmt = AUD_FMT_U16; |
269 | 99570a40 | balrog | |
270 | 99570a40 | balrog | s->codec.in_voice = AUD_open_in(&s->codec.card, s->codec.in_voice, |
271 | 99570a40 | balrog | "eac.codec.in", s, omap_eac_in_cb, &fmt);
|
272 | 99570a40 | balrog | s->codec.out_voice = AUD_open_out(&s->codec.card, s->codec.out_voice, |
273 | 99570a40 | balrog | "eac.codec.out", s, omap_eac_out_cb, &fmt);
|
274 | 99570a40 | balrog | |
275 | 99570a40 | balrog | omap_eac_volume_update(s); |
276 | 99570a40 | balrog | |
277 | 99570a40 | balrog | AUD_set_active_in(s->codec.in_voice, 1);
|
278 | 99570a40 | balrog | AUD_set_active_out(s->codec.out_voice, 1);
|
279 | 99570a40 | balrog | } |
280 | 99570a40 | balrog | |
281 | 99570a40 | balrog | static void omap_eac_reset(struct omap_eac_s *s) |
282 | 99570a40 | balrog | { |
283 | 99570a40 | balrog | s->sysconfig = 0;
|
284 | 99570a40 | balrog | s->config[0] = 0x0c; |
285 | 99570a40 | balrog | s->config[1] = 0x09; |
286 | 99570a40 | balrog | s->config[2] = 0xab; |
287 | 99570a40 | balrog | s->config[3] = 0x03; |
288 | 99570a40 | balrog | s->control = 0x00;
|
289 | 99570a40 | balrog | s->address = 0x00;
|
290 | 99570a40 | balrog | s->data = 0x0000;
|
291 | 99570a40 | balrog | s->vtol = 0x00;
|
292 | 99570a40 | balrog | s->vtsl = 0x00;
|
293 | 99570a40 | balrog | s->mixer = 0x0000;
|
294 | 99570a40 | balrog | s->gain[0] = 0xe7e7; |
295 | 99570a40 | balrog | s->gain[1] = 0x6767; |
296 | 99570a40 | balrog | s->gain[2] = 0x6767; |
297 | 99570a40 | balrog | s->gain[3] = 0x6767; |
298 | 99570a40 | balrog | s->att = 0xce;
|
299 | 99570a40 | balrog | s->max[0] = 0; |
300 | 99570a40 | balrog | s->max[1] = 0; |
301 | 99570a40 | balrog | s->max[2] = 0; |
302 | 99570a40 | balrog | s->max[3] = 0; |
303 | 99570a40 | balrog | s->max[4] = 0; |
304 | 99570a40 | balrog | s->max[5] = 0; |
305 | 99570a40 | balrog | s->max[6] = 0; |
306 | 99570a40 | balrog | |
307 | 99570a40 | balrog | s->modem.control = 0x00;
|
308 | 99570a40 | balrog | s->modem.config = 0x0000;
|
309 | 99570a40 | balrog | s->bt.control = 0x00;
|
310 | 99570a40 | balrog | s->bt.config = 0x0000;
|
311 | 99570a40 | balrog | s->codec.config[0] = 0x0649; |
312 | 99570a40 | balrog | s->codec.config[1] = 0x0000; |
313 | 99570a40 | balrog | s->codec.config[2] = 0x0007; |
314 | 99570a40 | balrog | s->codec.config[3] = 0x1ffc; |
315 | ab17b46d | balrog | s->codec.rxoff = 0;
|
316 | 99570a40 | balrog | s->codec.rxlen = 0;
|
317 | 99570a40 | balrog | s->codec.txlen = 0;
|
318 | 99570a40 | balrog | s->codec.rxavail = 0;
|
319 | 99570a40 | balrog | s->codec.txavail = 0;
|
320 | 99570a40 | balrog | |
321 | 99570a40 | balrog | omap_eac_format_update(s); |
322 | 99570a40 | balrog | omap_eac_interrupt_update(s); |
323 | 99570a40 | balrog | } |
324 | 99570a40 | balrog | |
325 | c227f099 | Anthony Liguori | static uint32_t omap_eac_read(void *opaque, target_phys_addr_t addr) |
326 | 99570a40 | balrog | { |
327 | 99570a40 | balrog | struct omap_eac_s *s = (struct omap_eac_s *) opaque; |
328 | ab17b46d | balrog | uint32_t ret; |
329 | 99570a40 | balrog | |
330 | 8da3ff18 | pbrook | switch (addr) {
|
331 | 99570a40 | balrog | case 0x000: /* CPCFR1 */ |
332 | 99570a40 | balrog | return s->config[0]; |
333 | 99570a40 | balrog | case 0x004: /* CPCFR2 */ |
334 | 99570a40 | balrog | return s->config[1]; |
335 | 99570a40 | balrog | case 0x008: /* CPCFR3 */ |
336 | 99570a40 | balrog | return s->config[2]; |
337 | 99570a40 | balrog | case 0x00c: /* CPCFR4 */ |
338 | 99570a40 | balrog | return s->config[3]; |
339 | 99570a40 | balrog | |
340 | 99570a40 | balrog | case 0x010: /* CPTCTL */ |
341 | 99570a40 | balrog | return s->control | ((s->codec.rxavail + s->codec.rxlen > 0) << 7) | |
342 | 99570a40 | balrog | ((s->codec.txlen < s->codec.txavail) << 5);
|
343 | 99570a40 | balrog | |
344 | 99570a40 | balrog | case 0x014: /* CPTTADR */ |
345 | 99570a40 | balrog | return s->address;
|
346 | 99570a40 | balrog | case 0x018: /* CPTDATL */ |
347 | 99570a40 | balrog | return s->data & 0xff; |
348 | 99570a40 | balrog | case 0x01c: /* CPTDATH */ |
349 | 99570a40 | balrog | return s->data >> 8; |
350 | 99570a40 | balrog | case 0x020: /* CPTVSLL */ |
351 | 99570a40 | balrog | return s->vtol;
|
352 | 99570a40 | balrog | case 0x024: /* CPTVSLH */ |
353 | 99570a40 | balrog | return s->vtsl | (3 << 5); /* CRDY1 | CRDY2 */ |
354 | 99570a40 | balrog | case 0x040: /* MPCTR */ |
355 | 99570a40 | balrog | return s->modem.control;
|
356 | 99570a40 | balrog | case 0x044: /* MPMCCFR */ |
357 | 99570a40 | balrog | return s->modem.config;
|
358 | 99570a40 | balrog | case 0x060: /* BPCTR */ |
359 | 99570a40 | balrog | return s->bt.control;
|
360 | 99570a40 | balrog | case 0x064: /* BPMCCFR */ |
361 | 99570a40 | balrog | return s->bt.config;
|
362 | 99570a40 | balrog | case 0x080: /* AMSCFR */ |
363 | 99570a40 | balrog | return s->mixer;
|
364 | 99570a40 | balrog | case 0x084: /* AMVCTR */ |
365 | 99570a40 | balrog | return s->gain[0]; |
366 | 99570a40 | balrog | case 0x088: /* AM1VCTR */ |
367 | 99570a40 | balrog | return s->gain[1]; |
368 | 99570a40 | balrog | case 0x08c: /* AM2VCTR */ |
369 | 99570a40 | balrog | return s->gain[2]; |
370 | 99570a40 | balrog | case 0x090: /* AM3VCTR */ |
371 | 99570a40 | balrog | return s->gain[3]; |
372 | 99570a40 | balrog | case 0x094: /* ASTCTR */ |
373 | 99570a40 | balrog | return s->att;
|
374 | 99570a40 | balrog | case 0x098: /* APD1LCR */ |
375 | 99570a40 | balrog | return s->max[0]; |
376 | 99570a40 | balrog | case 0x09c: /* APD1RCR */ |
377 | 99570a40 | balrog | return s->max[1]; |
378 | 99570a40 | balrog | case 0x0a0: /* APD2LCR */ |
379 | 99570a40 | balrog | return s->max[2]; |
380 | 99570a40 | balrog | case 0x0a4: /* APD2RCR */ |
381 | 99570a40 | balrog | return s->max[3]; |
382 | 99570a40 | balrog | case 0x0a8: /* APD3LCR */ |
383 | 99570a40 | balrog | return s->max[4]; |
384 | 99570a40 | balrog | case 0x0ac: /* APD3RCR */ |
385 | 99570a40 | balrog | return s->max[5]; |
386 | 99570a40 | balrog | case 0x0b0: /* APD4R */ |
387 | 99570a40 | balrog | return s->max[6]; |
388 | 99570a40 | balrog | case 0x0b4: /* ADWR */ |
389 | 99570a40 | balrog | /* This should be write-only? Docs list it as read-only. */
|
390 | 99570a40 | balrog | return 0x0000; |
391 | 99570a40 | balrog | case 0x0b8: /* ADRDR */ |
392 | ab17b46d | balrog | if (likely(s->codec.rxlen > 1)) { |
393 | ab17b46d | balrog | ret = s->codec.rxbuf[s->codec.rxoff ++]; |
394 | ab17b46d | balrog | s->codec.rxlen --; |
395 | ab17b46d | balrog | s->codec.rxoff &= EAC_BUF_LEN - 1;
|
396 | ab17b46d | balrog | return ret;
|
397 | ab17b46d | balrog | } else if (s->codec.rxlen) { |
398 | ab17b46d | balrog | ret = s->codec.rxbuf[s->codec.rxoff ++]; |
399 | ab17b46d | balrog | s->codec.rxlen --; |
400 | ab17b46d | balrog | s->codec.rxoff &= EAC_BUF_LEN - 1;
|
401 | 99570a40 | balrog | if (s->codec.rxavail)
|
402 | 99570a40 | balrog | omap_eac_in_refill(s); |
403 | ab17b46d | balrog | omap_eac_in_dmarequest_update(s); |
404 | ab17b46d | balrog | return ret;
|
405 | 99570a40 | balrog | } |
406 | 99570a40 | balrog | return 0x0000; |
407 | 99570a40 | balrog | case 0x0bc: /* AGCFR */ |
408 | 99570a40 | balrog | return s->codec.config[0]; |
409 | 99570a40 | balrog | case 0x0c0: /* AGCTR */ |
410 | 99570a40 | balrog | return s->codec.config[1] | ((s->codec.config[1] & 2) << 14); |
411 | 99570a40 | balrog | case 0x0c4: /* AGCFR2 */ |
412 | 99570a40 | balrog | return s->codec.config[2]; |
413 | 99570a40 | balrog | case 0x0c8: /* AGCFR3 */ |
414 | 99570a40 | balrog | return s->codec.config[3]; |
415 | 99570a40 | balrog | case 0x0cc: /* MBPDMACTR */ |
416 | 99570a40 | balrog | case 0x0d0: /* MPDDMARR */ |
417 | 99570a40 | balrog | case 0x0d8: /* MPUDMARR */ |
418 | 99570a40 | balrog | case 0x0e4: /* BPDDMARR */ |
419 | 99570a40 | balrog | case 0x0ec: /* BPUDMARR */ |
420 | 99570a40 | balrog | return 0x0000; |
421 | 99570a40 | balrog | |
422 | 99570a40 | balrog | case 0x100: /* VERSION_NUMBER */ |
423 | 99570a40 | balrog | return 0x0010; |
424 | 99570a40 | balrog | |
425 | 99570a40 | balrog | case 0x104: /* SYSCONFIG */ |
426 | 99570a40 | balrog | return s->sysconfig;
|
427 | 99570a40 | balrog | |
428 | 99570a40 | balrog | case 0x108: /* SYSSTATUS */ |
429 | 99570a40 | balrog | return 1 | 0xe; /* RESETDONE | stuff */ |
430 | 99570a40 | balrog | } |
431 | 99570a40 | balrog | |
432 | 99570a40 | balrog | OMAP_BAD_REG(addr); |
433 | 99570a40 | balrog | return 0; |
434 | 99570a40 | balrog | } |
435 | 99570a40 | balrog | |
436 | c227f099 | Anthony Liguori | static void omap_eac_write(void *opaque, target_phys_addr_t addr, |
437 | 99570a40 | balrog | uint32_t value) |
438 | 99570a40 | balrog | { |
439 | 99570a40 | balrog | struct omap_eac_s *s = (struct omap_eac_s *) opaque; |
440 | 99570a40 | balrog | |
441 | 8da3ff18 | pbrook | switch (addr) {
|
442 | 99570a40 | balrog | case 0x098: /* APD1LCR */ |
443 | 99570a40 | balrog | case 0x09c: /* APD1RCR */ |
444 | 99570a40 | balrog | case 0x0a0: /* APD2LCR */ |
445 | 99570a40 | balrog | case 0x0a4: /* APD2RCR */ |
446 | 99570a40 | balrog | case 0x0a8: /* APD3LCR */ |
447 | 99570a40 | balrog | case 0x0ac: /* APD3RCR */ |
448 | 99570a40 | balrog | case 0x0b0: /* APD4R */ |
449 | 99570a40 | balrog | case 0x0b8: /* ADRDR */ |
450 | 99570a40 | balrog | case 0x0d0: /* MPDDMARR */ |
451 | 99570a40 | balrog | case 0x0d8: /* MPUDMARR */ |
452 | 99570a40 | balrog | case 0x0e4: /* BPDDMARR */ |
453 | 99570a40 | balrog | case 0x0ec: /* BPUDMARR */ |
454 | 99570a40 | balrog | case 0x100: /* VERSION_NUMBER */ |
455 | 99570a40 | balrog | case 0x108: /* SYSSTATUS */ |
456 | 99570a40 | balrog | OMAP_RO_REG(addr); |
457 | 99570a40 | balrog | return;
|
458 | 99570a40 | balrog | |
459 | 99570a40 | balrog | case 0x000: /* CPCFR1 */ |
460 | 99570a40 | balrog | s->config[0] = value & 0xff; |
461 | 99570a40 | balrog | omap_eac_format_update(s); |
462 | 99570a40 | balrog | break;
|
463 | 99570a40 | balrog | case 0x004: /* CPCFR2 */ |
464 | 99570a40 | balrog | s->config[1] = value & 0xff; |
465 | 99570a40 | balrog | omap_eac_format_update(s); |
466 | 99570a40 | balrog | break;
|
467 | 99570a40 | balrog | case 0x008: /* CPCFR3 */ |
468 | 99570a40 | balrog | s->config[2] = value & 0xff; |
469 | 99570a40 | balrog | omap_eac_format_update(s); |
470 | 99570a40 | balrog | break;
|
471 | 99570a40 | balrog | case 0x00c: /* CPCFR4 */ |
472 | 99570a40 | balrog | s->config[3] = value & 0xff; |
473 | 99570a40 | balrog | omap_eac_format_update(s); |
474 | 99570a40 | balrog | break;
|
475 | 99570a40 | balrog | |
476 | 99570a40 | balrog | case 0x010: /* CPTCTL */ |
477 | 99570a40 | balrog | /* Assuming TXF and TXE bits are read-only... */
|
478 | 99570a40 | balrog | s->control = value & 0x5f;
|
479 | 99570a40 | balrog | omap_eac_interrupt_update(s); |
480 | 99570a40 | balrog | break;
|
481 | 99570a40 | balrog | |
482 | 99570a40 | balrog | case 0x014: /* CPTTADR */ |
483 | 99570a40 | balrog | s->address = value & 0xff;
|
484 | 99570a40 | balrog | break;
|
485 | 99570a40 | balrog | case 0x018: /* CPTDATL */ |
486 | 99570a40 | balrog | s->data &= 0xff00;
|
487 | 99570a40 | balrog | s->data |= value & 0xff;
|
488 | 99570a40 | balrog | break;
|
489 | 99570a40 | balrog | case 0x01c: /* CPTDATH */ |
490 | 99570a40 | balrog | s->data &= 0x00ff;
|
491 | 99570a40 | balrog | s->data |= value << 8;
|
492 | 99570a40 | balrog | break;
|
493 | 99570a40 | balrog | case 0x020: /* CPTVSLL */ |
494 | 99570a40 | balrog | s->vtol = value & 0xf8;
|
495 | 99570a40 | balrog | break;
|
496 | 99570a40 | balrog | case 0x024: /* CPTVSLH */ |
497 | 99570a40 | balrog | s->vtsl = value & 0x9f;
|
498 | 99570a40 | balrog | break;
|
499 | 99570a40 | balrog | case 0x040: /* MPCTR */ |
500 | 99570a40 | balrog | s->modem.control = value & 0x8f;
|
501 | 99570a40 | balrog | break;
|
502 | 99570a40 | balrog | case 0x044: /* MPMCCFR */ |
503 | 99570a40 | balrog | s->modem.config = value & 0x7fff;
|
504 | 99570a40 | balrog | break;
|
505 | 99570a40 | balrog | case 0x060: /* BPCTR */ |
506 | 99570a40 | balrog | s->bt.control = value & 0x8f;
|
507 | 99570a40 | balrog | break;
|
508 | 99570a40 | balrog | case 0x064: /* BPMCCFR */ |
509 | 99570a40 | balrog | s->bt.config = value & 0x7fff;
|
510 | 99570a40 | balrog | break;
|
511 | 99570a40 | balrog | case 0x080: /* AMSCFR */ |
512 | 99570a40 | balrog | s->mixer = value & 0x0fff;
|
513 | 99570a40 | balrog | break;
|
514 | 99570a40 | balrog | case 0x084: /* AMVCTR */ |
515 | 99570a40 | balrog | s->gain[0] = value & 0xffff; |
516 | 99570a40 | balrog | break;
|
517 | 99570a40 | balrog | case 0x088: /* AM1VCTR */ |
518 | 99570a40 | balrog | s->gain[1] = value & 0xff7f; |
519 | 99570a40 | balrog | break;
|
520 | 99570a40 | balrog | case 0x08c: /* AM2VCTR */ |
521 | 99570a40 | balrog | s->gain[2] = value & 0xff7f; |
522 | 99570a40 | balrog | break;
|
523 | 99570a40 | balrog | case 0x090: /* AM3VCTR */ |
524 | 99570a40 | balrog | s->gain[3] = value & 0xff7f; |
525 | 99570a40 | balrog | break;
|
526 | 99570a40 | balrog | case 0x094: /* ASTCTR */ |
527 | 99570a40 | balrog | s->att = value & 0xff;
|
528 | 99570a40 | balrog | break;
|
529 | 99570a40 | balrog | |
530 | 99570a40 | balrog | case 0x0b4: /* ADWR */ |
531 | 99570a40 | balrog | s->codec.txbuf[s->codec.txlen ++] = value; |
532 | 99570a40 | balrog | if (unlikely(s->codec.txlen == EAC_BUF_LEN ||
|
533 | 99570a40 | balrog | s->codec.txlen == s->codec.txavail)) { |
534 | 99570a40 | balrog | if (s->codec.txavail)
|
535 | 99570a40 | balrog | omap_eac_out_empty(s); |
536 | ab17b46d | balrog | /* Discard what couldn't be written */
|
537 | ab17b46d | balrog | s->codec.txlen = 0;
|
538 | 99570a40 | balrog | } |
539 | 99570a40 | balrog | break;
|
540 | 99570a40 | balrog | |
541 | 99570a40 | balrog | case 0x0bc: /* AGCFR */ |
542 | 99570a40 | balrog | s->codec.config[0] = value & 0x07ff; |
543 | 99570a40 | balrog | omap_eac_format_update(s); |
544 | 99570a40 | balrog | break;
|
545 | 99570a40 | balrog | case 0x0c0: /* AGCTR */ |
546 | 99570a40 | balrog | s->codec.config[1] = value & 0x780f; |
547 | 99570a40 | balrog | omap_eac_format_update(s); |
548 | 99570a40 | balrog | break;
|
549 | 99570a40 | balrog | case 0x0c4: /* AGCFR2 */ |
550 | 99570a40 | balrog | s->codec.config[2] = value & 0x003f; |
551 | 99570a40 | balrog | omap_eac_format_update(s); |
552 | 99570a40 | balrog | break;
|
553 | 99570a40 | balrog | case 0x0c8: /* AGCFR3 */ |
554 | 99570a40 | balrog | s->codec.config[3] = value & 0xffff; |
555 | 99570a40 | balrog | omap_eac_format_update(s); |
556 | 99570a40 | balrog | break;
|
557 | 99570a40 | balrog | case 0x0cc: /* MBPDMACTR */ |
558 | 99570a40 | balrog | case 0x0d4: /* MPDDMAWR */ |
559 | 99570a40 | balrog | case 0x0e0: /* MPUDMAWR */ |
560 | 99570a40 | balrog | case 0x0e8: /* BPDDMAWR */ |
561 | 99570a40 | balrog | case 0x0f0: /* BPUDMAWR */ |
562 | 99570a40 | balrog | break;
|
563 | 99570a40 | balrog | |
564 | 99570a40 | balrog | case 0x104: /* SYSCONFIG */ |
565 | 99570a40 | balrog | if (value & (1 << 1)) /* SOFTRESET */ |
566 | 99570a40 | balrog | omap_eac_reset(s); |
567 | 99570a40 | balrog | s->sysconfig = value & 0x31d;
|
568 | 99570a40 | balrog | break;
|
569 | 99570a40 | balrog | |
570 | 99570a40 | balrog | default:
|
571 | 99570a40 | balrog | OMAP_BAD_REG(addr); |
572 | 99570a40 | balrog | return;
|
573 | 99570a40 | balrog | } |
574 | 99570a40 | balrog | } |
575 | 99570a40 | balrog | |
576 | d60efc6b | Blue Swirl | static CPUReadMemoryFunc * const omap_eac_readfn[] = { |
577 | 99570a40 | balrog | omap_badwidth_read16, |
578 | 99570a40 | balrog | omap_eac_read, |
579 | 99570a40 | balrog | omap_badwidth_read16, |
580 | 99570a40 | balrog | }; |
581 | 99570a40 | balrog | |
582 | d60efc6b | Blue Swirl | static CPUWriteMemoryFunc * const omap_eac_writefn[] = { |
583 | 99570a40 | balrog | omap_badwidth_write16, |
584 | 99570a40 | balrog | omap_eac_write, |
585 | 99570a40 | balrog | omap_badwidth_write16, |
586 | 99570a40 | balrog | }; |
587 | 99570a40 | balrog | |
588 | c1ff227b | cmchao | static struct omap_eac_s *omap_eac_init(struct omap_target_agent_s *ta, |
589 | 99570a40 | balrog | qemu_irq irq, qemu_irq *drq, omap_clk fclk, omap_clk iclk) |
590 | 99570a40 | balrog | { |
591 | 99570a40 | balrog | int iomemtype;
|
592 | 99570a40 | balrog | struct omap_eac_s *s = (struct omap_eac_s *) |
593 | 99570a40 | balrog | qemu_mallocz(sizeof(struct omap_eac_s)); |
594 | 99570a40 | balrog | |
595 | 99570a40 | balrog | s->irq = irq; |
596 | 99570a40 | balrog | s->codec.rxdrq = *drq ++; |
597 | 22ed1d34 | Blue Swirl | s->codec.txdrq = *drq; |
598 | 99570a40 | balrog | omap_eac_reset(s); |
599 | 99570a40 | balrog | |
600 | 1a7dafce | malc | AUD_register_card("OMAP EAC", &s->codec.card);
|
601 | 99570a40 | balrog | |
602 | 1eed09cb | Avi Kivity | iomemtype = cpu_register_io_memory(omap_eac_readfn, |
603 | 2507c12a | Alexander Graf | omap_eac_writefn, s, DEVICE_NATIVE_ENDIAN); |
604 | 8da3ff18 | pbrook | omap_l4_attach(ta, 0, iomemtype);
|
605 | 99570a40 | balrog | |
606 | 99570a40 | balrog | return s;
|
607 | 99570a40 | balrog | } |
608 | 99570a40 | balrog | |
609 | 54585ffe | balrog | /* STI/XTI (emulation interface) console - reverse engineered only */
|
610 | 54585ffe | balrog | struct omap_sti_s {
|
611 | 54585ffe | balrog | qemu_irq irq; |
612 | 54585ffe | balrog | CharDriverState *chr; |
613 | 54585ffe | balrog | |
614 | 54585ffe | balrog | uint32_t sysconfig; |
615 | 54585ffe | balrog | uint32_t systest; |
616 | 54585ffe | balrog | uint32_t irqst; |
617 | 54585ffe | balrog | uint32_t irqen; |
618 | 54585ffe | balrog | uint32_t clkcontrol; |
619 | 54585ffe | balrog | uint32_t serial_config; |
620 | 54585ffe | balrog | }; |
621 | 54585ffe | balrog | |
622 | 54585ffe | balrog | #define STI_TRACE_CONSOLE_CHANNEL 239 |
623 | 54585ffe | balrog | #define STI_TRACE_CONTROL_CHANNEL 253 |
624 | 54585ffe | balrog | |
625 | 54585ffe | balrog | static inline void omap_sti_interrupt_update(struct omap_sti_s *s) |
626 | 54585ffe | balrog | { |
627 | 54585ffe | balrog | qemu_set_irq(s->irq, s->irqst & s->irqen); |
628 | 54585ffe | balrog | } |
629 | 54585ffe | balrog | |
630 | 54585ffe | balrog | static void omap_sti_reset(struct omap_sti_s *s) |
631 | 54585ffe | balrog | { |
632 | 54585ffe | balrog | s->sysconfig = 0;
|
633 | 54585ffe | balrog | s->irqst = 0;
|
634 | 54585ffe | balrog | s->irqen = 0;
|
635 | 54585ffe | balrog | s->clkcontrol = 0;
|
636 | 54585ffe | balrog | s->serial_config = 0;
|
637 | 54585ffe | balrog | |
638 | 54585ffe | balrog | omap_sti_interrupt_update(s); |
639 | 54585ffe | balrog | } |
640 | 54585ffe | balrog | |
641 | c227f099 | Anthony Liguori | static uint32_t omap_sti_read(void *opaque, target_phys_addr_t addr) |
642 | 54585ffe | balrog | { |
643 | 54585ffe | balrog | struct omap_sti_s *s = (struct omap_sti_s *) opaque; |
644 | 54585ffe | balrog | |
645 | 8da3ff18 | pbrook | switch (addr) {
|
646 | 54585ffe | balrog | case 0x00: /* STI_REVISION */ |
647 | 54585ffe | balrog | return 0x10; |
648 | 54585ffe | balrog | |
649 | 54585ffe | balrog | case 0x10: /* STI_SYSCONFIG */ |
650 | 54585ffe | balrog | return s->sysconfig;
|
651 | 54585ffe | balrog | |
652 | 54585ffe | balrog | case 0x14: /* STI_SYSSTATUS / STI_RX_STATUS / XTI_SYSSTATUS */ |
653 | 54585ffe | balrog | return 0x00; |
654 | 54585ffe | balrog | |
655 | 54585ffe | balrog | case 0x18: /* STI_IRQSTATUS */ |
656 | 54585ffe | balrog | return s->irqst;
|
657 | 54585ffe | balrog | |
658 | 54585ffe | balrog | case 0x1c: /* STI_IRQSETEN / STI_IRQCLREN */ |
659 | 54585ffe | balrog | return s->irqen;
|
660 | 54585ffe | balrog | |
661 | 54585ffe | balrog | case 0x24: /* STI_ER / STI_DR / XTI_TRACESELECT */ |
662 | 54585ffe | balrog | case 0x28: /* STI_RX_DR / XTI_RXDATA */ |
663 | e927bb00 | balrog | /* TODO */
|
664 | e927bb00 | balrog | return 0; |
665 | 54585ffe | balrog | |
666 | 54585ffe | balrog | case 0x2c: /* STI_CLK_CTRL / XTI_SCLKCRTL */ |
667 | 54585ffe | balrog | return s->clkcontrol;
|
668 | 54585ffe | balrog | |
669 | 54585ffe | balrog | case 0x30: /* STI_SERIAL_CFG / XTI_SCONFIG */ |
670 | 54585ffe | balrog | return s->serial_config;
|
671 | 54585ffe | balrog | } |
672 | 54585ffe | balrog | |
673 | 54585ffe | balrog | OMAP_BAD_REG(addr); |
674 | 54585ffe | balrog | return 0; |
675 | 54585ffe | balrog | } |
676 | 54585ffe | balrog | |
677 | c227f099 | Anthony Liguori | static void omap_sti_write(void *opaque, target_phys_addr_t addr, |
678 | 54585ffe | balrog | uint32_t value) |
679 | 54585ffe | balrog | { |
680 | 54585ffe | balrog | struct omap_sti_s *s = (struct omap_sti_s *) opaque; |
681 | 54585ffe | balrog | |
682 | 8da3ff18 | pbrook | switch (addr) {
|
683 | 54585ffe | balrog | case 0x00: /* STI_REVISION */ |
684 | 54585ffe | balrog | case 0x14: /* STI_SYSSTATUS / STI_RX_STATUS / XTI_SYSSTATUS */ |
685 | 54585ffe | balrog | OMAP_RO_REG(addr); |
686 | 54585ffe | balrog | return;
|
687 | 54585ffe | balrog | |
688 | 54585ffe | balrog | case 0x10: /* STI_SYSCONFIG */ |
689 | 54585ffe | balrog | if (value & (1 << 1)) /* SOFTRESET */ |
690 | 54585ffe | balrog | omap_sti_reset(s); |
691 | 54585ffe | balrog | s->sysconfig = value & 0xfe;
|
692 | 54585ffe | balrog | break;
|
693 | 54585ffe | balrog | |
694 | 54585ffe | balrog | case 0x18: /* STI_IRQSTATUS */ |
695 | 54585ffe | balrog | s->irqst &= ~value; |
696 | 54585ffe | balrog | omap_sti_interrupt_update(s); |
697 | 54585ffe | balrog | break;
|
698 | 54585ffe | balrog | |
699 | 54585ffe | balrog | case 0x1c: /* STI_IRQSETEN / STI_IRQCLREN */ |
700 | 54585ffe | balrog | s->irqen = value & 0xffff;
|
701 | 54585ffe | balrog | omap_sti_interrupt_update(s); |
702 | 54585ffe | balrog | break;
|
703 | 54585ffe | balrog | |
704 | 54585ffe | balrog | case 0x2c: /* STI_CLK_CTRL / XTI_SCLKCRTL */ |
705 | 54585ffe | balrog | s->clkcontrol = value & 0xff;
|
706 | 54585ffe | balrog | break;
|
707 | 54585ffe | balrog | |
708 | 54585ffe | balrog | case 0x30: /* STI_SERIAL_CFG / XTI_SCONFIG */ |
709 | 54585ffe | balrog | s->serial_config = value & 0xff;
|
710 | 54585ffe | balrog | break;
|
711 | 54585ffe | balrog | |
712 | 54585ffe | balrog | case 0x24: /* STI_ER / STI_DR / XTI_TRACESELECT */ |
713 | 54585ffe | balrog | case 0x28: /* STI_RX_DR / XTI_RXDATA */ |
714 | e927bb00 | balrog | /* TODO */
|
715 | e927bb00 | balrog | return;
|
716 | e927bb00 | balrog | |
717 | 54585ffe | balrog | default:
|
718 | 54585ffe | balrog | OMAP_BAD_REG(addr); |
719 | 54585ffe | balrog | return;
|
720 | 54585ffe | balrog | } |
721 | 54585ffe | balrog | } |
722 | 54585ffe | balrog | |
723 | d60efc6b | Blue Swirl | static CPUReadMemoryFunc * const omap_sti_readfn[] = { |
724 | 54585ffe | balrog | omap_badwidth_read32, |
725 | 54585ffe | balrog | omap_badwidth_read32, |
726 | 54585ffe | balrog | omap_sti_read, |
727 | 54585ffe | balrog | }; |
728 | 54585ffe | balrog | |
729 | d60efc6b | Blue Swirl | static CPUWriteMemoryFunc * const omap_sti_writefn[] = { |
730 | 54585ffe | balrog | omap_badwidth_write32, |
731 | 54585ffe | balrog | omap_badwidth_write32, |
732 | 54585ffe | balrog | omap_sti_write, |
733 | 54585ffe | balrog | }; |
734 | 54585ffe | balrog | |
735 | c227f099 | Anthony Liguori | static uint32_t omap_sti_fifo_read(void *opaque, target_phys_addr_t addr) |
736 | 54585ffe | balrog | { |
737 | 54585ffe | balrog | OMAP_BAD_REG(addr); |
738 | 54585ffe | balrog | return 0; |
739 | 54585ffe | balrog | } |
740 | 54585ffe | balrog | |
741 | c227f099 | Anthony Liguori | static void omap_sti_fifo_write(void *opaque, target_phys_addr_t addr, |
742 | 54585ffe | balrog | uint32_t value) |
743 | 54585ffe | balrog | { |
744 | 54585ffe | balrog | struct omap_sti_s *s = (struct omap_sti_s *) opaque; |
745 | 8da3ff18 | pbrook | int ch = addr >> 6; |
746 | 54585ffe | balrog | uint8_t byte = value; |
747 | 54585ffe | balrog | |
748 | 54585ffe | balrog | if (ch == STI_TRACE_CONTROL_CHANNEL) {
|
749 | 54585ffe | balrog | /* Flush channel <i>value</i>. */
|
750 | 75554a3c | balrog | qemu_chr_write(s->chr, (const uint8_t *) "\r", 1); |
751 | 54585ffe | balrog | } else if (ch == STI_TRACE_CONSOLE_CHANNEL || 1) { |
752 | 54585ffe | balrog | if (value == 0xc0 || value == 0xc3) { |
753 | 54585ffe | balrog | /* Open channel <i>ch</i>. */
|
754 | 54585ffe | balrog | } else if (value == 0x00) |
755 | 75554a3c | balrog | qemu_chr_write(s->chr, (const uint8_t *) "\n", 1); |
756 | 54585ffe | balrog | else
|
757 | 54585ffe | balrog | qemu_chr_write(s->chr, &byte, 1);
|
758 | 54585ffe | balrog | } |
759 | 54585ffe | balrog | } |
760 | 54585ffe | balrog | |
761 | d60efc6b | Blue Swirl | static CPUReadMemoryFunc * const omap_sti_fifo_readfn[] = { |
762 | 54585ffe | balrog | omap_sti_fifo_read, |
763 | 54585ffe | balrog | omap_badwidth_read8, |
764 | 54585ffe | balrog | omap_badwidth_read8, |
765 | 54585ffe | balrog | }; |
766 | 54585ffe | balrog | |
767 | d60efc6b | Blue Swirl | static CPUWriteMemoryFunc * const omap_sti_fifo_writefn[] = { |
768 | 54585ffe | balrog | omap_sti_fifo_write, |
769 | 54585ffe | balrog | omap_badwidth_write8, |
770 | 54585ffe | balrog | omap_badwidth_write8, |
771 | 54585ffe | balrog | }; |
772 | 54585ffe | balrog | |
773 | b1d8e52e | blueswir1 | static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta, |
774 | c227f099 | Anthony Liguori | target_phys_addr_t channel_base, qemu_irq irq, omap_clk clk, |
775 | 54585ffe | balrog | CharDriverState *chr) |
776 | 54585ffe | balrog | { |
777 | 54585ffe | balrog | int iomemtype;
|
778 | 54585ffe | balrog | struct omap_sti_s *s = (struct omap_sti_s *) |
779 | 54585ffe | balrog | qemu_mallocz(sizeof(struct omap_sti_s)); |
780 | 54585ffe | balrog | |
781 | 54585ffe | balrog | s->irq = irq; |
782 | 54585ffe | balrog | omap_sti_reset(s); |
783 | 54585ffe | balrog | |
784 | ceecf1d1 | aurel32 | s->chr = chr ?: qemu_chr_open("null", "null", NULL); |
785 | 54585ffe | balrog | |
786 | 1eed09cb | Avi Kivity | iomemtype = l4_register_io_memory(omap_sti_readfn, |
787 | 54585ffe | balrog | omap_sti_writefn, s); |
788 | 8da3ff18 | pbrook | omap_l4_attach(ta, 0, iomemtype);
|
789 | 54585ffe | balrog | |
790 | 1eed09cb | Avi Kivity | iomemtype = cpu_register_io_memory(omap_sti_fifo_readfn, |
791 | 2507c12a | Alexander Graf | omap_sti_fifo_writefn, s, DEVICE_NATIVE_ENDIAN); |
792 | 8da3ff18 | pbrook | cpu_register_physical_memory(channel_base, 0x10000, iomemtype);
|
793 | 54585ffe | balrog | |
794 | 54585ffe | balrog | return s;
|
795 | 54585ffe | balrog | } |
796 | 54585ffe | balrog | |
797 | 827df9f3 | balrog | /* L4 Interconnect */
|
798 | 827df9f3 | balrog | #define L4TA(n) (n)
|
799 | 827df9f3 | balrog | #define L4TAO(n) ((n) + 39) |
800 | 827df9f3 | balrog | |
801 | 2c1d9ecb | cmchao | static const struct omap_l4_region_s omap_l4_region[125] = { |
802 | 827df9f3 | balrog | [ 1] = { 0x40800, 0x800, 32 }, /* Initiator agent */ |
803 | 827df9f3 | balrog | [ 2] = { 0x41000, 0x1000, 32 }, /* Link agent */ |
804 | 827df9f3 | balrog | [ 0] = { 0x40000, 0x800, 32 }, /* Address and protection */ |
805 | 827df9f3 | balrog | [ 3] = { 0x00000, 0x1000, 32 | 16 | 8 }, /* System Control and Pinout */ |
806 | 827df9f3 | balrog | [ 4] = { 0x01000, 0x1000, 32 | 16 | 8 }, /* L4TAO1 */ |
807 | 827df9f3 | balrog | [ 5] = { 0x04000, 0x1000, 32 | 16 }, /* 32K Timer */ |
808 | 827df9f3 | balrog | [ 6] = { 0x05000, 0x1000, 32 | 16 | 8 }, /* L4TAO2 */ |
809 | 827df9f3 | balrog | [ 7] = { 0x08000, 0x800, 32 }, /* PRCM Region A */ |
810 | 827df9f3 | balrog | [ 8] = { 0x08800, 0x800, 32 }, /* PRCM Region B */ |
811 | 827df9f3 | balrog | [ 9] = { 0x09000, 0x1000, 32 | 16 | 8 }, /* L4TAO */ |
812 | 827df9f3 | balrog | [ 10] = { 0x12000, 0x1000, 32 | 16 | 8 }, /* Test (BCM) */ |
813 | 827df9f3 | balrog | [ 11] = { 0x13000, 0x1000, 32 | 16 | 8 }, /* L4TA1 */ |
814 | 827df9f3 | balrog | [ 12] = { 0x14000, 0x1000, 32 }, /* Test/emulation (TAP) */ |
815 | 827df9f3 | balrog | [ 13] = { 0x15000, 0x1000, 32 | 16 | 8 }, /* L4TA2 */ |
816 | 827df9f3 | balrog | [ 14] = { 0x18000, 0x1000, 32 | 16 | 8 }, /* GPIO1 */ |
817 | 827df9f3 | balrog | [ 16] = { 0x1a000, 0x1000, 32 | 16 | 8 }, /* GPIO2 */ |
818 | 827df9f3 | balrog | [ 18] = { 0x1c000, 0x1000, 32 | 16 | 8 }, /* GPIO3 */ |
819 | 827df9f3 | balrog | [ 19] = { 0x1e000, 0x1000, 32 | 16 | 8 }, /* GPIO4 */ |
820 | 827df9f3 | balrog | [ 15] = { 0x19000, 0x1000, 32 | 16 | 8 }, /* Quad GPIO TOP */ |
821 | 827df9f3 | balrog | [ 17] = { 0x1b000, 0x1000, 32 | 16 | 8 }, /* L4TA3 */ |
822 | 827df9f3 | balrog | [ 20] = { 0x20000, 0x1000, 32 | 16 | 8 }, /* WD Timer 1 (Secure) */ |
823 | 827df9f3 | balrog | [ 22] = { 0x22000, 0x1000, 32 | 16 | 8 }, /* WD Timer 2 (OMAP) */ |
824 | 827df9f3 | balrog | [ 21] = { 0x21000, 0x1000, 32 | 16 | 8 }, /* Dual WD timer TOP */ |
825 | 827df9f3 | balrog | [ 23] = { 0x23000, 0x1000, 32 | 16 | 8 }, /* L4TA4 */ |
826 | 827df9f3 | balrog | [ 24] = { 0x28000, 0x1000, 32 | 16 | 8 }, /* GP Timer 1 */ |
827 | 827df9f3 | balrog | [ 25] = { 0x29000, 0x1000, 32 | 16 | 8 }, /* L4TA7 */ |
828 | 827df9f3 | balrog | [ 26] = { 0x48000, 0x2000, 32 | 16 | 8 }, /* Emulation (ARM11ETB) */ |
829 | 827df9f3 | balrog | [ 27] = { 0x4a000, 0x1000, 32 | 16 | 8 }, /* L4TA9 */ |
830 | 827df9f3 | balrog | [ 28] = { 0x50000, 0x400, 32 | 16 | 8 }, /* Display top */ |
831 | 827df9f3 | balrog | [ 29] = { 0x50400, 0x400, 32 | 16 | 8 }, /* Display control */ |
832 | 827df9f3 | balrog | [ 30] = { 0x50800, 0x400, 32 | 16 | 8 }, /* Display RFBI */ |
833 | 827df9f3 | balrog | [ 31] = { 0x50c00, 0x400, 32 | 16 | 8 }, /* Display encoder */ |
834 | 827df9f3 | balrog | [ 32] = { 0x51000, 0x1000, 32 | 16 | 8 }, /* L4TA10 */ |
835 | 827df9f3 | balrog | [ 33] = { 0x52000, 0x400, 32 | 16 | 8 }, /* Camera top */ |
836 | 827df9f3 | balrog | [ 34] = { 0x52400, 0x400, 32 | 16 | 8 }, /* Camera core */ |
837 | 827df9f3 | balrog | [ 35] = { 0x52800, 0x400, 32 | 16 | 8 }, /* Camera DMA */ |
838 | 827df9f3 | balrog | [ 36] = { 0x52c00, 0x400, 32 | 16 | 8 }, /* Camera MMU */ |
839 | 827df9f3 | balrog | [ 37] = { 0x53000, 0x1000, 32 | 16 | 8 }, /* L4TA11 */ |
840 | 827df9f3 | balrog | [ 38] = { 0x56000, 0x1000, 32 | 16 | 8 }, /* sDMA */ |
841 | 827df9f3 | balrog | [ 39] = { 0x57000, 0x1000, 32 | 16 | 8 }, /* L4TA12 */ |
842 | 827df9f3 | balrog | [ 40] = { 0x58000, 0x1000, 32 | 16 | 8 }, /* SSI top */ |
843 | 827df9f3 | balrog | [ 41] = { 0x59000, 0x1000, 32 | 16 | 8 }, /* SSI GDD */ |
844 | 827df9f3 | balrog | [ 42] = { 0x5a000, 0x1000, 32 | 16 | 8 }, /* SSI Port1 */ |
845 | 827df9f3 | balrog | [ 43] = { 0x5b000, 0x1000, 32 | 16 | 8 }, /* SSI Port2 */ |
846 | 827df9f3 | balrog | [ 44] = { 0x5c000, 0x1000, 32 | 16 | 8 }, /* L4TA13 */ |
847 | 827df9f3 | balrog | [ 45] = { 0x5e000, 0x1000, 32 | 16 | 8 }, /* USB OTG */ |
848 | 827df9f3 | balrog | [ 46] = { 0x5f000, 0x1000, 32 | 16 | 8 }, /* L4TAO4 */ |
849 | 827df9f3 | balrog | [ 47] = { 0x60000, 0x1000, 32 | 16 | 8 }, /* Emulation (WIN_TRACER1SDRC) */ |
850 | 827df9f3 | balrog | [ 48] = { 0x61000, 0x1000, 32 | 16 | 8 }, /* L4TA14 */ |
851 | 827df9f3 | balrog | [ 49] = { 0x62000, 0x1000, 32 | 16 | 8 }, /* Emulation (WIN_TRACER2GPMC) */ |
852 | 827df9f3 | balrog | [ 50] = { 0x63000, 0x1000, 32 | 16 | 8 }, /* L4TA15 */ |
853 | 827df9f3 | balrog | [ 51] = { 0x64000, 0x1000, 32 | 16 | 8 }, /* Emulation (WIN_TRACER3OCM) */ |
854 | 827df9f3 | balrog | [ 52] = { 0x65000, 0x1000, 32 | 16 | 8 }, /* L4TA16 */ |
855 | 827df9f3 | balrog | [ 53] = { 0x66000, 0x300, 32 | 16 | 8 }, /* Emulation (WIN_TRACER4L4) */ |
856 | 827df9f3 | balrog | [ 54] = { 0x67000, 0x1000, 32 | 16 | 8 }, /* L4TA17 */ |
857 | 827df9f3 | balrog | [ 55] = { 0x68000, 0x1000, 32 | 16 | 8 }, /* Emulation (XTI) */ |
858 | 827df9f3 | balrog | [ 56] = { 0x69000, 0x1000, 32 | 16 | 8 }, /* L4TA18 */ |
859 | 827df9f3 | balrog | [ 57] = { 0x6a000, 0x1000, 16 | 8 }, /* UART1 */ |
860 | 827df9f3 | balrog | [ 58] = { 0x6b000, 0x1000, 32 | 16 | 8 }, /* L4TA19 */ |
861 | 827df9f3 | balrog | [ 59] = { 0x6c000, 0x1000, 16 | 8 }, /* UART2 */ |
862 | 827df9f3 | balrog | [ 60] = { 0x6d000, 0x1000, 32 | 16 | 8 }, /* L4TA20 */ |
863 | 827df9f3 | balrog | [ 61] = { 0x6e000, 0x1000, 16 | 8 }, /* UART3 */ |
864 | 827df9f3 | balrog | [ 62] = { 0x6f000, 0x1000, 32 | 16 | 8 }, /* L4TA21 */ |
865 | 827df9f3 | balrog | [ 63] = { 0x70000, 0x1000, 16 }, /* I2C1 */ |
866 | 827df9f3 | balrog | [ 64] = { 0x71000, 0x1000, 32 | 16 | 8 }, /* L4TAO5 */ |
867 | 827df9f3 | balrog | [ 65] = { 0x72000, 0x1000, 16 }, /* I2C2 */ |
868 | 827df9f3 | balrog | [ 66] = { 0x73000, 0x1000, 32 | 16 | 8 }, /* L4TAO6 */ |
869 | 827df9f3 | balrog | [ 67] = { 0x74000, 0x1000, 16 }, /* McBSP1 */ |
870 | 827df9f3 | balrog | [ 68] = { 0x75000, 0x1000, 32 | 16 | 8 }, /* L4TAO7 */ |
871 | 827df9f3 | balrog | [ 69] = { 0x76000, 0x1000, 16 }, /* McBSP2 */ |
872 | 827df9f3 | balrog | [ 70] = { 0x77000, 0x1000, 32 | 16 | 8 }, /* L4TAO8 */ |
873 | 827df9f3 | balrog | [ 71] = { 0x24000, 0x1000, 32 | 16 | 8 }, /* WD Timer 3 (DSP) */ |
874 | 827df9f3 | balrog | [ 72] = { 0x25000, 0x1000, 32 | 16 | 8 }, /* L4TA5 */ |
875 | 827df9f3 | balrog | [ 73] = { 0x26000, 0x1000, 32 | 16 | 8 }, /* WD Timer 4 (IVA) */ |
876 | 827df9f3 | balrog | [ 74] = { 0x27000, 0x1000, 32 | 16 | 8 }, /* L4TA6 */ |
877 | 827df9f3 | balrog | [ 75] = { 0x2a000, 0x1000, 32 | 16 | 8 }, /* GP Timer 2 */ |
878 | 827df9f3 | balrog | [ 76] = { 0x2b000, 0x1000, 32 | 16 | 8 }, /* L4TA8 */ |
879 | 827df9f3 | balrog | [ 77] = { 0x78000, 0x1000, 32 | 16 | 8 }, /* GP Timer 3 */ |
880 | 827df9f3 | balrog | [ 78] = { 0x79000, 0x1000, 32 | 16 | 8 }, /* L4TA22 */ |
881 | 827df9f3 | balrog | [ 79] = { 0x7a000, 0x1000, 32 | 16 | 8 }, /* GP Timer 4 */ |
882 | 827df9f3 | balrog | [ 80] = { 0x7b000, 0x1000, 32 | 16 | 8 }, /* L4TA23 */ |
883 | 827df9f3 | balrog | [ 81] = { 0x7c000, 0x1000, 32 | 16 | 8 }, /* GP Timer 5 */ |
884 | 827df9f3 | balrog | [ 82] = { 0x7d000, 0x1000, 32 | 16 | 8 }, /* L4TA24 */ |
885 | 827df9f3 | balrog | [ 83] = { 0x7e000, 0x1000, 32 | 16 | 8 }, /* GP Timer 6 */ |
886 | 827df9f3 | balrog | [ 84] = { 0x7f000, 0x1000, 32 | 16 | 8 }, /* L4TA25 */ |
887 | 827df9f3 | balrog | [ 85] = { 0x80000, 0x1000, 32 | 16 | 8 }, /* GP Timer 7 */ |
888 | 827df9f3 | balrog | [ 86] = { 0x81000, 0x1000, 32 | 16 | 8 }, /* L4TA26 */ |
889 | 827df9f3 | balrog | [ 87] = { 0x82000, 0x1000, 32 | 16 | 8 }, /* GP Timer 8 */ |
890 | 827df9f3 | balrog | [ 88] = { 0x83000, 0x1000, 32 | 16 | 8 }, /* L4TA27 */ |
891 | 827df9f3 | balrog | [ 89] = { 0x84000, 0x1000, 32 | 16 | 8 }, /* GP Timer 9 */ |
892 | 827df9f3 | balrog | [ 90] = { 0x85000, 0x1000, 32 | 16 | 8 }, /* L4TA28 */ |
893 | 827df9f3 | balrog | [ 91] = { 0x86000, 0x1000, 32 | 16 | 8 }, /* GP Timer 10 */ |
894 | 827df9f3 | balrog | [ 92] = { 0x87000, 0x1000, 32 | 16 | 8 }, /* L4TA29 */ |
895 | 827df9f3 | balrog | [ 93] = { 0x88000, 0x1000, 32 | 16 | 8 }, /* GP Timer 11 */ |
896 | 827df9f3 | balrog | [ 94] = { 0x89000, 0x1000, 32 | 16 | 8 }, /* L4TA30 */ |
897 | 827df9f3 | balrog | [ 95] = { 0x8a000, 0x1000, 32 | 16 | 8 }, /* GP Timer 12 */ |
898 | 827df9f3 | balrog | [ 96] = { 0x8b000, 0x1000, 32 | 16 | 8 }, /* L4TA31 */ |
899 | 827df9f3 | balrog | [ 97] = { 0x90000, 0x1000, 16 }, /* EAC */ |
900 | 827df9f3 | balrog | [ 98] = { 0x91000, 0x1000, 32 | 16 | 8 }, /* L4TA32 */ |
901 | 827df9f3 | balrog | [ 99] = { 0x92000, 0x1000, 16 }, /* FAC */ |
902 | 827df9f3 | balrog | [100] = { 0x93000, 0x1000, 32 | 16 | 8 }, /* L4TA33 */ |
903 | 827df9f3 | balrog | [101] = { 0x94000, 0x1000, 32 | 16 | 8 }, /* IPC (MAILBOX) */ |
904 | 827df9f3 | balrog | [102] = { 0x95000, 0x1000, 32 | 16 | 8 }, /* L4TA34 */ |
905 | 827df9f3 | balrog | [103] = { 0x98000, 0x1000, 32 | 16 | 8 }, /* SPI1 */ |
906 | 827df9f3 | balrog | [104] = { 0x99000, 0x1000, 32 | 16 | 8 }, /* L4TA35 */ |
907 | 827df9f3 | balrog | [105] = { 0x9a000, 0x1000, 32 | 16 | 8 }, /* SPI2 */ |
908 | 827df9f3 | balrog | [106] = { 0x9b000, 0x1000, 32 | 16 | 8 }, /* L4TA36 */ |
909 | 827df9f3 | balrog | [107] = { 0x9c000, 0x1000, 16 | 8 }, /* MMC SDIO */ |
910 | 827df9f3 | balrog | [108] = { 0x9d000, 0x1000, 32 | 16 | 8 }, /* L4TAO9 */ |
911 | 827df9f3 | balrog | [109] = { 0x9e000, 0x1000, 32 | 16 | 8 }, /* MS_PRO */ |
912 | 827df9f3 | balrog | [110] = { 0x9f000, 0x1000, 32 | 16 | 8 }, /* L4TAO10 */ |
913 | 827df9f3 | balrog | [111] = { 0xa0000, 0x1000, 32 }, /* RNG */ |
914 | 827df9f3 | balrog | [112] = { 0xa1000, 0x1000, 32 | 16 | 8 }, /* L4TAO11 */ |
915 | 827df9f3 | balrog | [113] = { 0xa2000, 0x1000, 32 }, /* DES3DES */ |
916 | 827df9f3 | balrog | [114] = { 0xa3000, 0x1000, 32 | 16 | 8 }, /* L4TAO12 */ |
917 | 827df9f3 | balrog | [115] = { 0xa4000, 0x1000, 32 }, /* SHA1MD5 */ |
918 | 827df9f3 | balrog | [116] = { 0xa5000, 0x1000, 32 | 16 | 8 }, /* L4TAO13 */ |
919 | 827df9f3 | balrog | [117] = { 0xa6000, 0x1000, 32 }, /* AES */ |
920 | 827df9f3 | balrog | [118] = { 0xa7000, 0x1000, 32 | 16 | 8 }, /* L4TA37 */ |
921 | 827df9f3 | balrog | [119] = { 0xa8000, 0x2000, 32 }, /* PKA */ |
922 | 827df9f3 | balrog | [120] = { 0xaa000, 0x1000, 32 | 16 | 8 }, /* L4TA38 */ |
923 | 827df9f3 | balrog | [121] = { 0xb0000, 0x1000, 32 }, /* MG */ |
924 | 827df9f3 | balrog | [122] = { 0xb1000, 0x1000, 32 | 16 | 8 }, |
925 | 827df9f3 | balrog | [123] = { 0xb2000, 0x1000, 32 }, /* HDQ/1-Wire */ |
926 | 827df9f3 | balrog | [124] = { 0xb3000, 0x1000, 32 | 16 | 8 }, /* L4TA39 */ |
927 | 827df9f3 | balrog | }; |
928 | 827df9f3 | balrog | |
929 | 2c1d9ecb | cmchao | static const struct omap_l4_agent_info_s omap_l4_agent_info[54] = { |
930 | 827df9f3 | balrog | { 0, 0, 3, 2 }, /* L4IA initiatior agent */ |
931 | 827df9f3 | balrog | { L4TAO(1), 3, 2, 1 }, /* Control and pinout module */ |
932 | 827df9f3 | balrog | { L4TAO(2), 5, 2, 1 }, /* 32K timer */ |
933 | 827df9f3 | balrog | { L4TAO(3), 7, 3, 2 }, /* PRCM */ |
934 | 827df9f3 | balrog | { L4TA(1), 10, 2, 1 }, /* BCM */ |
935 | 827df9f3 | balrog | { L4TA(2), 12, 2, 1 }, /* Test JTAG */ |
936 | 827df9f3 | balrog | { L4TA(3), 14, 6, 3 }, /* Quad GPIO */ |
937 | 827df9f3 | balrog | { L4TA(4), 20, 4, 3 }, /* WD timer 1/2 */ |
938 | 827df9f3 | balrog | { L4TA(7), 24, 2, 1 }, /* GP timer 1 */ |
939 | 827df9f3 | balrog | { L4TA(9), 26, 2, 1 }, /* ATM11 ETB */ |
940 | 827df9f3 | balrog | { L4TA(10), 28, 5, 4 }, /* Display subsystem */ |
941 | 827df9f3 | balrog | { L4TA(11), 33, 5, 4 }, /* Camera subsystem */ |
942 | 827df9f3 | balrog | { L4TA(12), 38, 2, 1 }, /* sDMA */ |
943 | 827df9f3 | balrog | { L4TA(13), 40, 5, 4 }, /* SSI */ |
944 | 827df9f3 | balrog | { L4TAO(4), 45, 2, 1 }, /* USB */ |
945 | 827df9f3 | balrog | { L4TA(14), 47, 2, 1 }, /* Win Tracer1 */ |
946 | 827df9f3 | balrog | { L4TA(15), 49, 2, 1 }, /* Win Tracer2 */ |
947 | 827df9f3 | balrog | { L4TA(16), 51, 2, 1 }, /* Win Tracer3 */ |
948 | 827df9f3 | balrog | { L4TA(17), 53, 2, 1 }, /* Win Tracer4 */ |
949 | 827df9f3 | balrog | { L4TA(18), 55, 2, 1 }, /* XTI */ |
950 | 827df9f3 | balrog | { L4TA(19), 57, 2, 1 }, /* UART1 */ |
951 | 827df9f3 | balrog | { L4TA(20), 59, 2, 1 }, /* UART2 */ |
952 | 827df9f3 | balrog | { L4TA(21), 61, 2, 1 }, /* UART3 */ |
953 | 827df9f3 | balrog | { L4TAO(5), 63, 2, 1 }, /* I2C1 */ |
954 | 827df9f3 | balrog | { L4TAO(6), 65, 2, 1 }, /* I2C2 */ |
955 | 827df9f3 | balrog | { L4TAO(7), 67, 2, 1 }, /* McBSP1 */ |
956 | 827df9f3 | balrog | { L4TAO(8), 69, 2, 1 }, /* McBSP2 */ |
957 | 827df9f3 | balrog | { L4TA(5), 71, 2, 1 }, /* WD Timer 3 (DSP) */ |
958 | 827df9f3 | balrog | { L4TA(6), 73, 2, 1 }, /* WD Timer 4 (IVA) */ |
959 | 827df9f3 | balrog | { L4TA(8), 75, 2, 1 }, /* GP Timer 2 */ |
960 | 827df9f3 | balrog | { L4TA(22), 77, 2, 1 }, /* GP Timer 3 */ |
961 | 827df9f3 | balrog | { L4TA(23), 79, 2, 1 }, /* GP Timer 4 */ |
962 | 827df9f3 | balrog | { L4TA(24), 81, 2, 1 }, /* GP Timer 5 */ |
963 | 827df9f3 | balrog | { L4TA(25), 83, 2, 1 }, /* GP Timer 6 */ |
964 | 827df9f3 | balrog | { L4TA(26), 85, 2, 1 }, /* GP Timer 7 */ |
965 | 827df9f3 | balrog | { L4TA(27), 87, 2, 1 }, /* GP Timer 8 */ |
966 | 827df9f3 | balrog | { L4TA(28), 89, 2, 1 }, /* GP Timer 9 */ |
967 | 827df9f3 | balrog | { L4TA(29), 91, 2, 1 }, /* GP Timer 10 */ |
968 | 827df9f3 | balrog | { L4TA(30), 93, 2, 1 }, /* GP Timer 11 */ |
969 | 827df9f3 | balrog | { L4TA(31), 95, 2, 1 }, /* GP Timer 12 */ |
970 | 827df9f3 | balrog | { L4TA(32), 97, 2, 1 }, /* EAC */ |
971 | 827df9f3 | balrog | { L4TA(33), 99, 2, 1 }, /* FAC */ |
972 | 827df9f3 | balrog | { L4TA(34), 101, 2, 1 }, /* IPC */ |
973 | 827df9f3 | balrog | { L4TA(35), 103, 2, 1 }, /* SPI1 */ |
974 | 827df9f3 | balrog | { L4TA(36), 105, 2, 1 }, /* SPI2 */ |
975 | 827df9f3 | balrog | { L4TAO(9), 107, 2, 1 }, /* MMC SDIO */ |
976 | 827df9f3 | balrog | { L4TAO(10), 109, 2, 1 }, |
977 | 827df9f3 | balrog | { L4TAO(11), 111, 2, 1 }, /* RNG */ |
978 | 827df9f3 | balrog | { L4TAO(12), 113, 2, 1 }, /* DES3DES */ |
979 | 827df9f3 | balrog | { L4TAO(13), 115, 2, 1 }, /* SHA1MD5 */ |
980 | 827df9f3 | balrog | { L4TA(37), 117, 2, 1 }, /* AES */ |
981 | 827df9f3 | balrog | { L4TA(38), 119, 2, 1 }, /* PKA */ |
982 | 827df9f3 | balrog | { -1, 121, 2, 1 }, |
983 | 827df9f3 | balrog | { L4TA(39), 123, 2, 1 }, /* HDQ/1-Wire */ |
984 | 827df9f3 | balrog | }; |
985 | 827df9f3 | balrog | |
986 | 2c1d9ecb | cmchao | #define omap_l4ta(bus, cs) \
|
987 | 2c1d9ecb | cmchao | omap_l4ta_get(bus, omap_l4_region, omap_l4_agent_info, L4TA(cs)) |
988 | 2c1d9ecb | cmchao | #define omap_l4tao(bus, cs) \
|
989 | 2c1d9ecb | cmchao | omap_l4ta_get(bus, omap_l4_region, omap_l4_agent_info, L4TAO(cs)) |
990 | 827df9f3 | balrog | |
991 | 827df9f3 | balrog | /* Power, Reset, and Clock Management */
|
992 | 827df9f3 | balrog | struct omap_prcm_s {
|
993 | 827df9f3 | balrog | qemu_irq irq[3];
|
994 | 827df9f3 | balrog | struct omap_mpu_state_s *mpu;
|
995 | 827df9f3 | balrog | |
996 | 827df9f3 | balrog | uint32_t irqst[3];
|
997 | 827df9f3 | balrog | uint32_t irqen[3];
|
998 | 827df9f3 | balrog | |
999 | 827df9f3 | balrog | uint32_t sysconfig; |
1000 | 827df9f3 | balrog | uint32_t voltctrl; |
1001 | 827df9f3 | balrog | uint32_t scratch[20];
|
1002 | 827df9f3 | balrog | |
1003 | 827df9f3 | balrog | uint32_t clksrc[1];
|
1004 | 827df9f3 | balrog | uint32_t clkout[1];
|
1005 | 827df9f3 | balrog | uint32_t clkemul[1];
|
1006 | 827df9f3 | balrog | uint32_t clkpol[1];
|
1007 | 827df9f3 | balrog | uint32_t clksel[8];
|
1008 | 827df9f3 | balrog | uint32_t clken[12];
|
1009 | 827df9f3 | balrog | uint32_t clkctrl[4];
|
1010 | 827df9f3 | balrog | uint32_t clkidle[7];
|
1011 | 827df9f3 | balrog | uint32_t setuptime[2];
|
1012 | 827df9f3 | balrog | |
1013 | 827df9f3 | balrog | uint32_t wkup[3];
|
1014 | 827df9f3 | balrog | uint32_t wken[3];
|
1015 | 827df9f3 | balrog | uint32_t wkst[3];
|
1016 | 827df9f3 | balrog | uint32_t rst[4];
|
1017 | 827df9f3 | balrog | uint32_t rstctrl[1];
|
1018 | 827df9f3 | balrog | uint32_t power[4];
|
1019 | 827df9f3 | balrog | uint32_t rsttime_wkup; |
1020 | 827df9f3 | balrog | |
1021 | 827df9f3 | balrog | uint32_t ev; |
1022 | 827df9f3 | balrog | uint32_t evtime[2];
|
1023 | 51fec3cc | balrog | |
1024 | 51fec3cc | balrog | int dpll_lock, apll_lock[2]; |
1025 | 827df9f3 | balrog | }; |
1026 | 827df9f3 | balrog | |
1027 | 827df9f3 | balrog | static void omap_prcm_int_update(struct omap_prcm_s *s, int dom) |
1028 | 827df9f3 | balrog | { |
1029 | 827df9f3 | balrog | qemu_set_irq(s->irq[dom], s->irqst[dom] & s->irqen[dom]); |
1030 | 827df9f3 | balrog | /* XXX or is the mask applied before PRCM_IRQSTATUS_* ? */
|
1031 | 827df9f3 | balrog | } |
1032 | 827df9f3 | balrog | |
1033 | c227f099 | Anthony Liguori | static uint32_t omap_prcm_read(void *opaque, target_phys_addr_t addr) |
1034 | 827df9f3 | balrog | { |
1035 | 827df9f3 | balrog | struct omap_prcm_s *s = (struct omap_prcm_s *) opaque; |
1036 | 51fec3cc | balrog | uint32_t ret; |
1037 | 827df9f3 | balrog | |
1038 | 8da3ff18 | pbrook | switch (addr) {
|
1039 | 827df9f3 | balrog | case 0x000: /* PRCM_REVISION */ |
1040 | 827df9f3 | balrog | return 0x10; |
1041 | 827df9f3 | balrog | |
1042 | 827df9f3 | balrog | case 0x010: /* PRCM_SYSCONFIG */ |
1043 | 827df9f3 | balrog | return s->sysconfig;
|
1044 | 827df9f3 | balrog | |
1045 | 827df9f3 | balrog | case 0x018: /* PRCM_IRQSTATUS_MPU */ |
1046 | 827df9f3 | balrog | return s->irqst[0]; |
1047 | 827df9f3 | balrog | |
1048 | 827df9f3 | balrog | case 0x01c: /* PRCM_IRQENABLE_MPU */ |
1049 | 827df9f3 | balrog | return s->irqen[0]; |
1050 | 827df9f3 | balrog | |
1051 | 827df9f3 | balrog | case 0x050: /* PRCM_VOLTCTRL */ |
1052 | 827df9f3 | balrog | return s->voltctrl;
|
1053 | 827df9f3 | balrog | case 0x054: /* PRCM_VOLTST */ |
1054 | 827df9f3 | balrog | return s->voltctrl & 3; |
1055 | 827df9f3 | balrog | |
1056 | 827df9f3 | balrog | case 0x060: /* PRCM_CLKSRC_CTRL */ |
1057 | 827df9f3 | balrog | return s->clksrc[0]; |
1058 | 827df9f3 | balrog | case 0x070: /* PRCM_CLKOUT_CTRL */ |
1059 | 827df9f3 | balrog | return s->clkout[0]; |
1060 | 827df9f3 | balrog | case 0x078: /* PRCM_CLKEMUL_CTRL */ |
1061 | 827df9f3 | balrog | return s->clkemul[0]; |
1062 | 827df9f3 | balrog | case 0x080: /* PRCM_CLKCFG_CTRL */ |
1063 | 827df9f3 | balrog | case 0x084: /* PRCM_CLKCFG_STATUS */ |
1064 | 827df9f3 | balrog | return 0; |
1065 | 827df9f3 | balrog | |
1066 | 827df9f3 | balrog | case 0x090: /* PRCM_VOLTSETUP */ |
1067 | 827df9f3 | balrog | return s->setuptime[0]; |
1068 | 827df9f3 | balrog | |
1069 | 827df9f3 | balrog | case 0x094: /* PRCM_CLKSSETUP */ |
1070 | 827df9f3 | balrog | return s->setuptime[1]; |
1071 | 827df9f3 | balrog | |
1072 | 827df9f3 | balrog | case 0x098: /* PRCM_POLCTRL */ |
1073 | 827df9f3 | balrog | return s->clkpol[0]; |
1074 | 827df9f3 | balrog | |
1075 | 827df9f3 | balrog | case 0x0b0: /* GENERAL_PURPOSE1 */ |
1076 | 827df9f3 | balrog | case 0x0b4: /* GENERAL_PURPOSE2 */ |
1077 | 827df9f3 | balrog | case 0x0b8: /* GENERAL_PURPOSE3 */ |
1078 | 827df9f3 | balrog | case 0x0bc: /* GENERAL_PURPOSE4 */ |
1079 | 827df9f3 | balrog | case 0x0c0: /* GENERAL_PURPOSE5 */ |
1080 | 827df9f3 | balrog | case 0x0c4: /* GENERAL_PURPOSE6 */ |
1081 | 827df9f3 | balrog | case 0x0c8: /* GENERAL_PURPOSE7 */ |
1082 | 827df9f3 | balrog | case 0x0cc: /* GENERAL_PURPOSE8 */ |
1083 | 827df9f3 | balrog | case 0x0d0: /* GENERAL_PURPOSE9 */ |
1084 | 827df9f3 | balrog | case 0x0d4: /* GENERAL_PURPOSE10 */ |
1085 | 827df9f3 | balrog | case 0x0d8: /* GENERAL_PURPOSE11 */ |
1086 | 827df9f3 | balrog | case 0x0dc: /* GENERAL_PURPOSE12 */ |
1087 | 827df9f3 | balrog | case 0x0e0: /* GENERAL_PURPOSE13 */ |
1088 | 827df9f3 | balrog | case 0x0e4: /* GENERAL_PURPOSE14 */ |
1089 | 827df9f3 | balrog | case 0x0e8: /* GENERAL_PURPOSE15 */ |
1090 | 827df9f3 | balrog | case 0x0ec: /* GENERAL_PURPOSE16 */ |
1091 | 827df9f3 | balrog | case 0x0f0: /* GENERAL_PURPOSE17 */ |
1092 | 827df9f3 | balrog | case 0x0f4: /* GENERAL_PURPOSE18 */ |
1093 | 827df9f3 | balrog | case 0x0f8: /* GENERAL_PURPOSE19 */ |
1094 | 827df9f3 | balrog | case 0x0fc: /* GENERAL_PURPOSE20 */ |
1095 | 8da3ff18 | pbrook | return s->scratch[(addr - 0xb0) >> 2]; |
1096 | 827df9f3 | balrog | |
1097 | 827df9f3 | balrog | case 0x140: /* CM_CLKSEL_MPU */ |
1098 | 827df9f3 | balrog | return s->clksel[0]; |
1099 | 827df9f3 | balrog | case 0x148: /* CM_CLKSTCTRL_MPU */ |
1100 | 827df9f3 | balrog | return s->clkctrl[0]; |
1101 | 827df9f3 | balrog | |
1102 | 827df9f3 | balrog | case 0x158: /* RM_RSTST_MPU */ |
1103 | 827df9f3 | balrog | return s->rst[0]; |
1104 | 827df9f3 | balrog | case 0x1c8: /* PM_WKDEP_MPU */ |
1105 | 827df9f3 | balrog | return s->wkup[0]; |
1106 | 827df9f3 | balrog | case 0x1d4: /* PM_EVGENCTRL_MPU */ |
1107 | 827df9f3 | balrog | return s->ev;
|
1108 | 827df9f3 | balrog | case 0x1d8: /* PM_EVEGENONTIM_MPU */ |
1109 | 827df9f3 | balrog | return s->evtime[0]; |
1110 | 827df9f3 | balrog | case 0x1dc: /* PM_EVEGENOFFTIM_MPU */ |
1111 | 827df9f3 | balrog | return s->evtime[1]; |
1112 | 827df9f3 | balrog | case 0x1e0: /* PM_PWSTCTRL_MPU */ |
1113 | 827df9f3 | balrog | return s->power[0]; |
1114 | 827df9f3 | balrog | case 0x1e4: /* PM_PWSTST_MPU */ |
1115 | 827df9f3 | balrog | return 0; |
1116 | 827df9f3 | balrog | |
1117 | 827df9f3 | balrog | case 0x200: /* CM_FCLKEN1_CORE */ |
1118 | 827df9f3 | balrog | return s->clken[0]; |
1119 | 827df9f3 | balrog | case 0x204: /* CM_FCLKEN2_CORE */ |
1120 | 827df9f3 | balrog | return s->clken[1]; |
1121 | 827df9f3 | balrog | case 0x210: /* CM_ICLKEN1_CORE */ |
1122 | 827df9f3 | balrog | return s->clken[2]; |
1123 | 827df9f3 | balrog | case 0x214: /* CM_ICLKEN2_CORE */ |
1124 | 827df9f3 | balrog | return s->clken[3]; |
1125 | 827df9f3 | balrog | case 0x21c: /* CM_ICLKEN4_CORE */ |
1126 | 827df9f3 | balrog | return s->clken[4]; |
1127 | 827df9f3 | balrog | |
1128 | 827df9f3 | balrog | case 0x220: /* CM_IDLEST1_CORE */ |
1129 | 827df9f3 | balrog | /* TODO: check the actual iclk status */
|
1130 | 827df9f3 | balrog | return 0x7ffffff9; |
1131 | 827df9f3 | balrog | case 0x224: /* CM_IDLEST2_CORE */ |
1132 | 827df9f3 | balrog | /* TODO: check the actual iclk status */
|
1133 | 827df9f3 | balrog | return 0x00000007; |
1134 | 827df9f3 | balrog | case 0x22c: /* CM_IDLEST4_CORE */ |
1135 | 827df9f3 | balrog | /* TODO: check the actual iclk status */
|
1136 | 827df9f3 | balrog | return 0x0000001f; |
1137 | 827df9f3 | balrog | |
1138 | 827df9f3 | balrog | case 0x230: /* CM_AUTOIDLE1_CORE */ |
1139 | 827df9f3 | balrog | return s->clkidle[0]; |
1140 | 827df9f3 | balrog | case 0x234: /* CM_AUTOIDLE2_CORE */ |
1141 | 827df9f3 | balrog | return s->clkidle[1]; |
1142 | 827df9f3 | balrog | case 0x238: /* CM_AUTOIDLE3_CORE */ |
1143 | 827df9f3 | balrog | return s->clkidle[2]; |
1144 | 827df9f3 | balrog | case 0x23c: /* CM_AUTOIDLE4_CORE */ |
1145 | 827df9f3 | balrog | return s->clkidle[3]; |
1146 | 827df9f3 | balrog | |
1147 | 827df9f3 | balrog | case 0x240: /* CM_CLKSEL1_CORE */ |
1148 | 827df9f3 | balrog | return s->clksel[1]; |
1149 | 827df9f3 | balrog | case 0x244: /* CM_CLKSEL2_CORE */ |
1150 | 827df9f3 | balrog | return s->clksel[2]; |
1151 | 827df9f3 | balrog | |
1152 | 827df9f3 | balrog | case 0x248: /* CM_CLKSTCTRL_CORE */ |
1153 | 827df9f3 | balrog | return s->clkctrl[1]; |
1154 | 827df9f3 | balrog | |
1155 | 827df9f3 | balrog | case 0x2a0: /* PM_WKEN1_CORE */ |
1156 | 827df9f3 | balrog | return s->wken[0]; |
1157 | 827df9f3 | balrog | case 0x2a4: /* PM_WKEN2_CORE */ |
1158 | 827df9f3 | balrog | return s->wken[1]; |
1159 | 827df9f3 | balrog | |
1160 | 827df9f3 | balrog | case 0x2b0: /* PM_WKST1_CORE */ |
1161 | 827df9f3 | balrog | return s->wkst[0]; |
1162 | 827df9f3 | balrog | case 0x2b4: /* PM_WKST2_CORE */ |
1163 | 827df9f3 | balrog | return s->wkst[1]; |
1164 | 827df9f3 | balrog | case 0x2c8: /* PM_WKDEP_CORE */ |
1165 | 827df9f3 | balrog | return 0x1e; |
1166 | 827df9f3 | balrog | |
1167 | 827df9f3 | balrog | case 0x2e0: /* PM_PWSTCTRL_CORE */ |
1168 | 827df9f3 | balrog | return s->power[1]; |
1169 | 827df9f3 | balrog | case 0x2e4: /* PM_PWSTST_CORE */ |
1170 | 827df9f3 | balrog | return 0x000030 | (s->power[1] & 0xfc00); |
1171 | 827df9f3 | balrog | |
1172 | 827df9f3 | balrog | case 0x300: /* CM_FCLKEN_GFX */ |
1173 | 827df9f3 | balrog | return s->clken[5]; |
1174 | 827df9f3 | balrog | case 0x310: /* CM_ICLKEN_GFX */ |
1175 | 827df9f3 | balrog | return s->clken[6]; |
1176 | 827df9f3 | balrog | case 0x320: /* CM_IDLEST_GFX */ |
1177 | 827df9f3 | balrog | /* TODO: check the actual iclk status */
|
1178 | 827df9f3 | balrog | return 0x00000001; |
1179 | 827df9f3 | balrog | case 0x340: /* CM_CLKSEL_GFX */ |
1180 | 827df9f3 | balrog | return s->clksel[3]; |
1181 | 827df9f3 | balrog | case 0x348: /* CM_CLKSTCTRL_GFX */ |
1182 | 827df9f3 | balrog | return s->clkctrl[2]; |
1183 | 827df9f3 | balrog | case 0x350: /* RM_RSTCTRL_GFX */ |
1184 | 827df9f3 | balrog | return s->rstctrl[0]; |
1185 | 827df9f3 | balrog | case 0x358: /* RM_RSTST_GFX */ |
1186 | 827df9f3 | balrog | return s->rst[1]; |
1187 | 827df9f3 | balrog | case 0x3c8: /* PM_WKDEP_GFX */ |
1188 | 827df9f3 | balrog | return s->wkup[1]; |
1189 | 827df9f3 | balrog | |
1190 | 827df9f3 | balrog | case 0x3e0: /* PM_PWSTCTRL_GFX */ |
1191 | 827df9f3 | balrog | return s->power[2]; |
1192 | 827df9f3 | balrog | case 0x3e4: /* PM_PWSTST_GFX */ |
1193 | 827df9f3 | balrog | return s->power[2] & 3; |
1194 | 827df9f3 | balrog | |
1195 | 827df9f3 | balrog | case 0x400: /* CM_FCLKEN_WKUP */ |
1196 | 827df9f3 | balrog | return s->clken[7]; |
1197 | 827df9f3 | balrog | case 0x410: /* CM_ICLKEN_WKUP */ |
1198 | 827df9f3 | balrog | return s->clken[8]; |
1199 | 827df9f3 | balrog | case 0x420: /* CM_IDLEST_WKUP */ |
1200 | 827df9f3 | balrog | /* TODO: check the actual iclk status */
|
1201 | 827df9f3 | balrog | return 0x0000003f; |
1202 | 827df9f3 | balrog | case 0x430: /* CM_AUTOIDLE_WKUP */ |
1203 | 827df9f3 | balrog | return s->clkidle[4]; |
1204 | 827df9f3 | balrog | case 0x440: /* CM_CLKSEL_WKUP */ |
1205 | 827df9f3 | balrog | return s->clksel[4]; |
1206 | 827df9f3 | balrog | case 0x450: /* RM_RSTCTRL_WKUP */ |
1207 | 827df9f3 | balrog | return 0; |
1208 | 827df9f3 | balrog | case 0x454: /* RM_RSTTIME_WKUP */ |
1209 | 827df9f3 | balrog | return s->rsttime_wkup;
|
1210 | 827df9f3 | balrog | case 0x458: /* RM_RSTST_WKUP */ |
1211 | 827df9f3 | balrog | return s->rst[2]; |
1212 | 827df9f3 | balrog | case 0x4a0: /* PM_WKEN_WKUP */ |
1213 | 827df9f3 | balrog | return s->wken[2]; |
1214 | 827df9f3 | balrog | case 0x4b0: /* PM_WKST_WKUP */ |
1215 | 827df9f3 | balrog | return s->wkst[2]; |
1216 | 827df9f3 | balrog | |
1217 | 827df9f3 | balrog | case 0x500: /* CM_CLKEN_PLL */ |
1218 | 827df9f3 | balrog | return s->clken[9]; |
1219 | 827df9f3 | balrog | case 0x520: /* CM_IDLEST_CKGEN */ |
1220 | 51fec3cc | balrog | ret = 0x0000070 | (s->apll_lock[0] << 9) | (s->apll_lock[1] << 8); |
1221 | 827df9f3 | balrog | if (!(s->clksel[6] & 3)) |
1222 | 51fec3cc | balrog | /* Core uses 32-kHz clock */
|
1223 | 51fec3cc | balrog | ret |= 3 << 0; |
1224 | 51fec3cc | balrog | else if (!s->dpll_lock) |
1225 | 51fec3cc | balrog | /* DPLL not locked, core uses ref_clk */
|
1226 | 51fec3cc | balrog | ret |= 1 << 0; |
1227 | 51fec3cc | balrog | else
|
1228 | 51fec3cc | balrog | /* Core uses DPLL */
|
1229 | 51fec3cc | balrog | ret |= 2 << 0; |
1230 | 51fec3cc | balrog | return ret;
|
1231 | 827df9f3 | balrog | case 0x530: /* CM_AUTOIDLE_PLL */ |
1232 | 827df9f3 | balrog | return s->clkidle[5]; |
1233 | 827df9f3 | balrog | case 0x540: /* CM_CLKSEL1_PLL */ |
1234 | 827df9f3 | balrog | return s->clksel[5]; |
1235 | 827df9f3 | balrog | case 0x544: /* CM_CLKSEL2_PLL */ |
1236 | 827df9f3 | balrog | return s->clksel[6]; |
1237 | 827df9f3 | balrog | |
1238 | 827df9f3 | balrog | case 0x800: /* CM_FCLKEN_DSP */ |
1239 | 827df9f3 | balrog | return s->clken[10]; |
1240 | 827df9f3 | balrog | case 0x810: /* CM_ICLKEN_DSP */ |
1241 | 827df9f3 | balrog | return s->clken[11]; |
1242 | 827df9f3 | balrog | case 0x820: /* CM_IDLEST_DSP */ |
1243 | 827df9f3 | balrog | /* TODO: check the actual iclk status */
|
1244 | 827df9f3 | balrog | return 0x00000103; |
1245 | 827df9f3 | balrog | case 0x830: /* CM_AUTOIDLE_DSP */ |
1246 | 827df9f3 | balrog | return s->clkidle[6]; |
1247 | 827df9f3 | balrog | case 0x840: /* CM_CLKSEL_DSP */ |
1248 | 827df9f3 | balrog | return s->clksel[7]; |
1249 | 827df9f3 | balrog | case 0x848: /* CM_CLKSTCTRL_DSP */ |
1250 | 827df9f3 | balrog | return s->clkctrl[3]; |
1251 | 827df9f3 | balrog | case 0x850: /* RM_RSTCTRL_DSP */ |
1252 | 827df9f3 | balrog | return 0; |
1253 | 827df9f3 | balrog | case 0x858: /* RM_RSTST_DSP */ |
1254 | 827df9f3 | balrog | return s->rst[3]; |
1255 | 827df9f3 | balrog | case 0x8c8: /* PM_WKDEP_DSP */ |
1256 | 827df9f3 | balrog | return s->wkup[2]; |
1257 | 827df9f3 | balrog | case 0x8e0: /* PM_PWSTCTRL_DSP */ |
1258 | 827df9f3 | balrog | return s->power[3]; |
1259 | 827df9f3 | balrog | case 0x8e4: /* PM_PWSTST_DSP */ |
1260 | 827df9f3 | balrog | return 0x008030 | (s->power[3] & 0x3003); |
1261 | 827df9f3 | balrog | |
1262 | 827df9f3 | balrog | case 0x8f0: /* PRCM_IRQSTATUS_DSP */ |
1263 | 827df9f3 | balrog | return s->irqst[1]; |
1264 | 827df9f3 | balrog | case 0x8f4: /* PRCM_IRQENABLE_DSP */ |
1265 | 827df9f3 | balrog | return s->irqen[1]; |
1266 | 827df9f3 | balrog | |
1267 | 827df9f3 | balrog | case 0x8f8: /* PRCM_IRQSTATUS_IVA */ |
1268 | 827df9f3 | balrog | return s->irqst[2]; |
1269 | 827df9f3 | balrog | case 0x8fc: /* PRCM_IRQENABLE_IVA */ |
1270 | 827df9f3 | balrog | return s->irqen[2]; |
1271 | 827df9f3 | balrog | } |
1272 | 827df9f3 | balrog | |
1273 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
1274 | 827df9f3 | balrog | return 0; |
1275 | 827df9f3 | balrog | } |
1276 | 827df9f3 | balrog | |
1277 | 51fec3cc | balrog | static void omap_prcm_apll_update(struct omap_prcm_s *s) |
1278 | 51fec3cc | balrog | { |
1279 | 51fec3cc | balrog | int mode[2]; |
1280 | 51fec3cc | balrog | |
1281 | 51fec3cc | balrog | mode[0] = (s->clken[9] >> 6) & 3; |
1282 | 51fec3cc | balrog | s->apll_lock[0] = (mode[0] == 3); |
1283 | 51fec3cc | balrog | mode[1] = (s->clken[9] >> 2) & 3; |
1284 | 51fec3cc | balrog | s->apll_lock[1] = (mode[1] == 3); |
1285 | 51fec3cc | balrog | /* TODO: update clocks */
|
1286 | 51fec3cc | balrog | |
1287 | 16d55035 | Blue Swirl | if (mode[0] == 1 || mode[0] == 2 || mode[1] == 1 || mode[1] == 2) |
1288 | 51fec3cc | balrog | fprintf(stderr, "%s: bad EN_54M_PLL or bad EN_96M_PLL\n",
|
1289 | 51fec3cc | balrog | __FUNCTION__); |
1290 | 51fec3cc | balrog | } |
1291 | 51fec3cc | balrog | |
1292 | 51fec3cc | balrog | static void omap_prcm_dpll_update(struct omap_prcm_s *s) |
1293 | 51fec3cc | balrog | { |
1294 | 51fec3cc | balrog | omap_clk dpll = omap_findclk(s->mpu, "dpll");
|
1295 | 51fec3cc | balrog | omap_clk dpll_x2 = omap_findclk(s->mpu, "dpll");
|
1296 | 51fec3cc | balrog | omap_clk core = omap_findclk(s->mpu, "core_clk");
|
1297 | 51fec3cc | balrog | int mode = (s->clken[9] >> 0) & 3; |
1298 | 51fec3cc | balrog | int mult, div;
|
1299 | 51fec3cc | balrog | |
1300 | 51fec3cc | balrog | mult = (s->clksel[5] >> 12) & 0x3ff; |
1301 | 51fec3cc | balrog | div = (s->clksel[5] >> 8) & 0xf; |
1302 | 51fec3cc | balrog | if (mult == 0 || mult == 1) |
1303 | 51fec3cc | balrog | mode = 1; /* Bypass */ |
1304 | 51fec3cc | balrog | |
1305 | 51fec3cc | balrog | s->dpll_lock = 0;
|
1306 | 51fec3cc | balrog | switch (mode) {
|
1307 | 51fec3cc | balrog | case 0: |
1308 | 51fec3cc | balrog | fprintf(stderr, "%s: bad EN_DPLL\n", __FUNCTION__);
|
1309 | 51fec3cc | balrog | break;
|
1310 | 51fec3cc | balrog | case 1: /* Low-power bypass mode (Default) */ |
1311 | 51fec3cc | balrog | case 2: /* Fast-relock bypass mode */ |
1312 | 51fec3cc | balrog | omap_clk_setrate(dpll, 1, 1); |
1313 | 51fec3cc | balrog | omap_clk_setrate(dpll_x2, 1, 1); |
1314 | 51fec3cc | balrog | break;
|
1315 | 51fec3cc | balrog | case 3: /* Lock mode */ |
1316 | 51fec3cc | balrog | s->dpll_lock = 1; /* After 20 FINT cycles (ref_clk / (div + 1)). */ |
1317 | 51fec3cc | balrog | |
1318 | 51fec3cc | balrog | omap_clk_setrate(dpll, div + 1, mult);
|
1319 | 51fec3cc | balrog | omap_clk_setrate(dpll_x2, div + 1, mult * 2); |
1320 | 51fec3cc | balrog | break;
|
1321 | 51fec3cc | balrog | } |
1322 | 51fec3cc | balrog | |
1323 | 51fec3cc | balrog | switch ((s->clksel[6] >> 0) & 3) { |
1324 | 51fec3cc | balrog | case 0: |
1325 | 51fec3cc | balrog | omap_clk_reparent(core, omap_findclk(s->mpu, "clk32-kHz"));
|
1326 | 51fec3cc | balrog | break;
|
1327 | 51fec3cc | balrog | case 1: |
1328 | 51fec3cc | balrog | omap_clk_reparent(core, dpll); |
1329 | 51fec3cc | balrog | break;
|
1330 | 51fec3cc | balrog | case 2: |
1331 | 51fec3cc | balrog | /* Default */
|
1332 | 51fec3cc | balrog | omap_clk_reparent(core, dpll_x2); |
1333 | 51fec3cc | balrog | break;
|
1334 | 51fec3cc | balrog | case 3: |
1335 | 51fec3cc | balrog | fprintf(stderr, "%s: bad CORE_CLK_SRC\n", __FUNCTION__);
|
1336 | 51fec3cc | balrog | break;
|
1337 | 51fec3cc | balrog | } |
1338 | 51fec3cc | balrog | } |
1339 | 51fec3cc | balrog | |
1340 | c227f099 | Anthony Liguori | static void omap_prcm_write(void *opaque, target_phys_addr_t addr, |
1341 | 827df9f3 | balrog | uint32_t value) |
1342 | 827df9f3 | balrog | { |
1343 | 827df9f3 | balrog | struct omap_prcm_s *s = (struct omap_prcm_s *) opaque; |
1344 | 827df9f3 | balrog | |
1345 | 8da3ff18 | pbrook | switch (addr) {
|
1346 | 827df9f3 | balrog | case 0x000: /* PRCM_REVISION */ |
1347 | 827df9f3 | balrog | case 0x054: /* PRCM_VOLTST */ |
1348 | 827df9f3 | balrog | case 0x084: /* PRCM_CLKCFG_STATUS */ |
1349 | 827df9f3 | balrog | case 0x1e4: /* PM_PWSTST_MPU */ |
1350 | 827df9f3 | balrog | case 0x220: /* CM_IDLEST1_CORE */ |
1351 | 827df9f3 | balrog | case 0x224: /* CM_IDLEST2_CORE */ |
1352 | 827df9f3 | balrog | case 0x22c: /* CM_IDLEST4_CORE */ |
1353 | 827df9f3 | balrog | case 0x2c8: /* PM_WKDEP_CORE */ |
1354 | 827df9f3 | balrog | case 0x2e4: /* PM_PWSTST_CORE */ |
1355 | 827df9f3 | balrog | case 0x320: /* CM_IDLEST_GFX */ |
1356 | 827df9f3 | balrog | case 0x3e4: /* PM_PWSTST_GFX */ |
1357 | 827df9f3 | balrog | case 0x420: /* CM_IDLEST_WKUP */ |
1358 | 827df9f3 | balrog | case 0x520: /* CM_IDLEST_CKGEN */ |
1359 | 827df9f3 | balrog | case 0x820: /* CM_IDLEST_DSP */ |
1360 | 827df9f3 | balrog | case 0x8e4: /* PM_PWSTST_DSP */ |
1361 | 827df9f3 | balrog | OMAP_RO_REG(addr); |
1362 | 827df9f3 | balrog | return;
|
1363 | 827df9f3 | balrog | |
1364 | 827df9f3 | balrog | case 0x010: /* PRCM_SYSCONFIG */ |
1365 | 827df9f3 | balrog | s->sysconfig = value & 1;
|
1366 | 827df9f3 | balrog | break;
|
1367 | 827df9f3 | balrog | |
1368 | 827df9f3 | balrog | case 0x018: /* PRCM_IRQSTATUS_MPU */ |
1369 | 827df9f3 | balrog | s->irqst[0] &= ~value;
|
1370 | 827df9f3 | balrog | omap_prcm_int_update(s, 0);
|
1371 | 827df9f3 | balrog | break;
|
1372 | 827df9f3 | balrog | case 0x01c: /* PRCM_IRQENABLE_MPU */ |
1373 | 827df9f3 | balrog | s->irqen[0] = value & 0x3f; |
1374 | 827df9f3 | balrog | omap_prcm_int_update(s, 0);
|
1375 | 827df9f3 | balrog | break;
|
1376 | 827df9f3 | balrog | |
1377 | 827df9f3 | balrog | case 0x050: /* PRCM_VOLTCTRL */ |
1378 | 827df9f3 | balrog | s->voltctrl = value & 0xf1c3;
|
1379 | 827df9f3 | balrog | break;
|
1380 | 827df9f3 | balrog | |
1381 | 827df9f3 | balrog | case 0x060: /* PRCM_CLKSRC_CTRL */ |
1382 | 827df9f3 | balrog | s->clksrc[0] = value & 0xdb; |
1383 | 827df9f3 | balrog | /* TODO update clocks */
|
1384 | 827df9f3 | balrog | break;
|
1385 | 827df9f3 | balrog | |
1386 | 827df9f3 | balrog | case 0x070: /* PRCM_CLKOUT_CTRL */ |
1387 | 827df9f3 | balrog | s->clkout[0] = value & 0xbbbb; |
1388 | 827df9f3 | balrog | /* TODO update clocks */
|
1389 | 827df9f3 | balrog | break;
|
1390 | 827df9f3 | balrog | |
1391 | 827df9f3 | balrog | case 0x078: /* PRCM_CLKEMUL_CTRL */ |
1392 | 827df9f3 | balrog | s->clkemul[0] = value & 1; |
1393 | 827df9f3 | balrog | /* TODO update clocks */
|
1394 | 827df9f3 | balrog | break;
|
1395 | 827df9f3 | balrog | |
1396 | 827df9f3 | balrog | case 0x080: /* PRCM_CLKCFG_CTRL */ |
1397 | 827df9f3 | balrog | break;
|
1398 | 827df9f3 | balrog | |
1399 | 827df9f3 | balrog | case 0x090: /* PRCM_VOLTSETUP */ |
1400 | 827df9f3 | balrog | s->setuptime[0] = value & 0xffff; |
1401 | 827df9f3 | balrog | break;
|
1402 | 827df9f3 | balrog | case 0x094: /* PRCM_CLKSSETUP */ |
1403 | 827df9f3 | balrog | s->setuptime[1] = value & 0xffff; |
1404 | 827df9f3 | balrog | break;
|
1405 | 827df9f3 | balrog | |
1406 | 827df9f3 | balrog | case 0x098: /* PRCM_POLCTRL */ |
1407 | 827df9f3 | balrog | s->clkpol[0] = value & 0x701; |
1408 | 827df9f3 | balrog | break;
|
1409 | 827df9f3 | balrog | |
1410 | 827df9f3 | balrog | case 0x0b0: /* GENERAL_PURPOSE1 */ |
1411 | 827df9f3 | balrog | case 0x0b4: /* GENERAL_PURPOSE2 */ |
1412 | 827df9f3 | balrog | case 0x0b8: /* GENERAL_PURPOSE3 */ |
1413 | 827df9f3 | balrog | case 0x0bc: /* GENERAL_PURPOSE4 */ |
1414 | 827df9f3 | balrog | case 0x0c0: /* GENERAL_PURPOSE5 */ |
1415 | 827df9f3 | balrog | case 0x0c4: /* GENERAL_PURPOSE6 */ |
1416 | 827df9f3 | balrog | case 0x0c8: /* GENERAL_PURPOSE7 */ |
1417 | 827df9f3 | balrog | case 0x0cc: /* GENERAL_PURPOSE8 */ |
1418 | 827df9f3 | balrog | case 0x0d0: /* GENERAL_PURPOSE9 */ |
1419 | 827df9f3 | balrog | case 0x0d4: /* GENERAL_PURPOSE10 */ |
1420 | 827df9f3 | balrog | case 0x0d8: /* GENERAL_PURPOSE11 */ |
1421 | 827df9f3 | balrog | case 0x0dc: /* GENERAL_PURPOSE12 */ |
1422 | 827df9f3 | balrog | case 0x0e0: /* GENERAL_PURPOSE13 */ |
1423 | 827df9f3 | balrog | case 0x0e4: /* GENERAL_PURPOSE14 */ |
1424 | 827df9f3 | balrog | case 0x0e8: /* GENERAL_PURPOSE15 */ |
1425 | 827df9f3 | balrog | case 0x0ec: /* GENERAL_PURPOSE16 */ |
1426 | 827df9f3 | balrog | case 0x0f0: /* GENERAL_PURPOSE17 */ |
1427 | 827df9f3 | balrog | case 0x0f4: /* GENERAL_PURPOSE18 */ |
1428 | 827df9f3 | balrog | case 0x0f8: /* GENERAL_PURPOSE19 */ |
1429 | 827df9f3 | balrog | case 0x0fc: /* GENERAL_PURPOSE20 */ |
1430 | 8da3ff18 | pbrook | s->scratch[(addr - 0xb0) >> 2] = value; |
1431 | 827df9f3 | balrog | break;
|
1432 | 827df9f3 | balrog | |
1433 | 827df9f3 | balrog | case 0x140: /* CM_CLKSEL_MPU */ |
1434 | 827df9f3 | balrog | s->clksel[0] = value & 0x1f; |
1435 | 827df9f3 | balrog | /* TODO update clocks */
|
1436 | 827df9f3 | balrog | break;
|
1437 | 827df9f3 | balrog | case 0x148: /* CM_CLKSTCTRL_MPU */ |
1438 | 827df9f3 | balrog | s->clkctrl[0] = value & 0x1f; |
1439 | 827df9f3 | balrog | break;
|
1440 | 827df9f3 | balrog | |
1441 | 827df9f3 | balrog | case 0x158: /* RM_RSTST_MPU */ |
1442 | 827df9f3 | balrog | s->rst[0] &= ~value;
|
1443 | 827df9f3 | balrog | break;
|
1444 | 827df9f3 | balrog | case 0x1c8: /* PM_WKDEP_MPU */ |
1445 | 827df9f3 | balrog | s->wkup[0] = value & 0x15; |
1446 | 827df9f3 | balrog | break;
|
1447 | 827df9f3 | balrog | |
1448 | 827df9f3 | balrog | case 0x1d4: /* PM_EVGENCTRL_MPU */ |
1449 | 827df9f3 | balrog | s->ev = value & 0x1f;
|
1450 | 827df9f3 | balrog | break;
|
1451 | 827df9f3 | balrog | case 0x1d8: /* PM_EVEGENONTIM_MPU */ |
1452 | 827df9f3 | balrog | s->evtime[0] = value;
|
1453 | 827df9f3 | balrog | break;
|
1454 | 827df9f3 | balrog | case 0x1dc: /* PM_EVEGENOFFTIM_MPU */ |
1455 | 827df9f3 | balrog | s->evtime[1] = value;
|
1456 | 827df9f3 | balrog | break;
|
1457 | 827df9f3 | balrog | |
1458 | 827df9f3 | balrog | case 0x1e0: /* PM_PWSTCTRL_MPU */ |
1459 | 827df9f3 | balrog | s->power[0] = value & 0xc0f; |
1460 | 827df9f3 | balrog | break;
|
1461 | 827df9f3 | balrog | |
1462 | 827df9f3 | balrog | case 0x200: /* CM_FCLKEN1_CORE */ |
1463 | 827df9f3 | balrog | s->clken[0] = value & 0xbfffffff; |
1464 | 827df9f3 | balrog | /* TODO update clocks */
|
1465 | 99570a40 | balrog | /* The EN_EAC bit only gets/puts func_96m_clk. */
|
1466 | 827df9f3 | balrog | break;
|
1467 | 827df9f3 | balrog | case 0x204: /* CM_FCLKEN2_CORE */ |
1468 | 827df9f3 | balrog | s->clken[1] = value & 0x00000007; |
1469 | 827df9f3 | balrog | /* TODO update clocks */
|
1470 | 827df9f3 | balrog | break;
|
1471 | 827df9f3 | balrog | case 0x210: /* CM_ICLKEN1_CORE */ |
1472 | 827df9f3 | balrog | s->clken[2] = value & 0xfffffff9; |
1473 | 827df9f3 | balrog | /* TODO update clocks */
|
1474 | 99570a40 | balrog | /* The EN_EAC bit only gets/puts core_l4_iclk. */
|
1475 | 827df9f3 | balrog | break;
|
1476 | 827df9f3 | balrog | case 0x214: /* CM_ICLKEN2_CORE */ |
1477 | 827df9f3 | balrog | s->clken[3] = value & 0x00000007; |
1478 | 827df9f3 | balrog | /* TODO update clocks */
|
1479 | 827df9f3 | balrog | break;
|
1480 | 827df9f3 | balrog | case 0x21c: /* CM_ICLKEN4_CORE */ |
1481 | 827df9f3 | balrog | s->clken[4] = value & 0x0000001f; |
1482 | 827df9f3 | balrog | /* TODO update clocks */
|
1483 | 827df9f3 | balrog | break;
|
1484 | 827df9f3 | balrog | |
1485 | 827df9f3 | balrog | case 0x230: /* CM_AUTOIDLE1_CORE */ |
1486 | 827df9f3 | balrog | s->clkidle[0] = value & 0xfffffff9; |
1487 | 827df9f3 | balrog | /* TODO update clocks */
|
1488 | 827df9f3 | balrog | break;
|
1489 | 827df9f3 | balrog | case 0x234: /* CM_AUTOIDLE2_CORE */ |
1490 | 827df9f3 | balrog | s->clkidle[1] = value & 0x00000007; |
1491 | 827df9f3 | balrog | /* TODO update clocks */
|
1492 | 827df9f3 | balrog | break;
|
1493 | 827df9f3 | balrog | case 0x238: /* CM_AUTOIDLE3_CORE */ |
1494 | 827df9f3 | balrog | s->clkidle[2] = value & 0x00000007; |
1495 | 827df9f3 | balrog | /* TODO update clocks */
|
1496 | 827df9f3 | balrog | break;
|
1497 | 827df9f3 | balrog | case 0x23c: /* CM_AUTOIDLE4_CORE */ |
1498 | 827df9f3 | balrog | s->clkidle[3] = value & 0x0000001f; |
1499 | 827df9f3 | balrog | /* TODO update clocks */
|
1500 | 827df9f3 | balrog | break;
|
1501 | 827df9f3 | balrog | |
1502 | 827df9f3 | balrog | case 0x240: /* CM_CLKSEL1_CORE */ |
1503 | 827df9f3 | balrog | s->clksel[1] = value & 0x0fffbf7f; |
1504 | 827df9f3 | balrog | /* TODO update clocks */
|
1505 | 827df9f3 | balrog | break;
|
1506 | 827df9f3 | balrog | |
1507 | 827df9f3 | balrog | case 0x244: /* CM_CLKSEL2_CORE */ |
1508 | 827df9f3 | balrog | s->clksel[2] = value & 0x00fffffc; |
1509 | 827df9f3 | balrog | /* TODO update clocks */
|
1510 | 827df9f3 | balrog | break;
|
1511 | 827df9f3 | balrog | |
1512 | 827df9f3 | balrog | case 0x248: /* CM_CLKSTCTRL_CORE */ |
1513 | 827df9f3 | balrog | s->clkctrl[1] = value & 0x7; |
1514 | 827df9f3 | balrog | break;
|
1515 | 827df9f3 | balrog | |
1516 | 827df9f3 | balrog | case 0x2a0: /* PM_WKEN1_CORE */ |
1517 | 827df9f3 | balrog | s->wken[0] = value & 0x04667ff8; |
1518 | 827df9f3 | balrog | break;
|
1519 | 827df9f3 | balrog | case 0x2a4: /* PM_WKEN2_CORE */ |
1520 | 827df9f3 | balrog | s->wken[1] = value & 0x00000005; |
1521 | 827df9f3 | balrog | break;
|
1522 | 827df9f3 | balrog | |
1523 | 827df9f3 | balrog | case 0x2b0: /* PM_WKST1_CORE */ |
1524 | 827df9f3 | balrog | s->wkst[0] &= ~value;
|
1525 | 827df9f3 | balrog | break;
|
1526 | 827df9f3 | balrog | case 0x2b4: /* PM_WKST2_CORE */ |
1527 | 827df9f3 | balrog | s->wkst[1] &= ~value;
|
1528 | 827df9f3 | balrog | break;
|
1529 | 827df9f3 | balrog | |
1530 | 827df9f3 | balrog | case 0x2e0: /* PM_PWSTCTRL_CORE */ |
1531 | 827df9f3 | balrog | s->power[1] = (value & 0x00fc3f) | (1 << 2); |
1532 | 827df9f3 | balrog | break;
|
1533 | 827df9f3 | balrog | |
1534 | 827df9f3 | balrog | case 0x300: /* CM_FCLKEN_GFX */ |
1535 | 827df9f3 | balrog | s->clken[5] = value & 6; |
1536 | 827df9f3 | balrog | /* TODO update clocks */
|
1537 | 827df9f3 | balrog | break;
|
1538 | 827df9f3 | balrog | case 0x310: /* CM_ICLKEN_GFX */ |
1539 | 827df9f3 | balrog | s->clken[6] = value & 1; |
1540 | 827df9f3 | balrog | /* TODO update clocks */
|
1541 | 827df9f3 | balrog | break;
|
1542 | 827df9f3 | balrog | case 0x340: /* CM_CLKSEL_GFX */ |
1543 | 827df9f3 | balrog | s->clksel[3] = value & 7; |
1544 | 827df9f3 | balrog | /* TODO update clocks */
|
1545 | 827df9f3 | balrog | break;
|
1546 | 827df9f3 | balrog | case 0x348: /* CM_CLKSTCTRL_GFX */ |
1547 | 827df9f3 | balrog | s->clkctrl[2] = value & 1; |
1548 | 827df9f3 | balrog | break;
|
1549 | 827df9f3 | balrog | case 0x350: /* RM_RSTCTRL_GFX */ |
1550 | 827df9f3 | balrog | s->rstctrl[0] = value & 1; |
1551 | 827df9f3 | balrog | /* TODO: reset */
|
1552 | 827df9f3 | balrog | break;
|
1553 | 827df9f3 | balrog | case 0x358: /* RM_RSTST_GFX */ |
1554 | 827df9f3 | balrog | s->rst[1] &= ~value;
|
1555 | 827df9f3 | balrog | break;
|
1556 | 827df9f3 | balrog | case 0x3c8: /* PM_WKDEP_GFX */ |
1557 | 827df9f3 | balrog | s->wkup[1] = value & 0x13; |
1558 | 827df9f3 | balrog | break;
|
1559 | 827df9f3 | balrog | case 0x3e0: /* PM_PWSTCTRL_GFX */ |
1560 | 827df9f3 | balrog | s->power[2] = (value & 0x00c0f) | (3 << 2); |
1561 | 827df9f3 | balrog | break;
|
1562 | 827df9f3 | balrog | |
1563 | 827df9f3 | balrog | case 0x400: /* CM_FCLKEN_WKUP */ |
1564 | 827df9f3 | balrog | s->clken[7] = value & 0xd; |
1565 | 827df9f3 | balrog | /* TODO update clocks */
|
1566 | 827df9f3 | balrog | break;
|
1567 | 827df9f3 | balrog | case 0x410: /* CM_ICLKEN_WKUP */ |
1568 | 827df9f3 | balrog | s->clken[8] = value & 0x3f; |
1569 | 827df9f3 | balrog | /* TODO update clocks */
|
1570 | 827df9f3 | balrog | break;
|
1571 | 827df9f3 | balrog | case 0x430: /* CM_AUTOIDLE_WKUP */ |
1572 | 827df9f3 | balrog | s->clkidle[4] = value & 0x0000003f; |
1573 | 827df9f3 | balrog | /* TODO update clocks */
|
1574 | 827df9f3 | balrog | break;
|
1575 | 827df9f3 | balrog | case 0x440: /* CM_CLKSEL_WKUP */ |
1576 | 827df9f3 | balrog | s->clksel[4] = value & 3; |
1577 | 827df9f3 | balrog | /* TODO update clocks */
|
1578 | 827df9f3 | balrog | break;
|
1579 | 827df9f3 | balrog | case 0x450: /* RM_RSTCTRL_WKUP */ |
1580 | 827df9f3 | balrog | /* TODO: reset */
|
1581 | 827df9f3 | balrog | if (value & 2) |
1582 | 827df9f3 | balrog | qemu_system_reset_request(); |
1583 | 827df9f3 | balrog | break;
|
1584 | 827df9f3 | balrog | case 0x454: /* RM_RSTTIME_WKUP */ |
1585 | 827df9f3 | balrog | s->rsttime_wkup = value & 0x1fff;
|
1586 | 827df9f3 | balrog | break;
|
1587 | 827df9f3 | balrog | case 0x458: /* RM_RSTST_WKUP */ |
1588 | 827df9f3 | balrog | s->rst[2] &= ~value;
|
1589 | 827df9f3 | balrog | break;
|
1590 | 827df9f3 | balrog | case 0x4a0: /* PM_WKEN_WKUP */ |
1591 | 827df9f3 | balrog | s->wken[2] = value & 0x00000005; |
1592 | 827df9f3 | balrog | break;
|
1593 | 827df9f3 | balrog | case 0x4b0: /* PM_WKST_WKUP */ |
1594 | 827df9f3 | balrog | s->wkst[2] &= ~value;
|
1595 | 827df9f3 | balrog | break;
|
1596 | 827df9f3 | balrog | |
1597 | 827df9f3 | balrog | case 0x500: /* CM_CLKEN_PLL */ |
1598 | 51fec3cc | balrog | if (value & 0xffffff30) |
1599 | 51fec3cc | balrog | fprintf(stderr, "%s: write 0s in CM_CLKEN_PLL for "
|
1600 | 51fec3cc | balrog | "future compatiblity\n", __FUNCTION__);
|
1601 | 51fec3cc | balrog | if ((s->clken[9] ^ value) & 0xcc) { |
1602 | 51fec3cc | balrog | s->clken[9] &= ~0xcc; |
1603 | 51fec3cc | balrog | s->clken[9] |= value & 0xcc; |
1604 | 51fec3cc | balrog | omap_prcm_apll_update(s); |
1605 | 51fec3cc | balrog | } |
1606 | 51fec3cc | balrog | if ((s->clken[9] ^ value) & 3) { |
1607 | 51fec3cc | balrog | s->clken[9] &= ~3; |
1608 | 51fec3cc | balrog | s->clken[9] |= value & 3; |
1609 | 51fec3cc | balrog | omap_prcm_dpll_update(s); |
1610 | 51fec3cc | balrog | } |
1611 | 827df9f3 | balrog | break;
|
1612 | 827df9f3 | balrog | case 0x530: /* CM_AUTOIDLE_PLL */ |
1613 | 827df9f3 | balrog | s->clkidle[5] = value & 0x000000cf; |
1614 | 827df9f3 | balrog | /* TODO update clocks */
|
1615 | 827df9f3 | balrog | break;
|
1616 | 827df9f3 | balrog | case 0x540: /* CM_CLKSEL1_PLL */ |
1617 | 51fec3cc | balrog | if (value & 0xfc4000d7) |
1618 | 51fec3cc | balrog | fprintf(stderr, "%s: write 0s in CM_CLKSEL1_PLL for "
|
1619 | 51fec3cc | balrog | "future compatiblity\n", __FUNCTION__);
|
1620 | 51fec3cc | balrog | if ((s->clksel[5] ^ value) & 0x003fff00) { |
1621 | 51fec3cc | balrog | s->clksel[5] = value & 0x03bfff28; |
1622 | 51fec3cc | balrog | omap_prcm_dpll_update(s); |
1623 | 51fec3cc | balrog | } |
1624 | 51fec3cc | balrog | /* TODO update the other clocks */
|
1625 | 51fec3cc | balrog | |
1626 | 827df9f3 | balrog | s->clksel[5] = value & 0x03bfff28; |
1627 | 827df9f3 | balrog | break;
|
1628 | 827df9f3 | balrog | case 0x544: /* CM_CLKSEL2_PLL */ |
1629 | 51fec3cc | balrog | if (value & ~3) |
1630 | 51fec3cc | balrog | fprintf(stderr, "%s: write 0s in CM_CLKSEL2_PLL[31:2] for "
|
1631 | 51fec3cc | balrog | "future compatiblity\n", __FUNCTION__);
|
1632 | 51fec3cc | balrog | if (s->clksel[6] != (value & 3)) { |
1633 | 51fec3cc | balrog | s->clksel[6] = value & 3; |
1634 | 51fec3cc | balrog | omap_prcm_dpll_update(s); |
1635 | 51fec3cc | balrog | } |
1636 | 827df9f3 | balrog | break;
|
1637 | 827df9f3 | balrog | |
1638 | 827df9f3 | balrog | case 0x800: /* CM_FCLKEN_DSP */ |
1639 | 827df9f3 | balrog | s->clken[10] = value & 0x501; |
1640 | 827df9f3 | balrog | /* TODO update clocks */
|
1641 | 827df9f3 | balrog | break;
|
1642 | 827df9f3 | balrog | case 0x810: /* CM_ICLKEN_DSP */ |
1643 | 827df9f3 | balrog | s->clken[11] = value & 0x2; |
1644 | 827df9f3 | balrog | /* TODO update clocks */
|
1645 | 827df9f3 | balrog | break;
|
1646 | 827df9f3 | balrog | case 0x830: /* CM_AUTOIDLE_DSP */ |
1647 | 827df9f3 | balrog | s->clkidle[6] = value & 0x2; |
1648 | 827df9f3 | balrog | /* TODO update clocks */
|
1649 | 827df9f3 | balrog | break;
|
1650 | 827df9f3 | balrog | case 0x840: /* CM_CLKSEL_DSP */ |
1651 | 827df9f3 | balrog | s->clksel[7] = value & 0x3fff; |
1652 | 827df9f3 | balrog | /* TODO update clocks */
|
1653 | 827df9f3 | balrog | break;
|
1654 | 827df9f3 | balrog | case 0x848: /* CM_CLKSTCTRL_DSP */ |
1655 | 827df9f3 | balrog | s->clkctrl[3] = value & 0x101; |
1656 | 827df9f3 | balrog | break;
|
1657 | 827df9f3 | balrog | case 0x850: /* RM_RSTCTRL_DSP */ |
1658 | 827df9f3 | balrog | /* TODO: reset */
|
1659 | 827df9f3 | balrog | break;
|
1660 | 827df9f3 | balrog | case 0x858: /* RM_RSTST_DSP */ |
1661 | 827df9f3 | balrog | s->rst[3] &= ~value;
|
1662 | 827df9f3 | balrog | break;
|
1663 | 827df9f3 | balrog | case 0x8c8: /* PM_WKDEP_DSP */ |
1664 | 827df9f3 | balrog | s->wkup[2] = value & 0x13; |
1665 | 827df9f3 | balrog | break;
|
1666 | 827df9f3 | balrog | case 0x8e0: /* PM_PWSTCTRL_DSP */ |
1667 | 827df9f3 | balrog | s->power[3] = (value & 0x03017) | (3 << 2); |
1668 | 827df9f3 | balrog | break;
|
1669 | 827df9f3 | balrog | |
1670 | 827df9f3 | balrog | case 0x8f0: /* PRCM_IRQSTATUS_DSP */ |
1671 | 827df9f3 | balrog | s->irqst[1] &= ~value;
|
1672 | 827df9f3 | balrog | omap_prcm_int_update(s, 1);
|
1673 | 827df9f3 | balrog | break;
|
1674 | 827df9f3 | balrog | case 0x8f4: /* PRCM_IRQENABLE_DSP */ |
1675 | 827df9f3 | balrog | s->irqen[1] = value & 0x7; |
1676 | 827df9f3 | balrog | omap_prcm_int_update(s, 1);
|
1677 | 827df9f3 | balrog | break;
|
1678 | 827df9f3 | balrog | |
1679 | 827df9f3 | balrog | case 0x8f8: /* PRCM_IRQSTATUS_IVA */ |
1680 | 827df9f3 | balrog | s->irqst[2] &= ~value;
|
1681 | 827df9f3 | balrog | omap_prcm_int_update(s, 2);
|
1682 | 827df9f3 | balrog | break;
|
1683 | 827df9f3 | balrog | case 0x8fc: /* PRCM_IRQENABLE_IVA */ |
1684 | 827df9f3 | balrog | s->irqen[2] = value & 0x7; |
1685 | 827df9f3 | balrog | omap_prcm_int_update(s, 2);
|
1686 | 827df9f3 | balrog | break;
|
1687 | 827df9f3 | balrog | |
1688 | 827df9f3 | balrog | default:
|
1689 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
1690 | 827df9f3 | balrog | return;
|
1691 | 827df9f3 | balrog | } |
1692 | 827df9f3 | balrog | } |
1693 | 827df9f3 | balrog | |
1694 | d60efc6b | Blue Swirl | static CPUReadMemoryFunc * const omap_prcm_readfn[] = { |
1695 | 827df9f3 | balrog | omap_badwidth_read32, |
1696 | 827df9f3 | balrog | omap_badwidth_read32, |
1697 | 827df9f3 | balrog | omap_prcm_read, |
1698 | 827df9f3 | balrog | }; |
1699 | 827df9f3 | balrog | |
1700 | d60efc6b | Blue Swirl | static CPUWriteMemoryFunc * const omap_prcm_writefn[] = { |
1701 | 827df9f3 | balrog | omap_badwidth_write32, |
1702 | 827df9f3 | balrog | omap_badwidth_write32, |
1703 | 827df9f3 | balrog | omap_prcm_write, |
1704 | 827df9f3 | balrog | }; |
1705 | 827df9f3 | balrog | |
1706 | 827df9f3 | balrog | static void omap_prcm_reset(struct omap_prcm_s *s) |
1707 | 827df9f3 | balrog | { |
1708 | 827df9f3 | balrog | s->sysconfig = 0;
|
1709 | 827df9f3 | balrog | s->irqst[0] = 0; |
1710 | 827df9f3 | balrog | s->irqst[1] = 0; |
1711 | 827df9f3 | balrog | s->irqst[2] = 0; |
1712 | 827df9f3 | balrog | s->irqen[0] = 0; |
1713 | 827df9f3 | balrog | s->irqen[1] = 0; |
1714 | 827df9f3 | balrog | s->irqen[2] = 0; |
1715 | 827df9f3 | balrog | s->voltctrl = 0x1040;
|
1716 | 827df9f3 | balrog | s->ev = 0x14;
|
1717 | 827df9f3 | balrog | s->evtime[0] = 0; |
1718 | 827df9f3 | balrog | s->evtime[1] = 0; |
1719 | 827df9f3 | balrog | s->clkctrl[0] = 0; |
1720 | 827df9f3 | balrog | s->clkctrl[1] = 0; |
1721 | 827df9f3 | balrog | s->clkctrl[2] = 0; |
1722 | 827df9f3 | balrog | s->clkctrl[3] = 0; |
1723 | 827df9f3 | balrog | s->clken[1] = 7; |
1724 | 827df9f3 | balrog | s->clken[3] = 7; |
1725 | 827df9f3 | balrog | s->clken[4] = 0; |
1726 | 827df9f3 | balrog | s->clken[5] = 0; |
1727 | 827df9f3 | balrog | s->clken[6] = 0; |
1728 | 827df9f3 | balrog | s->clken[7] = 0xc; |
1729 | 827df9f3 | balrog | s->clken[8] = 0x3e; |
1730 | 827df9f3 | balrog | s->clken[9] = 0x0d; |
1731 | 827df9f3 | balrog | s->clken[10] = 0; |
1732 | 827df9f3 | balrog | s->clken[11] = 0; |
1733 | 827df9f3 | balrog | s->clkidle[0] = 0; |
1734 | 827df9f3 | balrog | s->clkidle[2] = 7; |
1735 | 827df9f3 | balrog | s->clkidle[3] = 0; |
1736 | 827df9f3 | balrog | s->clkidle[4] = 0; |
1737 | 827df9f3 | balrog | s->clkidle[5] = 0x0c; |
1738 | 827df9f3 | balrog | s->clkidle[6] = 0; |
1739 | 827df9f3 | balrog | s->clksel[0] = 0x01; |
1740 | 827df9f3 | balrog | s->clksel[1] = 0x02100121; |
1741 | 827df9f3 | balrog | s->clksel[2] = 0x00000000; |
1742 | 827df9f3 | balrog | s->clksel[3] = 0x01; |
1743 | 827df9f3 | balrog | s->clksel[4] = 0; |
1744 | 827df9f3 | balrog | s->clksel[7] = 0x0121; |
1745 | 827df9f3 | balrog | s->wkup[0] = 0x15; |
1746 | 827df9f3 | balrog | s->wkup[1] = 0x13; |
1747 | 827df9f3 | balrog | s->wkup[2] = 0x13; |
1748 | 827df9f3 | balrog | s->wken[0] = 0x04667ff8; |
1749 | 827df9f3 | balrog | s->wken[1] = 0x00000005; |
1750 | 827df9f3 | balrog | s->wken[2] = 5; |
1751 | 827df9f3 | balrog | s->wkst[0] = 0; |
1752 | 827df9f3 | balrog | s->wkst[1] = 0; |
1753 | 827df9f3 | balrog | s->wkst[2] = 0; |
1754 | 827df9f3 | balrog | s->power[0] = 0x00c; |
1755 | 827df9f3 | balrog | s->power[1] = 4; |
1756 | 827df9f3 | balrog | s->power[2] = 0x0000c; |
1757 | 827df9f3 | balrog | s->power[3] = 0x14; |
1758 | 827df9f3 | balrog | s->rstctrl[0] = 1; |
1759 | 827df9f3 | balrog | s->rst[3] = 1; |
1760 | 51fec3cc | balrog | omap_prcm_apll_update(s); |
1761 | 51fec3cc | balrog | omap_prcm_dpll_update(s); |
1762 | 827df9f3 | balrog | } |
1763 | 827df9f3 | balrog | |
1764 | 827df9f3 | balrog | static void omap_prcm_coldreset(struct omap_prcm_s *s) |
1765 | 827df9f3 | balrog | { |
1766 | 827df9f3 | balrog | s->setuptime[0] = 0; |
1767 | 827df9f3 | balrog | s->setuptime[1] = 0; |
1768 | 827df9f3 | balrog | memset(&s->scratch, 0, sizeof(s->scratch)); |
1769 | 827df9f3 | balrog | s->rst[0] = 0x01; |
1770 | 827df9f3 | balrog | s->rst[1] = 0x00; |
1771 | 827df9f3 | balrog | s->rst[2] = 0x01; |
1772 | 827df9f3 | balrog | s->clken[0] = 0; |
1773 | 827df9f3 | balrog | s->clken[2] = 0; |
1774 | 827df9f3 | balrog | s->clkidle[1] = 0; |
1775 | 827df9f3 | balrog | s->clksel[5] = 0; |
1776 | 827df9f3 | balrog | s->clksel[6] = 2; |
1777 | 827df9f3 | balrog | s->clksrc[0] = 0x43; |
1778 | 827df9f3 | balrog | s->clkout[0] = 0x0303; |
1779 | 827df9f3 | balrog | s->clkemul[0] = 0; |
1780 | 827df9f3 | balrog | s->clkpol[0] = 0x100; |
1781 | 827df9f3 | balrog | s->rsttime_wkup = 0x1002;
|
1782 | 827df9f3 | balrog | |
1783 | 827df9f3 | balrog | omap_prcm_reset(s); |
1784 | 827df9f3 | balrog | } |
1785 | 827df9f3 | balrog | |
1786 | c1ff227b | cmchao | static struct omap_prcm_s *omap_prcm_init(struct omap_target_agent_s *ta, |
1787 | 827df9f3 | balrog | qemu_irq mpu_int, qemu_irq dsp_int, qemu_irq iva_int, |
1788 | 827df9f3 | balrog | struct omap_mpu_state_s *mpu)
|
1789 | 827df9f3 | balrog | { |
1790 | 827df9f3 | balrog | int iomemtype;
|
1791 | 827df9f3 | balrog | struct omap_prcm_s *s = (struct omap_prcm_s *) |
1792 | 827df9f3 | balrog | qemu_mallocz(sizeof(struct omap_prcm_s)); |
1793 | 827df9f3 | balrog | |
1794 | 827df9f3 | balrog | s->irq[0] = mpu_int;
|
1795 | 827df9f3 | balrog | s->irq[1] = dsp_int;
|
1796 | 827df9f3 | balrog | s->irq[2] = iva_int;
|
1797 | 827df9f3 | balrog | s->mpu = mpu; |
1798 | 827df9f3 | balrog | omap_prcm_coldreset(s); |
1799 | 827df9f3 | balrog | |
1800 | 1eed09cb | Avi Kivity | iomemtype = l4_register_io_memory(omap_prcm_readfn, |
1801 | 827df9f3 | balrog | omap_prcm_writefn, s); |
1802 | 8da3ff18 | pbrook | omap_l4_attach(ta, 0, iomemtype);
|
1803 | 827df9f3 | balrog | omap_l4_attach(ta, 1, iomemtype);
|
1804 | 827df9f3 | balrog | |
1805 | 827df9f3 | balrog | return s;
|
1806 | 827df9f3 | balrog | } |
1807 | 827df9f3 | balrog | |
1808 | 827df9f3 | balrog | /* System and Pinout control */
|
1809 | 827df9f3 | balrog | struct omap_sysctl_s {
|
1810 | 827df9f3 | balrog | struct omap_mpu_state_s *mpu;
|
1811 | 827df9f3 | balrog | |
1812 | 827df9f3 | balrog | uint32_t sysconfig; |
1813 | 827df9f3 | balrog | uint32_t devconfig; |
1814 | 827df9f3 | balrog | uint32_t psaconfig; |
1815 | 827df9f3 | balrog | uint32_t padconf[0x45];
|
1816 | 827df9f3 | balrog | uint8_t obs; |
1817 | 827df9f3 | balrog | uint32_t msuspendmux[5];
|
1818 | 827df9f3 | balrog | }; |
1819 | 827df9f3 | balrog | |
1820 | c227f099 | Anthony Liguori | static uint32_t omap_sysctl_read8(void *opaque, target_phys_addr_t addr) |
1821 | f451387a | balrog | { |
1822 | f451387a | balrog | |
1823 | f451387a | balrog | struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque; |
1824 | f451387a | balrog | int pad_offset, byte_offset;
|
1825 | f451387a | balrog | int value;
|
1826 | f451387a | balrog | |
1827 | 8da3ff18 | pbrook | switch (addr) {
|
1828 | f451387a | balrog | case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP */ |
1829 | 8da3ff18 | pbrook | pad_offset = (addr - 0x30) >> 2; |
1830 | 8da3ff18 | pbrook | byte_offset = (addr - 0x30) & (4 - 1); |
1831 | f451387a | balrog | |
1832 | f451387a | balrog | value = s->padconf[pad_offset]; |
1833 | f451387a | balrog | value = (value >> (byte_offset * 8)) & 0xff; |
1834 | f451387a | balrog | |
1835 | f451387a | balrog | return value;
|
1836 | f451387a | balrog | |
1837 | f451387a | balrog | default:
|
1838 | f451387a | balrog | break;
|
1839 | f451387a | balrog | } |
1840 | f451387a | balrog | |
1841 | f451387a | balrog | OMAP_BAD_REG(addr); |
1842 | f451387a | balrog | return 0; |
1843 | f451387a | balrog | } |
1844 | f451387a | balrog | |
1845 | c227f099 | Anthony Liguori | static uint32_t omap_sysctl_read(void *opaque, target_phys_addr_t addr) |
1846 | 827df9f3 | balrog | { |
1847 | 827df9f3 | balrog | struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque; |
1848 | 827df9f3 | balrog | |
1849 | 8da3ff18 | pbrook | switch (addr) {
|
1850 | 827df9f3 | balrog | case 0x000: /* CONTROL_REVISION */ |
1851 | 827df9f3 | balrog | return 0x20; |
1852 | 827df9f3 | balrog | |
1853 | 827df9f3 | balrog | case 0x010: /* CONTROL_SYSCONFIG */ |
1854 | 827df9f3 | balrog | return s->sysconfig;
|
1855 | 827df9f3 | balrog | |
1856 | 827df9f3 | balrog | case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP */ |
1857 | 8da3ff18 | pbrook | return s->padconf[(addr - 0x30) >> 2]; |
1858 | 827df9f3 | balrog | |
1859 | 827df9f3 | balrog | case 0x270: /* CONTROL_DEBOBS */ |
1860 | 827df9f3 | balrog | return s->obs;
|
1861 | 827df9f3 | balrog | |
1862 | 827df9f3 | balrog | case 0x274: /* CONTROL_DEVCONF */ |
1863 | 827df9f3 | balrog | return s->devconfig;
|
1864 | 827df9f3 | balrog | |
1865 | 827df9f3 | balrog | case 0x28c: /* CONTROL_EMU_SUPPORT */ |
1866 | 827df9f3 | balrog | return 0; |
1867 | 827df9f3 | balrog | |
1868 | 827df9f3 | balrog | case 0x290: /* CONTROL_MSUSPENDMUX_0 */ |
1869 | 827df9f3 | balrog | return s->msuspendmux[0]; |
1870 | 827df9f3 | balrog | case 0x294: /* CONTROL_MSUSPENDMUX_1 */ |
1871 | 827df9f3 | balrog | return s->msuspendmux[1]; |
1872 | 827df9f3 | balrog | case 0x298: /* CONTROL_MSUSPENDMUX_2 */ |
1873 | 827df9f3 | balrog | return s->msuspendmux[2]; |
1874 | 827df9f3 | balrog | case 0x29c: /* CONTROL_MSUSPENDMUX_3 */ |
1875 | 827df9f3 | balrog | return s->msuspendmux[3]; |
1876 | 827df9f3 | balrog | case 0x2a0: /* CONTROL_MSUSPENDMUX_4 */ |
1877 | 827df9f3 | balrog | return s->msuspendmux[4]; |
1878 | 827df9f3 | balrog | case 0x2a4: /* CONTROL_MSUSPENDMUX_5 */ |
1879 | 827df9f3 | balrog | return 0; |
1880 | 827df9f3 | balrog | |
1881 | 827df9f3 | balrog | case 0x2b8: /* CONTROL_PSA_CTRL */ |
1882 | 827df9f3 | balrog | return s->psaconfig;
|
1883 | 827df9f3 | balrog | case 0x2bc: /* CONTROL_PSA_CMD */ |
1884 | 827df9f3 | balrog | case 0x2c0: /* CONTROL_PSA_VALUE */ |
1885 | 827df9f3 | balrog | return 0; |
1886 | 827df9f3 | balrog | |
1887 | 827df9f3 | balrog | case 0x2b0: /* CONTROL_SEC_CTRL */ |
1888 | 827df9f3 | balrog | return 0x800000f1; |
1889 | 827df9f3 | balrog | case 0x2d0: /* CONTROL_SEC_EMU */ |
1890 | 827df9f3 | balrog | return 0x80000015; |
1891 | 827df9f3 | balrog | case 0x2d4: /* CONTROL_SEC_TAP */ |
1892 | 827df9f3 | balrog | return 0x8000007f; |
1893 | 827df9f3 | balrog | case 0x2b4: /* CONTROL_SEC_TEST */ |
1894 | 827df9f3 | balrog | case 0x2f0: /* CONTROL_SEC_STATUS */ |
1895 | 827df9f3 | balrog | case 0x2f4: /* CONTROL_SEC_ERR_STATUS */ |
1896 | 827df9f3 | balrog | /* Secure mode is not present on general-pusrpose device. Outside
|
1897 | 827df9f3 | balrog | * secure mode these values cannot be read or written. */
|
1898 | 827df9f3 | balrog | return 0; |
1899 | 827df9f3 | balrog | |
1900 | 827df9f3 | balrog | case 0x2d8: /* CONTROL_OCM_RAM_PERM */ |
1901 | 827df9f3 | balrog | return 0xff; |
1902 | 827df9f3 | balrog | case 0x2dc: /* CONTROL_OCM_PUB_RAM_ADD */ |
1903 | 827df9f3 | balrog | case 0x2e0: /* CONTROL_EXT_SEC_RAM_START_ADD */ |
1904 | 827df9f3 | balrog | case 0x2e4: /* CONTROL_EXT_SEC_RAM_STOP_ADD */ |
1905 | 827df9f3 | balrog | /* No secure mode so no Extended Secure RAM present. */
|
1906 | 827df9f3 | balrog | return 0; |
1907 | 827df9f3 | balrog | |
1908 | 827df9f3 | balrog | case 0x2f8: /* CONTROL_STATUS */ |
1909 | 827df9f3 | balrog | /* Device Type => General-purpose */
|
1910 | 827df9f3 | balrog | return 0x0300; |
1911 | 827df9f3 | balrog | case 0x2fc: /* CONTROL_GENERAL_PURPOSE_STATUS */ |
1912 | 827df9f3 | balrog | |
1913 | 827df9f3 | balrog | case 0x300: /* CONTROL_RPUB_KEY_H_0 */ |
1914 | 827df9f3 | balrog | case 0x304: /* CONTROL_RPUB_KEY_H_1 */ |
1915 | 827df9f3 | balrog | case 0x308: /* CONTROL_RPUB_KEY_H_2 */ |
1916 | 827df9f3 | balrog | case 0x30c: /* CONTROL_RPUB_KEY_H_3 */ |
1917 | 827df9f3 | balrog | return 0xdecafbad; |
1918 | 827df9f3 | balrog | |
1919 | 827df9f3 | balrog | case 0x310: /* CONTROL_RAND_KEY_0 */ |
1920 | 827df9f3 | balrog | case 0x314: /* CONTROL_RAND_KEY_1 */ |
1921 | 827df9f3 | balrog | case 0x318: /* CONTROL_RAND_KEY_2 */ |
1922 | 827df9f3 | balrog | case 0x31c: /* CONTROL_RAND_KEY_3 */ |
1923 | 827df9f3 | balrog | case 0x320: /* CONTROL_CUST_KEY_0 */ |
1924 | 827df9f3 | balrog | case 0x324: /* CONTROL_CUST_KEY_1 */ |
1925 | 827df9f3 | balrog | case 0x330: /* CONTROL_TEST_KEY_0 */ |
1926 | 827df9f3 | balrog | case 0x334: /* CONTROL_TEST_KEY_1 */ |
1927 | 827df9f3 | balrog | case 0x338: /* CONTROL_TEST_KEY_2 */ |
1928 | 827df9f3 | balrog | case 0x33c: /* CONTROL_TEST_KEY_3 */ |
1929 | 827df9f3 | balrog | case 0x340: /* CONTROL_TEST_KEY_4 */ |
1930 | 827df9f3 | balrog | case 0x344: /* CONTROL_TEST_KEY_5 */ |
1931 | 827df9f3 | balrog | case 0x348: /* CONTROL_TEST_KEY_6 */ |
1932 | 827df9f3 | balrog | case 0x34c: /* CONTROL_TEST_KEY_7 */ |
1933 | 827df9f3 | balrog | case 0x350: /* CONTROL_TEST_KEY_8 */ |
1934 | 827df9f3 | balrog | case 0x354: /* CONTROL_TEST_KEY_9 */ |
1935 | 827df9f3 | balrog | /* Can only be accessed in secure mode and when C_FieldAccEnable
|
1936 | 827df9f3 | balrog | * bit is set in CONTROL_SEC_CTRL.
|
1937 | 827df9f3 | balrog | * TODO: otherwise an interconnect access error is generated. */
|
1938 | 827df9f3 | balrog | return 0; |
1939 | 827df9f3 | balrog | } |
1940 | 827df9f3 | balrog | |
1941 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
1942 | 827df9f3 | balrog | return 0; |
1943 | 827df9f3 | balrog | } |
1944 | 827df9f3 | balrog | |
1945 | c227f099 | Anthony Liguori | static void omap_sysctl_write8(void *opaque, target_phys_addr_t addr, |
1946 | f451387a | balrog | uint32_t value) |
1947 | f451387a | balrog | { |
1948 | f451387a | balrog | struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque; |
1949 | f451387a | balrog | int pad_offset, byte_offset;
|
1950 | f451387a | balrog | int prev_value;
|
1951 | f451387a | balrog | |
1952 | 8da3ff18 | pbrook | switch (addr) {
|
1953 | f451387a | balrog | case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP */ |
1954 | 8da3ff18 | pbrook | pad_offset = (addr - 0x30) >> 2; |
1955 | 8da3ff18 | pbrook | byte_offset = (addr - 0x30) & (4 - 1); |
1956 | f451387a | balrog | |
1957 | f451387a | balrog | prev_value = s->padconf[pad_offset]; |
1958 | f451387a | balrog | prev_value &= ~(0xff << (byte_offset * 8)); |
1959 | f451387a | balrog | prev_value |= ((value & 0x1f1f1f1f) << (byte_offset * 8)) & 0x1f1f1f1f; |
1960 | f451387a | balrog | s->padconf[pad_offset] = prev_value; |
1961 | f451387a | balrog | break;
|
1962 | f451387a | balrog | |
1963 | f451387a | balrog | default:
|
1964 | f451387a | balrog | OMAP_BAD_REG(addr); |
1965 | f451387a | balrog | break;
|
1966 | f451387a | balrog | } |
1967 | f451387a | balrog | } |
1968 | f451387a | balrog | |
1969 | c227f099 | Anthony Liguori | static void omap_sysctl_write(void *opaque, target_phys_addr_t addr, |
1970 | 827df9f3 | balrog | uint32_t value) |
1971 | 827df9f3 | balrog | { |
1972 | 827df9f3 | balrog | struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque; |
1973 | 827df9f3 | balrog | |
1974 | 8da3ff18 | pbrook | switch (addr) {
|
1975 | 827df9f3 | balrog | case 0x000: /* CONTROL_REVISION */ |
1976 | 827df9f3 | balrog | case 0x2a4: /* CONTROL_MSUSPENDMUX_5 */ |
1977 | 827df9f3 | balrog | case 0x2c0: /* CONTROL_PSA_VALUE */ |
1978 | 827df9f3 | balrog | case 0x2f8: /* CONTROL_STATUS */ |
1979 | 827df9f3 | balrog | case 0x2fc: /* CONTROL_GENERAL_PURPOSE_STATUS */ |
1980 | 827df9f3 | balrog | case 0x300: /* CONTROL_RPUB_KEY_H_0 */ |
1981 | 827df9f3 | balrog | case 0x304: /* CONTROL_RPUB_KEY_H_1 */ |
1982 | 827df9f3 | balrog | case 0x308: /* CONTROL_RPUB_KEY_H_2 */ |
1983 | 827df9f3 | balrog | case 0x30c: /* CONTROL_RPUB_KEY_H_3 */ |
1984 | 827df9f3 | balrog | case 0x310: /* CONTROL_RAND_KEY_0 */ |
1985 | 827df9f3 | balrog | case 0x314: /* CONTROL_RAND_KEY_1 */ |
1986 | 827df9f3 | balrog | case 0x318: /* CONTROL_RAND_KEY_2 */ |
1987 | 827df9f3 | balrog | case 0x31c: /* CONTROL_RAND_KEY_3 */ |
1988 | 827df9f3 | balrog | case 0x320: /* CONTROL_CUST_KEY_0 */ |
1989 | 827df9f3 | balrog | case 0x324: /* CONTROL_CUST_KEY_1 */ |
1990 | 827df9f3 | balrog | case 0x330: /* CONTROL_TEST_KEY_0 */ |
1991 | 827df9f3 | balrog | case 0x334: /* CONTROL_TEST_KEY_1 */ |
1992 | 827df9f3 | balrog | case 0x338: /* CONTROL_TEST_KEY_2 */ |
1993 | 827df9f3 | balrog | case 0x33c: /* CONTROL_TEST_KEY_3 */ |
1994 | 827df9f3 | balrog | case 0x340: /* CONTROL_TEST_KEY_4 */ |
1995 | 827df9f3 | balrog | case 0x344: /* CONTROL_TEST_KEY_5 */ |
1996 | 827df9f3 | balrog | case 0x348: /* CONTROL_TEST_KEY_6 */ |
1997 | 827df9f3 | balrog | case 0x34c: /* CONTROL_TEST_KEY_7 */ |
1998 | 827df9f3 | balrog | case 0x350: /* CONTROL_TEST_KEY_8 */ |
1999 | 827df9f3 | balrog | case 0x354: /* CONTROL_TEST_KEY_9 */ |
2000 | 827df9f3 | balrog | OMAP_RO_REG(addr); |
2001 | 827df9f3 | balrog | return;
|
2002 | 827df9f3 | balrog | |
2003 | 827df9f3 | balrog | case 0x010: /* CONTROL_SYSCONFIG */ |
2004 | 827df9f3 | balrog | s->sysconfig = value & 0x1e;
|
2005 | 827df9f3 | balrog | break;
|
2006 | 827df9f3 | balrog | |
2007 | 827df9f3 | balrog | case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP */ |
2008 | 827df9f3 | balrog | /* XXX: should check constant bits */
|
2009 | 8da3ff18 | pbrook | s->padconf[(addr - 0x30) >> 2] = value & 0x1f1f1f1f; |
2010 | 827df9f3 | balrog | break;
|
2011 | 827df9f3 | balrog | |
2012 | 827df9f3 | balrog | case 0x270: /* CONTROL_DEBOBS */ |
2013 | 827df9f3 | balrog | s->obs = value & 0xff;
|
2014 | 827df9f3 | balrog | break;
|
2015 | 827df9f3 | balrog | |
2016 | 827df9f3 | balrog | case 0x274: /* CONTROL_DEVCONF */ |
2017 | 827df9f3 | balrog | s->devconfig = value & 0xffffc7ff;
|
2018 | 827df9f3 | balrog | break;
|
2019 | 827df9f3 | balrog | |
2020 | 827df9f3 | balrog | case 0x28c: /* CONTROL_EMU_SUPPORT */ |
2021 | 827df9f3 | balrog | break;
|
2022 | 827df9f3 | balrog | |
2023 | 827df9f3 | balrog | case 0x290: /* CONTROL_MSUSPENDMUX_0 */ |
2024 | 827df9f3 | balrog | s->msuspendmux[0] = value & 0x3fffffff; |
2025 | 827df9f3 | balrog | break;
|
2026 | 827df9f3 | balrog | case 0x294: /* CONTROL_MSUSPENDMUX_1 */ |
2027 | 827df9f3 | balrog | s->msuspendmux[1] = value & 0x3fffffff; |
2028 | 827df9f3 | balrog | break;
|
2029 | 827df9f3 | balrog | case 0x298: /* CONTROL_MSUSPENDMUX_2 */ |
2030 | 827df9f3 | balrog | s->msuspendmux[2] = value & 0x3fffffff; |
2031 | 827df9f3 | balrog | break;
|
2032 | 827df9f3 | balrog | case 0x29c: /* CONTROL_MSUSPENDMUX_3 */ |
2033 | 827df9f3 | balrog | s->msuspendmux[3] = value & 0x3fffffff; |
2034 | 827df9f3 | balrog | break;
|
2035 | 827df9f3 | balrog | case 0x2a0: /* CONTROL_MSUSPENDMUX_4 */ |
2036 | 827df9f3 | balrog | s->msuspendmux[4] = value & 0x3fffffff; |
2037 | 827df9f3 | balrog | break;
|
2038 | 827df9f3 | balrog | |
2039 | 827df9f3 | balrog | case 0x2b8: /* CONTROL_PSA_CTRL */ |
2040 | 827df9f3 | balrog | s->psaconfig = value & 0x1c;
|
2041 | 827df9f3 | balrog | s->psaconfig |= (value & 0x20) ? 2 : 1; |
2042 | 827df9f3 | balrog | break;
|
2043 | 827df9f3 | balrog | case 0x2bc: /* CONTROL_PSA_CMD */ |
2044 | 827df9f3 | balrog | break;
|
2045 | 827df9f3 | balrog | |
2046 | 827df9f3 | balrog | case 0x2b0: /* CONTROL_SEC_CTRL */ |
2047 | 827df9f3 | balrog | case 0x2b4: /* CONTROL_SEC_TEST */ |
2048 | 827df9f3 | balrog | case 0x2d0: /* CONTROL_SEC_EMU */ |
2049 | 827df9f3 | balrog | case 0x2d4: /* CONTROL_SEC_TAP */ |
2050 | 827df9f3 | balrog | case 0x2d8: /* CONTROL_OCM_RAM_PERM */ |
2051 | 827df9f3 | balrog | case 0x2dc: /* CONTROL_OCM_PUB_RAM_ADD */ |
2052 | 827df9f3 | balrog | case 0x2e0: /* CONTROL_EXT_SEC_RAM_START_ADD */ |
2053 | 827df9f3 | balrog | case 0x2e4: /* CONTROL_EXT_SEC_RAM_STOP_ADD */ |
2054 | 827df9f3 | balrog | case 0x2f0: /* CONTROL_SEC_STATUS */ |
2055 | 827df9f3 | balrog | case 0x2f4: /* CONTROL_SEC_ERR_STATUS */ |
2056 | 827df9f3 | balrog | break;
|
2057 | 827df9f3 | balrog | |
2058 | 827df9f3 | balrog | default:
|
2059 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
2060 | 827df9f3 | balrog | return;
|
2061 | 827df9f3 | balrog | } |
2062 | 827df9f3 | balrog | } |
2063 | 827df9f3 | balrog | |
2064 | d60efc6b | Blue Swirl | static CPUReadMemoryFunc * const omap_sysctl_readfn[] = { |
2065 | f451387a | balrog | omap_sysctl_read8, |
2066 | 827df9f3 | balrog | omap_badwidth_read32, /* TODO */
|
2067 | 827df9f3 | balrog | omap_sysctl_read, |
2068 | 827df9f3 | balrog | }; |
2069 | 827df9f3 | balrog | |
2070 | d60efc6b | Blue Swirl | static CPUWriteMemoryFunc * const omap_sysctl_writefn[] = { |
2071 | f451387a | balrog | omap_sysctl_write8, |
2072 | 827df9f3 | balrog | omap_badwidth_write32, /* TODO */
|
2073 | 827df9f3 | balrog | omap_sysctl_write, |
2074 | 827df9f3 | balrog | }; |
2075 | 827df9f3 | balrog | |
2076 | 827df9f3 | balrog | static void omap_sysctl_reset(struct omap_sysctl_s *s) |
2077 | 827df9f3 | balrog | { |
2078 | 827df9f3 | balrog | /* (power-on reset) */
|
2079 | 827df9f3 | balrog | s->sysconfig = 0;
|
2080 | 827df9f3 | balrog | s->obs = 0;
|
2081 | 827df9f3 | balrog | s->devconfig = 0x0c000000;
|
2082 | 827df9f3 | balrog | s->msuspendmux[0] = 0x00000000; |
2083 | 827df9f3 | balrog | s->msuspendmux[1] = 0x00000000; |
2084 | 827df9f3 | balrog | s->msuspendmux[2] = 0x00000000; |
2085 | 827df9f3 | balrog | s->msuspendmux[3] = 0x00000000; |
2086 | 827df9f3 | balrog | s->msuspendmux[4] = 0x00000000; |
2087 | 827df9f3 | balrog | s->psaconfig = 1;
|
2088 | 827df9f3 | balrog | |
2089 | 827df9f3 | balrog | s->padconf[0x00] = 0x000f0f0f; |
2090 | 827df9f3 | balrog | s->padconf[0x01] = 0x00000000; |
2091 | 827df9f3 | balrog | s->padconf[0x02] = 0x00000000; |
2092 | 827df9f3 | balrog | s->padconf[0x03] = 0x00000000; |
2093 | 827df9f3 | balrog | s->padconf[0x04] = 0x00000000; |
2094 | 827df9f3 | balrog | s->padconf[0x05] = 0x00000000; |
2095 | 827df9f3 | balrog | s->padconf[0x06] = 0x00000000; |
2096 | 827df9f3 | balrog | s->padconf[0x07] = 0x00000000; |
2097 | 827df9f3 | balrog | s->padconf[0x08] = 0x08080800; |
2098 | 827df9f3 | balrog | s->padconf[0x09] = 0x08080808; |
2099 | 827df9f3 | balrog | s->padconf[0x0a] = 0x08080808; |
2100 | 827df9f3 | balrog | s->padconf[0x0b] = 0x08080808; |
2101 | 827df9f3 | balrog | s->padconf[0x0c] = 0x08080808; |
2102 | 827df9f3 | balrog | s->padconf[0x0d] = 0x08080800; |
2103 | 827df9f3 | balrog | s->padconf[0x0e] = 0x08080808; |
2104 | 827df9f3 | balrog | s->padconf[0x0f] = 0x08080808; |
2105 | 827df9f3 | balrog | s->padconf[0x10] = 0x18181808; /* | 0x07070700 if SBoot3 */ |
2106 | 827df9f3 | balrog | s->padconf[0x11] = 0x18181818; /* | 0x07070707 if SBoot3 */ |
2107 | 827df9f3 | balrog | s->padconf[0x12] = 0x18181818; /* | 0x07070707 if SBoot3 */ |
2108 | 827df9f3 | balrog | s->padconf[0x13] = 0x18181818; /* | 0x07070707 if SBoot3 */ |
2109 | 827df9f3 | balrog | s->padconf[0x14] = 0x18181818; /* | 0x00070707 if SBoot3 */ |
2110 | 827df9f3 | balrog | s->padconf[0x15] = 0x18181818; |
2111 | 827df9f3 | balrog | s->padconf[0x16] = 0x18181818; /* | 0x07000000 if SBoot3 */ |
2112 | 827df9f3 | balrog | s->padconf[0x17] = 0x1f001f00; |
2113 | 827df9f3 | balrog | s->padconf[0x18] = 0x1f1f1f1f; |
2114 | 827df9f3 | balrog | s->padconf[0x19] = 0x00000000; |
2115 | 827df9f3 | balrog | s->padconf[0x1a] = 0x1f180000; |
2116 | 827df9f3 | balrog | s->padconf[0x1b] = 0x00001f1f; |
2117 | 827df9f3 | balrog | s->padconf[0x1c] = 0x1f001f00; |
2118 | 827df9f3 | balrog | s->padconf[0x1d] = 0x00000000; |
2119 | 827df9f3 | balrog | s->padconf[0x1e] = 0x00000000; |
2120 | 827df9f3 | balrog | s->padconf[0x1f] = 0x08000000; |
2121 | 827df9f3 | balrog | s->padconf[0x20] = 0x08080808; |
2122 | 827df9f3 | balrog | s->padconf[0x21] = 0x08080808; |
2123 | 827df9f3 | balrog | s->padconf[0x22] = 0x0f080808; |
2124 | 827df9f3 | balrog | s->padconf[0x23] = 0x0f0f0f0f; |
2125 | 827df9f3 | balrog | s->padconf[0x24] = 0x000f0f0f; |
2126 | 827df9f3 | balrog | s->padconf[0x25] = 0x1f1f1f0f; |
2127 | 827df9f3 | balrog | s->padconf[0x26] = 0x080f0f1f; |
2128 | 827df9f3 | balrog | s->padconf[0x27] = 0x070f1808; |
2129 | 827df9f3 | balrog | s->padconf[0x28] = 0x0f070707; |
2130 | 827df9f3 | balrog | s->padconf[0x29] = 0x000f0f1f; |
2131 | 827df9f3 | balrog | s->padconf[0x2a] = 0x0f0f0f1f; |
2132 | 827df9f3 | balrog | s->padconf[0x2b] = 0x08000000; |
2133 | 827df9f3 | balrog | s->padconf[0x2c] = 0x0000001f; |
2134 | 827df9f3 | balrog | s->padconf[0x2d] = 0x0f0f1f00; |
2135 | 827df9f3 | balrog | s->padconf[0x2e] = 0x1f1f0f0f; |
2136 | 827df9f3 | balrog | s->padconf[0x2f] = 0x0f1f1f1f; |
2137 | 827df9f3 | balrog | s->padconf[0x30] = 0x0f0f0f0f; |
2138 | 827df9f3 | balrog | s->padconf[0x31] = 0x0f1f0f1f; |
2139 | 827df9f3 | balrog | s->padconf[0x32] = 0x0f0f0f0f; |
2140 | 827df9f3 | balrog | s->padconf[0x33] = 0x0f1f0f1f; |
2141 | 827df9f3 | balrog | s->padconf[0x34] = 0x1f1f0f0f; |
2142 | 827df9f3 | balrog | s->padconf[0x35] = 0x0f0f1f1f; |
2143 | 827df9f3 | balrog | s->padconf[0x36] = 0x0f0f1f0f; |
2144 | 827df9f3 | balrog | s->padconf[0x37] = 0x0f0f0f0f; |
2145 | 827df9f3 | balrog | s->padconf[0x38] = 0x1f18180f; |
2146 | 827df9f3 | balrog | s->padconf[0x39] = 0x1f1f1f1f; |
2147 | 827df9f3 | balrog | s->padconf[0x3a] = 0x00001f1f; |
2148 | 827df9f3 | balrog | s->padconf[0x3b] = 0x00000000; |
2149 | 827df9f3 | balrog | s->padconf[0x3c] = 0x00000000; |
2150 | 827df9f3 | balrog | s->padconf[0x3d] = 0x0f0f0f0f; |
2151 | 827df9f3 | balrog | s->padconf[0x3e] = 0x18000f0f; |
2152 | 827df9f3 | balrog | s->padconf[0x3f] = 0x00070000; |
2153 | 827df9f3 | balrog | s->padconf[0x40] = 0x00000707; |
2154 | 827df9f3 | balrog | s->padconf[0x41] = 0x0f1f0700; |
2155 | 827df9f3 | balrog | s->padconf[0x42] = 0x1f1f070f; |
2156 | 827df9f3 | balrog | s->padconf[0x43] = 0x0008081f; |
2157 | 827df9f3 | balrog | s->padconf[0x44] = 0x00000800; |
2158 | 827df9f3 | balrog | } |
2159 | 827df9f3 | balrog | |
2160 | c1ff227b | cmchao | static struct omap_sysctl_s *omap_sysctl_init(struct omap_target_agent_s *ta, |
2161 | 827df9f3 | balrog | omap_clk iclk, struct omap_mpu_state_s *mpu)
|
2162 | 827df9f3 | balrog | { |
2163 | 827df9f3 | balrog | int iomemtype;
|
2164 | 827df9f3 | balrog | struct omap_sysctl_s *s = (struct omap_sysctl_s *) |
2165 | 827df9f3 | balrog | qemu_mallocz(sizeof(struct omap_sysctl_s)); |
2166 | 827df9f3 | balrog | |
2167 | 827df9f3 | balrog | s->mpu = mpu; |
2168 | 827df9f3 | balrog | omap_sysctl_reset(s); |
2169 | 827df9f3 | balrog | |
2170 | 1eed09cb | Avi Kivity | iomemtype = l4_register_io_memory(omap_sysctl_readfn, |
2171 | 827df9f3 | balrog | omap_sysctl_writefn, s); |
2172 | 8da3ff18 | pbrook | omap_l4_attach(ta, 0, iomemtype);
|
2173 | 827df9f3 | balrog | |
2174 | 827df9f3 | balrog | return s;
|
2175 | 827df9f3 | balrog | } |
2176 | 827df9f3 | balrog | |
2177 | 827df9f3 | balrog | /* General chip reset */
|
2178 | 827df9f3 | balrog | static void omap2_mpu_reset(void *opaque) |
2179 | 827df9f3 | balrog | { |
2180 | 827df9f3 | balrog | struct omap_mpu_state_s *mpu = (struct omap_mpu_state_s *) opaque; |
2181 | 827df9f3 | balrog | |
2182 | 827df9f3 | balrog | omap_inth_reset(mpu->ih[0]);
|
2183 | 827df9f3 | balrog | omap_dma_reset(mpu->dma); |
2184 | 827df9f3 | balrog | omap_prcm_reset(mpu->prcm); |
2185 | 827df9f3 | balrog | omap_sysctl_reset(mpu->sysc); |
2186 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[0]);
|
2187 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[1]);
|
2188 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[2]);
|
2189 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[3]);
|
2190 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[4]);
|
2191 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[5]);
|
2192 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[6]);
|
2193 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[7]);
|
2194 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[8]);
|
2195 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[9]);
|
2196 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[10]);
|
2197 | 827df9f3 | balrog | omap_gp_timer_reset(mpu->gptimer[11]);
|
2198 | 011d87d0 | cmchao | omap_synctimer_reset(mpu->synctimer); |
2199 | 827df9f3 | balrog | omap_sdrc_reset(mpu->sdrc); |
2200 | 827df9f3 | balrog | omap_gpmc_reset(mpu->gpmc); |
2201 | 827df9f3 | balrog | omap_dss_reset(mpu->dss); |
2202 | 827df9f3 | balrog | omap_uart_reset(mpu->uart[0]);
|
2203 | 827df9f3 | balrog | omap_uart_reset(mpu->uart[1]);
|
2204 | 827df9f3 | balrog | omap_uart_reset(mpu->uart[2]);
|
2205 | 827df9f3 | balrog | omap_mmc_reset(mpu->mmc); |
2206 | 827df9f3 | balrog | omap_gpif_reset(mpu->gpif); |
2207 | 827df9f3 | balrog | omap_mcspi_reset(mpu->mcspi[0]);
|
2208 | 827df9f3 | balrog | omap_mcspi_reset(mpu->mcspi[1]);
|
2209 | 827df9f3 | balrog | omap_i2c_reset(mpu->i2c[0]);
|
2210 | 827df9f3 | balrog | omap_i2c_reset(mpu->i2c[1]);
|
2211 | 827df9f3 | balrog | cpu_reset(mpu->env); |
2212 | 827df9f3 | balrog | } |
2213 | 827df9f3 | balrog | |
2214 | 827df9f3 | balrog | static int omap2_validate_addr(struct omap_mpu_state_s *s, |
2215 | c227f099 | Anthony Liguori | target_phys_addr_t addr) |
2216 | 827df9f3 | balrog | { |
2217 | 827df9f3 | balrog | return 1; |
2218 | 827df9f3 | balrog | } |
2219 | 827df9f3 | balrog | |
2220 | 827df9f3 | balrog | static const struct dma_irq_map omap2_dma_irq_map[] = { |
2221 | 827df9f3 | balrog | { 0, OMAP_INT_24XX_SDMA_IRQ0 },
|
2222 | 827df9f3 | balrog | { 0, OMAP_INT_24XX_SDMA_IRQ1 },
|
2223 | 827df9f3 | balrog | { 0, OMAP_INT_24XX_SDMA_IRQ2 },
|
2224 | 827df9f3 | balrog | { 0, OMAP_INT_24XX_SDMA_IRQ3 },
|
2225 | 827df9f3 | balrog | }; |
2226 | 827df9f3 | balrog | |
2227 | 827df9f3 | balrog | struct omap_mpu_state_s *omap2420_mpu_init(unsigned long sdram_size, |
2228 | 3023f332 | aliguori | const char *core) |
2229 | 827df9f3 | balrog | { |
2230 | 827df9f3 | balrog | struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) |
2231 | 827df9f3 | balrog | qemu_mallocz(sizeof(struct omap_mpu_state_s)); |
2232 | c227f099 | Anthony Liguori | ram_addr_t sram_base, q2_base; |
2233 | 827df9f3 | balrog | qemu_irq *cpu_irq; |
2234 | 827df9f3 | balrog | qemu_irq dma_irqs[4];
|
2235 | 827df9f3 | balrog | omap_clk gpio_clks[4];
|
2236 | 751c6a17 | Gerd Hoffmann | DriveInfo *dinfo; |
2237 | 827df9f3 | balrog | int i;
|
2238 | 827df9f3 | balrog | |
2239 | 827df9f3 | balrog | /* Core */
|
2240 | 827df9f3 | balrog | s->mpu_model = omap2420; |
2241 | 827df9f3 | balrog | s->env = cpu_init(core ?: "arm1136-r2");
|
2242 | 827df9f3 | balrog | if (!s->env) {
|
2243 | 827df9f3 | balrog | fprintf(stderr, "Unable to find CPU definition\n");
|
2244 | 827df9f3 | balrog | exit(1);
|
2245 | 827df9f3 | balrog | } |
2246 | 827df9f3 | balrog | s->sdram_size = sdram_size; |
2247 | 827df9f3 | balrog | s->sram_size = OMAP242X_SRAM_SIZE; |
2248 | 827df9f3 | balrog | |
2249 | 827df9f3 | balrog | s->wakeup = qemu_allocate_irqs(omap_mpu_wakeup, s, 1)[0]; |
2250 | 827df9f3 | balrog | |
2251 | 827df9f3 | balrog | /* Clocks */
|
2252 | 827df9f3 | balrog | omap_clk_init(s); |
2253 | 827df9f3 | balrog | |
2254 | 827df9f3 | balrog | /* Memory-mapped stuff */
|
2255 | 827df9f3 | balrog | cpu_register_physical_memory(OMAP2_Q2_BASE, s->sdram_size, |
2256 | 1724f049 | Alex Williamson | (q2_base = qemu_ram_alloc(NULL, "omap2.dram", |
2257 | 1724f049 | Alex Williamson | s->sdram_size)) | IO_MEM_RAM); |
2258 | 827df9f3 | balrog | cpu_register_physical_memory(OMAP2_SRAM_BASE, s->sram_size, |
2259 | 1724f049 | Alex Williamson | (sram_base = qemu_ram_alloc(NULL, "omap2.sram", |
2260 | 1724f049 | Alex Williamson | s->sram_size)) | IO_MEM_RAM); |
2261 | 827df9f3 | balrog | |
2262 | 827df9f3 | balrog | s->l4 = omap_l4_init(OMAP2_L4_BASE, 54);
|
2263 | 827df9f3 | balrog | |
2264 | 827df9f3 | balrog | /* Actually mapped at any 2K boundary in the ARM11 private-peripheral if */
|
2265 | 827df9f3 | balrog | cpu_irq = arm_pic_init_cpu(s->env); |
2266 | 827df9f3 | balrog | s->ih[0] = omap2_inth_init(0x480fe000, 0x1000, 3, &s->irq[0], |
2267 | 827df9f3 | balrog | cpu_irq[ARM_PIC_CPU_IRQ], cpu_irq[ARM_PIC_CPU_FIQ], |
2268 | 827df9f3 | balrog | omap_findclk(s, "mpu_intc_fclk"),
|
2269 | 827df9f3 | balrog | omap_findclk(s, "mpu_intc_iclk"));
|
2270 | 827df9f3 | balrog | |
2271 | 827df9f3 | balrog | s->prcm = omap_prcm_init(omap_l4tao(s->l4, 3),
|
2272 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_PRCM_MPU_IRQ], NULL, NULL, s); |
2273 | 827df9f3 | balrog | |
2274 | 827df9f3 | balrog | s->sysc = omap_sysctl_init(omap_l4tao(s->l4, 1),
|
2275 | 827df9f3 | balrog | omap_findclk(s, "omapctrl_iclk"), s);
|
2276 | 827df9f3 | balrog | |
2277 | 827df9f3 | balrog | for (i = 0; i < 4; i ++) |
2278 | 827df9f3 | balrog | dma_irqs[i] = |
2279 | 827df9f3 | balrog | s->irq[omap2_dma_irq_map[i].ih][omap2_dma_irq_map[i].intr]; |
2280 | 827df9f3 | balrog | s->dma = omap_dma4_init(0x48056000, dma_irqs, s, 256, 32, |
2281 | 827df9f3 | balrog | omap_findclk(s, "sdma_iclk"),
|
2282 | 827df9f3 | balrog | omap_findclk(s, "sdma_fclk"));
|
2283 | 827df9f3 | balrog | s->port->addr_valid = omap2_validate_addr; |
2284 | 827df9f3 | balrog | |
2285 | afbb5194 | balrog | /* Register SDRAM and SRAM ports for fast DMA transfers. */
|
2286 | afbb5194 | balrog | soc_dma_port_add_mem_ram(s->dma, q2_base, OMAP2_Q2_BASE, s->sdram_size); |
2287 | afbb5194 | balrog | soc_dma_port_add_mem_ram(s->dma, sram_base, OMAP2_SRAM_BASE, s->sram_size); |
2288 | afbb5194 | balrog | |
2289 | 827df9f3 | balrog | s->uart[0] = omap2_uart_init(omap_l4ta(s->l4, 19), |
2290 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_UART1_IRQ],
|
2291 | 827df9f3 | balrog | omap_findclk(s, "uart1_fclk"),
|
2292 | 827df9f3 | balrog | omap_findclk(s, "uart1_iclk"),
|
2293 | 827df9f3 | balrog | s->drq[OMAP24XX_DMA_UART1_TX], |
2294 | 6a8aabd3 | Stefan Weil | s->drq[OMAP24XX_DMA_UART1_RX], |
2295 | 6a8aabd3 | Stefan Weil | "uart1",
|
2296 | 6a8aabd3 | Stefan Weil | serial_hds[0]);
|
2297 | 827df9f3 | balrog | s->uart[1] = omap2_uart_init(omap_l4ta(s->l4, 20), |
2298 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_UART2_IRQ],
|
2299 | 827df9f3 | balrog | omap_findclk(s, "uart2_fclk"),
|
2300 | 827df9f3 | balrog | omap_findclk(s, "uart2_iclk"),
|
2301 | 827df9f3 | balrog | s->drq[OMAP24XX_DMA_UART2_TX], |
2302 | 827df9f3 | balrog | s->drq[OMAP24XX_DMA_UART2_RX], |
2303 | 6a8aabd3 | Stefan Weil | "uart2",
|
2304 | b9d38e95 | Blue Swirl | serial_hds[0] ? serial_hds[1] : NULL); |
2305 | 827df9f3 | balrog | s->uart[2] = omap2_uart_init(omap_l4ta(s->l4, 21), |
2306 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_UART3_IRQ],
|
2307 | 827df9f3 | balrog | omap_findclk(s, "uart3_fclk"),
|
2308 | 827df9f3 | balrog | omap_findclk(s, "uart3_iclk"),
|
2309 | 827df9f3 | balrog | s->drq[OMAP24XX_DMA_UART3_TX], |
2310 | 827df9f3 | balrog | s->drq[OMAP24XX_DMA_UART3_RX], |
2311 | 6a8aabd3 | Stefan Weil | "uart3",
|
2312 | b9d38e95 | Blue Swirl | serial_hds[0] && serial_hds[1] ? serial_hds[2] : NULL); |
2313 | 827df9f3 | balrog | |
2314 | 827df9f3 | balrog | s->gptimer[0] = omap_gp_timer_init(omap_l4ta(s->l4, 7), |
2315 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER1],
|
2316 | 827df9f3 | balrog | omap_findclk(s, "wu_gpt1_clk"),
|
2317 | 827df9f3 | balrog | omap_findclk(s, "wu_l4_iclk"));
|
2318 | 827df9f3 | balrog | s->gptimer[1] = omap_gp_timer_init(omap_l4ta(s->l4, 8), |
2319 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER2],
|
2320 | 827df9f3 | balrog | omap_findclk(s, "core_gpt2_clk"),
|
2321 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2322 | 827df9f3 | balrog | s->gptimer[2] = omap_gp_timer_init(omap_l4ta(s->l4, 22), |
2323 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER3],
|
2324 | 827df9f3 | balrog | omap_findclk(s, "core_gpt3_clk"),
|
2325 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2326 | 827df9f3 | balrog | s->gptimer[3] = omap_gp_timer_init(omap_l4ta(s->l4, 23), |
2327 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER4],
|
2328 | 827df9f3 | balrog | omap_findclk(s, "core_gpt4_clk"),
|
2329 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2330 | 827df9f3 | balrog | s->gptimer[4] = omap_gp_timer_init(omap_l4ta(s->l4, 24), |
2331 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER5],
|
2332 | 827df9f3 | balrog | omap_findclk(s, "core_gpt5_clk"),
|
2333 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2334 | 827df9f3 | balrog | s->gptimer[5] = omap_gp_timer_init(omap_l4ta(s->l4, 25), |
2335 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER6],
|
2336 | 827df9f3 | balrog | omap_findclk(s, "core_gpt6_clk"),
|
2337 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2338 | 827df9f3 | balrog | s->gptimer[6] = omap_gp_timer_init(omap_l4ta(s->l4, 26), |
2339 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER7],
|
2340 | 827df9f3 | balrog | omap_findclk(s, "core_gpt7_clk"),
|
2341 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2342 | 827df9f3 | balrog | s->gptimer[7] = omap_gp_timer_init(omap_l4ta(s->l4, 27), |
2343 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER8],
|
2344 | 827df9f3 | balrog | omap_findclk(s, "core_gpt8_clk"),
|
2345 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2346 | 827df9f3 | balrog | s->gptimer[8] = omap_gp_timer_init(omap_l4ta(s->l4, 28), |
2347 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER9],
|
2348 | 827df9f3 | balrog | omap_findclk(s, "core_gpt9_clk"),
|
2349 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2350 | 827df9f3 | balrog | s->gptimer[9] = omap_gp_timer_init(omap_l4ta(s->l4, 29), |
2351 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER10],
|
2352 | 827df9f3 | balrog | omap_findclk(s, "core_gpt10_clk"),
|
2353 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2354 | 827df9f3 | balrog | s->gptimer[10] = omap_gp_timer_init(omap_l4ta(s->l4, 30), |
2355 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER11],
|
2356 | 827df9f3 | balrog | omap_findclk(s, "core_gpt11_clk"),
|
2357 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2358 | 827df9f3 | balrog | s->gptimer[11] = omap_gp_timer_init(omap_l4ta(s->l4, 31), |
2359 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_GPTIMER12],
|
2360 | 827df9f3 | balrog | omap_findclk(s, "core_gpt12_clk"),
|
2361 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2362 | 827df9f3 | balrog | |
2363 | 827df9f3 | balrog | omap_tap_init(omap_l4ta(s->l4, 2), s);
|
2364 | 827df9f3 | balrog | |
2365 | 011d87d0 | cmchao | s->synctimer = omap_synctimer_init(omap_l4tao(s->l4, 2), s,
|
2366 | 827df9f3 | balrog | omap_findclk(s, "clk32-kHz"),
|
2367 | 827df9f3 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2368 | 827df9f3 | balrog | |
2369 | 827df9f3 | balrog | s->i2c[0] = omap2_i2c_init(omap_l4tao(s->l4, 5), |
2370 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_I2C1_IRQ],
|
2371 | 827df9f3 | balrog | &s->drq[OMAP24XX_DMA_I2C1_TX], |
2372 | 827df9f3 | balrog | omap_findclk(s, "i2c1.fclk"),
|
2373 | 827df9f3 | balrog | omap_findclk(s, "i2c1.iclk"));
|
2374 | 827df9f3 | balrog | s->i2c[1] = omap2_i2c_init(omap_l4tao(s->l4, 6), |
2375 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_I2C2_IRQ],
|
2376 | 827df9f3 | balrog | &s->drq[OMAP24XX_DMA_I2C2_TX], |
2377 | 827df9f3 | balrog | omap_findclk(s, "i2c2.fclk"),
|
2378 | 827df9f3 | balrog | omap_findclk(s, "i2c2.iclk"));
|
2379 | 827df9f3 | balrog | |
2380 | 827df9f3 | balrog | gpio_clks[0] = omap_findclk(s, "gpio1_dbclk"); |
2381 | 827df9f3 | balrog | gpio_clks[1] = omap_findclk(s, "gpio2_dbclk"); |
2382 | 827df9f3 | balrog | gpio_clks[2] = omap_findclk(s, "gpio3_dbclk"); |
2383 | 827df9f3 | balrog | gpio_clks[3] = omap_findclk(s, "gpio4_dbclk"); |
2384 | 827df9f3 | balrog | s->gpif = omap2_gpio_init(omap_l4ta(s->l4, 3),
|
2385 | 827df9f3 | balrog | &s->irq[0][OMAP_INT_24XX_GPIO_BANK1],
|
2386 | 827df9f3 | balrog | gpio_clks, omap_findclk(s, "gpio_iclk"), 4); |
2387 | 827df9f3 | balrog | |
2388 | 827df9f3 | balrog | s->sdrc = omap_sdrc_init(0x68009000);
|
2389 | 827df9f3 | balrog | s->gpmc = omap_gpmc_init(0x6800a000, s->irq[0][OMAP_INT_24XX_GPMC_IRQ]); |
2390 | 827df9f3 | balrog | |
2391 | 751c6a17 | Gerd Hoffmann | dinfo = drive_get(IF_SD, 0, 0); |
2392 | 751c6a17 | Gerd Hoffmann | if (!dinfo) {
|
2393 | 827df9f3 | balrog | fprintf(stderr, "qemu: missing SecureDigital device\n");
|
2394 | 827df9f3 | balrog | exit(1);
|
2395 | 827df9f3 | balrog | } |
2396 | 751c6a17 | Gerd Hoffmann | s->mmc = omap2_mmc_init(omap_l4tao(s->l4, 9), dinfo->bdrv,
|
2397 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_MMC_IRQ],
|
2398 | 827df9f3 | balrog | &s->drq[OMAP24XX_DMA_MMC1_TX], |
2399 | 827df9f3 | balrog | omap_findclk(s, "mmc_fclk"), omap_findclk(s, "mmc_iclk")); |
2400 | 827df9f3 | balrog | |
2401 | 827df9f3 | balrog | s->mcspi[0] = omap_mcspi_init(omap_l4ta(s->l4, 35), 4, |
2402 | 99570a40 | balrog | s->irq[0][OMAP_INT_24XX_MCSPI1_IRQ],
|
2403 | 827df9f3 | balrog | &s->drq[OMAP24XX_DMA_SPI1_TX0], |
2404 | 827df9f3 | balrog | omap_findclk(s, "spi1_fclk"),
|
2405 | 827df9f3 | balrog | omap_findclk(s, "spi1_iclk"));
|
2406 | 827df9f3 | balrog | s->mcspi[1] = omap_mcspi_init(omap_l4ta(s->l4, 36), 2, |
2407 | 99570a40 | balrog | s->irq[0][OMAP_INT_24XX_MCSPI2_IRQ],
|
2408 | 827df9f3 | balrog | &s->drq[OMAP24XX_DMA_SPI2_TX0], |
2409 | 827df9f3 | balrog | omap_findclk(s, "spi2_fclk"),
|
2410 | 827df9f3 | balrog | omap_findclk(s, "spi2_iclk"));
|
2411 | 827df9f3 | balrog | |
2412 | 3023f332 | aliguori | s->dss = omap_dss_init(omap_l4ta(s->l4, 10), 0x68000800, |
2413 | 827df9f3 | balrog | /* XXX wire M_IRQ_25, D_L2_IRQ_30 and I_IRQ_13 together */
|
2414 | 827df9f3 | balrog | s->irq[0][OMAP_INT_24XX_DSS_IRQ], s->drq[OMAP24XX_DMA_DSS],
|
2415 | 827df9f3 | balrog | omap_findclk(s, "dss_clk1"), omap_findclk(s, "dss_clk2"), |
2416 | 827df9f3 | balrog | omap_findclk(s, "dss_54m_clk"),
|
2417 | 827df9f3 | balrog | omap_findclk(s, "dss_l3_iclk"),
|
2418 | 827df9f3 | balrog | omap_findclk(s, "dss_l4_iclk"));
|
2419 | 827df9f3 | balrog | |
2420 | 54585ffe | balrog | omap_sti_init(omap_l4ta(s->l4, 18), 0x54000000, |
2421 | 54585ffe | balrog | s->irq[0][OMAP_INT_24XX_STI], omap_findclk(s, "emul_ck"), |
2422 | 54585ffe | balrog | serial_hds[0] && serial_hds[1] && serial_hds[2] ? |
2423 | b9d38e95 | Blue Swirl | serial_hds[3] : NULL); |
2424 | 54585ffe | balrog | |
2425 | 99570a40 | balrog | s->eac = omap_eac_init(omap_l4ta(s->l4, 32),
|
2426 | 99570a40 | balrog | s->irq[0][OMAP_INT_24XX_EAC_IRQ],
|
2427 | 99570a40 | balrog | /* Ten consecutive lines */
|
2428 | 99570a40 | balrog | &s->drq[OMAP24XX_DMA_EAC_AC_RD], |
2429 | 99570a40 | balrog | omap_findclk(s, "func_96m_clk"),
|
2430 | 99570a40 | balrog | omap_findclk(s, "core_l4_iclk"));
|
2431 | 99570a40 | balrog | |
2432 | 827df9f3 | balrog | /* All register mappings (includin those not currenlty implemented):
|
2433 | 827df9f3 | balrog | * SystemControlMod 48000000 - 48000fff
|
2434 | 827df9f3 | balrog | * SystemControlL4 48001000 - 48001fff
|
2435 | 827df9f3 | balrog | * 32kHz Timer Mod 48004000 - 48004fff
|
2436 | 827df9f3 | balrog | * 32kHz Timer L4 48005000 - 48005fff
|
2437 | 827df9f3 | balrog | * PRCM ModA 48008000 - 480087ff
|
2438 | 827df9f3 | balrog | * PRCM ModB 48008800 - 48008fff
|
2439 | 827df9f3 | balrog | * PRCM L4 48009000 - 48009fff
|
2440 | 827df9f3 | balrog | * TEST-BCM Mod 48012000 - 48012fff
|
2441 | 827df9f3 | balrog | * TEST-BCM L4 48013000 - 48013fff
|
2442 | 827df9f3 | balrog | * TEST-TAP Mod 48014000 - 48014fff
|
2443 | 827df9f3 | balrog | * TEST-TAP L4 48015000 - 48015fff
|
2444 | 827df9f3 | balrog | * GPIO1 Mod 48018000 - 48018fff
|
2445 | 827df9f3 | balrog | * GPIO Top 48019000 - 48019fff
|
2446 | 827df9f3 | balrog | * GPIO2 Mod 4801a000 - 4801afff
|
2447 | 827df9f3 | balrog | * GPIO L4 4801b000 - 4801bfff
|
2448 | 827df9f3 | balrog | * GPIO3 Mod 4801c000 - 4801cfff
|
2449 | 827df9f3 | balrog | * GPIO4 Mod 4801e000 - 4801efff
|
2450 | 827df9f3 | balrog | * WDTIMER1 Mod 48020000 - 48010fff
|
2451 | 827df9f3 | balrog | * WDTIMER Top 48021000 - 48011fff
|
2452 | 827df9f3 | balrog | * WDTIMER2 Mod 48022000 - 48012fff
|
2453 | 827df9f3 | balrog | * WDTIMER L4 48023000 - 48013fff
|
2454 | 827df9f3 | balrog | * WDTIMER3 Mod 48024000 - 48014fff
|
2455 | 827df9f3 | balrog | * WDTIMER3 L4 48025000 - 48015fff
|
2456 | 827df9f3 | balrog | * WDTIMER4 Mod 48026000 - 48016fff
|
2457 | 827df9f3 | balrog | * WDTIMER4 L4 48027000 - 48017fff
|
2458 | 827df9f3 | balrog | * GPTIMER1 Mod 48028000 - 48018fff
|
2459 | 827df9f3 | balrog | * GPTIMER1 L4 48029000 - 48019fff
|
2460 | 827df9f3 | balrog | * GPTIMER2 Mod 4802a000 - 4801afff
|
2461 | 827df9f3 | balrog | * GPTIMER2 L4 4802b000 - 4801bfff
|
2462 | 827df9f3 | balrog | * L4-Config AP 48040000 - 480407ff
|
2463 | 827df9f3 | balrog | * L4-Config IP 48040800 - 48040fff
|
2464 | 827df9f3 | balrog | * L4-Config LA 48041000 - 48041fff
|
2465 | 827df9f3 | balrog | * ARM11ETB Mod 48048000 - 48049fff
|
2466 | 827df9f3 | balrog | * ARM11ETB L4 4804a000 - 4804afff
|
2467 | 827df9f3 | balrog | * DISPLAY Top 48050000 - 480503ff
|
2468 | 827df9f3 | balrog | * DISPLAY DISPC 48050400 - 480507ff
|
2469 | 827df9f3 | balrog | * DISPLAY RFBI 48050800 - 48050bff
|
2470 | 827df9f3 | balrog | * DISPLAY VENC 48050c00 - 48050fff
|
2471 | 827df9f3 | balrog | * DISPLAY L4 48051000 - 48051fff
|
2472 | 827df9f3 | balrog | * CAMERA Top 48052000 - 480523ff
|
2473 | 827df9f3 | balrog | * CAMERA core 48052400 - 480527ff
|
2474 | 827df9f3 | balrog | * CAMERA DMA 48052800 - 48052bff
|
2475 | 827df9f3 | balrog | * CAMERA MMU 48052c00 - 48052fff
|
2476 | 827df9f3 | balrog | * CAMERA L4 48053000 - 48053fff
|
2477 | 827df9f3 | balrog | * SDMA Mod 48056000 - 48056fff
|
2478 | 827df9f3 | balrog | * SDMA L4 48057000 - 48057fff
|
2479 | 827df9f3 | balrog | * SSI Top 48058000 - 48058fff
|
2480 | 827df9f3 | balrog | * SSI GDD 48059000 - 48059fff
|
2481 | 827df9f3 | balrog | * SSI Port1 4805a000 - 4805afff
|
2482 | 827df9f3 | balrog | * SSI Port2 4805b000 - 4805bfff
|
2483 | 827df9f3 | balrog | * SSI L4 4805c000 - 4805cfff
|
2484 | 827df9f3 | balrog | * USB Mod 4805e000 - 480fefff
|
2485 | 827df9f3 | balrog | * USB L4 4805f000 - 480fffff
|
2486 | 827df9f3 | balrog | * WIN_TRACER1 Mod 48060000 - 48060fff
|
2487 | 827df9f3 | balrog | * WIN_TRACER1 L4 48061000 - 48061fff
|
2488 | 827df9f3 | balrog | * WIN_TRACER2 Mod 48062000 - 48062fff
|
2489 | 827df9f3 | balrog | * WIN_TRACER2 L4 48063000 - 48063fff
|
2490 | 827df9f3 | balrog | * WIN_TRACER3 Mod 48064000 - 48064fff
|
2491 | 827df9f3 | balrog | * WIN_TRACER3 L4 48065000 - 48065fff
|
2492 | 827df9f3 | balrog | * WIN_TRACER4 Top 48066000 - 480660ff
|
2493 | 827df9f3 | balrog | * WIN_TRACER4 ETT 48066100 - 480661ff
|
2494 | 827df9f3 | balrog | * WIN_TRACER4 WT 48066200 - 480662ff
|
2495 | 827df9f3 | balrog | * WIN_TRACER4 L4 48067000 - 48067fff
|
2496 | 827df9f3 | balrog | * XTI Mod 48068000 - 48068fff
|
2497 | 827df9f3 | balrog | * XTI L4 48069000 - 48069fff
|
2498 | 827df9f3 | balrog | * UART1 Mod 4806a000 - 4806afff
|
2499 | 827df9f3 | balrog | * UART1 L4 4806b000 - 4806bfff
|
2500 | 827df9f3 | balrog | * UART2 Mod 4806c000 - 4806cfff
|
2501 | 827df9f3 | balrog | * UART2 L4 4806d000 - 4806dfff
|
2502 | 827df9f3 | balrog | * UART3 Mod 4806e000 - 4806efff
|
2503 | 827df9f3 | balrog | * UART3 L4 4806f000 - 4806ffff
|
2504 | 827df9f3 | balrog | * I2C1 Mod 48070000 - 48070fff
|
2505 | 827df9f3 | balrog | * I2C1 L4 48071000 - 48071fff
|
2506 | 827df9f3 | balrog | * I2C2 Mod 48072000 - 48072fff
|
2507 | 827df9f3 | balrog | * I2C2 L4 48073000 - 48073fff
|
2508 | 827df9f3 | balrog | * McBSP1 Mod 48074000 - 48074fff
|
2509 | 827df9f3 | balrog | * McBSP1 L4 48075000 - 48075fff
|
2510 | 827df9f3 | balrog | * McBSP2 Mod 48076000 - 48076fff
|
2511 | 827df9f3 | balrog | * McBSP2 L4 48077000 - 48077fff
|
2512 | 827df9f3 | balrog | * GPTIMER3 Mod 48078000 - 48078fff
|
2513 | 827df9f3 | balrog | * GPTIMER3 L4 48079000 - 48079fff
|
2514 | 827df9f3 | balrog | * GPTIMER4 Mod 4807a000 - 4807afff
|
2515 | 827df9f3 | balrog | * GPTIMER4 L4 4807b000 - 4807bfff
|
2516 | 827df9f3 | balrog | * GPTIMER5 Mod 4807c000 - 4807cfff
|
2517 | 827df9f3 | balrog | * GPTIMER5 L4 4807d000 - 4807dfff
|
2518 | 827df9f3 | balrog | * GPTIMER6 Mod 4807e000 - 4807efff
|
2519 | 827df9f3 | balrog | * GPTIMER6 L4 4807f000 - 4807ffff
|
2520 | 827df9f3 | balrog | * GPTIMER7 Mod 48080000 - 48080fff
|
2521 | 827df9f3 | balrog | * GPTIMER7 L4 48081000 - 48081fff
|
2522 | 827df9f3 | balrog | * GPTIMER8 Mod 48082000 - 48082fff
|
2523 | 827df9f3 | balrog | * GPTIMER8 L4 48083000 - 48083fff
|
2524 | 827df9f3 | balrog | * GPTIMER9 Mod 48084000 - 48084fff
|
2525 | 827df9f3 | balrog | * GPTIMER9 L4 48085000 - 48085fff
|
2526 | 827df9f3 | balrog | * GPTIMER10 Mod 48086000 - 48086fff
|
2527 | 827df9f3 | balrog | * GPTIMER10 L4 48087000 - 48087fff
|
2528 | 827df9f3 | balrog | * GPTIMER11 Mod 48088000 - 48088fff
|
2529 | 827df9f3 | balrog | * GPTIMER11 L4 48089000 - 48089fff
|
2530 | 827df9f3 | balrog | * GPTIMER12 Mod 4808a000 - 4808afff
|
2531 | 827df9f3 | balrog | * GPTIMER12 L4 4808b000 - 4808bfff
|
2532 | 827df9f3 | balrog | * EAC Mod 48090000 - 48090fff
|
2533 | 827df9f3 | balrog | * EAC L4 48091000 - 48091fff
|
2534 | 827df9f3 | balrog | * FAC Mod 48092000 - 48092fff
|
2535 | 827df9f3 | balrog | * FAC L4 48093000 - 48093fff
|
2536 | 827df9f3 | balrog | * MAILBOX Mod 48094000 - 48094fff
|
2537 | 827df9f3 | balrog | * MAILBOX L4 48095000 - 48095fff
|
2538 | 827df9f3 | balrog | * SPI1 Mod 48098000 - 48098fff
|
2539 | 827df9f3 | balrog | * SPI1 L4 48099000 - 48099fff
|
2540 | 827df9f3 | balrog | * SPI2 Mod 4809a000 - 4809afff
|
2541 | 827df9f3 | balrog | * SPI2 L4 4809b000 - 4809bfff
|
2542 | 827df9f3 | balrog | * MMC/SDIO Mod 4809c000 - 4809cfff
|
2543 | 827df9f3 | balrog | * MMC/SDIO L4 4809d000 - 4809dfff
|
2544 | 827df9f3 | balrog | * MS_PRO Mod 4809e000 - 4809efff
|
2545 | 827df9f3 | balrog | * MS_PRO L4 4809f000 - 4809ffff
|
2546 | 827df9f3 | balrog | * RNG Mod 480a0000 - 480a0fff
|
2547 | 827df9f3 | balrog | * RNG L4 480a1000 - 480a1fff
|
2548 | 827df9f3 | balrog | * DES3DES Mod 480a2000 - 480a2fff
|
2549 | 827df9f3 | balrog | * DES3DES L4 480a3000 - 480a3fff
|
2550 | 827df9f3 | balrog | * SHA1MD5 Mod 480a4000 - 480a4fff
|
2551 | 827df9f3 | balrog | * SHA1MD5 L4 480a5000 - 480a5fff
|
2552 | 827df9f3 | balrog | * AES Mod 480a6000 - 480a6fff
|
2553 | 827df9f3 | balrog | * AES L4 480a7000 - 480a7fff
|
2554 | 827df9f3 | balrog | * PKA Mod 480a8000 - 480a9fff
|
2555 | 827df9f3 | balrog | * PKA L4 480aa000 - 480aafff
|
2556 | 827df9f3 | balrog | * MG Mod 480b0000 - 480b0fff
|
2557 | 827df9f3 | balrog | * MG L4 480b1000 - 480b1fff
|
2558 | 827df9f3 | balrog | * HDQ/1-wire Mod 480b2000 - 480b2fff
|
2559 | 827df9f3 | balrog | * HDQ/1-wire L4 480b3000 - 480b3fff
|
2560 | 827df9f3 | balrog | * MPU interrupt 480fe000 - 480fefff
|
2561 | 54585ffe | balrog | * STI channel base 54000000 - 5400ffff
|
2562 | 827df9f3 | balrog | * IVA RAM 5c000000 - 5c01ffff
|
2563 | 827df9f3 | balrog | * IVA ROM 5c020000 - 5c027fff
|
2564 | 827df9f3 | balrog | * IMG_BUF_A 5c040000 - 5c040fff
|
2565 | 827df9f3 | balrog | * IMG_BUF_B 5c042000 - 5c042fff
|
2566 | 827df9f3 | balrog | * VLCDS 5c048000 - 5c0487ff
|
2567 | 827df9f3 | balrog | * IMX_COEF 5c049000 - 5c04afff
|
2568 | 827df9f3 | balrog | * IMX_CMD 5c051000 - 5c051fff
|
2569 | 827df9f3 | balrog | * VLCDQ 5c053000 - 5c0533ff
|
2570 | 827df9f3 | balrog | * VLCDH 5c054000 - 5c054fff
|
2571 | 827df9f3 | balrog | * SEQ_CMD 5c055000 - 5c055fff
|
2572 | 827df9f3 | balrog | * IMX_REG 5c056000 - 5c0560ff
|
2573 | 827df9f3 | balrog | * VLCD_REG 5c056100 - 5c0561ff
|
2574 | 827df9f3 | balrog | * SEQ_REG 5c056200 - 5c0562ff
|
2575 | 827df9f3 | balrog | * IMG_BUF_REG 5c056300 - 5c0563ff
|
2576 | 827df9f3 | balrog | * SEQIRQ_REG 5c056400 - 5c0564ff
|
2577 | 827df9f3 | balrog | * OCP_REG 5c060000 - 5c060fff
|
2578 | 827df9f3 | balrog | * SYSC_REG 5c070000 - 5c070fff
|
2579 | 827df9f3 | balrog | * MMU_REG 5d000000 - 5d000fff
|
2580 | 827df9f3 | balrog | * sDMA R 68000400 - 680005ff
|
2581 | 827df9f3 | balrog | * sDMA W 68000600 - 680007ff
|
2582 | 827df9f3 | balrog | * Display Control 68000800 - 680009ff
|
2583 | 827df9f3 | balrog | * DSP subsystem 68000a00 - 68000bff
|
2584 | 827df9f3 | balrog | * MPU subsystem 68000c00 - 68000dff
|
2585 | 827df9f3 | balrog | * IVA subsystem 68001000 - 680011ff
|
2586 | 827df9f3 | balrog | * USB 68001200 - 680013ff
|
2587 | 827df9f3 | balrog | * Camera 68001400 - 680015ff
|
2588 | 827df9f3 | balrog | * VLYNQ (firewall) 68001800 - 68001bff
|
2589 | 827df9f3 | balrog | * VLYNQ 68001e00 - 68001fff
|
2590 | 827df9f3 | balrog | * SSI 68002000 - 680021ff
|
2591 | 827df9f3 | balrog | * L4 68002400 - 680025ff
|
2592 | 827df9f3 | balrog | * DSP (firewall) 68002800 - 68002bff
|
2593 | 827df9f3 | balrog | * DSP subsystem 68002e00 - 68002fff
|
2594 | 827df9f3 | balrog | * IVA (firewall) 68003000 - 680033ff
|
2595 | 827df9f3 | balrog | * IVA 68003600 - 680037ff
|
2596 | 827df9f3 | balrog | * GFX 68003a00 - 68003bff
|
2597 | 827df9f3 | balrog | * CMDWR emulation 68003c00 - 68003dff
|
2598 | 827df9f3 | balrog | * SMS 68004000 - 680041ff
|
2599 | 827df9f3 | balrog | * OCM 68004200 - 680043ff
|
2600 | 827df9f3 | balrog | * GPMC 68004400 - 680045ff
|
2601 | 827df9f3 | balrog | * RAM (firewall) 68005000 - 680053ff
|
2602 | 827df9f3 | balrog | * RAM (err login) 68005400 - 680057ff
|
2603 | 827df9f3 | balrog | * ROM (firewall) 68005800 - 68005bff
|
2604 | 827df9f3 | balrog | * ROM (err login) 68005c00 - 68005fff
|
2605 | 827df9f3 | balrog | * GPMC (firewall) 68006000 - 680063ff
|
2606 | 827df9f3 | balrog | * GPMC (err login) 68006400 - 680067ff
|
2607 | 827df9f3 | balrog | * SMS (err login) 68006c00 - 68006fff
|
2608 | 827df9f3 | balrog | * SMS registers 68008000 - 68008fff
|
2609 | 827df9f3 | balrog | * SDRC registers 68009000 - 68009fff
|
2610 | 827df9f3 | balrog | * GPMC registers 6800a000 6800afff
|
2611 | 827df9f3 | balrog | */
|
2612 | 827df9f3 | balrog | |
2613 | a08d4367 | Jan Kiszka | qemu_register_reset(omap2_mpu_reset, s); |
2614 | 827df9f3 | balrog | |
2615 | 827df9f3 | balrog | return s;
|
2616 | 827df9f3 | balrog | } |