root / hw / omap_dss.c @ 4b16eb9d
History | View | Annotate | Download (31.3 kB)
1 | 827df9f3 | balrog | /*
|
---|---|---|---|
2 | 827df9f3 | balrog | * OMAP2 Display Subsystem.
|
3 | 827df9f3 | balrog | *
|
4 | 827df9f3 | balrog | * Copyright (C) 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 | fad6cb1a | aurel32 | * with this program; if not, write to the Free Software Foundation, Inc.,
|
19 | fad6cb1a | aurel32 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
20 | 827df9f3 | balrog | */
|
21 | 827df9f3 | balrog | #include "hw.h" |
22 | 827df9f3 | balrog | #include "console.h" |
23 | 827df9f3 | balrog | #include "omap.h" |
24 | 827df9f3 | balrog | |
25 | 827df9f3 | balrog | struct omap_dss_s {
|
26 | 827df9f3 | balrog | qemu_irq irq; |
27 | 827df9f3 | balrog | qemu_irq drq; |
28 | 827df9f3 | balrog | DisplayState *state; |
29 | 827df9f3 | balrog | |
30 | 827df9f3 | balrog | int autoidle;
|
31 | 827df9f3 | balrog | int control;
|
32 | 827df9f3 | balrog | int enable;
|
33 | 827df9f3 | balrog | |
34 | 827df9f3 | balrog | struct omap_dss_panel_s {
|
35 | 827df9f3 | balrog | int enable;
|
36 | 827df9f3 | balrog | int nx;
|
37 | 827df9f3 | balrog | int ny;
|
38 | 827df9f3 | balrog | |
39 | 827df9f3 | balrog | int x;
|
40 | 827df9f3 | balrog | int y;
|
41 | 827df9f3 | balrog | } dig, lcd; |
42 | 827df9f3 | balrog | |
43 | 827df9f3 | balrog | struct {
|
44 | 827df9f3 | balrog | uint32_t idlemode; |
45 | 827df9f3 | balrog | uint32_t irqst; |
46 | 827df9f3 | balrog | uint32_t irqen; |
47 | 827df9f3 | balrog | uint32_t control; |
48 | 827df9f3 | balrog | uint32_t config; |
49 | 827df9f3 | balrog | uint32_t capable; |
50 | f3d8b1eb | aurel32 | uint32_t timing[4];
|
51 | 827df9f3 | balrog | int line;
|
52 | 827df9f3 | balrog | uint32_t bg[2];
|
53 | 827df9f3 | balrog | uint32_t trans[2];
|
54 | 827df9f3 | balrog | |
55 | 827df9f3 | balrog | struct omap_dss_plane_s {
|
56 | 827df9f3 | balrog | int enable;
|
57 | 827df9f3 | balrog | int bpp;
|
58 | 827df9f3 | balrog | int posx;
|
59 | 827df9f3 | balrog | int posy;
|
60 | 827df9f3 | balrog | int nx;
|
61 | 827df9f3 | balrog | int ny;
|
62 | 827df9f3 | balrog | |
63 | 827df9f3 | balrog | target_phys_addr_t addr[3];
|
64 | 827df9f3 | balrog | |
65 | 827df9f3 | balrog | uint32_t attr; |
66 | 827df9f3 | balrog | uint32_t tresh; |
67 | 827df9f3 | balrog | int rowinc;
|
68 | 827df9f3 | balrog | int colinc;
|
69 | 827df9f3 | balrog | int wininc;
|
70 | 827df9f3 | balrog | } l[3];
|
71 | 827df9f3 | balrog | |
72 | 827df9f3 | balrog | int invalidate;
|
73 | 827df9f3 | balrog | uint16_t palette[256];
|
74 | 827df9f3 | balrog | } dispc; |
75 | 827df9f3 | balrog | |
76 | 827df9f3 | balrog | struct {
|
77 | 827df9f3 | balrog | int idlemode;
|
78 | 827df9f3 | balrog | uint32_t control; |
79 | 827df9f3 | balrog | int enable;
|
80 | 827df9f3 | balrog | int pixels;
|
81 | 827df9f3 | balrog | int busy;
|
82 | 827df9f3 | balrog | int skiplines;
|
83 | 827df9f3 | balrog | uint16_t rxbuf; |
84 | 827df9f3 | balrog | uint32_t config[2];
|
85 | 827df9f3 | balrog | uint32_t time[4];
|
86 | 827df9f3 | balrog | uint32_t data[6];
|
87 | 827df9f3 | balrog | uint16_t vsync; |
88 | 827df9f3 | balrog | uint16_t hsync; |
89 | 827df9f3 | balrog | struct rfbi_chip_s *chip[2]; |
90 | 827df9f3 | balrog | } rfbi; |
91 | 827df9f3 | balrog | }; |
92 | 827df9f3 | balrog | |
93 | 827df9f3 | balrog | static void omap_dispc_interrupt_update(struct omap_dss_s *s) |
94 | 827df9f3 | balrog | { |
95 | 827df9f3 | balrog | qemu_set_irq(s->irq, s->dispc.irqst & s->dispc.irqen); |
96 | 827df9f3 | balrog | } |
97 | 827df9f3 | balrog | |
98 | 827df9f3 | balrog | static void omap_rfbi_reset(struct omap_dss_s *s) |
99 | 827df9f3 | balrog | { |
100 | 827df9f3 | balrog | s->rfbi.idlemode = 0;
|
101 | 827df9f3 | balrog | s->rfbi.control = 2;
|
102 | 827df9f3 | balrog | s->rfbi.enable = 0;
|
103 | 827df9f3 | balrog | s->rfbi.pixels = 0;
|
104 | 827df9f3 | balrog | s->rfbi.skiplines = 0;
|
105 | 827df9f3 | balrog | s->rfbi.busy = 0;
|
106 | 827df9f3 | balrog | s->rfbi.config[0] = 0x00310000; |
107 | 827df9f3 | balrog | s->rfbi.config[1] = 0x00310000; |
108 | 827df9f3 | balrog | s->rfbi.time[0] = 0; |
109 | 827df9f3 | balrog | s->rfbi.time[1] = 0; |
110 | 827df9f3 | balrog | s->rfbi.time[2] = 0; |
111 | 827df9f3 | balrog | s->rfbi.time[3] = 0; |
112 | 827df9f3 | balrog | s->rfbi.data[0] = 0; |
113 | 827df9f3 | balrog | s->rfbi.data[1] = 0; |
114 | 827df9f3 | balrog | s->rfbi.data[2] = 0; |
115 | 827df9f3 | balrog | s->rfbi.data[3] = 0; |
116 | 827df9f3 | balrog | s->rfbi.data[4] = 0; |
117 | 827df9f3 | balrog | s->rfbi.data[5] = 0; |
118 | 827df9f3 | balrog | s->rfbi.vsync = 0;
|
119 | 827df9f3 | balrog | s->rfbi.hsync = 0;
|
120 | 827df9f3 | balrog | } |
121 | 827df9f3 | balrog | |
122 | 827df9f3 | balrog | void omap_dss_reset(struct omap_dss_s *s) |
123 | 827df9f3 | balrog | { |
124 | 827df9f3 | balrog | s->autoidle = 0;
|
125 | 827df9f3 | balrog | s->control = 0;
|
126 | 827df9f3 | balrog | s->enable = 0;
|
127 | 827df9f3 | balrog | |
128 | 827df9f3 | balrog | s->dig.enable = 0;
|
129 | 827df9f3 | balrog | s->dig.nx = 1;
|
130 | 827df9f3 | balrog | s->dig.ny = 1;
|
131 | 827df9f3 | balrog | |
132 | 827df9f3 | balrog | s->lcd.enable = 0;
|
133 | 827df9f3 | balrog | s->lcd.nx = 1;
|
134 | 827df9f3 | balrog | s->lcd.ny = 1;
|
135 | 827df9f3 | balrog | |
136 | 827df9f3 | balrog | s->dispc.idlemode = 0;
|
137 | 827df9f3 | balrog | s->dispc.irqst = 0;
|
138 | 827df9f3 | balrog | s->dispc.irqen = 0;
|
139 | 827df9f3 | balrog | s->dispc.control = 0;
|
140 | 827df9f3 | balrog | s->dispc.config = 0;
|
141 | 827df9f3 | balrog | s->dispc.capable = 0x161;
|
142 | 827df9f3 | balrog | s->dispc.timing[0] = 0; |
143 | 827df9f3 | balrog | s->dispc.timing[1] = 0; |
144 | 827df9f3 | balrog | s->dispc.timing[2] = 0; |
145 | f3d8b1eb | aurel32 | s->dispc.timing[3] = 0; |
146 | 827df9f3 | balrog | s->dispc.line = 0;
|
147 | 827df9f3 | balrog | s->dispc.bg[0] = 0; |
148 | 827df9f3 | balrog | s->dispc.bg[1] = 0; |
149 | 827df9f3 | balrog | s->dispc.trans[0] = 0; |
150 | 827df9f3 | balrog | s->dispc.trans[1] = 0; |
151 | 827df9f3 | balrog | |
152 | 827df9f3 | balrog | s->dispc.l[0].enable = 0; |
153 | 827df9f3 | balrog | s->dispc.l[0].bpp = 0; |
154 | 827df9f3 | balrog | s->dispc.l[0].addr[0] = 0; |
155 | 827df9f3 | balrog | s->dispc.l[0].addr[1] = 0; |
156 | 827df9f3 | balrog | s->dispc.l[0].addr[2] = 0; |
157 | 827df9f3 | balrog | s->dispc.l[0].posx = 0; |
158 | 827df9f3 | balrog | s->dispc.l[0].posy = 0; |
159 | 827df9f3 | balrog | s->dispc.l[0].nx = 1; |
160 | 827df9f3 | balrog | s->dispc.l[0].ny = 1; |
161 | 827df9f3 | balrog | s->dispc.l[0].attr = 0; |
162 | 827df9f3 | balrog | s->dispc.l[0].tresh = 0; |
163 | 827df9f3 | balrog | s->dispc.l[0].rowinc = 1; |
164 | 827df9f3 | balrog | s->dispc.l[0].colinc = 1; |
165 | 827df9f3 | balrog | s->dispc.l[0].wininc = 0; |
166 | 827df9f3 | balrog | |
167 | 827df9f3 | balrog | omap_rfbi_reset(s); |
168 | 827df9f3 | balrog | omap_dispc_interrupt_update(s); |
169 | 827df9f3 | balrog | } |
170 | 827df9f3 | balrog | |
171 | 827df9f3 | balrog | static uint32_t omap_diss_read(void *opaque, target_phys_addr_t addr) |
172 | 827df9f3 | balrog | { |
173 | 827df9f3 | balrog | struct omap_dss_s *s = (struct omap_dss_s *) opaque; |
174 | 827df9f3 | balrog | |
175 | 8da3ff18 | pbrook | switch (addr) {
|
176 | 827df9f3 | balrog | case 0x00: /* DSS_REVISIONNUMBER */ |
177 | 827df9f3 | balrog | return 0x20; |
178 | 827df9f3 | balrog | |
179 | 827df9f3 | balrog | case 0x10: /* DSS_SYSCONFIG */ |
180 | 827df9f3 | balrog | return s->autoidle;
|
181 | 827df9f3 | balrog | |
182 | 827df9f3 | balrog | case 0x14: /* DSS_SYSSTATUS */ |
183 | 827df9f3 | balrog | return 1; /* RESETDONE */ |
184 | 827df9f3 | balrog | |
185 | 827df9f3 | balrog | case 0x40: /* DSS_CONTROL */ |
186 | 827df9f3 | balrog | return s->control;
|
187 | 827df9f3 | balrog | |
188 | 827df9f3 | balrog | case 0x50: /* DSS_PSA_LCD_REG_1 */ |
189 | 827df9f3 | balrog | case 0x54: /* DSS_PSA_LCD_REG_2 */ |
190 | 827df9f3 | balrog | case 0x58: /* DSS_PSA_VIDEO_REG */ |
191 | 827df9f3 | balrog | /* TODO: fake some values when appropriate s->control bits are set */
|
192 | 827df9f3 | balrog | return 0; |
193 | 827df9f3 | balrog | |
194 | 827df9f3 | balrog | case 0x5c: /* DSS_STATUS */ |
195 | 827df9f3 | balrog | return 1 + (s->control & 1); |
196 | 827df9f3 | balrog | |
197 | 827df9f3 | balrog | default:
|
198 | 827df9f3 | balrog | break;
|
199 | 827df9f3 | balrog | } |
200 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
201 | 827df9f3 | balrog | return 0; |
202 | 827df9f3 | balrog | } |
203 | 827df9f3 | balrog | |
204 | 827df9f3 | balrog | static void omap_diss_write(void *opaque, target_phys_addr_t addr, |
205 | 827df9f3 | balrog | uint32_t value) |
206 | 827df9f3 | balrog | { |
207 | 827df9f3 | balrog | struct omap_dss_s *s = (struct omap_dss_s *) opaque; |
208 | 827df9f3 | balrog | |
209 | 8da3ff18 | pbrook | switch (addr) {
|
210 | 827df9f3 | balrog | case 0x00: /* DSS_REVISIONNUMBER */ |
211 | 827df9f3 | balrog | case 0x14: /* DSS_SYSSTATUS */ |
212 | 827df9f3 | balrog | case 0x50: /* DSS_PSA_LCD_REG_1 */ |
213 | 827df9f3 | balrog | case 0x54: /* DSS_PSA_LCD_REG_2 */ |
214 | 827df9f3 | balrog | case 0x58: /* DSS_PSA_VIDEO_REG */ |
215 | 827df9f3 | balrog | case 0x5c: /* DSS_STATUS */ |
216 | 827df9f3 | balrog | OMAP_RO_REG(addr); |
217 | 827df9f3 | balrog | break;
|
218 | 827df9f3 | balrog | |
219 | 827df9f3 | balrog | case 0x10: /* DSS_SYSCONFIG */ |
220 | 827df9f3 | balrog | if (value & 2) /* SOFTRESET */ |
221 | 827df9f3 | balrog | omap_dss_reset(s); |
222 | 827df9f3 | balrog | s->autoidle = value & 1;
|
223 | 827df9f3 | balrog | break;
|
224 | 827df9f3 | balrog | |
225 | 827df9f3 | balrog | case 0x40: /* DSS_CONTROL */ |
226 | 827df9f3 | balrog | s->control = value & 0x3dd;
|
227 | 827df9f3 | balrog | break;
|
228 | 827df9f3 | balrog | |
229 | 827df9f3 | balrog | default:
|
230 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
231 | 827df9f3 | balrog | } |
232 | 827df9f3 | balrog | } |
233 | 827df9f3 | balrog | |
234 | 827df9f3 | balrog | static CPUReadMemoryFunc *omap_diss1_readfn[] = {
|
235 | 827df9f3 | balrog | omap_badwidth_read32, |
236 | 827df9f3 | balrog | omap_badwidth_read32, |
237 | 827df9f3 | balrog | omap_diss_read, |
238 | 827df9f3 | balrog | }; |
239 | 827df9f3 | balrog | |
240 | 827df9f3 | balrog | static CPUWriteMemoryFunc *omap_diss1_writefn[] = {
|
241 | 827df9f3 | balrog | omap_badwidth_write32, |
242 | 827df9f3 | balrog | omap_badwidth_write32, |
243 | 827df9f3 | balrog | omap_diss_write, |
244 | 827df9f3 | balrog | }; |
245 | 827df9f3 | balrog | |
246 | 827df9f3 | balrog | static uint32_t omap_disc_read(void *opaque, target_phys_addr_t addr) |
247 | 827df9f3 | balrog | { |
248 | 827df9f3 | balrog | struct omap_dss_s *s = (struct omap_dss_s *) opaque; |
249 | 827df9f3 | balrog | |
250 | 8da3ff18 | pbrook | switch (addr) {
|
251 | 827df9f3 | balrog | case 0x000: /* DISPC_REVISION */ |
252 | 827df9f3 | balrog | return 0x20; |
253 | 827df9f3 | balrog | |
254 | 827df9f3 | balrog | case 0x010: /* DISPC_SYSCONFIG */ |
255 | 827df9f3 | balrog | return s->dispc.idlemode;
|
256 | 827df9f3 | balrog | |
257 | 827df9f3 | balrog | case 0x014: /* DISPC_SYSSTATUS */ |
258 | 827df9f3 | balrog | return 1; /* RESETDONE */ |
259 | 827df9f3 | balrog | |
260 | 827df9f3 | balrog | case 0x018: /* DISPC_IRQSTATUS */ |
261 | 827df9f3 | balrog | return s->dispc.irqst;
|
262 | 827df9f3 | balrog | |
263 | 827df9f3 | balrog | case 0x01c: /* DISPC_IRQENABLE */ |
264 | 827df9f3 | balrog | return s->dispc.irqen;
|
265 | 827df9f3 | balrog | |
266 | 827df9f3 | balrog | case 0x040: /* DISPC_CONTROL */ |
267 | 827df9f3 | balrog | return s->dispc.control;
|
268 | 827df9f3 | balrog | |
269 | 827df9f3 | balrog | case 0x044: /* DISPC_CONFIG */ |
270 | 827df9f3 | balrog | return s->dispc.config;
|
271 | 827df9f3 | balrog | |
272 | 827df9f3 | balrog | case 0x048: /* DISPC_CAPABLE */ |
273 | 827df9f3 | balrog | return s->dispc.capable;
|
274 | 827df9f3 | balrog | |
275 | 827df9f3 | balrog | case 0x04c: /* DISPC_DEFAULT_COLOR0 */ |
276 | 827df9f3 | balrog | return s->dispc.bg[0]; |
277 | 827df9f3 | balrog | case 0x050: /* DISPC_DEFAULT_COLOR1 */ |
278 | 827df9f3 | balrog | return s->dispc.bg[1]; |
279 | 827df9f3 | balrog | case 0x054: /* DISPC_TRANS_COLOR0 */ |
280 | 827df9f3 | balrog | return s->dispc.trans[0]; |
281 | 827df9f3 | balrog | case 0x058: /* DISPC_TRANS_COLOR1 */ |
282 | 827df9f3 | balrog | return s->dispc.trans[1]; |
283 | 827df9f3 | balrog | |
284 | 827df9f3 | balrog | case 0x05c: /* DISPC_LINE_STATUS */ |
285 | 827df9f3 | balrog | return 0x7ff; |
286 | 827df9f3 | balrog | case 0x060: /* DISPC_LINE_NUMBER */ |
287 | 827df9f3 | balrog | return s->dispc.line;
|
288 | 827df9f3 | balrog | |
289 | 827df9f3 | balrog | case 0x064: /* DISPC_TIMING_H */ |
290 | 827df9f3 | balrog | return s->dispc.timing[0]; |
291 | 827df9f3 | balrog | case 0x068: /* DISPC_TIMING_V */ |
292 | 827df9f3 | balrog | return s->dispc.timing[1]; |
293 | 827df9f3 | balrog | case 0x06c: /* DISPC_POL_FREQ */ |
294 | 827df9f3 | balrog | return s->dispc.timing[2]; |
295 | 827df9f3 | balrog | case 0x070: /* DISPC_DIVISOR */ |
296 | 827df9f3 | balrog | return s->dispc.timing[3]; |
297 | 827df9f3 | balrog | |
298 | 827df9f3 | balrog | case 0x078: /* DISPC_SIZE_DIG */ |
299 | 827df9f3 | balrog | return ((s->dig.ny - 1) << 16) | (s->dig.nx - 1); |
300 | 827df9f3 | balrog | case 0x07c: /* DISPC_SIZE_LCD */ |
301 | 827df9f3 | balrog | return ((s->lcd.ny - 1) << 16) | (s->lcd.nx - 1); |
302 | 827df9f3 | balrog | |
303 | 827df9f3 | balrog | case 0x080: /* DISPC_GFX_BA0 */ |
304 | 827df9f3 | balrog | return s->dispc.l[0].addr[0]; |
305 | 827df9f3 | balrog | case 0x084: /* DISPC_GFX_BA1 */ |
306 | 827df9f3 | balrog | return s->dispc.l[0].addr[1]; |
307 | 827df9f3 | balrog | case 0x088: /* DISPC_GFX_POSITION */ |
308 | 827df9f3 | balrog | return (s->dispc.l[0].posy << 16) | s->dispc.l[0].posx; |
309 | 827df9f3 | balrog | case 0x08c: /* DISPC_GFX_SIZE */ |
310 | 827df9f3 | balrog | return ((s->dispc.l[0].ny - 1) << 16) | (s->dispc.l[0].nx - 1); |
311 | 827df9f3 | balrog | case 0x0a0: /* DISPC_GFX_ATTRIBUTES */ |
312 | 827df9f3 | balrog | return s->dispc.l[0].attr; |
313 | 827df9f3 | balrog | case 0x0a4: /* DISPC_GFX_FIFO_TRESHOLD */ |
314 | 827df9f3 | balrog | return s->dispc.l[0].tresh; |
315 | 827df9f3 | balrog | case 0x0a8: /* DISPC_GFX_FIFO_SIZE_STATUS */ |
316 | 827df9f3 | balrog | return 256; |
317 | 827df9f3 | balrog | case 0x0ac: /* DISPC_GFX_ROW_INC */ |
318 | 827df9f3 | balrog | return s->dispc.l[0].rowinc; |
319 | 827df9f3 | balrog | case 0x0b0: /* DISPC_GFX_PIXEL_INC */ |
320 | 827df9f3 | balrog | return s->dispc.l[0].colinc; |
321 | 827df9f3 | balrog | case 0x0b4: /* DISPC_GFX_WINDOW_SKIP */ |
322 | 827df9f3 | balrog | return s->dispc.l[0].wininc; |
323 | 827df9f3 | balrog | case 0x0b8: /* DISPC_GFX_TABLE_BA */ |
324 | 827df9f3 | balrog | return s->dispc.l[0].addr[2]; |
325 | 827df9f3 | balrog | |
326 | 827df9f3 | balrog | case 0x0bc: /* DISPC_VID1_BA0 */ |
327 | 827df9f3 | balrog | case 0x0c0: /* DISPC_VID1_BA1 */ |
328 | 827df9f3 | balrog | case 0x0c4: /* DISPC_VID1_POSITION */ |
329 | 827df9f3 | balrog | case 0x0c8: /* DISPC_VID1_SIZE */ |
330 | 827df9f3 | balrog | case 0x0cc: /* DISPC_VID1_ATTRIBUTES */ |
331 | 827df9f3 | balrog | case 0x0d0: /* DISPC_VID1_FIFO_TRESHOLD */ |
332 | 827df9f3 | balrog | case 0x0d4: /* DISPC_VID1_FIFO_SIZE_STATUS */ |
333 | 827df9f3 | balrog | case 0x0d8: /* DISPC_VID1_ROW_INC */ |
334 | 827df9f3 | balrog | case 0x0dc: /* DISPC_VID1_PIXEL_INC */ |
335 | 827df9f3 | balrog | case 0x0e0: /* DISPC_VID1_FIR */ |
336 | 827df9f3 | balrog | case 0x0e4: /* DISPC_VID1_PICTURE_SIZE */ |
337 | 827df9f3 | balrog | case 0x0e8: /* DISPC_VID1_ACCU0 */ |
338 | 827df9f3 | balrog | case 0x0ec: /* DISPC_VID1_ACCU1 */ |
339 | 827df9f3 | balrog | case 0x0f0 ... 0x140: /* DISPC_VID1_FIR_COEF, DISPC_VID1_CONV_COEF */ |
340 | 827df9f3 | balrog | case 0x14c: /* DISPC_VID2_BA0 */ |
341 | 827df9f3 | balrog | case 0x150: /* DISPC_VID2_BA1 */ |
342 | 827df9f3 | balrog | case 0x154: /* DISPC_VID2_POSITION */ |
343 | 827df9f3 | balrog | case 0x158: /* DISPC_VID2_SIZE */ |
344 | 827df9f3 | balrog | case 0x15c: /* DISPC_VID2_ATTRIBUTES */ |
345 | 827df9f3 | balrog | case 0x160: /* DISPC_VID2_FIFO_TRESHOLD */ |
346 | 827df9f3 | balrog | case 0x164: /* DISPC_VID2_FIFO_SIZE_STATUS */ |
347 | 827df9f3 | balrog | case 0x168: /* DISPC_VID2_ROW_INC */ |
348 | 827df9f3 | balrog | case 0x16c: /* DISPC_VID2_PIXEL_INC */ |
349 | 827df9f3 | balrog | case 0x170: /* DISPC_VID2_FIR */ |
350 | 827df9f3 | balrog | case 0x174: /* DISPC_VID2_PICTURE_SIZE */ |
351 | 827df9f3 | balrog | case 0x178: /* DISPC_VID2_ACCU0 */ |
352 | 827df9f3 | balrog | case 0x17c: /* DISPC_VID2_ACCU1 */ |
353 | 827df9f3 | balrog | case 0x180 ... 0x1d0: /* DISPC_VID2_FIR_COEF, DISPC_VID2_CONV_COEF */ |
354 | 827df9f3 | balrog | case 0x1d4: /* DISPC_DATA_CYCLE1 */ |
355 | 827df9f3 | balrog | case 0x1d8: /* DISPC_DATA_CYCLE2 */ |
356 | 827df9f3 | balrog | case 0x1dc: /* DISPC_DATA_CYCLE3 */ |
357 | 827df9f3 | balrog | return 0; |
358 | 827df9f3 | balrog | |
359 | 827df9f3 | balrog | default:
|
360 | 827df9f3 | balrog | break;
|
361 | 827df9f3 | balrog | } |
362 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
363 | 827df9f3 | balrog | return 0; |
364 | 827df9f3 | balrog | } |
365 | 827df9f3 | balrog | |
366 | 827df9f3 | balrog | static void omap_disc_write(void *opaque, target_phys_addr_t addr, |
367 | 827df9f3 | balrog | uint32_t value) |
368 | 827df9f3 | balrog | { |
369 | 827df9f3 | balrog | struct omap_dss_s *s = (struct omap_dss_s *) opaque; |
370 | 827df9f3 | balrog | |
371 | 8da3ff18 | pbrook | switch (addr) {
|
372 | 827df9f3 | balrog | case 0x010: /* DISPC_SYSCONFIG */ |
373 | 827df9f3 | balrog | if (value & 2) /* SOFTRESET */ |
374 | 827df9f3 | balrog | omap_dss_reset(s); |
375 | 827df9f3 | balrog | s->dispc.idlemode = value & 0x301b;
|
376 | 827df9f3 | balrog | break;
|
377 | 827df9f3 | balrog | |
378 | 827df9f3 | balrog | case 0x018: /* DISPC_IRQSTATUS */ |
379 | 827df9f3 | balrog | s->dispc.irqst &= ~value; |
380 | 827df9f3 | balrog | omap_dispc_interrupt_update(s); |
381 | 827df9f3 | balrog | break;
|
382 | 827df9f3 | balrog | |
383 | 827df9f3 | balrog | case 0x01c: /* DISPC_IRQENABLE */ |
384 | 827df9f3 | balrog | s->dispc.irqen = value & 0xffff;
|
385 | 827df9f3 | balrog | omap_dispc_interrupt_update(s); |
386 | 827df9f3 | balrog | break;
|
387 | 827df9f3 | balrog | |
388 | 827df9f3 | balrog | case 0x040: /* DISPC_CONTROL */ |
389 | 827df9f3 | balrog | s->dispc.control = value & 0x07ff9fff;
|
390 | 827df9f3 | balrog | s->dig.enable = (value >> 1) & 1; |
391 | 827df9f3 | balrog | s->lcd.enable = (value >> 0) & 1; |
392 | 827df9f3 | balrog | if (value & (1 << 12)) /* OVERLAY_OPTIMIZATION */ |
393 | 827df9f3 | balrog | if (~((s->dispc.l[1].attr | s->dispc.l[2].attr) & 1)) |
394 | 827df9f3 | balrog | fprintf(stderr, "%s: Overlay Optimization when no overlay "
|
395 | 827df9f3 | balrog | "region effectively exists leads to "
|
396 | 827df9f3 | balrog | "unpredictable behaviour!\n", __FUNCTION__);
|
397 | 827df9f3 | balrog | if (value & (1 << 6)) { /* GODIGITAL */ |
398 | 827df9f3 | balrog | /* XXX: Shadowed fields are:
|
399 | 827df9f3 | balrog | * s->dispc.config
|
400 | 827df9f3 | balrog | * s->dispc.capable
|
401 | 827df9f3 | balrog | * s->dispc.bg[0]
|
402 | 827df9f3 | balrog | * s->dispc.bg[1]
|
403 | 827df9f3 | balrog | * s->dispc.trans[0]
|
404 | 827df9f3 | balrog | * s->dispc.trans[1]
|
405 | 827df9f3 | balrog | * s->dispc.line
|
406 | 827df9f3 | balrog | * s->dispc.timing[0]
|
407 | 827df9f3 | balrog | * s->dispc.timing[1]
|
408 | 827df9f3 | balrog | * s->dispc.timing[2]
|
409 | 827df9f3 | balrog | * s->dispc.timing[3]
|
410 | 827df9f3 | balrog | * s->lcd.nx
|
411 | 827df9f3 | balrog | * s->lcd.ny
|
412 | 827df9f3 | balrog | * s->dig.nx
|
413 | 827df9f3 | balrog | * s->dig.ny
|
414 | 827df9f3 | balrog | * s->dispc.l[0].addr[0]
|
415 | 827df9f3 | balrog | * s->dispc.l[0].addr[1]
|
416 | 827df9f3 | balrog | * s->dispc.l[0].addr[2]
|
417 | 827df9f3 | balrog | * s->dispc.l[0].posx
|
418 | 827df9f3 | balrog | * s->dispc.l[0].posy
|
419 | 827df9f3 | balrog | * s->dispc.l[0].nx
|
420 | 827df9f3 | balrog | * s->dispc.l[0].ny
|
421 | 827df9f3 | balrog | * s->dispc.l[0].tresh
|
422 | 827df9f3 | balrog | * s->dispc.l[0].rowinc
|
423 | 827df9f3 | balrog | * s->dispc.l[0].colinc
|
424 | 827df9f3 | balrog | * s->dispc.l[0].wininc
|
425 | 827df9f3 | balrog | * All they need to be loaded here from their shadow registers.
|
426 | 827df9f3 | balrog | */
|
427 | 827df9f3 | balrog | } |
428 | 827df9f3 | balrog | if (value & (1 << 5)) { /* GOLCD */ |
429 | 827df9f3 | balrog | /* XXX: Likewise for LCD here. */
|
430 | 827df9f3 | balrog | } |
431 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
432 | 827df9f3 | balrog | break;
|
433 | 827df9f3 | balrog | |
434 | 827df9f3 | balrog | case 0x044: /* DISPC_CONFIG */ |
435 | 827df9f3 | balrog | s->dispc.config = value & 0x3fff;
|
436 | 827df9f3 | balrog | /* XXX:
|
437 | 827df9f3 | balrog | * bits 2:1 (LOADMODE) reset to 0 after set to 1 and palette loaded
|
438 | 827df9f3 | balrog | * bits 2:1 (LOADMODE) reset to 2 after set to 3 and palette loaded
|
439 | 827df9f3 | balrog | */
|
440 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
441 | 827df9f3 | balrog | break;
|
442 | 827df9f3 | balrog | |
443 | 827df9f3 | balrog | case 0x048: /* DISPC_CAPABLE */ |
444 | 827df9f3 | balrog | s->dispc.capable = value & 0x3ff;
|
445 | 827df9f3 | balrog | break;
|
446 | 827df9f3 | balrog | |
447 | 827df9f3 | balrog | case 0x04c: /* DISPC_DEFAULT_COLOR0 */ |
448 | 827df9f3 | balrog | s->dispc.bg[0] = value & 0xffffff; |
449 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
450 | 827df9f3 | balrog | break;
|
451 | 827df9f3 | balrog | case 0x050: /* DISPC_DEFAULT_COLOR1 */ |
452 | 827df9f3 | balrog | s->dispc.bg[1] = value & 0xffffff; |
453 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
454 | 827df9f3 | balrog | break;
|
455 | 827df9f3 | balrog | case 0x054: /* DISPC_TRANS_COLOR0 */ |
456 | 827df9f3 | balrog | s->dispc.trans[0] = value & 0xffffff; |
457 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
458 | 827df9f3 | balrog | break;
|
459 | 827df9f3 | balrog | case 0x058: /* DISPC_TRANS_COLOR1 */ |
460 | 827df9f3 | balrog | s->dispc.trans[1] = value & 0xffffff; |
461 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
462 | 827df9f3 | balrog | break;
|
463 | 827df9f3 | balrog | |
464 | 827df9f3 | balrog | case 0x060: /* DISPC_LINE_NUMBER */ |
465 | 827df9f3 | balrog | s->dispc.line = value & 0x7ff;
|
466 | 827df9f3 | balrog | break;
|
467 | 827df9f3 | balrog | |
468 | 827df9f3 | balrog | case 0x064: /* DISPC_TIMING_H */ |
469 | 827df9f3 | balrog | s->dispc.timing[0] = value & 0x0ff0ff3f; |
470 | 827df9f3 | balrog | break;
|
471 | 827df9f3 | balrog | case 0x068: /* DISPC_TIMING_V */ |
472 | 827df9f3 | balrog | s->dispc.timing[1] = value & 0x0ff0ff3f; |
473 | 827df9f3 | balrog | break;
|
474 | 827df9f3 | balrog | case 0x06c: /* DISPC_POL_FREQ */ |
475 | 827df9f3 | balrog | s->dispc.timing[2] = value & 0x0003ffff; |
476 | 827df9f3 | balrog | break;
|
477 | 827df9f3 | balrog | case 0x070: /* DISPC_DIVISOR */ |
478 | 827df9f3 | balrog | s->dispc.timing[3] = value & 0x00ff00ff; |
479 | 827df9f3 | balrog | break;
|
480 | 827df9f3 | balrog | |
481 | 827df9f3 | balrog | case 0x078: /* DISPC_SIZE_DIG */ |
482 | 827df9f3 | balrog | s->dig.nx = ((value >> 0) & 0x7ff) + 1; /* PPL */ |
483 | 827df9f3 | balrog | s->dig.ny = ((value >> 16) & 0x7ff) + 1; /* LPP */ |
484 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
485 | 827df9f3 | balrog | break;
|
486 | 827df9f3 | balrog | case 0x07c: /* DISPC_SIZE_LCD */ |
487 | 827df9f3 | balrog | s->lcd.nx = ((value >> 0) & 0x7ff) + 1; /* PPL */ |
488 | 827df9f3 | balrog | s->lcd.ny = ((value >> 16) & 0x7ff) + 1; /* LPP */ |
489 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
490 | 827df9f3 | balrog | break;
|
491 | 827df9f3 | balrog | case 0x080: /* DISPC_GFX_BA0 */ |
492 | 827df9f3 | balrog | s->dispc.l[0].addr[0] = (target_phys_addr_t) value; |
493 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
494 | 827df9f3 | balrog | break;
|
495 | 827df9f3 | balrog | case 0x084: /* DISPC_GFX_BA1 */ |
496 | 827df9f3 | balrog | s->dispc.l[0].addr[1] = (target_phys_addr_t) value; |
497 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
498 | 827df9f3 | balrog | break;
|
499 | 827df9f3 | balrog | case 0x088: /* DISPC_GFX_POSITION */ |
500 | 827df9f3 | balrog | s->dispc.l[0].posx = ((value >> 0) & 0x7ff); /* GFXPOSX */ |
501 | 827df9f3 | balrog | s->dispc.l[0].posy = ((value >> 16) & 0x7ff); /* GFXPOSY */ |
502 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
503 | 827df9f3 | balrog | break;
|
504 | 827df9f3 | balrog | case 0x08c: /* DISPC_GFX_SIZE */ |
505 | 827df9f3 | balrog | s->dispc.l[0].nx = ((value >> 0) & 0x7ff) + 1; /* GFXSIZEX */ |
506 | 827df9f3 | balrog | s->dispc.l[0].ny = ((value >> 16) & 0x7ff) + 1; /* GFXSIZEY */ |
507 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
508 | 827df9f3 | balrog | break;
|
509 | 827df9f3 | balrog | case 0x0a0: /* DISPC_GFX_ATTRIBUTES */ |
510 | 827df9f3 | balrog | s->dispc.l[0].attr = value & 0x7ff; |
511 | 827df9f3 | balrog | if (value & (3 << 9)) |
512 | 827df9f3 | balrog | fprintf(stderr, "%s: Big-endian pixel format not supported\n",
|
513 | 827df9f3 | balrog | __FUNCTION__); |
514 | 827df9f3 | balrog | s->dispc.l[0].enable = value & 1; |
515 | 827df9f3 | balrog | s->dispc.l[0].bpp = (value >> 1) & 0xf; |
516 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
517 | 827df9f3 | balrog | break;
|
518 | 827df9f3 | balrog | case 0x0a4: /* DISPC_GFX_FIFO_TRESHOLD */ |
519 | 827df9f3 | balrog | s->dispc.l[0].tresh = value & 0x01ff01ff; |
520 | 827df9f3 | balrog | break;
|
521 | 827df9f3 | balrog | case 0x0ac: /* DISPC_GFX_ROW_INC */ |
522 | 827df9f3 | balrog | s->dispc.l[0].rowinc = value;
|
523 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
524 | 827df9f3 | balrog | break;
|
525 | 827df9f3 | balrog | case 0x0b0: /* DISPC_GFX_PIXEL_INC */ |
526 | 827df9f3 | balrog | s->dispc.l[0].colinc = value;
|
527 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
528 | 827df9f3 | balrog | break;
|
529 | 827df9f3 | balrog | case 0x0b4: /* DISPC_GFX_WINDOW_SKIP */ |
530 | 827df9f3 | balrog | s->dispc.l[0].wininc = value;
|
531 | 827df9f3 | balrog | break;
|
532 | 827df9f3 | balrog | case 0x0b8: /* DISPC_GFX_TABLE_BA */ |
533 | 827df9f3 | balrog | s->dispc.l[0].addr[2] = (target_phys_addr_t) value; |
534 | 827df9f3 | balrog | s->dispc.invalidate = 1;
|
535 | 827df9f3 | balrog | break;
|
536 | 827df9f3 | balrog | |
537 | 827df9f3 | balrog | case 0x0bc: /* DISPC_VID1_BA0 */ |
538 | 827df9f3 | balrog | case 0x0c0: /* DISPC_VID1_BA1 */ |
539 | 827df9f3 | balrog | case 0x0c4: /* DISPC_VID1_POSITION */ |
540 | 827df9f3 | balrog | case 0x0c8: /* DISPC_VID1_SIZE */ |
541 | 827df9f3 | balrog | case 0x0cc: /* DISPC_VID1_ATTRIBUTES */ |
542 | 827df9f3 | balrog | case 0x0d0: /* DISPC_VID1_FIFO_TRESHOLD */ |
543 | 827df9f3 | balrog | case 0x0d8: /* DISPC_VID1_ROW_INC */ |
544 | 827df9f3 | balrog | case 0x0dc: /* DISPC_VID1_PIXEL_INC */ |
545 | 827df9f3 | balrog | case 0x0e0: /* DISPC_VID1_FIR */ |
546 | 827df9f3 | balrog | case 0x0e4: /* DISPC_VID1_PICTURE_SIZE */ |
547 | 827df9f3 | balrog | case 0x0e8: /* DISPC_VID1_ACCU0 */ |
548 | 827df9f3 | balrog | case 0x0ec: /* DISPC_VID1_ACCU1 */ |
549 | 827df9f3 | balrog | case 0x0f0 ... 0x140: /* DISPC_VID1_FIR_COEF, DISPC_VID1_CONV_COEF */ |
550 | 827df9f3 | balrog | case 0x14c: /* DISPC_VID2_BA0 */ |
551 | 827df9f3 | balrog | case 0x150: /* DISPC_VID2_BA1 */ |
552 | 827df9f3 | balrog | case 0x154: /* DISPC_VID2_POSITION */ |
553 | 827df9f3 | balrog | case 0x158: /* DISPC_VID2_SIZE */ |
554 | 827df9f3 | balrog | case 0x15c: /* DISPC_VID2_ATTRIBUTES */ |
555 | 827df9f3 | balrog | case 0x160: /* DISPC_VID2_FIFO_TRESHOLD */ |
556 | 827df9f3 | balrog | case 0x168: /* DISPC_VID2_ROW_INC */ |
557 | 827df9f3 | balrog | case 0x16c: /* DISPC_VID2_PIXEL_INC */ |
558 | 827df9f3 | balrog | case 0x170: /* DISPC_VID2_FIR */ |
559 | 827df9f3 | balrog | case 0x174: /* DISPC_VID2_PICTURE_SIZE */ |
560 | 827df9f3 | balrog | case 0x178: /* DISPC_VID2_ACCU0 */ |
561 | 827df9f3 | balrog | case 0x17c: /* DISPC_VID2_ACCU1 */ |
562 | 827df9f3 | balrog | case 0x180 ... 0x1d0: /* DISPC_VID2_FIR_COEF, DISPC_VID2_CONV_COEF */ |
563 | 827df9f3 | balrog | case 0x1d4: /* DISPC_DATA_CYCLE1 */ |
564 | 827df9f3 | balrog | case 0x1d8: /* DISPC_DATA_CYCLE2 */ |
565 | 827df9f3 | balrog | case 0x1dc: /* DISPC_DATA_CYCLE3 */ |
566 | 827df9f3 | balrog | break;
|
567 | 827df9f3 | balrog | |
568 | 827df9f3 | balrog | default:
|
569 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
570 | 827df9f3 | balrog | } |
571 | 827df9f3 | balrog | } |
572 | 827df9f3 | balrog | |
573 | 827df9f3 | balrog | static CPUReadMemoryFunc *omap_disc1_readfn[] = {
|
574 | 827df9f3 | balrog | omap_badwidth_read32, |
575 | 827df9f3 | balrog | omap_badwidth_read32, |
576 | 827df9f3 | balrog | omap_disc_read, |
577 | 827df9f3 | balrog | }; |
578 | 827df9f3 | balrog | |
579 | 827df9f3 | balrog | static CPUWriteMemoryFunc *omap_disc1_writefn[] = {
|
580 | 827df9f3 | balrog | omap_badwidth_write32, |
581 | 827df9f3 | balrog | omap_badwidth_write32, |
582 | 827df9f3 | balrog | omap_disc_write, |
583 | 827df9f3 | balrog | }; |
584 | 827df9f3 | balrog | |
585 | 827df9f3 | balrog | static void omap_rfbi_transfer_stop(struct omap_dss_s *s) |
586 | 827df9f3 | balrog | { |
587 | 827df9f3 | balrog | if (!s->rfbi.busy)
|
588 | 827df9f3 | balrog | return;
|
589 | 827df9f3 | balrog | |
590 | 827df9f3 | balrog | /* TODO: in non-Bypass mode we probably need to just deassert the DRQ. */
|
591 | 827df9f3 | balrog | |
592 | 827df9f3 | balrog | s->rfbi.busy = 0;
|
593 | 827df9f3 | balrog | } |
594 | 827df9f3 | balrog | |
595 | 827df9f3 | balrog | static void omap_rfbi_transfer_start(struct omap_dss_s *s) |
596 | 827df9f3 | balrog | { |
597 | 827df9f3 | balrog | void *data;
|
598 | 5c130f65 | pbrook | target_phys_addr_t len; |
599 | 5c130f65 | pbrook | target_phys_addr_t data_addr; |
600 | 827df9f3 | balrog | int pitch;
|
601 | 5c130f65 | pbrook | static void *bounce_buffer; |
602 | 5c130f65 | pbrook | static target_phys_addr_t bounce_len;
|
603 | 827df9f3 | balrog | |
604 | 827df9f3 | balrog | if (!s->rfbi.enable || s->rfbi.busy)
|
605 | 827df9f3 | balrog | return;
|
606 | 827df9f3 | balrog | |
607 | 827df9f3 | balrog | if (s->rfbi.control & (1 << 1)) { /* BYPASS */ |
608 | 827df9f3 | balrog | /* TODO: in non-Bypass mode we probably need to just assert the
|
609 | 827df9f3 | balrog | * DRQ and wait for DMA to write the pixels. */
|
610 | 827df9f3 | balrog | fprintf(stderr, "%s: Bypass mode unimplemented\n", __FUNCTION__);
|
611 | 827df9f3 | balrog | return;
|
612 | 827df9f3 | balrog | } |
613 | 827df9f3 | balrog | |
614 | 827df9f3 | balrog | if (!(s->dispc.control & (1 << 11))) /* RFBIMODE */ |
615 | 827df9f3 | balrog | return;
|
616 | 827df9f3 | balrog | /* TODO: check that LCD output is enabled in DISPC. */
|
617 | 827df9f3 | balrog | |
618 | 827df9f3 | balrog | s->rfbi.busy = 1;
|
619 | 827df9f3 | balrog | |
620 | 5c130f65 | pbrook | len = s->rfbi.pixels * 2;
|
621 | 5c130f65 | pbrook | |
622 | 5c130f65 | pbrook | data_addr = s->dispc.l[0].addr[0]; |
623 | 5c130f65 | pbrook | data = cpu_physical_memory_map(data_addr, &len, 0);
|
624 | 5c130f65 | pbrook | if (data && len != s->rfbi.pixels * 2) { |
625 | 5c130f65 | pbrook | cpu_physical_memory_unmap(data, len, 0, 0); |
626 | 5c130f65 | pbrook | data = NULL;
|
627 | 5c130f65 | pbrook | len = s->rfbi.pixels * 2;
|
628 | 5c130f65 | pbrook | } |
629 | 5c130f65 | pbrook | if (!data) {
|
630 | 5c130f65 | pbrook | if (len > bounce_len) {
|
631 | 5c130f65 | pbrook | bounce_buffer = qemu_realloc(bounce_buffer, len); |
632 | 5c130f65 | pbrook | } |
633 | 5c130f65 | pbrook | data = bounce_buffer; |
634 | 5c130f65 | pbrook | cpu_physical_memory_read(data_addr, data, len); |
635 | 5c130f65 | pbrook | } |
636 | 827df9f3 | balrog | |
637 | 827df9f3 | balrog | /* TODO bpp */
|
638 | 827df9f3 | balrog | s->rfbi.pixels = 0;
|
639 | 827df9f3 | balrog | |
640 | 827df9f3 | balrog | /* TODO: negative values */
|
641 | 827df9f3 | balrog | pitch = s->dispc.l[0].nx + (s->dispc.l[0].rowinc - 1) / 2; |
642 | 827df9f3 | balrog | |
643 | 827df9f3 | balrog | if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0]) |
644 | 827df9f3 | balrog | s->rfbi.chip[0]->block(s->rfbi.chip[0]->opaque, 1, data, len, pitch); |
645 | 827df9f3 | balrog | if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1]) |
646 | 827df9f3 | balrog | s->rfbi.chip[1]->block(s->rfbi.chip[1]->opaque, 1, data, len, pitch); |
647 | 827df9f3 | balrog | |
648 | 5c130f65 | pbrook | if (data != bounce_buffer) {
|
649 | 5c130f65 | pbrook | cpu_physical_memory_unmap(data, len, 0, len);
|
650 | 5c130f65 | pbrook | } |
651 | 5c130f65 | pbrook | |
652 | 827df9f3 | balrog | omap_rfbi_transfer_stop(s); |
653 | 827df9f3 | balrog | |
654 | 827df9f3 | balrog | /* TODO */
|
655 | 827df9f3 | balrog | s->dispc.irqst |= 1; /* FRAMEDONE */ |
656 | 827df9f3 | balrog | omap_dispc_interrupt_update(s); |
657 | 827df9f3 | balrog | } |
658 | 827df9f3 | balrog | |
659 | 827df9f3 | balrog | static uint32_t omap_rfbi_read(void *opaque, target_phys_addr_t addr) |
660 | 827df9f3 | balrog | { |
661 | 827df9f3 | balrog | struct omap_dss_s *s = (struct omap_dss_s *) opaque; |
662 | 827df9f3 | balrog | |
663 | 8da3ff18 | pbrook | switch (addr) {
|
664 | 827df9f3 | balrog | case 0x00: /* RFBI_REVISION */ |
665 | 827df9f3 | balrog | return 0x10; |
666 | 827df9f3 | balrog | |
667 | 827df9f3 | balrog | case 0x10: /* RFBI_SYSCONFIG */ |
668 | 827df9f3 | balrog | return s->rfbi.idlemode;
|
669 | 827df9f3 | balrog | |
670 | 827df9f3 | balrog | case 0x14: /* RFBI_SYSSTATUS */ |
671 | 827df9f3 | balrog | return 1 | (s->rfbi.busy << 8); /* RESETDONE */ |
672 | 827df9f3 | balrog | |
673 | 827df9f3 | balrog | case 0x40: /* RFBI_CONTROL */ |
674 | 827df9f3 | balrog | return s->rfbi.control;
|
675 | 827df9f3 | balrog | |
676 | 827df9f3 | balrog | case 0x44: /* RFBI_PIXELCNT */ |
677 | 827df9f3 | balrog | return s->rfbi.pixels;
|
678 | 827df9f3 | balrog | |
679 | 827df9f3 | balrog | case 0x48: /* RFBI_LINE_NUMBER */ |
680 | 827df9f3 | balrog | return s->rfbi.skiplines;
|
681 | 827df9f3 | balrog | |
682 | 827df9f3 | balrog | case 0x58: /* RFBI_READ */ |
683 | 827df9f3 | balrog | case 0x5c: /* RFBI_STATUS */ |
684 | 827df9f3 | balrog | return s->rfbi.rxbuf;
|
685 | 827df9f3 | balrog | |
686 | 827df9f3 | balrog | case 0x60: /* RFBI_CONFIG0 */ |
687 | 827df9f3 | balrog | return s->rfbi.config[0]; |
688 | 827df9f3 | balrog | case 0x64: /* RFBI_ONOFF_TIME0 */ |
689 | 827df9f3 | balrog | return s->rfbi.time[0]; |
690 | 827df9f3 | balrog | case 0x68: /* RFBI_CYCLE_TIME0 */ |
691 | 827df9f3 | balrog | return s->rfbi.time[1]; |
692 | 827df9f3 | balrog | case 0x6c: /* RFBI_DATA_CYCLE1_0 */ |
693 | 827df9f3 | balrog | return s->rfbi.data[0]; |
694 | 827df9f3 | balrog | case 0x70: /* RFBI_DATA_CYCLE2_0 */ |
695 | 827df9f3 | balrog | return s->rfbi.data[1]; |
696 | 827df9f3 | balrog | case 0x74: /* RFBI_DATA_CYCLE3_0 */ |
697 | 827df9f3 | balrog | return s->rfbi.data[2]; |
698 | 827df9f3 | balrog | |
699 | 827df9f3 | balrog | case 0x78: /* RFBI_CONFIG1 */ |
700 | 827df9f3 | balrog | return s->rfbi.config[1]; |
701 | 827df9f3 | balrog | case 0x7c: /* RFBI_ONOFF_TIME1 */ |
702 | 827df9f3 | balrog | return s->rfbi.time[2]; |
703 | 827df9f3 | balrog | case 0x80: /* RFBI_CYCLE_TIME1 */ |
704 | 827df9f3 | balrog | return s->rfbi.time[3]; |
705 | 827df9f3 | balrog | case 0x84: /* RFBI_DATA_CYCLE1_1 */ |
706 | 827df9f3 | balrog | return s->rfbi.data[3]; |
707 | 827df9f3 | balrog | case 0x88: /* RFBI_DATA_CYCLE2_1 */ |
708 | 827df9f3 | balrog | return s->rfbi.data[4]; |
709 | 827df9f3 | balrog | case 0x8c: /* RFBI_DATA_CYCLE3_1 */ |
710 | 827df9f3 | balrog | return s->rfbi.data[5]; |
711 | 827df9f3 | balrog | |
712 | 827df9f3 | balrog | case 0x90: /* RFBI_VSYNC_WIDTH */ |
713 | 827df9f3 | balrog | return s->rfbi.vsync;
|
714 | 827df9f3 | balrog | case 0x94: /* RFBI_HSYNC_WIDTH */ |
715 | 827df9f3 | balrog | return s->rfbi.hsync;
|
716 | 827df9f3 | balrog | } |
717 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
718 | 827df9f3 | balrog | return 0; |
719 | 827df9f3 | balrog | } |
720 | 827df9f3 | balrog | |
721 | 827df9f3 | balrog | static void omap_rfbi_write(void *opaque, target_phys_addr_t addr, |
722 | 827df9f3 | balrog | uint32_t value) |
723 | 827df9f3 | balrog | { |
724 | 827df9f3 | balrog | struct omap_dss_s *s = (struct omap_dss_s *) opaque; |
725 | 827df9f3 | balrog | |
726 | 8da3ff18 | pbrook | switch (addr) {
|
727 | 827df9f3 | balrog | case 0x10: /* RFBI_SYSCONFIG */ |
728 | 827df9f3 | balrog | if (value & 2) /* SOFTRESET */ |
729 | 827df9f3 | balrog | omap_rfbi_reset(s); |
730 | 827df9f3 | balrog | s->rfbi.idlemode = value & 0x19;
|
731 | 827df9f3 | balrog | break;
|
732 | 827df9f3 | balrog | |
733 | 827df9f3 | balrog | case 0x40: /* RFBI_CONTROL */ |
734 | 827df9f3 | balrog | s->rfbi.control = value & 0xf;
|
735 | 827df9f3 | balrog | s->rfbi.enable = value & 1;
|
736 | 827df9f3 | balrog | if (value & (1 << 4) && /* ITE */ |
737 | 827df9f3 | balrog | !(s->rfbi.config[0] & s->rfbi.config[1] & 0xc)) |
738 | 827df9f3 | balrog | omap_rfbi_transfer_start(s); |
739 | 827df9f3 | balrog | break;
|
740 | 827df9f3 | balrog | |
741 | 827df9f3 | balrog | case 0x44: /* RFBI_PIXELCNT */ |
742 | 827df9f3 | balrog | s->rfbi.pixels = value; |
743 | 827df9f3 | balrog | break;
|
744 | 827df9f3 | balrog | |
745 | 827df9f3 | balrog | case 0x48: /* RFBI_LINE_NUMBER */ |
746 | 827df9f3 | balrog | s->rfbi.skiplines = value & 0x7ff;
|
747 | 827df9f3 | balrog | break;
|
748 | 827df9f3 | balrog | |
749 | 827df9f3 | balrog | case 0x4c: /* RFBI_CMD */ |
750 | 827df9f3 | balrog | if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0]) |
751 | 827df9f3 | balrog | s->rfbi.chip[0]->write(s->rfbi.chip[0]->opaque, 0, value & 0xffff); |
752 | 827df9f3 | balrog | if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1]) |
753 | 827df9f3 | balrog | s->rfbi.chip[1]->write(s->rfbi.chip[1]->opaque, 0, value & 0xffff); |
754 | 827df9f3 | balrog | break;
|
755 | 827df9f3 | balrog | case 0x50: /* RFBI_PARAM */ |
756 | 827df9f3 | balrog | if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0]) |
757 | 827df9f3 | balrog | s->rfbi.chip[0]->write(s->rfbi.chip[0]->opaque, 1, value & 0xffff); |
758 | 827df9f3 | balrog | if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1]) |
759 | 827df9f3 | balrog | s->rfbi.chip[1]->write(s->rfbi.chip[1]->opaque, 1, value & 0xffff); |
760 | 827df9f3 | balrog | break;
|
761 | 827df9f3 | balrog | case 0x54: /* RFBI_DATA */ |
762 | 827df9f3 | balrog | /* TODO: take into account the format set up in s->rfbi.config[?] and
|
763 | 827df9f3 | balrog | * s->rfbi.data[?], but special-case the most usual scenario so that
|
764 | 827df9f3 | balrog | * speed doesn't suffer. */
|
765 | 827df9f3 | balrog | if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0]) { |
766 | 827df9f3 | balrog | s->rfbi.chip[0]->write(s->rfbi.chip[0]->opaque, 1, value & 0xffff); |
767 | 827df9f3 | balrog | s->rfbi.chip[0]->write(s->rfbi.chip[0]->opaque, 1, value >> 16); |
768 | 827df9f3 | balrog | } |
769 | 827df9f3 | balrog | if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1]) { |
770 | 827df9f3 | balrog | s->rfbi.chip[1]->write(s->rfbi.chip[1]->opaque, 1, value & 0xffff); |
771 | 827df9f3 | balrog | s->rfbi.chip[1]->write(s->rfbi.chip[1]->opaque, 1, value >> 16); |
772 | 827df9f3 | balrog | } |
773 | 827df9f3 | balrog | if (!-- s->rfbi.pixels)
|
774 | 827df9f3 | balrog | omap_rfbi_transfer_stop(s); |
775 | 827df9f3 | balrog | break;
|
776 | 827df9f3 | balrog | case 0x58: /* RFBI_READ */ |
777 | 827df9f3 | balrog | if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0]) |
778 | 827df9f3 | balrog | s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 1); |
779 | 827df9f3 | balrog | else if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1]) |
780 | 827df9f3 | balrog | s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 1); |
781 | 827df9f3 | balrog | if (!-- s->rfbi.pixels)
|
782 | 827df9f3 | balrog | omap_rfbi_transfer_stop(s); |
783 | 827df9f3 | balrog | break;
|
784 | 827df9f3 | balrog | |
785 | 827df9f3 | balrog | case 0x5c: /* RFBI_STATUS */ |
786 | 827df9f3 | balrog | if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0]) |
787 | 827df9f3 | balrog | s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 0); |
788 | 827df9f3 | balrog | else if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1]) |
789 | 827df9f3 | balrog | s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 0); |
790 | 827df9f3 | balrog | if (!-- s->rfbi.pixels)
|
791 | 827df9f3 | balrog | omap_rfbi_transfer_stop(s); |
792 | 827df9f3 | balrog | break;
|
793 | 827df9f3 | balrog | |
794 | 827df9f3 | balrog | case 0x60: /* RFBI_CONFIG0 */ |
795 | 827df9f3 | balrog | s->rfbi.config[0] = value & 0x003f1fff; |
796 | 827df9f3 | balrog | break;
|
797 | 827df9f3 | balrog | |
798 | 827df9f3 | balrog | case 0x64: /* RFBI_ONOFF_TIME0 */ |
799 | 827df9f3 | balrog | s->rfbi.time[0] = value & 0x3fffffff; |
800 | 827df9f3 | balrog | break;
|
801 | 827df9f3 | balrog | case 0x68: /* RFBI_CYCLE_TIME0 */ |
802 | 827df9f3 | balrog | s->rfbi.time[1] = value & 0x0fffffff; |
803 | 827df9f3 | balrog | break;
|
804 | 827df9f3 | balrog | case 0x6c: /* RFBI_DATA_CYCLE1_0 */ |
805 | 827df9f3 | balrog | s->rfbi.data[0] = value & 0x0f1f0f1f; |
806 | 827df9f3 | balrog | break;
|
807 | 827df9f3 | balrog | case 0x70: /* RFBI_DATA_CYCLE2_0 */ |
808 | 827df9f3 | balrog | s->rfbi.data[1] = value & 0x0f1f0f1f; |
809 | 827df9f3 | balrog | break;
|
810 | 827df9f3 | balrog | case 0x74: /* RFBI_DATA_CYCLE3_0 */ |
811 | 827df9f3 | balrog | s->rfbi.data[2] = value & 0x0f1f0f1f; |
812 | 827df9f3 | balrog | break;
|
813 | 827df9f3 | balrog | case 0x78: /* RFBI_CONFIG1 */ |
814 | 827df9f3 | balrog | s->rfbi.config[1] = value & 0x003f1fff; |
815 | 827df9f3 | balrog | break;
|
816 | 827df9f3 | balrog | |
817 | 827df9f3 | balrog | case 0x7c: /* RFBI_ONOFF_TIME1 */ |
818 | 827df9f3 | balrog | s->rfbi.time[2] = value & 0x3fffffff; |
819 | 827df9f3 | balrog | break;
|
820 | 827df9f3 | balrog | case 0x80: /* RFBI_CYCLE_TIME1 */ |
821 | 827df9f3 | balrog | s->rfbi.time[3] = value & 0x0fffffff; |
822 | 827df9f3 | balrog | break;
|
823 | 827df9f3 | balrog | case 0x84: /* RFBI_DATA_CYCLE1_1 */ |
824 | 827df9f3 | balrog | s->rfbi.data[3] = value & 0x0f1f0f1f; |
825 | 827df9f3 | balrog | break;
|
826 | 827df9f3 | balrog | case 0x88: /* RFBI_DATA_CYCLE2_1 */ |
827 | 827df9f3 | balrog | s->rfbi.data[4] = value & 0x0f1f0f1f; |
828 | 827df9f3 | balrog | break;
|
829 | 827df9f3 | balrog | case 0x8c: /* RFBI_DATA_CYCLE3_1 */ |
830 | 827df9f3 | balrog | s->rfbi.data[5] = value & 0x0f1f0f1f; |
831 | 827df9f3 | balrog | break;
|
832 | 827df9f3 | balrog | |
833 | 827df9f3 | balrog | case 0x90: /* RFBI_VSYNC_WIDTH */ |
834 | 827df9f3 | balrog | s->rfbi.vsync = value & 0xffff;
|
835 | 827df9f3 | balrog | break;
|
836 | 827df9f3 | balrog | case 0x94: /* RFBI_HSYNC_WIDTH */ |
837 | 827df9f3 | balrog | s->rfbi.hsync = value & 0xffff;
|
838 | 827df9f3 | balrog | break;
|
839 | 827df9f3 | balrog | |
840 | 827df9f3 | balrog | default:
|
841 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
842 | 827df9f3 | balrog | } |
843 | 827df9f3 | balrog | } |
844 | 827df9f3 | balrog | |
845 | 827df9f3 | balrog | static CPUReadMemoryFunc *omap_rfbi1_readfn[] = {
|
846 | 827df9f3 | balrog | omap_badwidth_read32, |
847 | 827df9f3 | balrog | omap_badwidth_read32, |
848 | 827df9f3 | balrog | omap_rfbi_read, |
849 | 827df9f3 | balrog | }; |
850 | 827df9f3 | balrog | |
851 | 827df9f3 | balrog | static CPUWriteMemoryFunc *omap_rfbi1_writefn[] = {
|
852 | 827df9f3 | balrog | omap_badwidth_write32, |
853 | 827df9f3 | balrog | omap_badwidth_write32, |
854 | 827df9f3 | balrog | omap_rfbi_write, |
855 | 827df9f3 | balrog | }; |
856 | 827df9f3 | balrog | |
857 | 827df9f3 | balrog | static uint32_t omap_venc_read(void *opaque, target_phys_addr_t addr) |
858 | 827df9f3 | balrog | { |
859 | 8da3ff18 | pbrook | switch (addr) {
|
860 | 827df9f3 | balrog | case 0x00: /* REV_ID */ |
861 | 827df9f3 | balrog | case 0x04: /* STATUS */ |
862 | 827df9f3 | balrog | case 0x08: /* F_CONTROL */ |
863 | 827df9f3 | balrog | case 0x10: /* VIDOUT_CTRL */ |
864 | 827df9f3 | balrog | case 0x14: /* SYNC_CTRL */ |
865 | 827df9f3 | balrog | case 0x1c: /* LLEN */ |
866 | 827df9f3 | balrog | case 0x20: /* FLENS */ |
867 | 827df9f3 | balrog | case 0x24: /* HFLTR_CTRL */ |
868 | 827df9f3 | balrog | case 0x28: /* CC_CARR_WSS_CARR */ |
869 | 827df9f3 | balrog | case 0x2c: /* C_PHASE */ |
870 | 827df9f3 | balrog | case 0x30: /* GAIN_U */ |
871 | 827df9f3 | balrog | case 0x34: /* GAIN_V */ |
872 | 827df9f3 | balrog | case 0x38: /* GAIN_Y */ |
873 | 827df9f3 | balrog | case 0x3c: /* BLACK_LEVEL */ |
874 | 827df9f3 | balrog | case 0x40: /* BLANK_LEVEL */ |
875 | 827df9f3 | balrog | case 0x44: /* X_COLOR */ |
876 | 827df9f3 | balrog | case 0x48: /* M_CONTROL */ |
877 | 827df9f3 | balrog | case 0x4c: /* BSTAMP_WSS_DATA */ |
878 | 827df9f3 | balrog | case 0x50: /* S_CARR */ |
879 | 827df9f3 | balrog | case 0x54: /* LINE21 */ |
880 | 827df9f3 | balrog | case 0x58: /* LN_SEL */ |
881 | 827df9f3 | balrog | case 0x5c: /* L21__WC_CTL */ |
882 | 827df9f3 | balrog | case 0x60: /* HTRIGGER_VTRIGGER */ |
883 | 827df9f3 | balrog | case 0x64: /* SAVID__EAVID */ |
884 | 827df9f3 | balrog | case 0x68: /* FLEN__FAL */ |
885 | 827df9f3 | balrog | case 0x6c: /* LAL__PHASE_RESET */ |
886 | 827df9f3 | balrog | case 0x70: /* HS_INT_START_STOP_X */ |
887 | 827df9f3 | balrog | case 0x74: /* HS_EXT_START_STOP_X */ |
888 | 827df9f3 | balrog | case 0x78: /* VS_INT_START_X */ |
889 | 827df9f3 | balrog | case 0x7c: /* VS_INT_STOP_X__VS_INT_START_Y */ |
890 | 827df9f3 | balrog | case 0x80: /* VS_INT_STOP_Y__VS_INT_START_X */ |
891 | 827df9f3 | balrog | case 0x84: /* VS_EXT_STOP_X__VS_EXT_START_Y */ |
892 | 827df9f3 | balrog | case 0x88: /* VS_EXT_STOP_Y */ |
893 | 827df9f3 | balrog | case 0x90: /* AVID_START_STOP_X */ |
894 | 827df9f3 | balrog | case 0x94: /* AVID_START_STOP_Y */ |
895 | 827df9f3 | balrog | case 0xa0: /* FID_INT_START_X__FID_INT_START_Y */ |
896 | 827df9f3 | balrog | case 0xa4: /* FID_INT_OFFSET_Y__FID_EXT_START_X */ |
897 | 827df9f3 | balrog | case 0xa8: /* FID_EXT_START_Y__FID_EXT_OFFSET_Y */ |
898 | 827df9f3 | balrog | case 0xb0: /* TVDETGP_INT_START_STOP_X */ |
899 | 827df9f3 | balrog | case 0xb4: /* TVDETGP_INT_START_STOP_Y */ |
900 | 827df9f3 | balrog | case 0xb8: /* GEN_CTRL */ |
901 | 827df9f3 | balrog | case 0xc4: /* DAC_TST__DAC_A */ |
902 | 827df9f3 | balrog | case 0xc8: /* DAC_B__DAC_C */ |
903 | 827df9f3 | balrog | return 0; |
904 | 827df9f3 | balrog | |
905 | 827df9f3 | balrog | default:
|
906 | 827df9f3 | balrog | break;
|
907 | 827df9f3 | balrog | } |
908 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
909 | 827df9f3 | balrog | return 0; |
910 | 827df9f3 | balrog | } |
911 | 827df9f3 | balrog | |
912 | 827df9f3 | balrog | static void omap_venc_write(void *opaque, target_phys_addr_t addr, |
913 | 827df9f3 | balrog | uint32_t value) |
914 | 827df9f3 | balrog | { |
915 | 8da3ff18 | pbrook | switch (addr) {
|
916 | 827df9f3 | balrog | case 0x08: /* F_CONTROL */ |
917 | 827df9f3 | balrog | case 0x10: /* VIDOUT_CTRL */ |
918 | 827df9f3 | balrog | case 0x14: /* SYNC_CTRL */ |
919 | 827df9f3 | balrog | case 0x1c: /* LLEN */ |
920 | 827df9f3 | balrog | case 0x20: /* FLENS */ |
921 | 827df9f3 | balrog | case 0x24: /* HFLTR_CTRL */ |
922 | 827df9f3 | balrog | case 0x28: /* CC_CARR_WSS_CARR */ |
923 | 827df9f3 | balrog | case 0x2c: /* C_PHASE */ |
924 | 827df9f3 | balrog | case 0x30: /* GAIN_U */ |
925 | 827df9f3 | balrog | case 0x34: /* GAIN_V */ |
926 | 827df9f3 | balrog | case 0x38: /* GAIN_Y */ |
927 | 827df9f3 | balrog | case 0x3c: /* BLACK_LEVEL */ |
928 | 827df9f3 | balrog | case 0x40: /* BLANK_LEVEL */ |
929 | 827df9f3 | balrog | case 0x44: /* X_COLOR */ |
930 | 827df9f3 | balrog | case 0x48: /* M_CONTROL */ |
931 | 827df9f3 | balrog | case 0x4c: /* BSTAMP_WSS_DATA */ |
932 | 827df9f3 | balrog | case 0x50: /* S_CARR */ |
933 | 827df9f3 | balrog | case 0x54: /* LINE21 */ |
934 | 827df9f3 | balrog | case 0x58: /* LN_SEL */ |
935 | 827df9f3 | balrog | case 0x5c: /* L21__WC_CTL */ |
936 | 827df9f3 | balrog | case 0x60: /* HTRIGGER_VTRIGGER */ |
937 | 827df9f3 | balrog | case 0x64: /* SAVID__EAVID */ |
938 | 827df9f3 | balrog | case 0x68: /* FLEN__FAL */ |
939 | 827df9f3 | balrog | case 0x6c: /* LAL__PHASE_RESET */ |
940 | 827df9f3 | balrog | case 0x70: /* HS_INT_START_STOP_X */ |
941 | 827df9f3 | balrog | case 0x74: /* HS_EXT_START_STOP_X */ |
942 | 827df9f3 | balrog | case 0x78: /* VS_INT_START_X */ |
943 | 827df9f3 | balrog | case 0x7c: /* VS_INT_STOP_X__VS_INT_START_Y */ |
944 | 827df9f3 | balrog | case 0x80: /* VS_INT_STOP_Y__VS_INT_START_X */ |
945 | 827df9f3 | balrog | case 0x84: /* VS_EXT_STOP_X__VS_EXT_START_Y */ |
946 | 827df9f3 | balrog | case 0x88: /* VS_EXT_STOP_Y */ |
947 | 827df9f3 | balrog | case 0x90: /* AVID_START_STOP_X */ |
948 | 827df9f3 | balrog | case 0x94: /* AVID_START_STOP_Y */ |
949 | 827df9f3 | balrog | case 0xa0: /* FID_INT_START_X__FID_INT_START_Y */ |
950 | 827df9f3 | balrog | case 0xa4: /* FID_INT_OFFSET_Y__FID_EXT_START_X */ |
951 | 827df9f3 | balrog | case 0xa8: /* FID_EXT_START_Y__FID_EXT_OFFSET_Y */ |
952 | 827df9f3 | balrog | case 0xb0: /* TVDETGP_INT_START_STOP_X */ |
953 | 827df9f3 | balrog | case 0xb4: /* TVDETGP_INT_START_STOP_Y */ |
954 | 827df9f3 | balrog | case 0xb8: /* GEN_CTRL */ |
955 | 827df9f3 | balrog | case 0xc4: /* DAC_TST__DAC_A */ |
956 | 827df9f3 | balrog | case 0xc8: /* DAC_B__DAC_C */ |
957 | 827df9f3 | balrog | break;
|
958 | 827df9f3 | balrog | |
959 | 827df9f3 | balrog | default:
|
960 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
961 | 827df9f3 | balrog | } |
962 | 827df9f3 | balrog | } |
963 | 827df9f3 | balrog | |
964 | 827df9f3 | balrog | static CPUReadMemoryFunc *omap_venc1_readfn[] = {
|
965 | 827df9f3 | balrog | omap_badwidth_read32, |
966 | 827df9f3 | balrog | omap_badwidth_read32, |
967 | 827df9f3 | balrog | omap_venc_read, |
968 | 827df9f3 | balrog | }; |
969 | 827df9f3 | balrog | |
970 | 827df9f3 | balrog | static CPUWriteMemoryFunc *omap_venc1_writefn[] = {
|
971 | 827df9f3 | balrog | omap_badwidth_write32, |
972 | 827df9f3 | balrog | omap_badwidth_write32, |
973 | 827df9f3 | balrog | omap_venc_write, |
974 | 827df9f3 | balrog | }; |
975 | 827df9f3 | balrog | |
976 | 827df9f3 | balrog | static uint32_t omap_im3_read(void *opaque, target_phys_addr_t addr) |
977 | 827df9f3 | balrog | { |
978 | 8da3ff18 | pbrook | switch (addr) {
|
979 | 827df9f3 | balrog | case 0x0a8: /* SBIMERRLOGA */ |
980 | 827df9f3 | balrog | case 0x0b0: /* SBIMERRLOG */ |
981 | 827df9f3 | balrog | case 0x190: /* SBIMSTATE */ |
982 | 827df9f3 | balrog | case 0x198: /* SBTMSTATE_L */ |
983 | 827df9f3 | balrog | case 0x19c: /* SBTMSTATE_H */ |
984 | 827df9f3 | balrog | case 0x1a8: /* SBIMCONFIG_L */ |
985 | 827df9f3 | balrog | case 0x1ac: /* SBIMCONFIG_H */ |
986 | 827df9f3 | balrog | case 0x1f8: /* SBID_L */ |
987 | 827df9f3 | balrog | case 0x1fc: /* SBID_H */ |
988 | 827df9f3 | balrog | return 0; |
989 | 827df9f3 | balrog | |
990 | 827df9f3 | balrog | default:
|
991 | 827df9f3 | balrog | break;
|
992 | 827df9f3 | balrog | } |
993 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
994 | 827df9f3 | balrog | return 0; |
995 | 827df9f3 | balrog | } |
996 | 827df9f3 | balrog | |
997 | 827df9f3 | balrog | static void omap_im3_write(void *opaque, target_phys_addr_t addr, |
998 | 827df9f3 | balrog | uint32_t value) |
999 | 827df9f3 | balrog | { |
1000 | 8da3ff18 | pbrook | switch (addr) {
|
1001 | 827df9f3 | balrog | case 0x0b0: /* SBIMERRLOG */ |
1002 | 827df9f3 | balrog | case 0x190: /* SBIMSTATE */ |
1003 | 827df9f3 | balrog | case 0x198: /* SBTMSTATE_L */ |
1004 | 827df9f3 | balrog | case 0x19c: /* SBTMSTATE_H */ |
1005 | 827df9f3 | balrog | case 0x1a8: /* SBIMCONFIG_L */ |
1006 | 827df9f3 | balrog | case 0x1ac: /* SBIMCONFIG_H */ |
1007 | 827df9f3 | balrog | break;
|
1008 | 827df9f3 | balrog | |
1009 | 827df9f3 | balrog | default:
|
1010 | 827df9f3 | balrog | OMAP_BAD_REG(addr); |
1011 | 827df9f3 | balrog | } |
1012 | 827df9f3 | balrog | } |
1013 | 827df9f3 | balrog | |
1014 | 827df9f3 | balrog | static CPUReadMemoryFunc *omap_im3_readfn[] = {
|
1015 | 827df9f3 | balrog | omap_badwidth_read32, |
1016 | 827df9f3 | balrog | omap_badwidth_read32, |
1017 | 827df9f3 | balrog | omap_im3_read, |
1018 | 827df9f3 | balrog | }; |
1019 | 827df9f3 | balrog | |
1020 | 827df9f3 | balrog | static CPUWriteMemoryFunc *omap_im3_writefn[] = {
|
1021 | 827df9f3 | balrog | omap_badwidth_write32, |
1022 | 827df9f3 | balrog | omap_badwidth_write32, |
1023 | 827df9f3 | balrog | omap_im3_write, |
1024 | 827df9f3 | balrog | }; |
1025 | 827df9f3 | balrog | |
1026 | 827df9f3 | balrog | struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta, |
1027 | 3023f332 | aliguori | target_phys_addr_t l3_base, |
1028 | 827df9f3 | balrog | qemu_irq irq, qemu_irq drq, |
1029 | 827df9f3 | balrog | omap_clk fck1, omap_clk fck2, omap_clk ck54m, |
1030 | 827df9f3 | balrog | omap_clk ick1, omap_clk ick2) |
1031 | 827df9f3 | balrog | { |
1032 | 827df9f3 | balrog | int iomemtype[5]; |
1033 | 827df9f3 | balrog | struct omap_dss_s *s = (struct omap_dss_s *) |
1034 | 827df9f3 | balrog | qemu_mallocz(sizeof(struct omap_dss_s)); |
1035 | 827df9f3 | balrog | |
1036 | 827df9f3 | balrog | s->irq = irq; |
1037 | 827df9f3 | balrog | s->drq = drq; |
1038 | 827df9f3 | balrog | omap_dss_reset(s); |
1039 | 827df9f3 | balrog | |
1040 | c66fb5bc | balrog | iomemtype[0] = l4_register_io_memory(0, omap_diss1_readfn, |
1041 | 827df9f3 | balrog | omap_diss1_writefn, s); |
1042 | c66fb5bc | balrog | iomemtype[1] = l4_register_io_memory(0, omap_disc1_readfn, |
1043 | 827df9f3 | balrog | omap_disc1_writefn, s); |
1044 | c66fb5bc | balrog | iomemtype[2] = l4_register_io_memory(0, omap_rfbi1_readfn, |
1045 | 827df9f3 | balrog | omap_rfbi1_writefn, s); |
1046 | c66fb5bc | balrog | iomemtype[3] = l4_register_io_memory(0, omap_venc1_readfn, |
1047 | 827df9f3 | balrog | omap_venc1_writefn, s); |
1048 | 827df9f3 | balrog | iomemtype[4] = cpu_register_io_memory(0, omap_im3_readfn, |
1049 | 827df9f3 | balrog | omap_im3_writefn, s); |
1050 | 8da3ff18 | pbrook | omap_l4_attach(ta, 0, iomemtype[0]); |
1051 | 8da3ff18 | pbrook | omap_l4_attach(ta, 1, iomemtype[1]); |
1052 | 9e7d11ff | balrog | omap_l4_attach(ta, 2, iomemtype[2]); |
1053 | 8da3ff18 | pbrook | omap_l4_attach(ta, 3, iomemtype[3]); |
1054 | 8da3ff18 | pbrook | cpu_register_physical_memory(l3_base, 0x1000, iomemtype[4]); |
1055 | 827df9f3 | balrog | |
1056 | 827df9f3 | balrog | #if 0
|
1057 | 3023f332 | aliguori | s->state = graphic_console_init(omap_update_display,
|
1058 | 3023f332 | aliguori | omap_invalidate_display, omap_screen_dump, s);
|
1059 | 827df9f3 | balrog | #endif
|
1060 | 827df9f3 | balrog | |
1061 | 827df9f3 | balrog | return s;
|
1062 | 827df9f3 | balrog | } |
1063 | 827df9f3 | balrog | |
1064 | 827df9f3 | balrog | void omap_rfbi_attach(struct omap_dss_s *s, int cs, struct rfbi_chip_s *chip) |
1065 | 827df9f3 | balrog | { |
1066 | 827df9f3 | balrog | if (cs < 0 || cs > 1) |
1067 | 827df9f3 | balrog | cpu_abort(cpu_single_env, "%s: wrong CS %i\n", __FUNCTION__, cs);
|
1068 | 827df9f3 | balrog | s->rfbi.chip[cs] = chip; |
1069 | 827df9f3 | balrog | } |