root / hw / spitz.c @ 89cdb6af
History | View | Annotate | Download (30.2 kB)
1 | b00052e4 | balrog | /*
|
---|---|---|---|
2 | b00052e4 | balrog | * PXA270-based Clamshell PDA platforms.
|
3 | b00052e4 | balrog | *
|
4 | b00052e4 | balrog | * Copyright (c) 2006 Openedhand Ltd.
|
5 | b00052e4 | balrog | * Written by Andrzej Zaborowski <balrog@zabor.org>
|
6 | b00052e4 | balrog | *
|
7 | b00052e4 | balrog | * This code is licensed under the GNU GPL v2.
|
8 | b00052e4 | balrog | */
|
9 | b00052e4 | balrog | |
10 | 87ecb68b | pbrook | #include "hw.h" |
11 | 87ecb68b | pbrook | #include "pxa.h" |
12 | 87ecb68b | pbrook | #include "arm-misc.h" |
13 | 87ecb68b | pbrook | #include "sysemu.h" |
14 | 87ecb68b | pbrook | #include "pcmcia.h" |
15 | 87ecb68b | pbrook | #include "i2c.h" |
16 | 87ecb68b | pbrook | #include "flash.h" |
17 | 87ecb68b | pbrook | #include "qemu-timer.h" |
18 | 87ecb68b | pbrook | #include "devices.h" |
19 | e33d8cdb | balrog | #include "sharpsl.h" |
20 | 87ecb68b | pbrook | #include "console.h" |
21 | 87ecb68b | pbrook | #include "block.h" |
22 | 87ecb68b | pbrook | #include "audio/audio.h" |
23 | 87ecb68b | pbrook | #include "boards.h" |
24 | b00052e4 | balrog | |
25 | b00052e4 | balrog | #undef REG_FMT
|
26 | 444ce241 | bellard | #if TARGET_PHYS_ADDR_BITS == 32 |
27 | 444ce241 | bellard | #define REG_FMT "0x%02x" |
28 | 444ce241 | bellard | #else
|
29 | b00052e4 | balrog | #define REG_FMT "0x%02lx" |
30 | 444ce241 | bellard | #endif
|
31 | b00052e4 | balrog | |
32 | b00052e4 | balrog | /* Spitz Flash */
|
33 | b00052e4 | balrog | #define FLASH_BASE 0x0c000000 |
34 | b00052e4 | balrog | #define FLASH_ECCLPLB 0x00 /* Line parity 7 - 0 bit */ |
35 | b00052e4 | balrog | #define FLASH_ECCLPUB 0x04 /* Line parity 15 - 8 bit */ |
36 | b00052e4 | balrog | #define FLASH_ECCCP 0x08 /* Column parity 5 - 0 bit */ |
37 | b00052e4 | balrog | #define FLASH_ECCCNTR 0x0c /* ECC byte counter */ |
38 | b00052e4 | balrog | #define FLASH_ECCCLRR 0x10 /* Clear ECC */ |
39 | b00052e4 | balrog | #define FLASH_FLASHIO 0x14 /* Flash I/O */ |
40 | b00052e4 | balrog | #define FLASH_FLASHCTL 0x18 /* Flash Control */ |
41 | b00052e4 | balrog | |
42 | b00052e4 | balrog | #define FLASHCTL_CE0 (1 << 0) |
43 | b00052e4 | balrog | #define FLASHCTL_CLE (1 << 1) |
44 | b00052e4 | balrog | #define FLASHCTL_ALE (1 << 2) |
45 | b00052e4 | balrog | #define FLASHCTL_WP (1 << 3) |
46 | b00052e4 | balrog | #define FLASHCTL_CE1 (1 << 4) |
47 | b00052e4 | balrog | #define FLASHCTL_RYBY (1 << 5) |
48 | b00052e4 | balrog | #define FLASHCTL_NCE (FLASHCTL_CE0 | FLASHCTL_CE1)
|
49 | b00052e4 | balrog | |
50 | b00052e4 | balrog | struct sl_nand_s {
|
51 | b00052e4 | balrog | target_phys_addr_t target_base; |
52 | b00052e4 | balrog | struct nand_flash_s *nand;
|
53 | b00052e4 | balrog | uint8_t ctl; |
54 | b00052e4 | balrog | struct ecc_state_s ecc;
|
55 | b00052e4 | balrog | }; |
56 | b00052e4 | balrog | |
57 | b00052e4 | balrog | static uint32_t sl_readb(void *opaque, target_phys_addr_t addr) |
58 | b00052e4 | balrog | { |
59 | b00052e4 | balrog | struct sl_nand_s *s = (struct sl_nand_s *) opaque; |
60 | b00052e4 | balrog | int ryby;
|
61 | b00052e4 | balrog | addr -= s->target_base; |
62 | b00052e4 | balrog | |
63 | b00052e4 | balrog | switch (addr) {
|
64 | b00052e4 | balrog | #define BSHR(byte, from, to) ((s->ecc.lp[byte] >> (from - to)) & (1 << to)) |
65 | b00052e4 | balrog | case FLASH_ECCLPLB:
|
66 | b00052e4 | balrog | return BSHR(0, 4, 0) | BSHR(0, 5, 2) | BSHR(0, 6, 4) | BSHR(0, 7, 6) | |
67 | b00052e4 | balrog | BSHR(1, 4, 1) | BSHR(1, 5, 3) | BSHR(1, 6, 5) | BSHR(1, 7, 7); |
68 | b00052e4 | balrog | |
69 | b00052e4 | balrog | #define BSHL(byte, from, to) ((s->ecc.lp[byte] << (to - from)) & (1 << to)) |
70 | b00052e4 | balrog | case FLASH_ECCLPUB:
|
71 | b00052e4 | balrog | return BSHL(0, 0, 0) | BSHL(0, 1, 2) | BSHL(0, 2, 4) | BSHL(0, 3, 6) | |
72 | b00052e4 | balrog | BSHL(1, 0, 1) | BSHL(1, 1, 3) | BSHL(1, 2, 5) | BSHL(1, 3, 7); |
73 | b00052e4 | balrog | |
74 | b00052e4 | balrog | case FLASH_ECCCP:
|
75 | b00052e4 | balrog | return s->ecc.cp;
|
76 | b00052e4 | balrog | |
77 | b00052e4 | balrog | case FLASH_ECCCNTR:
|
78 | b00052e4 | balrog | return s->ecc.count & 0xff; |
79 | b00052e4 | balrog | |
80 | b00052e4 | balrog | case FLASH_FLASHCTL:
|
81 | b00052e4 | balrog | nand_getpins(s->nand, &ryby); |
82 | b00052e4 | balrog | if (ryby)
|
83 | b00052e4 | balrog | return s->ctl | FLASHCTL_RYBY;
|
84 | b00052e4 | balrog | else
|
85 | b00052e4 | balrog | return s->ctl;
|
86 | b00052e4 | balrog | |
87 | b00052e4 | balrog | case FLASH_FLASHIO:
|
88 | b00052e4 | balrog | return ecc_digest(&s->ecc, nand_getio(s->nand));
|
89 | b00052e4 | balrog | |
90 | b00052e4 | balrog | default:
|
91 | 89cdb6af | balrog | zaurus_printf("Bad register offset " REG_FMT "\n", addr); |
92 | b00052e4 | balrog | } |
93 | b00052e4 | balrog | return 0; |
94 | b00052e4 | balrog | } |
95 | b00052e4 | balrog | |
96 | a5236105 | balrog | static uint32_t sl_readl(void *opaque, target_phys_addr_t addr) |
97 | a5236105 | balrog | { |
98 | a5236105 | balrog | struct sl_nand_s *s = (struct sl_nand_s *) opaque; |
99 | a5236105 | balrog | addr -= s->target_base; |
100 | a5236105 | balrog | |
101 | a5236105 | balrog | if (addr == FLASH_FLASHIO)
|
102 | a5236105 | balrog | return ecc_digest(&s->ecc, nand_getio(s->nand)) |
|
103 | a5236105 | balrog | (ecc_digest(&s->ecc, nand_getio(s->nand)) << 16);
|
104 | a5236105 | balrog | |
105 | a5236105 | balrog | return sl_readb(opaque, addr);
|
106 | a5236105 | balrog | } |
107 | a5236105 | balrog | |
108 | b00052e4 | balrog | static void sl_writeb(void *opaque, target_phys_addr_t addr, |
109 | b00052e4 | balrog | uint32_t value) |
110 | b00052e4 | balrog | { |
111 | b00052e4 | balrog | struct sl_nand_s *s = (struct sl_nand_s *) opaque; |
112 | b00052e4 | balrog | addr -= s->target_base; |
113 | b00052e4 | balrog | |
114 | b00052e4 | balrog | switch (addr) {
|
115 | b00052e4 | balrog | case FLASH_ECCCLRR:
|
116 | b00052e4 | balrog | /* Value is ignored. */
|
117 | b00052e4 | balrog | ecc_reset(&s->ecc); |
118 | b00052e4 | balrog | break;
|
119 | b00052e4 | balrog | |
120 | b00052e4 | balrog | case FLASH_FLASHCTL:
|
121 | b00052e4 | balrog | s->ctl = value & 0xff & ~FLASHCTL_RYBY;
|
122 | b00052e4 | balrog | nand_setpins(s->nand, |
123 | b00052e4 | balrog | s->ctl & FLASHCTL_CLE, |
124 | b00052e4 | balrog | s->ctl & FLASHCTL_ALE, |
125 | b00052e4 | balrog | s->ctl & FLASHCTL_NCE, |
126 | b00052e4 | balrog | s->ctl & FLASHCTL_WP, |
127 | b00052e4 | balrog | 0);
|
128 | b00052e4 | balrog | break;
|
129 | b00052e4 | balrog | |
130 | b00052e4 | balrog | case FLASH_FLASHIO:
|
131 | b00052e4 | balrog | nand_setio(s->nand, ecc_digest(&s->ecc, value & 0xff));
|
132 | b00052e4 | balrog | break;
|
133 | b00052e4 | balrog | |
134 | b00052e4 | balrog | default:
|
135 | 89cdb6af | balrog | zaurus_printf("Bad register offset " REG_FMT "\n", addr); |
136 | b00052e4 | balrog | } |
137 | b00052e4 | balrog | } |
138 | b00052e4 | balrog | |
139 | aa941b94 | balrog | static void sl_save(QEMUFile *f, void *opaque) |
140 | aa941b94 | balrog | { |
141 | aa941b94 | balrog | struct sl_nand_s *s = (struct sl_nand_s *) opaque; |
142 | aa941b94 | balrog | |
143 | aa941b94 | balrog | qemu_put_8s(f, &s->ctl); |
144 | aa941b94 | balrog | ecc_put(f, &s->ecc); |
145 | aa941b94 | balrog | } |
146 | aa941b94 | balrog | |
147 | aa941b94 | balrog | static int sl_load(QEMUFile *f, void *opaque, int version_id) |
148 | aa941b94 | balrog | { |
149 | aa941b94 | balrog | struct sl_nand_s *s = (struct sl_nand_s *) opaque; |
150 | aa941b94 | balrog | |
151 | aa941b94 | balrog | qemu_get_8s(f, &s->ctl); |
152 | aa941b94 | balrog | ecc_get(f, &s->ecc); |
153 | aa941b94 | balrog | |
154 | aa941b94 | balrog | return 0; |
155 | aa941b94 | balrog | } |
156 | aa941b94 | balrog | |
157 | b00052e4 | balrog | enum {
|
158 | b00052e4 | balrog | FLASH_128M, |
159 | b00052e4 | balrog | FLASH_1024M, |
160 | b00052e4 | balrog | }; |
161 | b00052e4 | balrog | |
162 | b00052e4 | balrog | static void sl_flash_register(struct pxa2xx_state_s *cpu, int size) |
163 | b00052e4 | balrog | { |
164 | b00052e4 | balrog | int iomemtype;
|
165 | b00052e4 | balrog | struct sl_nand_s *s;
|
166 | b00052e4 | balrog | CPUReadMemoryFunc *sl_readfn[] = { |
167 | b00052e4 | balrog | sl_readb, |
168 | b00052e4 | balrog | sl_readb, |
169 | a5236105 | balrog | sl_readl, |
170 | b00052e4 | balrog | }; |
171 | b00052e4 | balrog | CPUWriteMemoryFunc *sl_writefn[] = { |
172 | b00052e4 | balrog | sl_writeb, |
173 | b00052e4 | balrog | sl_writeb, |
174 | b00052e4 | balrog | sl_writeb, |
175 | b00052e4 | balrog | }; |
176 | b00052e4 | balrog | |
177 | b00052e4 | balrog | s = (struct sl_nand_s *) qemu_mallocz(sizeof(struct sl_nand_s)); |
178 | b00052e4 | balrog | s->target_base = FLASH_BASE; |
179 | b00052e4 | balrog | s->ctl = 0;
|
180 | b00052e4 | balrog | if (size == FLASH_128M)
|
181 | b00052e4 | balrog | s->nand = nand_init(NAND_MFR_SAMSUNG, 0x73);
|
182 | b00052e4 | balrog | else if (size == FLASH_1024M) |
183 | b00052e4 | balrog | s->nand = nand_init(NAND_MFR_SAMSUNG, 0xf1);
|
184 | b00052e4 | balrog | |
185 | b00052e4 | balrog | iomemtype = cpu_register_io_memory(0, sl_readfn,
|
186 | b00052e4 | balrog | sl_writefn, s); |
187 | b00052e4 | balrog | cpu_register_physical_memory(s->target_base, 0x40, iomemtype);
|
188 | aa941b94 | balrog | |
189 | aa941b94 | balrog | register_savevm("sl_flash", 0, 0, sl_save, sl_load, s); |
190 | b00052e4 | balrog | } |
191 | b00052e4 | balrog | |
192 | b00052e4 | balrog | /* Spitz Keyboard */
|
193 | b00052e4 | balrog | |
194 | b00052e4 | balrog | #define SPITZ_KEY_STROBE_NUM 11 |
195 | b00052e4 | balrog | #define SPITZ_KEY_SENSE_NUM 7 |
196 | b00052e4 | balrog | |
197 | b00052e4 | balrog | static const int spitz_gpio_key_sense[SPITZ_KEY_SENSE_NUM] = { |
198 | b00052e4 | balrog | 12, 17, 91, 34, 36, 38, 39 |
199 | b00052e4 | balrog | }; |
200 | b00052e4 | balrog | |
201 | b00052e4 | balrog | static const int spitz_gpio_key_strobe[SPITZ_KEY_STROBE_NUM] = { |
202 | b00052e4 | balrog | 88, 23, 24, 25, 26, 27, 52, 103, 107, 108, 114 |
203 | b00052e4 | balrog | }; |
204 | b00052e4 | balrog | |
205 | b00052e4 | balrog | /* Eighth additional row maps the special keys */
|
206 | b00052e4 | balrog | static int spitz_keymap[SPITZ_KEY_SENSE_NUM + 1][SPITZ_KEY_STROBE_NUM] = { |
207 | b00052e4 | balrog | { 0x1d, 0x02, 0x04, 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0e, 0x3f, 0x40 }, |
208 | b00052e4 | balrog | { -1 , 0x03, 0x05, 0x13, 0x15, 0x09, 0x17, 0x18, 0x19, 0x41, 0x42 }, |
209 | b00052e4 | balrog | { 0x0f, 0x10, 0x12, 0x14, 0x22, 0x16, 0x24, 0x25, -1 , -1 , -1 }, |
210 | b00052e4 | balrog | { 0x3c, 0x11, 0x1f, 0x21, 0x2f, 0x23, 0x32, 0x26, -1 , 0x36, -1 }, |
211 | b00052e4 | balrog | { 0x3b, 0x1e, 0x20, 0x2e, 0x30, 0x31, 0x34, -1 , 0x1c, 0x2a, -1 }, |
212 | 2b76bdc9 | balrog | { 0x44, 0x2c, 0x2d, 0x0c, 0x39, 0x33, -1 , 0x48, -1 , -1 , 0x38 }, |
213 | 2b76bdc9 | balrog | { 0x37, 0x3d, -1 , 0x45, 0x57, 0x58, 0x4b, 0x50, 0x4d, -1 , -1 }, |
214 | b00052e4 | balrog | { 0x52, 0x43, 0x01, 0x47, 0x49, -1 , -1 , -1 , -1 , -1 , -1 }, |
215 | b00052e4 | balrog | }; |
216 | b00052e4 | balrog | |
217 | b00052e4 | balrog | #define SPITZ_GPIO_AK_INT 13 /* Remote control */ |
218 | b00052e4 | balrog | #define SPITZ_GPIO_SYNC 16 /* Sync button */ |
219 | b00052e4 | balrog | #define SPITZ_GPIO_ON_KEY 95 /* Power button */ |
220 | b00052e4 | balrog | #define SPITZ_GPIO_SWA 97 /* Lid */ |
221 | b00052e4 | balrog | #define SPITZ_GPIO_SWB 96 /* Tablet mode */ |
222 | b00052e4 | balrog | |
223 | b00052e4 | balrog | /* The special buttons are mapped to unused keys */
|
224 | b00052e4 | balrog | static const int spitz_gpiomap[5] = { |
225 | b00052e4 | balrog | SPITZ_GPIO_AK_INT, SPITZ_GPIO_SYNC, SPITZ_GPIO_ON_KEY, |
226 | b00052e4 | balrog | SPITZ_GPIO_SWA, SPITZ_GPIO_SWB, |
227 | b00052e4 | balrog | }; |
228 | b00052e4 | balrog | static int spitz_gpio_invert[5] = { 0, 0, 0, 0, 0, }; |
229 | b00052e4 | balrog | |
230 | b00052e4 | balrog | struct spitz_keyboard_s {
|
231 | 38641a52 | balrog | qemu_irq sense[SPITZ_KEY_SENSE_NUM]; |
232 | 38641a52 | balrog | qemu_irq *strobe; |
233 | 38641a52 | balrog | qemu_irq gpiomap[5];
|
234 | b00052e4 | balrog | int keymap[0x80]; |
235 | b00052e4 | balrog | uint16_t keyrow[SPITZ_KEY_SENSE_NUM]; |
236 | b00052e4 | balrog | uint16_t strobe_state; |
237 | b00052e4 | balrog | uint16_t sense_state; |
238 | b00052e4 | balrog | |
239 | b00052e4 | balrog | uint16_t pre_map[0x100];
|
240 | b00052e4 | balrog | uint16_t modifiers; |
241 | b00052e4 | balrog | uint16_t imodifiers; |
242 | b00052e4 | balrog | uint8_t fifo[16];
|
243 | b00052e4 | balrog | int fifopos, fifolen;
|
244 | b00052e4 | balrog | QEMUTimer *kbdtimer; |
245 | b00052e4 | balrog | }; |
246 | b00052e4 | balrog | |
247 | b00052e4 | balrog | static void spitz_keyboard_sense_update(struct spitz_keyboard_s *s) |
248 | b00052e4 | balrog | { |
249 | b00052e4 | balrog | int i;
|
250 | b00052e4 | balrog | uint16_t strobe, sense = 0;
|
251 | b00052e4 | balrog | for (i = 0; i < SPITZ_KEY_SENSE_NUM; i ++) { |
252 | b00052e4 | balrog | strobe = s->keyrow[i] & s->strobe_state; |
253 | b00052e4 | balrog | if (strobe) {
|
254 | b00052e4 | balrog | sense |= 1 << i;
|
255 | b00052e4 | balrog | if (!(s->sense_state & (1 << i))) |
256 | 38641a52 | balrog | qemu_irq_raise(s->sense[i]); |
257 | b00052e4 | balrog | } else if (s->sense_state & (1 << i)) |
258 | 38641a52 | balrog | qemu_irq_lower(s->sense[i]); |
259 | b00052e4 | balrog | } |
260 | b00052e4 | balrog | |
261 | b00052e4 | balrog | s->sense_state = sense; |
262 | b00052e4 | balrog | } |
263 | b00052e4 | balrog | |
264 | 38641a52 | balrog | static void spitz_keyboard_strobe(void *opaque, int line, int level) |
265 | b00052e4 | balrog | { |
266 | 38641a52 | balrog | struct spitz_keyboard_s *s = (struct spitz_keyboard_s *) opaque; |
267 | 38641a52 | balrog | |
268 | 38641a52 | balrog | if (level)
|
269 | 38641a52 | balrog | s->strobe_state |= 1 << line;
|
270 | 38641a52 | balrog | else
|
271 | 38641a52 | balrog | s->strobe_state &= ~(1 << line);
|
272 | 38641a52 | balrog | spitz_keyboard_sense_update(s); |
273 | b00052e4 | balrog | } |
274 | b00052e4 | balrog | |
275 | b00052e4 | balrog | static void spitz_keyboard_keydown(struct spitz_keyboard_s *s, int keycode) |
276 | b00052e4 | balrog | { |
277 | b00052e4 | balrog | int spitz_keycode = s->keymap[keycode & 0x7f]; |
278 | b00052e4 | balrog | if (spitz_keycode == -1) |
279 | b00052e4 | balrog | return;
|
280 | b00052e4 | balrog | |
281 | b00052e4 | balrog | /* Handle the additional keys */
|
282 | b00052e4 | balrog | if ((spitz_keycode >> 4) == SPITZ_KEY_SENSE_NUM) { |
283 | 38641a52 | balrog | qemu_set_irq(s->gpiomap[spitz_keycode & 0xf], (keycode < 0x80) ^ |
284 | b00052e4 | balrog | spitz_gpio_invert[spitz_keycode & 0xf]);
|
285 | b00052e4 | balrog | return;
|
286 | b00052e4 | balrog | } |
287 | b00052e4 | balrog | |
288 | b00052e4 | balrog | if (keycode & 0x80) |
289 | b00052e4 | balrog | s->keyrow[spitz_keycode >> 4] &= ~(1 << (spitz_keycode & 0xf)); |
290 | b00052e4 | balrog | else
|
291 | b00052e4 | balrog | s->keyrow[spitz_keycode >> 4] |= 1 << (spitz_keycode & 0xf); |
292 | b00052e4 | balrog | |
293 | b00052e4 | balrog | spitz_keyboard_sense_update(s); |
294 | b00052e4 | balrog | } |
295 | b00052e4 | balrog | |
296 | b00052e4 | balrog | #define SHIFT (1 << 7) |
297 | b00052e4 | balrog | #define CTRL (1 << 8) |
298 | b00052e4 | balrog | #define FN (1 << 9) |
299 | b00052e4 | balrog | |
300 | b00052e4 | balrog | #define QUEUE_KEY(c) s->fifo[(s->fifopos + s->fifolen ++) & 0xf] = c |
301 | b00052e4 | balrog | |
302 | b00052e4 | balrog | static void spitz_keyboard_handler(struct spitz_keyboard_s *s, int keycode) |
303 | b00052e4 | balrog | { |
304 | b00052e4 | balrog | uint16_t code; |
305 | b00052e4 | balrog | int mapcode;
|
306 | b00052e4 | balrog | switch (keycode) {
|
307 | b00052e4 | balrog | case 0x2a: /* Left Shift */ |
308 | b00052e4 | balrog | s->modifiers |= 1;
|
309 | b00052e4 | balrog | break;
|
310 | b00052e4 | balrog | case 0xaa: |
311 | b00052e4 | balrog | s->modifiers &= ~1;
|
312 | b00052e4 | balrog | break;
|
313 | b00052e4 | balrog | case 0x36: /* Right Shift */ |
314 | b00052e4 | balrog | s->modifiers |= 2;
|
315 | b00052e4 | balrog | break;
|
316 | b00052e4 | balrog | case 0xb6: |
317 | b00052e4 | balrog | s->modifiers &= ~2;
|
318 | b00052e4 | balrog | break;
|
319 | b00052e4 | balrog | case 0x1d: /* Control */ |
320 | b00052e4 | balrog | s->modifiers |= 4;
|
321 | b00052e4 | balrog | break;
|
322 | b00052e4 | balrog | case 0x9d: |
323 | b00052e4 | balrog | s->modifiers &= ~4;
|
324 | b00052e4 | balrog | break;
|
325 | b00052e4 | balrog | case 0x38: /* Alt */ |
326 | b00052e4 | balrog | s->modifiers |= 8;
|
327 | b00052e4 | balrog | break;
|
328 | b00052e4 | balrog | case 0xb8: |
329 | b00052e4 | balrog | s->modifiers &= ~8;
|
330 | b00052e4 | balrog | break;
|
331 | b00052e4 | balrog | } |
332 | b00052e4 | balrog | |
333 | b00052e4 | balrog | code = s->pre_map[mapcode = ((s->modifiers & 3) ?
|
334 | b00052e4 | balrog | (keycode | SHIFT) : |
335 | b00052e4 | balrog | (keycode & ~SHIFT))]; |
336 | b00052e4 | balrog | |
337 | b00052e4 | balrog | if (code != mapcode) {
|
338 | b00052e4 | balrog | #if 0
|
339 | b00052e4 | balrog | if ((code & SHIFT) && !(s->modifiers & 1))
|
340 | b00052e4 | balrog | QUEUE_KEY(0x2a | (keycode & 0x80));
|
341 | b00052e4 | balrog | if ((code & CTRL ) && !(s->modifiers & 4))
|
342 | b00052e4 | balrog | QUEUE_KEY(0x1d | (keycode & 0x80));
|
343 | b00052e4 | balrog | if ((code & FN ) && !(s->modifiers & 8))
|
344 | b00052e4 | balrog | QUEUE_KEY(0x38 | (keycode & 0x80));
|
345 | b00052e4 | balrog | if ((code & FN ) && (s->modifiers & 1))
|
346 | b00052e4 | balrog | QUEUE_KEY(0x2a | (~keycode & 0x80));
|
347 | b00052e4 | balrog | if ((code & FN ) && (s->modifiers & 2))
|
348 | b00052e4 | balrog | QUEUE_KEY(0x36 | (~keycode & 0x80));
|
349 | b00052e4 | balrog | #else
|
350 | b00052e4 | balrog | if (keycode & 0x80) { |
351 | b00052e4 | balrog | if ((s->imodifiers & 1 ) && !(s->modifiers & 1)) |
352 | b00052e4 | balrog | QUEUE_KEY(0x2a | 0x80); |
353 | b00052e4 | balrog | if ((s->imodifiers & 4 ) && !(s->modifiers & 4)) |
354 | b00052e4 | balrog | QUEUE_KEY(0x1d | 0x80); |
355 | b00052e4 | balrog | if ((s->imodifiers & 8 ) && !(s->modifiers & 8)) |
356 | b00052e4 | balrog | QUEUE_KEY(0x38 | 0x80); |
357 | b00052e4 | balrog | if ((s->imodifiers & 0x10) && (s->modifiers & 1)) |
358 | b00052e4 | balrog | QUEUE_KEY(0x2a);
|
359 | b00052e4 | balrog | if ((s->imodifiers & 0x20) && (s->modifiers & 2)) |
360 | b00052e4 | balrog | QUEUE_KEY(0x36);
|
361 | b00052e4 | balrog | s->imodifiers = 0;
|
362 | b00052e4 | balrog | } else {
|
363 | b00052e4 | balrog | if ((code & SHIFT) && !((s->modifiers | s->imodifiers) & 1)) { |
364 | b00052e4 | balrog | QUEUE_KEY(0x2a);
|
365 | b00052e4 | balrog | s->imodifiers |= 1;
|
366 | b00052e4 | balrog | } |
367 | b00052e4 | balrog | if ((code & CTRL ) && !((s->modifiers | s->imodifiers) & 4)) { |
368 | b00052e4 | balrog | QUEUE_KEY(0x1d);
|
369 | b00052e4 | balrog | s->imodifiers |= 4;
|
370 | b00052e4 | balrog | } |
371 | b00052e4 | balrog | if ((code & FN ) && !((s->modifiers | s->imodifiers) & 8)) { |
372 | b00052e4 | balrog | QUEUE_KEY(0x38);
|
373 | b00052e4 | balrog | s->imodifiers |= 8;
|
374 | b00052e4 | balrog | } |
375 | b00052e4 | balrog | if ((code & FN ) && (s->modifiers & 1) && |
376 | b00052e4 | balrog | !(s->imodifiers & 0x10)) {
|
377 | b00052e4 | balrog | QUEUE_KEY(0x2a | 0x80); |
378 | b00052e4 | balrog | s->imodifiers |= 0x10;
|
379 | b00052e4 | balrog | } |
380 | b00052e4 | balrog | if ((code & FN ) && (s->modifiers & 2) && |
381 | b00052e4 | balrog | !(s->imodifiers & 0x20)) {
|
382 | b00052e4 | balrog | QUEUE_KEY(0x36 | 0x80); |
383 | b00052e4 | balrog | s->imodifiers |= 0x20;
|
384 | b00052e4 | balrog | } |
385 | b00052e4 | balrog | } |
386 | b00052e4 | balrog | #endif
|
387 | b00052e4 | balrog | } |
388 | b00052e4 | balrog | |
389 | b00052e4 | balrog | QUEUE_KEY((code & 0x7f) | (keycode & 0x80)); |
390 | b00052e4 | balrog | } |
391 | b00052e4 | balrog | |
392 | b00052e4 | balrog | static void spitz_keyboard_tick(void *opaque) |
393 | b00052e4 | balrog | { |
394 | b00052e4 | balrog | struct spitz_keyboard_s *s = (struct spitz_keyboard_s *) opaque; |
395 | b00052e4 | balrog | |
396 | b00052e4 | balrog | if (s->fifolen) {
|
397 | b00052e4 | balrog | spitz_keyboard_keydown(s, s->fifo[s->fifopos ++]); |
398 | b00052e4 | balrog | s->fifolen --; |
399 | b00052e4 | balrog | if (s->fifopos >= 16) |
400 | b00052e4 | balrog | s->fifopos = 0;
|
401 | b00052e4 | balrog | } |
402 | b00052e4 | balrog | |
403 | b00052e4 | balrog | qemu_mod_timer(s->kbdtimer, qemu_get_clock(vm_clock) + ticks_per_sec / 32);
|
404 | b00052e4 | balrog | } |
405 | b00052e4 | balrog | |
406 | b00052e4 | balrog | static void spitz_keyboard_pre_map(struct spitz_keyboard_s *s) |
407 | b00052e4 | balrog | { |
408 | b00052e4 | balrog | int i;
|
409 | b00052e4 | balrog | for (i = 0; i < 0x100; i ++) |
410 | b00052e4 | balrog | s->pre_map[i] = i; |
411 | b00052e4 | balrog | s->pre_map[0x02 | SHIFT ] = 0x02 | SHIFT; /* exclam */ |
412 | b00052e4 | balrog | s->pre_map[0x28 | SHIFT ] = 0x03 | SHIFT; /* quotedbl */ |
413 | b00052e4 | balrog | s->pre_map[0x04 | SHIFT ] = 0x04 | SHIFT; /* numbersign */ |
414 | b00052e4 | balrog | s->pre_map[0x05 | SHIFT ] = 0x05 | SHIFT; /* dollar */ |
415 | b00052e4 | balrog | s->pre_map[0x06 | SHIFT ] = 0x06 | SHIFT; /* percent */ |
416 | b00052e4 | balrog | s->pre_map[0x08 | SHIFT ] = 0x07 | SHIFT; /* ampersand */ |
417 | b00052e4 | balrog | s->pre_map[0x28 ] = 0x08 | SHIFT; /* apostrophe */ |
418 | b00052e4 | balrog | s->pre_map[0x0a | SHIFT ] = 0x09 | SHIFT; /* parenleft */ |
419 | b00052e4 | balrog | s->pre_map[0x0b | SHIFT ] = 0x0a | SHIFT; /* parenright */ |
420 | b00052e4 | balrog | s->pre_map[0x29 | SHIFT ] = 0x0b | SHIFT; /* asciitilde */ |
421 | b00052e4 | balrog | s->pre_map[0x03 | SHIFT ] = 0x0c | SHIFT; /* at */ |
422 | b00052e4 | balrog | s->pre_map[0xd3 ] = 0x0e | FN; /* Delete */ |
423 | b00052e4 | balrog | s->pre_map[0x3a ] = 0x0f | FN; /* Caps_Lock */ |
424 | b00052e4 | balrog | s->pre_map[0x07 | SHIFT ] = 0x11 | FN; /* asciicircum */ |
425 | b00052e4 | balrog | s->pre_map[0x0d ] = 0x12 | FN; /* equal */ |
426 | b00052e4 | balrog | s->pre_map[0x0d | SHIFT ] = 0x13 | FN; /* plus */ |
427 | b00052e4 | balrog | s->pre_map[0x1a ] = 0x14 | FN; /* bracketleft */ |
428 | b00052e4 | balrog | s->pre_map[0x1b ] = 0x15 | FN; /* bracketright */ |
429 | 2b76bdc9 | balrog | s->pre_map[0x1a | SHIFT ] = 0x16 | FN; /* braceleft */ |
430 | 2b76bdc9 | balrog | s->pre_map[0x1b | SHIFT ] = 0x17 | FN; /* braceright */ |
431 | b00052e4 | balrog | s->pre_map[0x27 ] = 0x22 | FN; /* semicolon */ |
432 | b00052e4 | balrog | s->pre_map[0x27 | SHIFT ] = 0x23 | FN; /* colon */ |
433 | b00052e4 | balrog | s->pre_map[0x09 | SHIFT ] = 0x24 | FN; /* asterisk */ |
434 | b00052e4 | balrog | s->pre_map[0x2b ] = 0x25 | FN; /* backslash */ |
435 | b00052e4 | balrog | s->pre_map[0x2b | SHIFT ] = 0x26 | FN; /* bar */ |
436 | b00052e4 | balrog | s->pre_map[0x0c | SHIFT ] = 0x30 | FN; /* underscore */ |
437 | 2b76bdc9 | balrog | s->pre_map[0x33 | SHIFT ] = 0x33 | FN; /* less */ |
438 | b00052e4 | balrog | s->pre_map[0x35 ] = 0x33 | SHIFT; /* slash */ |
439 | 2b76bdc9 | balrog | s->pre_map[0x34 | SHIFT ] = 0x34 | FN; /* greater */ |
440 | b00052e4 | balrog | s->pre_map[0x35 | SHIFT ] = 0x34 | SHIFT; /* question */ |
441 | b00052e4 | balrog | s->pre_map[0x49 ] = 0x48 | FN; /* Page_Up */ |
442 | b00052e4 | balrog | s->pre_map[0x51 ] = 0x50 | FN; /* Page_Down */ |
443 | b00052e4 | balrog | |
444 | b00052e4 | balrog | s->modifiers = 0;
|
445 | b00052e4 | balrog | s->imodifiers = 0;
|
446 | b00052e4 | balrog | s->fifopos = 0;
|
447 | b00052e4 | balrog | s->fifolen = 0;
|
448 | b00052e4 | balrog | s->kbdtimer = qemu_new_timer(vm_clock, spitz_keyboard_tick, s); |
449 | b00052e4 | balrog | spitz_keyboard_tick(s); |
450 | b00052e4 | balrog | } |
451 | b00052e4 | balrog | |
452 | b00052e4 | balrog | #undef SHIFT
|
453 | b00052e4 | balrog | #undef CTRL
|
454 | b00052e4 | balrog | #undef FN
|
455 | b00052e4 | balrog | |
456 | aa941b94 | balrog | static void spitz_keyboard_save(QEMUFile *f, void *opaque) |
457 | aa941b94 | balrog | { |
458 | aa941b94 | balrog | struct spitz_keyboard_s *s = (struct spitz_keyboard_s *) opaque; |
459 | aa941b94 | balrog | int i;
|
460 | aa941b94 | balrog | |
461 | aa941b94 | balrog | qemu_put_be16s(f, &s->sense_state); |
462 | aa941b94 | balrog | qemu_put_be16s(f, &s->strobe_state); |
463 | aa941b94 | balrog | for (i = 0; i < 5; i ++) |
464 | aa941b94 | balrog | qemu_put_byte(f, spitz_gpio_invert[i]); |
465 | aa941b94 | balrog | } |
466 | aa941b94 | balrog | |
467 | aa941b94 | balrog | static int spitz_keyboard_load(QEMUFile *f, void *opaque, int version_id) |
468 | aa941b94 | balrog | { |
469 | aa941b94 | balrog | struct spitz_keyboard_s *s = (struct spitz_keyboard_s *) opaque; |
470 | aa941b94 | balrog | int i;
|
471 | aa941b94 | balrog | |
472 | aa941b94 | balrog | qemu_get_be16s(f, &s->sense_state); |
473 | aa941b94 | balrog | qemu_get_be16s(f, &s->strobe_state); |
474 | aa941b94 | balrog | for (i = 0; i < 5; i ++) |
475 | aa941b94 | balrog | spitz_gpio_invert[i] = qemu_get_byte(f); |
476 | aa941b94 | balrog | |
477 | aa941b94 | balrog | /* Release all pressed keys */
|
478 | aa941b94 | balrog | memset(s->keyrow, 0, sizeof(s->keyrow)); |
479 | aa941b94 | balrog | spitz_keyboard_sense_update(s); |
480 | aa941b94 | balrog | s->modifiers = 0;
|
481 | aa941b94 | balrog | s->imodifiers = 0;
|
482 | aa941b94 | balrog | s->fifopos = 0;
|
483 | aa941b94 | balrog | s->fifolen = 0;
|
484 | aa941b94 | balrog | |
485 | aa941b94 | balrog | return 0; |
486 | aa941b94 | balrog | } |
487 | aa941b94 | balrog | |
488 | b00052e4 | balrog | static void spitz_keyboard_register(struct pxa2xx_state_s *cpu) |
489 | b00052e4 | balrog | { |
490 | b00052e4 | balrog | int i, j;
|
491 | b00052e4 | balrog | struct spitz_keyboard_s *s;
|
492 | b00052e4 | balrog | |
493 | b00052e4 | balrog | s = (struct spitz_keyboard_s *)
|
494 | b00052e4 | balrog | qemu_mallocz(sizeof(struct spitz_keyboard_s)); |
495 | b00052e4 | balrog | memset(s, 0, sizeof(struct spitz_keyboard_s)); |
496 | b00052e4 | balrog | |
497 | b00052e4 | balrog | for (i = 0; i < 0x80; i ++) |
498 | b00052e4 | balrog | s->keymap[i] = -1;
|
499 | b00052e4 | balrog | for (i = 0; i < SPITZ_KEY_SENSE_NUM + 1; i ++) |
500 | b00052e4 | balrog | for (j = 0; j < SPITZ_KEY_STROBE_NUM; j ++) |
501 | b00052e4 | balrog | if (spitz_keymap[i][j] != -1) |
502 | b00052e4 | balrog | s->keymap[spitz_keymap[i][j]] = (i << 4) | j;
|
503 | b00052e4 | balrog | |
504 | 38641a52 | balrog | for (i = 0; i < SPITZ_KEY_SENSE_NUM; i ++) |
505 | 38641a52 | balrog | s->sense[i] = pxa2xx_gpio_in_get(cpu->gpio)[spitz_gpio_key_sense[i]]; |
506 | 38641a52 | balrog | |
507 | 38641a52 | balrog | for (i = 0; i < 5; i ++) |
508 | 38641a52 | balrog | s->gpiomap[i] = pxa2xx_gpio_in_get(cpu->gpio)[spitz_gpiomap[i]]; |
509 | 38641a52 | balrog | |
510 | 38641a52 | balrog | s->strobe = qemu_allocate_irqs(spitz_keyboard_strobe, s, |
511 | 38641a52 | balrog | SPITZ_KEY_STROBE_NUM); |
512 | b00052e4 | balrog | for (i = 0; i < SPITZ_KEY_STROBE_NUM; i ++) |
513 | 38641a52 | balrog | pxa2xx_gpio_out_set(cpu->gpio, spitz_gpio_key_strobe[i], s->strobe[i]); |
514 | b00052e4 | balrog | |
515 | b00052e4 | balrog | spitz_keyboard_pre_map(s); |
516 | b00052e4 | balrog | qemu_add_kbd_event_handler((QEMUPutKBDEvent *) spitz_keyboard_handler, s); |
517 | aa941b94 | balrog | |
518 | aa941b94 | balrog | register_savevm("spitz_keyboard", 0, 0, |
519 | aa941b94 | balrog | spitz_keyboard_save, spitz_keyboard_load, s); |
520 | b00052e4 | balrog | } |
521 | b00052e4 | balrog | |
522 | b00052e4 | balrog | /* LCD backlight controller */
|
523 | b00052e4 | balrog | |
524 | b00052e4 | balrog | #define LCDTG_RESCTL 0x00 |
525 | b00052e4 | balrog | #define LCDTG_PHACTRL 0x01 |
526 | b00052e4 | balrog | #define LCDTG_DUTYCTRL 0x02 |
527 | b00052e4 | balrog | #define LCDTG_POWERREG0 0x03 |
528 | b00052e4 | balrog | #define LCDTG_POWERREG1 0x04 |
529 | b00052e4 | balrog | #define LCDTG_GPOR3 0x05 |
530 | b00052e4 | balrog | #define LCDTG_PICTRL 0x06 |
531 | b00052e4 | balrog | #define LCDTG_POLCTRL 0x07 |
532 | b00052e4 | balrog | |
533 | b00052e4 | balrog | static int bl_intensity, bl_power; |
534 | b00052e4 | balrog | |
535 | b00052e4 | balrog | static void spitz_bl_update(struct pxa2xx_state_s *s) |
536 | b00052e4 | balrog | { |
537 | b00052e4 | balrog | if (bl_power && bl_intensity)
|
538 | 89cdb6af | balrog | zaurus_printf("LCD Backlight now at %i/63\n", bl_intensity);
|
539 | b00052e4 | balrog | else
|
540 | 89cdb6af | balrog | zaurus_printf("LCD Backlight now off\n");
|
541 | b00052e4 | balrog | } |
542 | b00052e4 | balrog | |
543 | 38641a52 | balrog | static inline void spitz_bl_bit5(void *opaque, int line, int level) |
544 | b00052e4 | balrog | { |
545 | b00052e4 | balrog | int prev = bl_intensity;
|
546 | b00052e4 | balrog | |
547 | b00052e4 | balrog | if (level)
|
548 | b00052e4 | balrog | bl_intensity &= ~0x20;
|
549 | b00052e4 | balrog | else
|
550 | b00052e4 | balrog | bl_intensity |= 0x20;
|
551 | b00052e4 | balrog | |
552 | b00052e4 | balrog | if (bl_power && prev != bl_intensity)
|
553 | b00052e4 | balrog | spitz_bl_update((struct pxa2xx_state_s *) opaque);
|
554 | b00052e4 | balrog | } |
555 | b00052e4 | balrog | |
556 | 38641a52 | balrog | static inline void spitz_bl_power(void *opaque, int line, int level) |
557 | b00052e4 | balrog | { |
558 | b00052e4 | balrog | bl_power = !!level; |
559 | b00052e4 | balrog | spitz_bl_update((struct pxa2xx_state_s *) opaque);
|
560 | b00052e4 | balrog | } |
561 | b00052e4 | balrog | |
562 | b00052e4 | balrog | static void spitz_lcdtg_dac_put(void *opaque, uint8_t cmd) |
563 | b00052e4 | balrog | { |
564 | b00052e4 | balrog | int addr, value;
|
565 | b00052e4 | balrog | addr = cmd >> 5;
|
566 | b00052e4 | balrog | value = cmd & 0x1f;
|
567 | b00052e4 | balrog | |
568 | b00052e4 | balrog | switch (addr) {
|
569 | b00052e4 | balrog | case LCDTG_RESCTL:
|
570 | b00052e4 | balrog | if (value)
|
571 | 89cdb6af | balrog | zaurus_printf("LCD in QVGA mode\n");
|
572 | b00052e4 | balrog | else
|
573 | 89cdb6af | balrog | zaurus_printf("LCD in VGA mode\n");
|
574 | b00052e4 | balrog | break;
|
575 | b00052e4 | balrog | |
576 | b00052e4 | balrog | case LCDTG_DUTYCTRL:
|
577 | b00052e4 | balrog | bl_intensity &= ~0x1f;
|
578 | b00052e4 | balrog | bl_intensity |= value; |
579 | b00052e4 | balrog | if (bl_power)
|
580 | b00052e4 | balrog | spitz_bl_update((struct pxa2xx_state_s *) opaque);
|
581 | b00052e4 | balrog | break;
|
582 | b00052e4 | balrog | |
583 | b00052e4 | balrog | case LCDTG_POWERREG0:
|
584 | b00052e4 | balrog | /* Set common voltage to M62332FP */
|
585 | b00052e4 | balrog | break;
|
586 | b00052e4 | balrog | } |
587 | b00052e4 | balrog | } |
588 | b00052e4 | balrog | |
589 | b00052e4 | balrog | /* SSP devices */
|
590 | b00052e4 | balrog | |
591 | b00052e4 | balrog | #define CORGI_SSP_PORT 2 |
592 | b00052e4 | balrog | |
593 | b00052e4 | balrog | #define SPITZ_GPIO_LCDCON_CS 53 |
594 | b00052e4 | balrog | #define SPITZ_GPIO_ADS7846_CS 14 |
595 | b00052e4 | balrog | #define SPITZ_GPIO_MAX1111_CS 20 |
596 | b00052e4 | balrog | #define SPITZ_GPIO_TP_INT 11 |
597 | b00052e4 | balrog | |
598 | b00052e4 | balrog | static int lcd_en, ads_en, max_en; |
599 | b00052e4 | balrog | static struct max111x_s *max1111; |
600 | b00052e4 | balrog | static struct ads7846_state_s *ads7846; |
601 | b00052e4 | balrog | |
602 | b00052e4 | balrog | /* "Demux" the signal based on current chipselect */
|
603 | b00052e4 | balrog | static uint32_t corgi_ssp_read(void *opaque) |
604 | b00052e4 | balrog | { |
605 | b00052e4 | balrog | if (lcd_en)
|
606 | b00052e4 | balrog | return 0; |
607 | b00052e4 | balrog | if (ads_en)
|
608 | b00052e4 | balrog | return ads7846_read(ads7846);
|
609 | b00052e4 | balrog | if (max_en)
|
610 | b00052e4 | balrog | return max111x_read(max1111);
|
611 | b00052e4 | balrog | return 0; |
612 | b00052e4 | balrog | } |
613 | b00052e4 | balrog | |
614 | b00052e4 | balrog | static void corgi_ssp_write(void *opaque, uint32_t value) |
615 | b00052e4 | balrog | { |
616 | b00052e4 | balrog | if (lcd_en)
|
617 | b00052e4 | balrog | spitz_lcdtg_dac_put(opaque, value); |
618 | b00052e4 | balrog | if (ads_en)
|
619 | b00052e4 | balrog | ads7846_write(ads7846, value); |
620 | b00052e4 | balrog | if (max_en)
|
621 | b00052e4 | balrog | max111x_write(max1111, value); |
622 | b00052e4 | balrog | } |
623 | b00052e4 | balrog | |
624 | 38641a52 | balrog | static void corgi_ssp_gpio_cs(void *opaque, int line, int level) |
625 | b00052e4 | balrog | { |
626 | 38641a52 | balrog | switch (line) {
|
627 | 38641a52 | balrog | case 0: |
628 | b00052e4 | balrog | lcd_en = !level; |
629 | 38641a52 | balrog | break;
|
630 | 38641a52 | balrog | case 1: |
631 | b00052e4 | balrog | ads_en = !level; |
632 | 38641a52 | balrog | break;
|
633 | 38641a52 | balrog | case 2: |
634 | b00052e4 | balrog | max_en = !level; |
635 | 38641a52 | balrog | break;
|
636 | 38641a52 | balrog | } |
637 | b00052e4 | balrog | } |
638 | b00052e4 | balrog | |
639 | b00052e4 | balrog | #define MAX1111_BATT_VOLT 1 |
640 | b00052e4 | balrog | #define MAX1111_BATT_TEMP 2 |
641 | b00052e4 | balrog | #define MAX1111_ACIN_VOLT 3 |
642 | b00052e4 | balrog | |
643 | b00052e4 | balrog | #define SPITZ_BATTERY_TEMP 0xe0 /* About 2.9V */ |
644 | b00052e4 | balrog | #define SPITZ_BATTERY_VOLT 0xd0 /* About 4.0V */ |
645 | b00052e4 | balrog | #define SPITZ_CHARGEON_ACIN 0x80 /* About 5.0V */ |
646 | b00052e4 | balrog | |
647 | 38641a52 | balrog | static void spitz_adc_temp_on(void *opaque, int line, int level) |
648 | b00052e4 | balrog | { |
649 | b00052e4 | balrog | if (!max1111)
|
650 | b00052e4 | balrog | return;
|
651 | b00052e4 | balrog | |
652 | b00052e4 | balrog | if (level)
|
653 | b00052e4 | balrog | max111x_set_input(max1111, MAX1111_BATT_TEMP, SPITZ_BATTERY_TEMP); |
654 | b00052e4 | balrog | else
|
655 | b00052e4 | balrog | max111x_set_input(max1111, MAX1111_BATT_TEMP, 0);
|
656 | b00052e4 | balrog | } |
657 | b00052e4 | balrog | |
658 | aa941b94 | balrog | static void spitz_ssp_save(QEMUFile *f, void *opaque) |
659 | aa941b94 | balrog | { |
660 | aa941b94 | balrog | qemu_put_be32(f, lcd_en); |
661 | aa941b94 | balrog | qemu_put_be32(f, ads_en); |
662 | aa941b94 | balrog | qemu_put_be32(f, max_en); |
663 | aa941b94 | balrog | qemu_put_be32(f, bl_intensity); |
664 | aa941b94 | balrog | qemu_put_be32(f, bl_power); |
665 | aa941b94 | balrog | } |
666 | aa941b94 | balrog | |
667 | aa941b94 | balrog | static int spitz_ssp_load(QEMUFile *f, void *opaque, int version_id) |
668 | aa941b94 | balrog | { |
669 | aa941b94 | balrog | lcd_en = qemu_get_be32(f); |
670 | aa941b94 | balrog | ads_en = qemu_get_be32(f); |
671 | aa941b94 | balrog | max_en = qemu_get_be32(f); |
672 | aa941b94 | balrog | bl_intensity = qemu_get_be32(f); |
673 | aa941b94 | balrog | bl_power = qemu_get_be32(f); |
674 | aa941b94 | balrog | |
675 | aa941b94 | balrog | return 0; |
676 | aa941b94 | balrog | } |
677 | aa941b94 | balrog | |
678 | b00052e4 | balrog | static void spitz_ssp_attach(struct pxa2xx_state_s *cpu) |
679 | b00052e4 | balrog | { |
680 | 38641a52 | balrog | qemu_irq *chipselects; |
681 | 38641a52 | balrog | |
682 | b00052e4 | balrog | lcd_en = ads_en = max_en = 0;
|
683 | b00052e4 | balrog | |
684 | 38641a52 | balrog | ads7846 = ads7846_init(pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_TP_INT]); |
685 | b00052e4 | balrog | |
686 | b00052e4 | balrog | max1111 = max1111_init(0);
|
687 | b00052e4 | balrog | max111x_set_input(max1111, MAX1111_BATT_VOLT, SPITZ_BATTERY_VOLT); |
688 | b00052e4 | balrog | max111x_set_input(max1111, MAX1111_BATT_TEMP, 0);
|
689 | b00052e4 | balrog | max111x_set_input(max1111, MAX1111_ACIN_VOLT, SPITZ_CHARGEON_ACIN); |
690 | b00052e4 | balrog | |
691 | b00052e4 | balrog | pxa2xx_ssp_attach(cpu->ssp[CORGI_SSP_PORT - 1], corgi_ssp_read,
|
692 | b00052e4 | balrog | corgi_ssp_write, cpu); |
693 | b00052e4 | balrog | |
694 | 38641a52 | balrog | chipselects = qemu_allocate_irqs(corgi_ssp_gpio_cs, cpu, 3);
|
695 | 38641a52 | balrog | pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_LCDCON_CS, chipselects[0]);
|
696 | 38641a52 | balrog | pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_ADS7846_CS, chipselects[1]);
|
697 | 38641a52 | balrog | pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_MAX1111_CS, chipselects[2]);
|
698 | b00052e4 | balrog | |
699 | b00052e4 | balrog | bl_intensity = 0x20;
|
700 | b00052e4 | balrog | bl_power = 0;
|
701 | aa941b94 | balrog | |
702 | aa941b94 | balrog | register_savevm("spitz_ssp", 0, 0, spitz_ssp_save, spitz_ssp_load, cpu); |
703 | b00052e4 | balrog | } |
704 | b00052e4 | balrog | |
705 | b00052e4 | balrog | /* CF Microdrive */
|
706 | b00052e4 | balrog | |
707 | b00052e4 | balrog | static void spitz_microdrive_attach(struct pxa2xx_state_s *cpu) |
708 | b00052e4 | balrog | { |
709 | b00052e4 | balrog | struct pcmcia_card_s *md;
|
710 | e4bcb14c | ths | int index;
|
711 | e4bcb14c | ths | BlockDriverState *bs; |
712 | b00052e4 | balrog | |
713 | e4bcb14c | ths | index = drive_get_index(IF_IDE, 0, 0); |
714 | e4bcb14c | ths | if (index == -1) |
715 | e4bcb14c | ths | return;
|
716 | e4bcb14c | ths | bs = drives_table[index].bdrv; |
717 | e4bcb14c | ths | if (bdrv_is_inserted(bs) && !bdrv_is_removable(bs)) {
|
718 | b00052e4 | balrog | md = dscm1xxxx_init(bs); |
719 | bf5ee248 | balrog | pxa2xx_pcmcia_attach(cpu->pcmcia[1], md);
|
720 | b00052e4 | balrog | } |
721 | b00052e4 | balrog | } |
722 | b00052e4 | balrog | |
723 | adb86c37 | balrog | /* Wm8750 and Max7310 on I2C */
|
724 | adb86c37 | balrog | |
725 | adb86c37 | balrog | #define AKITA_MAX_ADDR 0x18 |
726 | 611d7189 | balrog | #define SPITZ_WM_ADDRL 0x1b |
727 | 611d7189 | balrog | #define SPITZ_WM_ADDRH 0x1a |
728 | adb86c37 | balrog | |
729 | adb86c37 | balrog | #define SPITZ_GPIO_WM 5 |
730 | adb86c37 | balrog | |
731 | adb86c37 | balrog | #ifdef HAS_AUDIO
|
732 | 38641a52 | balrog | static void spitz_wm8750_addr(void *opaque, int line, int level) |
733 | adb86c37 | balrog | { |
734 | adb86c37 | balrog | i2c_slave *wm = (i2c_slave *) opaque; |
735 | adb86c37 | balrog | if (level)
|
736 | adb86c37 | balrog | i2c_set_slave_address(wm, SPITZ_WM_ADDRH); |
737 | adb86c37 | balrog | else
|
738 | adb86c37 | balrog | i2c_set_slave_address(wm, SPITZ_WM_ADDRL); |
739 | adb86c37 | balrog | } |
740 | adb86c37 | balrog | #endif
|
741 | adb86c37 | balrog | |
742 | adb86c37 | balrog | static void spitz_i2c_setup(struct pxa2xx_state_s *cpu) |
743 | adb86c37 | balrog | { |
744 | adb86c37 | balrog | /* Attach the CPU on one end of our I2C bus. */
|
745 | adb86c37 | balrog | i2c_bus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
|
746 | adb86c37 | balrog | |
747 | adb86c37 | balrog | #ifdef HAS_AUDIO
|
748 | adb86c37 | balrog | AudioState *audio; |
749 | adb86c37 | balrog | i2c_slave *wm; |
750 | adb86c37 | balrog | |
751 | adb86c37 | balrog | audio = AUD_init(); |
752 | adb86c37 | balrog | if (!audio)
|
753 | adb86c37 | balrog | return;
|
754 | adb86c37 | balrog | /* Attach a WM8750 to the bus */
|
755 | adb86c37 | balrog | wm = wm8750_init(bus, audio); |
756 | adb86c37 | balrog | |
757 | 38641a52 | balrog | spitz_wm8750_addr(wm, 0, 0); |
758 | 38641a52 | balrog | pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_WM, |
759 | 38641a52 | balrog | qemu_allocate_irqs(spitz_wm8750_addr, wm, 1)[0]); |
760 | adb86c37 | balrog | /* .. and to the sound interface. */
|
761 | adb86c37 | balrog | cpu->i2s->opaque = wm; |
762 | adb86c37 | balrog | cpu->i2s->codec_out = wm8750_dac_dat; |
763 | adb86c37 | balrog | cpu->i2s->codec_in = wm8750_adc_dat; |
764 | adb86c37 | balrog | wm8750_data_req_set(wm, cpu->i2s->data_req, cpu->i2s); |
765 | adb86c37 | balrog | #endif
|
766 | adb86c37 | balrog | } |
767 | adb86c37 | balrog | |
768 | adb86c37 | balrog | static void spitz_akita_i2c_setup(struct pxa2xx_state_s *cpu) |
769 | adb86c37 | balrog | { |
770 | adb86c37 | balrog | /* Attach a Max7310 to Akita I2C bus. */
|
771 | adb86c37 | balrog | i2c_set_slave_address(max7310_init(pxa2xx_i2c_bus(cpu->i2c[0])),
|
772 | adb86c37 | balrog | AKITA_MAX_ADDR); |
773 | adb86c37 | balrog | } |
774 | adb86c37 | balrog | |
775 | b00052e4 | balrog | /* Other peripherals */
|
776 | b00052e4 | balrog | |
777 | 38641a52 | balrog | static void spitz_out_switch(void *opaque, int line, int level) |
778 | b00052e4 | balrog | { |
779 | 38641a52 | balrog | switch (line) {
|
780 | 38641a52 | balrog | case 0: |
781 | 89cdb6af | balrog | zaurus_printf("Charging %s.\n", level ? "off" : "on"); |
782 | 38641a52 | balrog | break;
|
783 | 38641a52 | balrog | case 1: |
784 | 89cdb6af | balrog | zaurus_printf("Discharging %s.\n", level ? "on" : "off"); |
785 | 38641a52 | balrog | break;
|
786 | 38641a52 | balrog | case 2: |
787 | 89cdb6af | balrog | zaurus_printf("Green LED %s.\n", level ? "on" : "off"); |
788 | 38641a52 | balrog | break;
|
789 | 38641a52 | balrog | case 3: |
790 | 89cdb6af | balrog | zaurus_printf("Orange LED %s.\n", level ? "on" : "off"); |
791 | 38641a52 | balrog | break;
|
792 | 38641a52 | balrog | case 4: |
793 | 38641a52 | balrog | spitz_bl_bit5(opaque, line, level); |
794 | 38641a52 | balrog | break;
|
795 | 38641a52 | balrog | case 5: |
796 | 38641a52 | balrog | spitz_bl_power(opaque, line, level); |
797 | 38641a52 | balrog | break;
|
798 | 38641a52 | balrog | case 6: |
799 | 38641a52 | balrog | spitz_adc_temp_on(opaque, line, level); |
800 | 38641a52 | balrog | break;
|
801 | 38641a52 | balrog | } |
802 | b00052e4 | balrog | } |
803 | b00052e4 | balrog | |
804 | b00052e4 | balrog | #define SPITZ_SCP_LED_GREEN 1 |
805 | b00052e4 | balrog | #define SPITZ_SCP_JK_B 2 |
806 | b00052e4 | balrog | #define SPITZ_SCP_CHRG_ON 3 |
807 | b00052e4 | balrog | #define SPITZ_SCP_MUTE_L 4 |
808 | b00052e4 | balrog | #define SPITZ_SCP_MUTE_R 5 |
809 | b00052e4 | balrog | #define SPITZ_SCP_CF_POWER 6 |
810 | b00052e4 | balrog | #define SPITZ_SCP_LED_ORANGE 7 |
811 | b00052e4 | balrog | #define SPITZ_SCP_JK_A 8 |
812 | b00052e4 | balrog | #define SPITZ_SCP_ADC_TEMP_ON 9 |
813 | b00052e4 | balrog | #define SPITZ_SCP2_IR_ON 1 |
814 | b00052e4 | balrog | #define SPITZ_SCP2_AKIN_PULLUP 2 |
815 | b00052e4 | balrog | #define SPITZ_SCP2_BACKLIGHT_CONT 7 |
816 | b00052e4 | balrog | #define SPITZ_SCP2_BACKLIGHT_ON 8 |
817 | b00052e4 | balrog | #define SPITZ_SCP2_MIC_BIAS 9 |
818 | b00052e4 | balrog | |
819 | b00052e4 | balrog | static void spitz_scoop_gpio_setup(struct pxa2xx_state_s *cpu, |
820 | e33d8cdb | balrog | struct scoop_info_s *scp0, struct scoop_info_s *scp1) |
821 | b00052e4 | balrog | { |
822 | 38641a52 | balrog | qemu_irq *outsignals = qemu_allocate_irqs(spitz_out_switch, cpu, 8);
|
823 | 38641a52 | balrog | |
824 | e33d8cdb | balrog | scoop_gpio_out_set(scp0, SPITZ_SCP_CHRG_ON, outsignals[0]);
|
825 | e33d8cdb | balrog | scoop_gpio_out_set(scp0, SPITZ_SCP_JK_B, outsignals[1]);
|
826 | e33d8cdb | balrog | scoop_gpio_out_set(scp0, SPITZ_SCP_LED_GREEN, outsignals[2]);
|
827 | e33d8cdb | balrog | scoop_gpio_out_set(scp0, SPITZ_SCP_LED_ORANGE, outsignals[3]);
|
828 | b00052e4 | balrog | |
829 | e33d8cdb | balrog | if (scp1) {
|
830 | e33d8cdb | balrog | scoop_gpio_out_set(scp1, SPITZ_SCP2_BACKLIGHT_CONT, outsignals[4]);
|
831 | e33d8cdb | balrog | scoop_gpio_out_set(scp1, SPITZ_SCP2_BACKLIGHT_ON, outsignals[5]);
|
832 | b00052e4 | balrog | } |
833 | b00052e4 | balrog | |
834 | e33d8cdb | balrog | scoop_gpio_out_set(scp0, SPITZ_SCP_ADC_TEMP_ON, outsignals[6]);
|
835 | b00052e4 | balrog | } |
836 | b00052e4 | balrog | |
837 | b00052e4 | balrog | #define SPITZ_GPIO_HSYNC 22 |
838 | b00052e4 | balrog | #define SPITZ_GPIO_SD_DETECT 9 |
839 | b00052e4 | balrog | #define SPITZ_GPIO_SD_WP 81 |
840 | b00052e4 | balrog | #define SPITZ_GPIO_ON_RESET 89 |
841 | b00052e4 | balrog | #define SPITZ_GPIO_BAT_COVER 90 |
842 | b00052e4 | balrog | #define SPITZ_GPIO_CF1_IRQ 105 |
843 | b00052e4 | balrog | #define SPITZ_GPIO_CF1_CD 94 |
844 | b00052e4 | balrog | #define SPITZ_GPIO_CF2_IRQ 106 |
845 | b00052e4 | balrog | #define SPITZ_GPIO_CF2_CD 93 |
846 | b00052e4 | balrog | |
847 | 38641a52 | balrog | static int spitz_hsync; |
848 | b00052e4 | balrog | |
849 | 38641a52 | balrog | static void spitz_lcd_hsync_handler(void *opaque, int line, int level) |
850 | b00052e4 | balrog | { |
851 | b00052e4 | balrog | struct pxa2xx_state_s *cpu = (struct pxa2xx_state_s *) opaque; |
852 | 38641a52 | balrog | qemu_set_irq(pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_HSYNC], spitz_hsync); |
853 | b00052e4 | balrog | spitz_hsync ^= 1;
|
854 | b00052e4 | balrog | } |
855 | b00052e4 | balrog | |
856 | b00052e4 | balrog | static void spitz_gpio_setup(struct pxa2xx_state_s *cpu, int slots) |
857 | b00052e4 | balrog | { |
858 | 38641a52 | balrog | qemu_irq lcd_hsync; |
859 | b00052e4 | balrog | /*
|
860 | b00052e4 | balrog | * Bad hack: We toggle the LCD hsync GPIO on every GPIO status
|
861 | b00052e4 | balrog | * read to satisfy broken guests that poll-wait for hsync.
|
862 | b00052e4 | balrog | * Simulating a real hsync event would be less practical and
|
863 | b00052e4 | balrog | * wouldn't guarantee that a guest ever exits the loop.
|
864 | b00052e4 | balrog | */
|
865 | b00052e4 | balrog | spitz_hsync = 0;
|
866 | 38641a52 | balrog | lcd_hsync = qemu_allocate_irqs(spitz_lcd_hsync_handler, cpu, 1)[0]; |
867 | 38641a52 | balrog | pxa2xx_gpio_read_notifier(cpu->gpio, lcd_hsync); |
868 | 38641a52 | balrog | pxa2xx_lcd_vsync_notifier(cpu->lcd, lcd_hsync); |
869 | b00052e4 | balrog | |
870 | b00052e4 | balrog | /* MMC/SD host */
|
871 | 02ce600c | balrog | pxa2xx_mmci_handlers(cpu->mmc, |
872 | 02ce600c | balrog | pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_SD_WP], |
873 | 02ce600c | balrog | pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_SD_DETECT]); |
874 | b00052e4 | balrog | |
875 | b00052e4 | balrog | /* Battery lock always closed */
|
876 | 38641a52 | balrog | qemu_irq_raise(pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_BAT_COVER]); |
877 | b00052e4 | balrog | |
878 | b00052e4 | balrog | /* Handle reset */
|
879 | 38641a52 | balrog | pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_ON_RESET, cpu->reset); |
880 | b00052e4 | balrog | |
881 | b00052e4 | balrog | /* PCMCIA signals: card's IRQ and Card-Detect */
|
882 | b00052e4 | balrog | if (slots >= 1) |
883 | 38641a52 | balrog | pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[0],
|
884 | 38641a52 | balrog | pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_CF1_IRQ], |
885 | 38641a52 | balrog | pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_CF1_CD]); |
886 | b00052e4 | balrog | if (slots >= 2) |
887 | 38641a52 | balrog | pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[1],
|
888 | 38641a52 | balrog | pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_CF2_IRQ], |
889 | 38641a52 | balrog | pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_CF2_CD]); |
890 | b00052e4 | balrog | |
891 | b00052e4 | balrog | /* Initialise the screen rotation related signals */
|
892 | b00052e4 | balrog | spitz_gpio_invert[3] = 0; /* Always open */ |
893 | b00052e4 | balrog | if (graphic_rotate) { /* Tablet mode */ |
894 | b00052e4 | balrog | spitz_gpio_invert[4] = 0; |
895 | b00052e4 | balrog | } else { /* Portrait mode */ |
896 | b00052e4 | balrog | spitz_gpio_invert[4] = 1; |
897 | b00052e4 | balrog | } |
898 | 38641a52 | balrog | qemu_set_irq(pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_SWA], |
899 | 38641a52 | balrog | spitz_gpio_invert[3]);
|
900 | 38641a52 | balrog | qemu_set_irq(pxa2xx_gpio_in_get(cpu->gpio)[SPITZ_GPIO_SWB], |
901 | 38641a52 | balrog | spitz_gpio_invert[4]);
|
902 | b00052e4 | balrog | } |
903 | b00052e4 | balrog | |
904 | b00052e4 | balrog | /* Board init. */
|
905 | b00052e4 | balrog | enum spitz_model_e { spitz, akita, borzoi, terrier };
|
906 | b00052e4 | balrog | |
907 | 7fb4fdcf | balrog | #define SPITZ_RAM 0x04000000 |
908 | 7fb4fdcf | balrog | #define SPITZ_ROM 0x00800000 |
909 | 7fb4fdcf | balrog | |
910 | f93eb9ff | balrog | static struct arm_boot_info spitz_binfo = { |
911 | f93eb9ff | balrog | .loader_start = PXA2XX_SDRAM_BASE, |
912 | f93eb9ff | balrog | .ram_size = 0x04000000,
|
913 | f93eb9ff | balrog | }; |
914 | f93eb9ff | balrog | |
915 | 00f82b8a | aurel32 | static void spitz_common_init(ram_addr_t ram_size, int vga_ram_size, |
916 | b00052e4 | balrog | DisplayState *ds, const char *kernel_filename, |
917 | b00052e4 | balrog | const char *kernel_cmdline, const char *initrd_filename, |
918 | 4207117c | balrog | const char *cpu_model, enum spitz_model_e model, int arm_id) |
919 | b00052e4 | balrog | { |
920 | b00052e4 | balrog | struct pxa2xx_state_s *cpu;
|
921 | e33d8cdb | balrog | struct scoop_info_s *scp0, *scp1 = NULL; |
922 | b00052e4 | balrog | |
923 | 4207117c | balrog | if (!cpu_model)
|
924 | 4207117c | balrog | cpu_model = (model == terrier) ? "pxa270-c5" : "pxa270-c0"; |
925 | b00052e4 | balrog | |
926 | d95b2f8d | balrog | /* Setup CPU & memory */
|
927 | 7fb4fdcf | balrog | if (ram_size < SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE) {
|
928 | b00052e4 | balrog | fprintf(stderr, "This platform requires %i bytes of memory\n",
|
929 | 7fb4fdcf | balrog | SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE); |
930 | b00052e4 | balrog | exit(1);
|
931 | b00052e4 | balrog | } |
932 | 7fb4fdcf | balrog | cpu = pxa270_init(spitz_binfo.ram_size, ds, cpu_model); |
933 | b00052e4 | balrog | |
934 | b00052e4 | balrog | sl_flash_register(cpu, (model == spitz) ? FLASH_128M : FLASH_1024M); |
935 | b00052e4 | balrog | |
936 | 7fb4fdcf | balrog | cpu_register_physical_memory(0, SPITZ_ROM,
|
937 | 7fb4fdcf | balrog | qemu_ram_alloc(SPITZ_ROM) | IO_MEM_ROM); |
938 | b00052e4 | balrog | |
939 | b00052e4 | balrog | /* Setup peripherals */
|
940 | b00052e4 | balrog | spitz_keyboard_register(cpu); |
941 | b00052e4 | balrog | |
942 | b00052e4 | balrog | spitz_ssp_attach(cpu); |
943 | b00052e4 | balrog | |
944 | e33d8cdb | balrog | scp0 = scoop_init(cpu, 0, 0x10800000); |
945 | e33d8cdb | balrog | if (model != akita) {
|
946 | e33d8cdb | balrog | scp1 = scoop_init(cpu, 1, 0x08800040); |
947 | e33d8cdb | balrog | } |
948 | b00052e4 | balrog | |
949 | e33d8cdb | balrog | spitz_scoop_gpio_setup(cpu, scp0, scp1); |
950 | b00052e4 | balrog | |
951 | b00052e4 | balrog | spitz_gpio_setup(cpu, (model == akita) ? 1 : 2); |
952 | b00052e4 | balrog | |
953 | adb86c37 | balrog | spitz_i2c_setup(cpu); |
954 | adb86c37 | balrog | |
955 | adb86c37 | balrog | if (model == akita)
|
956 | adb86c37 | balrog | spitz_akita_i2c_setup(cpu); |
957 | adb86c37 | balrog | |
958 | b00052e4 | balrog | if (model == terrier)
|
959 | bf5ee248 | balrog | /* A 6.0 GB microdrive is permanently sitting in CF slot 1. */
|
960 | b00052e4 | balrog | spitz_microdrive_attach(cpu); |
961 | b00052e4 | balrog | else if (model != akita) |
962 | bf5ee248 | balrog | /* A 4.0 GB microdrive is permanently sitting in CF slot 1. */
|
963 | b00052e4 | balrog | spitz_microdrive_attach(cpu); |
964 | b00052e4 | balrog | |
965 | b00052e4 | balrog | /* Setup initial (reset) machine state */
|
966 | f93eb9ff | balrog | cpu->env->regs[15] = spitz_binfo.loader_start;
|
967 | b00052e4 | balrog | |
968 | f93eb9ff | balrog | spitz_binfo.kernel_filename = kernel_filename; |
969 | f93eb9ff | balrog | spitz_binfo.kernel_cmdline = kernel_cmdline; |
970 | f93eb9ff | balrog | spitz_binfo.initrd_filename = initrd_filename; |
971 | f93eb9ff | balrog | spitz_binfo.board_id = arm_id; |
972 | f93eb9ff | balrog | arm_load_kernel(cpu->env, &spitz_binfo); |
973 | d95b2f8d | balrog | sl_bootparam_write(SL_PXA_PARAM_BASE - PXA2XX_SDRAM_BASE); |
974 | b00052e4 | balrog | } |
975 | b00052e4 | balrog | |
976 | 00f82b8a | aurel32 | static void spitz_init(ram_addr_t ram_size, int vga_ram_size, |
977 | 6ac0e82d | balrog | const char *boot_device, DisplayState *ds, |
978 | b00052e4 | balrog | const char *kernel_filename, const char *kernel_cmdline, |
979 | b00052e4 | balrog | const char *initrd_filename, const char *cpu_model) |
980 | b00052e4 | balrog | { |
981 | b00052e4 | balrog | spitz_common_init(ram_size, vga_ram_size, ds, kernel_filename, |
982 | 4207117c | balrog | kernel_cmdline, initrd_filename, cpu_model, spitz, 0x2c9);
|
983 | b00052e4 | balrog | } |
984 | b00052e4 | balrog | |
985 | 00f82b8a | aurel32 | static void borzoi_init(ram_addr_t ram_size, int vga_ram_size, |
986 | 6ac0e82d | balrog | const char *boot_device, DisplayState *ds, |
987 | b00052e4 | balrog | const char *kernel_filename, const char *kernel_cmdline, |
988 | b00052e4 | balrog | const char *initrd_filename, const char *cpu_model) |
989 | b00052e4 | balrog | { |
990 | b00052e4 | balrog | spitz_common_init(ram_size, vga_ram_size, ds, kernel_filename, |
991 | 4207117c | balrog | kernel_cmdline, initrd_filename, cpu_model, borzoi, 0x33f);
|
992 | b00052e4 | balrog | } |
993 | b00052e4 | balrog | |
994 | 00f82b8a | aurel32 | static void akita_init(ram_addr_t ram_size, int vga_ram_size, |
995 | 6ac0e82d | balrog | const char *boot_device, DisplayState *ds, |
996 | b00052e4 | balrog | const char *kernel_filename, const char *kernel_cmdline, |
997 | b00052e4 | balrog | const char *initrd_filename, const char *cpu_model) |
998 | b00052e4 | balrog | { |
999 | b00052e4 | balrog | spitz_common_init(ram_size, vga_ram_size, ds, kernel_filename, |
1000 | 4207117c | balrog | kernel_cmdline, initrd_filename, cpu_model, akita, 0x2e8);
|
1001 | b00052e4 | balrog | } |
1002 | b00052e4 | balrog | |
1003 | 00f82b8a | aurel32 | static void terrier_init(ram_addr_t ram_size, int vga_ram_size, |
1004 | 6ac0e82d | balrog | const char *boot_device, DisplayState *ds, |
1005 | b00052e4 | balrog | const char *kernel_filename, const char *kernel_cmdline, |
1006 | b00052e4 | balrog | const char *initrd_filename, const char *cpu_model) |
1007 | b00052e4 | balrog | { |
1008 | b00052e4 | balrog | spitz_common_init(ram_size, vga_ram_size, ds, kernel_filename, |
1009 | 4207117c | balrog | kernel_cmdline, initrd_filename, cpu_model, terrier, 0x33f);
|
1010 | b00052e4 | balrog | } |
1011 | b00052e4 | balrog | |
1012 | b00052e4 | balrog | QEMUMachine akitapda_machine = { |
1013 | b00052e4 | balrog | "akita",
|
1014 | b00052e4 | balrog | "Akita PDA (PXA270)",
|
1015 | b00052e4 | balrog | akita_init, |
1016 | 7fb4fdcf | balrog | SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED, |
1017 | b00052e4 | balrog | }; |
1018 | b00052e4 | balrog | |
1019 | b00052e4 | balrog | QEMUMachine spitzpda_machine = { |
1020 | b00052e4 | balrog | "spitz",
|
1021 | b00052e4 | balrog | "Spitz PDA (PXA270)",
|
1022 | b00052e4 | balrog | spitz_init, |
1023 | 7fb4fdcf | balrog | SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED, |
1024 | b00052e4 | balrog | }; |
1025 | b00052e4 | balrog | |
1026 | b00052e4 | balrog | QEMUMachine borzoipda_machine = { |
1027 | b00052e4 | balrog | "borzoi",
|
1028 | b00052e4 | balrog | "Borzoi PDA (PXA270)",
|
1029 | b00052e4 | balrog | borzoi_init, |
1030 | 7fb4fdcf | balrog | SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED, |
1031 | b00052e4 | balrog | }; |
1032 | b00052e4 | balrog | |
1033 | b00052e4 | balrog | QEMUMachine terrierpda_machine = { |
1034 | b00052e4 | balrog | "terrier",
|
1035 | b00052e4 | balrog | "Terrier PDA (PXA270)",
|
1036 | b00052e4 | balrog | terrier_init, |
1037 | 7fb4fdcf | balrog | SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED, |
1038 | b00052e4 | balrog | }; |