Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / hw / arm / musicpal.c
blob33ece06bbd6a155ba96d15f51e2b0c39a413aea3
1 /*
2 * Marvell MV88W8618 / Freecom MusicPal emulation.
4 * Copyright (c) 2008 Jan Kiszka
6 * This code is licensed under the GNU GPL v2.
8 * Contributions after 2012-01-13 are licensed under the terms of the
9 * GNU GPL, version 2 or (at your option) any later version.
12 #include "qemu/osdep.h"
13 #include "qemu/units.h"
14 #include "qapi/error.h"
15 #include "hw/sysbus.h"
16 #include "migration/vmstate.h"
17 #include "hw/arm/boot.h"
18 #include "net/net.h"
19 #include "sysemu/sysemu.h"
20 #include "hw/boards.h"
21 #include "hw/char/serial-mm.h"
22 #include "qemu/timer.h"
23 #include "hw/ptimer.h"
24 #include "hw/qdev-properties.h"
25 #include "hw/block/flash.h"
26 #include "ui/console.h"
27 #include "hw/i2c/i2c.h"
28 #include "hw/i2c/bitbang_i2c.h"
29 #include "hw/irq.h"
30 #include "hw/or-irq.h"
31 #include "hw/audio/wm8750.h"
32 #include "sysemu/block-backend.h"
33 #include "sysemu/runstate.h"
34 #include "sysemu/dma.h"
35 #include "ui/pixel_ops.h"
36 #include "qemu/cutils.h"
37 #include "qom/object.h"
38 #include "hw/net/mv88w8618_eth.h"
39 #include "audio/audio.h"
40 #include "qemu/error-report.h"
41 #include "target/arm/cpu-qom.h"
43 #define MP_MISC_BASE 0x80002000
44 #define MP_MISC_SIZE 0x00001000
46 #define MP_ETH_BASE 0x80008000
48 #define MP_WLAN_BASE 0x8000C000
49 #define MP_WLAN_SIZE 0x00000800
51 #define MP_UART1_BASE 0x8000C840
52 #define MP_UART2_BASE 0x8000C940
54 #define MP_GPIO_BASE 0x8000D000
55 #define MP_GPIO_SIZE 0x00001000
57 #define MP_FLASHCFG_BASE 0x90006000
58 #define MP_FLASHCFG_SIZE 0x00001000
60 #define MP_AUDIO_BASE 0x90007000
62 #define MP_PIC_BASE 0x90008000
63 #define MP_PIC_SIZE 0x00001000
65 #define MP_PIT_BASE 0x90009000
66 #define MP_PIT_SIZE 0x00001000
68 #define MP_LCD_BASE 0x9000c000
69 #define MP_LCD_SIZE 0x00001000
71 #define MP_SRAM_BASE 0xC0000000
72 #define MP_SRAM_SIZE 0x00020000
74 #define MP_RAM_DEFAULT_SIZE 32*1024*1024
75 #define MP_FLASH_SIZE_MAX 32*1024*1024
77 #define MP_TIMER1_IRQ 4
78 #define MP_TIMER2_IRQ 5
79 #define MP_TIMER3_IRQ 6
80 #define MP_TIMER4_IRQ 7
81 #define MP_EHCI_IRQ 8
82 #define MP_ETH_IRQ 9
83 #define MP_UART_SHARED_IRQ 11
84 #define MP_GPIO_IRQ 12
85 #define MP_RTC_IRQ 28
86 #define MP_AUDIO_IRQ 30
88 /* Wolfson 8750 I2C address */
89 #define MP_WM_ADDR 0x1A
91 /* LCD register offsets */
92 #define MP_LCD_IRQCTRL 0x180
93 #define MP_LCD_IRQSTAT 0x184
94 #define MP_LCD_SPICTRL 0x1ac
95 #define MP_LCD_INST 0x1bc
96 #define MP_LCD_DATA 0x1c0
98 /* Mode magics */
99 #define MP_LCD_SPI_DATA 0x00100011
100 #define MP_LCD_SPI_CMD 0x00104011
101 #define MP_LCD_SPI_INVALID 0x00000000
103 /* Commands */
104 #define MP_LCD_INST_SETPAGE0 0xB0
105 /* ... */
106 #define MP_LCD_INST_SETPAGE7 0xB7
108 #define MP_LCD_TEXTCOLOR 0xe0e0ff /* RRGGBB */
110 #define TYPE_MUSICPAL_LCD "musicpal_lcd"
111 OBJECT_DECLARE_SIMPLE_TYPE(musicpal_lcd_state, MUSICPAL_LCD)
113 struct musicpal_lcd_state {
114 /*< private >*/
115 SysBusDevice parent_obj;
116 /*< public >*/
118 MemoryRegion iomem;
119 uint32_t brightness;
120 uint32_t mode;
121 uint32_t irqctrl;
122 uint32_t page;
123 uint32_t page_off;
124 QemuConsole *con;
125 uint8_t video_ram[128*64/8];
128 static uint8_t scale_lcd_color(musicpal_lcd_state *s, uint8_t col)
130 switch (s->brightness) {
131 case 7:
132 return col;
133 case 0:
134 return 0;
135 default:
136 return (col * s->brightness) / 7;
140 static inline void set_lcd_pixel32(musicpal_lcd_state *s,
141 int x, int y, uint32_t col)
143 int dx, dy;
144 DisplaySurface *surface = qemu_console_surface(s->con);
145 uint32_t *pixel =
146 &((uint32_t *) surface_data(surface))[(y * 128 * 3 + x) * 3];
148 for (dy = 0; dy < 3; dy++, pixel += 127 * 3) {
149 for (dx = 0; dx < 3; dx++, pixel++) {
150 *pixel = col;
155 static void lcd_refresh(void *opaque)
157 musicpal_lcd_state *s = opaque;
158 int x, y, col;
160 col = rgb_to_pixel32(scale_lcd_color(s, (MP_LCD_TEXTCOLOR >> 16) & 0xff),
161 scale_lcd_color(s, (MP_LCD_TEXTCOLOR >> 8) & 0xff),
162 scale_lcd_color(s, MP_LCD_TEXTCOLOR & 0xff));
163 for (x = 0; x < 128; x++) {
164 for (y = 0; y < 64; y++) {
165 if (s->video_ram[x + (y / 8) * 128] & (1 << (y % 8))) {
166 set_lcd_pixel32(s, x, y, col);
167 } else {
168 set_lcd_pixel32(s, x, y, 0);
173 dpy_gfx_update(s->con, 0, 0, 128*3, 64*3);
176 static void lcd_invalidate(void *opaque)
180 static void musicpal_lcd_gpio_brightness_in(void *opaque, int irq, int level)
182 musicpal_lcd_state *s = opaque;
183 s->brightness &= ~(1 << irq);
184 s->brightness |= level << irq;
187 static uint64_t musicpal_lcd_read(void *opaque, hwaddr offset,
188 unsigned size)
190 musicpal_lcd_state *s = opaque;
192 switch (offset) {
193 case MP_LCD_IRQCTRL:
194 return s->irqctrl;
196 default:
197 return 0;
201 static void musicpal_lcd_write(void *opaque, hwaddr offset,
202 uint64_t value, unsigned size)
204 musicpal_lcd_state *s = opaque;
206 switch (offset) {
207 case MP_LCD_IRQCTRL:
208 s->irqctrl = value;
209 break;
211 case MP_LCD_SPICTRL:
212 if (value == MP_LCD_SPI_DATA || value == MP_LCD_SPI_CMD) {
213 s->mode = value;
214 } else {
215 s->mode = MP_LCD_SPI_INVALID;
217 break;
219 case MP_LCD_INST:
220 if (value >= MP_LCD_INST_SETPAGE0 && value <= MP_LCD_INST_SETPAGE7) {
221 s->page = value - MP_LCD_INST_SETPAGE0;
222 s->page_off = 0;
224 break;
226 case MP_LCD_DATA:
227 if (s->mode == MP_LCD_SPI_CMD) {
228 if (value >= MP_LCD_INST_SETPAGE0 &&
229 value <= MP_LCD_INST_SETPAGE7) {
230 s->page = value - MP_LCD_INST_SETPAGE0;
231 s->page_off = 0;
233 } else if (s->mode == MP_LCD_SPI_DATA) {
234 s->video_ram[s->page*128 + s->page_off] = value;
235 s->page_off = (s->page_off + 1) & 127;
237 break;
241 static const MemoryRegionOps musicpal_lcd_ops = {
242 .read = musicpal_lcd_read,
243 .write = musicpal_lcd_write,
244 .endianness = DEVICE_NATIVE_ENDIAN,
247 static const GraphicHwOps musicpal_gfx_ops = {
248 .invalidate = lcd_invalidate,
249 .gfx_update = lcd_refresh,
252 static void musicpal_lcd_realize(DeviceState *dev, Error **errp)
254 musicpal_lcd_state *s = MUSICPAL_LCD(dev);
255 s->con = graphic_console_init(dev, 0, &musicpal_gfx_ops, s);
256 qemu_console_resize(s->con, 128 * 3, 64 * 3);
259 static void musicpal_lcd_init(Object *obj)
261 SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
262 DeviceState *dev = DEVICE(sbd);
263 musicpal_lcd_state *s = MUSICPAL_LCD(dev);
265 s->brightness = 7;
267 memory_region_init_io(&s->iomem, obj, &musicpal_lcd_ops, s,
268 "musicpal-lcd", MP_LCD_SIZE);
269 sysbus_init_mmio(sbd, &s->iomem);
271 qdev_init_gpio_in(dev, musicpal_lcd_gpio_brightness_in, 3);
274 static const VMStateDescription musicpal_lcd_vmsd = {
275 .name = "musicpal_lcd",
276 .version_id = 1,
277 .minimum_version_id = 1,
278 .fields = (const VMStateField[]) {
279 VMSTATE_UINT32(brightness, musicpal_lcd_state),
280 VMSTATE_UINT32(mode, musicpal_lcd_state),
281 VMSTATE_UINT32(irqctrl, musicpal_lcd_state),
282 VMSTATE_UINT32(page, musicpal_lcd_state),
283 VMSTATE_UINT32(page_off, musicpal_lcd_state),
284 VMSTATE_BUFFER(video_ram, musicpal_lcd_state),
285 VMSTATE_END_OF_LIST()
289 static void musicpal_lcd_class_init(ObjectClass *klass, void *data)
291 DeviceClass *dc = DEVICE_CLASS(klass);
293 dc->vmsd = &musicpal_lcd_vmsd;
294 dc->realize = musicpal_lcd_realize;
297 static const TypeInfo musicpal_lcd_info = {
298 .name = TYPE_MUSICPAL_LCD,
299 .parent = TYPE_SYS_BUS_DEVICE,
300 .instance_size = sizeof(musicpal_lcd_state),
301 .instance_init = musicpal_lcd_init,
302 .class_init = musicpal_lcd_class_init,
305 /* PIC register offsets */
306 #define MP_PIC_STATUS 0x00
307 #define MP_PIC_ENABLE_SET 0x08
308 #define MP_PIC_ENABLE_CLR 0x0C
310 #define TYPE_MV88W8618_PIC "mv88w8618_pic"
311 OBJECT_DECLARE_SIMPLE_TYPE(mv88w8618_pic_state, MV88W8618_PIC)
313 struct mv88w8618_pic_state {
314 /*< private >*/
315 SysBusDevice parent_obj;
316 /*< public >*/
318 MemoryRegion iomem;
319 uint32_t level;
320 uint32_t enabled;
321 qemu_irq parent_irq;
324 static void mv88w8618_pic_update(mv88w8618_pic_state *s)
326 qemu_set_irq(s->parent_irq, (s->level & s->enabled));
329 static void mv88w8618_pic_set_irq(void *opaque, int irq, int level)
331 mv88w8618_pic_state *s = opaque;
333 if (level) {
334 s->level |= 1 << irq;
335 } else {
336 s->level &= ~(1 << irq);
338 mv88w8618_pic_update(s);
341 static uint64_t mv88w8618_pic_read(void *opaque, hwaddr offset,
342 unsigned size)
344 mv88w8618_pic_state *s = opaque;
346 switch (offset) {
347 case MP_PIC_STATUS:
348 return s->level & s->enabled;
350 default:
351 return 0;
355 static void mv88w8618_pic_write(void *opaque, hwaddr offset,
356 uint64_t value, unsigned size)
358 mv88w8618_pic_state *s = opaque;
360 switch (offset) {
361 case MP_PIC_ENABLE_SET:
362 s->enabled |= value;
363 break;
365 case MP_PIC_ENABLE_CLR:
366 s->enabled &= ~value;
367 s->level &= ~value;
368 break;
370 mv88w8618_pic_update(s);
373 static void mv88w8618_pic_reset(DeviceState *d)
375 mv88w8618_pic_state *s = MV88W8618_PIC(d);
377 s->level = 0;
378 s->enabled = 0;
381 static const MemoryRegionOps mv88w8618_pic_ops = {
382 .read = mv88w8618_pic_read,
383 .write = mv88w8618_pic_write,
384 .endianness = DEVICE_NATIVE_ENDIAN,
387 static void mv88w8618_pic_init(Object *obj)
389 SysBusDevice *dev = SYS_BUS_DEVICE(obj);
390 mv88w8618_pic_state *s = MV88W8618_PIC(dev);
392 qdev_init_gpio_in(DEVICE(dev), mv88w8618_pic_set_irq, 32);
393 sysbus_init_irq(dev, &s->parent_irq);
394 memory_region_init_io(&s->iomem, obj, &mv88w8618_pic_ops, s,
395 "musicpal-pic", MP_PIC_SIZE);
396 sysbus_init_mmio(dev, &s->iomem);
399 static const VMStateDescription mv88w8618_pic_vmsd = {
400 .name = "mv88w8618_pic",
401 .version_id = 1,
402 .minimum_version_id = 1,
403 .fields = (const VMStateField[]) {
404 VMSTATE_UINT32(level, mv88w8618_pic_state),
405 VMSTATE_UINT32(enabled, mv88w8618_pic_state),
406 VMSTATE_END_OF_LIST()
410 static void mv88w8618_pic_class_init(ObjectClass *klass, void *data)
412 DeviceClass *dc = DEVICE_CLASS(klass);
414 device_class_set_legacy_reset(dc, mv88w8618_pic_reset);
415 dc->vmsd = &mv88w8618_pic_vmsd;
418 static const TypeInfo mv88w8618_pic_info = {
419 .name = TYPE_MV88W8618_PIC,
420 .parent = TYPE_SYS_BUS_DEVICE,
421 .instance_size = sizeof(mv88w8618_pic_state),
422 .instance_init = mv88w8618_pic_init,
423 .class_init = mv88w8618_pic_class_init,
426 /* PIT register offsets */
427 #define MP_PIT_TIMER1_LENGTH 0x00
428 /* ... */
429 #define MP_PIT_TIMER4_LENGTH 0x0C
430 #define MP_PIT_CONTROL 0x10
431 #define MP_PIT_TIMER1_VALUE 0x14
432 /* ... */
433 #define MP_PIT_TIMER4_VALUE 0x20
434 #define MP_BOARD_RESET 0x34
436 /* Magic board reset value (probably some watchdog behind it) */
437 #define MP_BOARD_RESET_MAGIC 0x10000
439 typedef struct mv88w8618_timer_state {
440 ptimer_state *ptimer;
441 uint32_t limit;
442 int freq;
443 qemu_irq irq;
444 } mv88w8618_timer_state;
446 #define TYPE_MV88W8618_PIT "mv88w8618_pit"
447 OBJECT_DECLARE_SIMPLE_TYPE(mv88w8618_pit_state, MV88W8618_PIT)
449 struct mv88w8618_pit_state {
450 /*< private >*/
451 SysBusDevice parent_obj;
452 /*< public >*/
454 MemoryRegion iomem;
455 mv88w8618_timer_state timer[4];
458 static void mv88w8618_timer_tick(void *opaque)
460 mv88w8618_timer_state *s = opaque;
462 qemu_irq_raise(s->irq);
465 static void mv88w8618_timer_init(SysBusDevice *dev, mv88w8618_timer_state *s,
466 uint32_t freq)
468 sysbus_init_irq(dev, &s->irq);
469 s->freq = freq;
471 s->ptimer = ptimer_init(mv88w8618_timer_tick, s, PTIMER_POLICY_LEGACY);
474 static uint64_t mv88w8618_pit_read(void *opaque, hwaddr offset,
475 unsigned size)
477 mv88w8618_pit_state *s = opaque;
478 mv88w8618_timer_state *t;
480 switch (offset) {
481 case MP_PIT_TIMER1_VALUE ... MP_PIT_TIMER4_VALUE:
482 t = &s->timer[(offset-MP_PIT_TIMER1_VALUE) >> 2];
483 return ptimer_get_count(t->ptimer);
485 default:
486 return 0;
490 static void mv88w8618_pit_write(void *opaque, hwaddr offset,
491 uint64_t value, unsigned size)
493 mv88w8618_pit_state *s = opaque;
494 mv88w8618_timer_state *t;
495 int i;
497 switch (offset) {
498 case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH:
499 t = &s->timer[offset >> 2];
500 t->limit = value;
501 ptimer_transaction_begin(t->ptimer);
502 if (t->limit > 0) {
503 ptimer_set_limit(t->ptimer, t->limit, 1);
504 } else {
505 ptimer_stop(t->ptimer);
507 ptimer_transaction_commit(t->ptimer);
508 break;
510 case MP_PIT_CONTROL:
511 for (i = 0; i < 4; i++) {
512 t = &s->timer[i];
513 ptimer_transaction_begin(t->ptimer);
514 if (value & 0xf && t->limit > 0) {
515 ptimer_set_limit(t->ptimer, t->limit, 0);
516 ptimer_set_freq(t->ptimer, t->freq);
517 ptimer_run(t->ptimer, 0);
518 } else {
519 ptimer_stop(t->ptimer);
521 ptimer_transaction_commit(t->ptimer);
522 value >>= 4;
524 break;
526 case MP_BOARD_RESET:
527 if (value == MP_BOARD_RESET_MAGIC) {
528 qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
530 break;
534 static void mv88w8618_pit_reset(DeviceState *d)
536 mv88w8618_pit_state *s = MV88W8618_PIT(d);
537 int i;
539 for (i = 0; i < 4; i++) {
540 mv88w8618_timer_state *t = &s->timer[i];
541 ptimer_transaction_begin(t->ptimer);
542 ptimer_stop(t->ptimer);
543 ptimer_transaction_commit(t->ptimer);
544 t->limit = 0;
548 static const MemoryRegionOps mv88w8618_pit_ops = {
549 .read = mv88w8618_pit_read,
550 .write = mv88w8618_pit_write,
551 .endianness = DEVICE_NATIVE_ENDIAN,
554 static void mv88w8618_pit_init(Object *obj)
556 SysBusDevice *dev = SYS_BUS_DEVICE(obj);
557 mv88w8618_pit_state *s = MV88W8618_PIT(dev);
558 int i;
560 /* Letting them all run at 1 MHz is likely just a pragmatic
561 * simplification. */
562 for (i = 0; i < 4; i++) {
563 mv88w8618_timer_init(dev, &s->timer[i], 1000000);
566 memory_region_init_io(&s->iomem, obj, &mv88w8618_pit_ops, s,
567 "musicpal-pit", MP_PIT_SIZE);
568 sysbus_init_mmio(dev, &s->iomem);
571 static void mv88w8618_pit_finalize(Object *obj)
573 SysBusDevice *dev = SYS_BUS_DEVICE(obj);
574 mv88w8618_pit_state *s = MV88W8618_PIT(dev);
575 int i;
577 for (i = 0; i < 4; i++) {
578 ptimer_free(s->timer[i].ptimer);
582 static const VMStateDescription mv88w8618_timer_vmsd = {
583 .name = "timer",
584 .version_id = 1,
585 .minimum_version_id = 1,
586 .fields = (const VMStateField[]) {
587 VMSTATE_PTIMER(ptimer, mv88w8618_timer_state),
588 VMSTATE_UINT32(limit, mv88w8618_timer_state),
589 VMSTATE_END_OF_LIST()
593 static const VMStateDescription mv88w8618_pit_vmsd = {
594 .name = "mv88w8618_pit",
595 .version_id = 1,
596 .minimum_version_id = 1,
597 .fields = (const VMStateField[]) {
598 VMSTATE_STRUCT_ARRAY(timer, mv88w8618_pit_state, 4, 1,
599 mv88w8618_timer_vmsd, mv88w8618_timer_state),
600 VMSTATE_END_OF_LIST()
604 static void mv88w8618_pit_class_init(ObjectClass *klass, void *data)
606 DeviceClass *dc = DEVICE_CLASS(klass);
608 device_class_set_legacy_reset(dc, mv88w8618_pit_reset);
609 dc->vmsd = &mv88w8618_pit_vmsd;
612 static const TypeInfo mv88w8618_pit_info = {
613 .name = TYPE_MV88W8618_PIT,
614 .parent = TYPE_SYS_BUS_DEVICE,
615 .instance_size = sizeof(mv88w8618_pit_state),
616 .instance_init = mv88w8618_pit_init,
617 .instance_finalize = mv88w8618_pit_finalize,
618 .class_init = mv88w8618_pit_class_init,
621 /* Flash config register offsets */
622 #define MP_FLASHCFG_CFGR0 0x04
624 #define TYPE_MV88W8618_FLASHCFG "mv88w8618_flashcfg"
625 OBJECT_DECLARE_SIMPLE_TYPE(mv88w8618_flashcfg_state, MV88W8618_FLASHCFG)
627 struct mv88w8618_flashcfg_state {
628 /*< private >*/
629 SysBusDevice parent_obj;
630 /*< public >*/
632 MemoryRegion iomem;
633 uint32_t cfgr0;
636 static uint64_t mv88w8618_flashcfg_read(void *opaque,
637 hwaddr offset,
638 unsigned size)
640 mv88w8618_flashcfg_state *s = opaque;
642 switch (offset) {
643 case MP_FLASHCFG_CFGR0:
644 return s->cfgr0;
646 default:
647 return 0;
651 static void mv88w8618_flashcfg_write(void *opaque, hwaddr offset,
652 uint64_t value, unsigned size)
654 mv88w8618_flashcfg_state *s = opaque;
656 switch (offset) {
657 case MP_FLASHCFG_CFGR0:
658 s->cfgr0 = value;
659 break;
663 static const MemoryRegionOps mv88w8618_flashcfg_ops = {
664 .read = mv88w8618_flashcfg_read,
665 .write = mv88w8618_flashcfg_write,
666 .endianness = DEVICE_NATIVE_ENDIAN,
669 static void mv88w8618_flashcfg_init(Object *obj)
671 SysBusDevice *dev = SYS_BUS_DEVICE(obj);
672 mv88w8618_flashcfg_state *s = MV88W8618_FLASHCFG(dev);
674 s->cfgr0 = 0xfffe4285; /* Default as set by U-Boot for 8 MB flash */
675 memory_region_init_io(&s->iomem, obj, &mv88w8618_flashcfg_ops, s,
676 "musicpal-flashcfg", MP_FLASHCFG_SIZE);
677 sysbus_init_mmio(dev, &s->iomem);
680 static const VMStateDescription mv88w8618_flashcfg_vmsd = {
681 .name = "mv88w8618_flashcfg",
682 .version_id = 1,
683 .minimum_version_id = 1,
684 .fields = (const VMStateField[]) {
685 VMSTATE_UINT32(cfgr0, mv88w8618_flashcfg_state),
686 VMSTATE_END_OF_LIST()
690 static void mv88w8618_flashcfg_class_init(ObjectClass *klass, void *data)
692 DeviceClass *dc = DEVICE_CLASS(klass);
694 dc->vmsd = &mv88w8618_flashcfg_vmsd;
697 static const TypeInfo mv88w8618_flashcfg_info = {
698 .name = TYPE_MV88W8618_FLASHCFG,
699 .parent = TYPE_SYS_BUS_DEVICE,
700 .instance_size = sizeof(mv88w8618_flashcfg_state),
701 .instance_init = mv88w8618_flashcfg_init,
702 .class_init = mv88w8618_flashcfg_class_init,
705 /* Misc register offsets */
706 #define MP_MISC_BOARD_REVISION 0x18
708 #define MP_BOARD_REVISION 0x31
710 struct MusicPalMiscState {
711 SysBusDevice parent_obj;
712 MemoryRegion iomem;
715 #define TYPE_MUSICPAL_MISC "musicpal-misc"
716 OBJECT_DECLARE_SIMPLE_TYPE(MusicPalMiscState, MUSICPAL_MISC)
718 static uint64_t musicpal_misc_read(void *opaque, hwaddr offset,
719 unsigned size)
721 switch (offset) {
722 case MP_MISC_BOARD_REVISION:
723 return MP_BOARD_REVISION;
725 default:
726 return 0;
730 static void musicpal_misc_write(void *opaque, hwaddr offset,
731 uint64_t value, unsigned size)
735 static const MemoryRegionOps musicpal_misc_ops = {
736 .read = musicpal_misc_read,
737 .write = musicpal_misc_write,
738 .endianness = DEVICE_NATIVE_ENDIAN,
741 static void musicpal_misc_init(Object *obj)
743 SysBusDevice *sd = SYS_BUS_DEVICE(obj);
744 MusicPalMiscState *s = MUSICPAL_MISC(obj);
746 memory_region_init_io(&s->iomem, OBJECT(s), &musicpal_misc_ops, NULL,
747 "musicpal-misc", MP_MISC_SIZE);
748 sysbus_init_mmio(sd, &s->iomem);
751 static const TypeInfo musicpal_misc_info = {
752 .name = TYPE_MUSICPAL_MISC,
753 .parent = TYPE_SYS_BUS_DEVICE,
754 .instance_init = musicpal_misc_init,
755 .instance_size = sizeof(MusicPalMiscState),
758 /* WLAN register offsets */
759 #define MP_WLAN_MAGIC1 0x11c
760 #define MP_WLAN_MAGIC2 0x124
762 static uint64_t mv88w8618_wlan_read(void *opaque, hwaddr offset,
763 unsigned size)
765 switch (offset) {
766 /* Workaround to allow loading the binary-only wlandrv.ko crap
767 * from the original Freecom firmware. */
768 case MP_WLAN_MAGIC1:
769 return ~3;
770 case MP_WLAN_MAGIC2:
771 return -1;
773 default:
774 return 0;
778 static void mv88w8618_wlan_write(void *opaque, hwaddr offset,
779 uint64_t value, unsigned size)
783 static const MemoryRegionOps mv88w8618_wlan_ops = {
784 .read = mv88w8618_wlan_read,
785 .write =mv88w8618_wlan_write,
786 .endianness = DEVICE_NATIVE_ENDIAN,
789 static void mv88w8618_wlan_realize(DeviceState *dev, Error **errp)
791 MemoryRegion *iomem = g_new(MemoryRegion, 1);
793 memory_region_init_io(iomem, OBJECT(dev), &mv88w8618_wlan_ops, NULL,
794 "musicpal-wlan", MP_WLAN_SIZE);
795 sysbus_init_mmio(SYS_BUS_DEVICE(dev), iomem);
798 /* GPIO register offsets */
799 #define MP_GPIO_OE_LO 0x008
800 #define MP_GPIO_OUT_LO 0x00c
801 #define MP_GPIO_IN_LO 0x010
802 #define MP_GPIO_IER_LO 0x014
803 #define MP_GPIO_IMR_LO 0x018
804 #define MP_GPIO_ISR_LO 0x020
805 #define MP_GPIO_OE_HI 0x508
806 #define MP_GPIO_OUT_HI 0x50c
807 #define MP_GPIO_IN_HI 0x510
808 #define MP_GPIO_IER_HI 0x514
809 #define MP_GPIO_IMR_HI 0x518
810 #define MP_GPIO_ISR_HI 0x520
812 /* GPIO bits & masks */
813 #define MP_GPIO_LCD_BRIGHTNESS 0x00070000
814 #define MP_GPIO_I2C_DATA_BIT 29
815 #define MP_GPIO_I2C_CLOCK_BIT 30
817 /* LCD brightness bits in GPIO_OE_HI */
818 #define MP_OE_LCD_BRIGHTNESS 0x0007
820 #define TYPE_MUSICPAL_GPIO "musicpal_gpio"
821 OBJECT_DECLARE_SIMPLE_TYPE(musicpal_gpio_state, MUSICPAL_GPIO)
823 struct musicpal_gpio_state {
824 /*< private >*/
825 SysBusDevice parent_obj;
826 /*< public >*/
828 MemoryRegion iomem;
829 uint32_t lcd_brightness;
830 uint32_t out_state;
831 uint32_t in_state;
832 uint32_t ier;
833 uint32_t imr;
834 uint32_t isr;
835 qemu_irq irq;
836 qemu_irq out[5]; /* 3 brightness out + 2 lcd (data and clock ) */
839 static void musicpal_gpio_brightness_update(musicpal_gpio_state *s) {
840 int i;
841 uint32_t brightness;
843 /* compute brightness ratio */
844 switch (s->lcd_brightness) {
845 case 0x00000007:
846 brightness = 0;
847 break;
849 case 0x00020000:
850 brightness = 1;
851 break;
853 case 0x00020001:
854 brightness = 2;
855 break;
857 case 0x00040000:
858 brightness = 3;
859 break;
861 case 0x00010006:
862 brightness = 4;
863 break;
865 case 0x00020005:
866 brightness = 5;
867 break;
869 case 0x00040003:
870 brightness = 6;
871 break;
873 case 0x00030004:
874 default:
875 brightness = 7;
878 /* set lcd brightness GPIOs */
879 for (i = 0; i <= 2; i++) {
880 qemu_set_irq(s->out[i], (brightness >> i) & 1);
884 static void musicpal_gpio_pin_event(void *opaque, int pin, int level)
886 musicpal_gpio_state *s = opaque;
887 uint32_t mask = 1 << pin;
888 uint32_t delta = level << pin;
889 uint32_t old = s->in_state & mask;
891 s->in_state &= ~mask;
892 s->in_state |= delta;
894 if ((old ^ delta) &&
895 ((level && (s->imr & mask)) || (!level && (s->ier & mask)))) {
896 s->isr = mask;
897 qemu_irq_raise(s->irq);
901 static uint64_t musicpal_gpio_read(void *opaque, hwaddr offset,
902 unsigned size)
904 musicpal_gpio_state *s = opaque;
906 switch (offset) {
907 case MP_GPIO_OE_HI: /* used for LCD brightness control */
908 return s->lcd_brightness & MP_OE_LCD_BRIGHTNESS;
910 case MP_GPIO_OUT_LO:
911 return s->out_state & 0xFFFF;
912 case MP_GPIO_OUT_HI:
913 return s->out_state >> 16;
915 case MP_GPIO_IN_LO:
916 return s->in_state & 0xFFFF;
917 case MP_GPIO_IN_HI:
918 return s->in_state >> 16;
920 case MP_GPIO_IER_LO:
921 return s->ier & 0xFFFF;
922 case MP_GPIO_IER_HI:
923 return s->ier >> 16;
925 case MP_GPIO_IMR_LO:
926 return s->imr & 0xFFFF;
927 case MP_GPIO_IMR_HI:
928 return s->imr >> 16;
930 case MP_GPIO_ISR_LO:
931 return s->isr & 0xFFFF;
932 case MP_GPIO_ISR_HI:
933 return s->isr >> 16;
935 default:
936 return 0;
940 static void musicpal_gpio_write(void *opaque, hwaddr offset,
941 uint64_t value, unsigned size)
943 musicpal_gpio_state *s = opaque;
944 switch (offset) {
945 case MP_GPIO_OE_HI: /* used for LCD brightness control */
946 s->lcd_brightness = (s->lcd_brightness & MP_GPIO_LCD_BRIGHTNESS) |
947 (value & MP_OE_LCD_BRIGHTNESS);
948 musicpal_gpio_brightness_update(s);
949 break;
951 case MP_GPIO_OUT_LO:
952 s->out_state = (s->out_state & 0xFFFF0000) | (value & 0xFFFF);
953 break;
954 case MP_GPIO_OUT_HI:
955 s->out_state = (s->out_state & 0xFFFF) | (value << 16);
956 s->lcd_brightness = (s->lcd_brightness & 0xFFFF) |
957 (s->out_state & MP_GPIO_LCD_BRIGHTNESS);
958 musicpal_gpio_brightness_update(s);
959 qemu_set_irq(s->out[3], (s->out_state >> MP_GPIO_I2C_DATA_BIT) & 1);
960 qemu_set_irq(s->out[4], (s->out_state >> MP_GPIO_I2C_CLOCK_BIT) & 1);
961 break;
963 case MP_GPIO_IER_LO:
964 s->ier = (s->ier & 0xFFFF0000) | (value & 0xFFFF);
965 break;
966 case MP_GPIO_IER_HI:
967 s->ier = (s->ier & 0xFFFF) | (value << 16);
968 break;
970 case MP_GPIO_IMR_LO:
971 s->imr = (s->imr & 0xFFFF0000) | (value & 0xFFFF);
972 break;
973 case MP_GPIO_IMR_HI:
974 s->imr = (s->imr & 0xFFFF) | (value << 16);
975 break;
979 static const MemoryRegionOps musicpal_gpio_ops = {
980 .read = musicpal_gpio_read,
981 .write = musicpal_gpio_write,
982 .endianness = DEVICE_NATIVE_ENDIAN,
985 static void musicpal_gpio_reset(DeviceState *d)
987 musicpal_gpio_state *s = MUSICPAL_GPIO(d);
989 s->lcd_brightness = 0;
990 s->out_state = 0;
991 s->in_state = 0xffffffff;
992 s->ier = 0;
993 s->imr = 0;
994 s->isr = 0;
997 static void musicpal_gpio_init(Object *obj)
999 SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
1000 DeviceState *dev = DEVICE(sbd);
1001 musicpal_gpio_state *s = MUSICPAL_GPIO(dev);
1003 sysbus_init_irq(sbd, &s->irq);
1005 memory_region_init_io(&s->iomem, obj, &musicpal_gpio_ops, s,
1006 "musicpal-gpio", MP_GPIO_SIZE);
1007 sysbus_init_mmio(sbd, &s->iomem);
1009 qdev_init_gpio_out(dev, s->out, ARRAY_SIZE(s->out));
1011 qdev_init_gpio_in(dev, musicpal_gpio_pin_event, 32);
1014 static const VMStateDescription musicpal_gpio_vmsd = {
1015 .name = "musicpal_gpio",
1016 .version_id = 1,
1017 .minimum_version_id = 1,
1018 .fields = (const VMStateField[]) {
1019 VMSTATE_UINT32(lcd_brightness, musicpal_gpio_state),
1020 VMSTATE_UINT32(out_state, musicpal_gpio_state),
1021 VMSTATE_UINT32(in_state, musicpal_gpio_state),
1022 VMSTATE_UINT32(ier, musicpal_gpio_state),
1023 VMSTATE_UINT32(imr, musicpal_gpio_state),
1024 VMSTATE_UINT32(isr, musicpal_gpio_state),
1025 VMSTATE_END_OF_LIST()
1029 static void musicpal_gpio_class_init(ObjectClass *klass, void *data)
1031 DeviceClass *dc = DEVICE_CLASS(klass);
1033 device_class_set_legacy_reset(dc, musicpal_gpio_reset);
1034 dc->vmsd = &musicpal_gpio_vmsd;
1037 static const TypeInfo musicpal_gpio_info = {
1038 .name = TYPE_MUSICPAL_GPIO,
1039 .parent = TYPE_SYS_BUS_DEVICE,
1040 .instance_size = sizeof(musicpal_gpio_state),
1041 .instance_init = musicpal_gpio_init,
1042 .class_init = musicpal_gpio_class_init,
1045 /* Keyboard codes & masks */
1046 #define MP_KEY_WHEEL_VOL (1 << 0)
1047 #define MP_KEY_WHEEL_VOL_INV (1 << 1)
1048 #define MP_KEY_WHEEL_NAV (1 << 2)
1049 #define MP_KEY_WHEEL_NAV_INV (1 << 3)
1050 #define MP_KEY_BTN_FAVORITS (1 << 4)
1051 #define MP_KEY_BTN_MENU (1 << 5)
1052 #define MP_KEY_BTN_VOLUME (1 << 6)
1053 #define MP_KEY_BTN_NAVIGATION (1 << 7)
1055 #define TYPE_MUSICPAL_KEY "musicpal_key"
1056 OBJECT_DECLARE_SIMPLE_TYPE(musicpal_key_state, MUSICPAL_KEY)
1058 struct musicpal_key_state {
1059 /*< private >*/
1060 SysBusDevice parent_obj;
1061 /*< public >*/
1063 uint32_t pressed_keys;
1064 qemu_irq out[8];
1067 static void musicpal_key_event(DeviceState *dev, QemuConsole *src,
1068 InputEvent *evt)
1070 musicpal_key_state *s = MUSICPAL_KEY(dev);
1071 InputKeyEvent *key = evt->u.key.data;
1072 int qcode = qemu_input_key_value_to_qcode(key->key);
1073 uint32_t event = 0;
1074 int i;
1076 switch (qcode) {
1077 case Q_KEY_CODE_UP:
1078 event = MP_KEY_WHEEL_NAV | MP_KEY_WHEEL_NAV_INV;
1079 break;
1081 case Q_KEY_CODE_DOWN:
1082 event = MP_KEY_WHEEL_NAV;
1083 break;
1085 case Q_KEY_CODE_LEFT:
1086 event = MP_KEY_WHEEL_VOL | MP_KEY_WHEEL_VOL_INV;
1087 break;
1089 case Q_KEY_CODE_RIGHT:
1090 event = MP_KEY_WHEEL_VOL;
1091 break;
1093 case Q_KEY_CODE_F:
1094 event = MP_KEY_BTN_FAVORITS;
1095 break;
1097 case Q_KEY_CODE_TAB:
1098 event = MP_KEY_BTN_VOLUME;
1099 break;
1101 case Q_KEY_CODE_RET:
1102 event = MP_KEY_BTN_NAVIGATION;
1103 break;
1105 case Q_KEY_CODE_M:
1106 event = MP_KEY_BTN_MENU;
1107 break;
1111 * We allow repeated wheel-events when the arrow keys are held down,
1112 * but do not repeat already-pressed buttons for the other key inputs.
1114 if (!(event & (MP_KEY_WHEEL_NAV | MP_KEY_WHEEL_VOL))) {
1115 if (key->down && (s->pressed_keys & event)) {
1116 event = 0;
1120 if (event) {
1121 /* Raise GPIO pin first if repeating a key */
1122 if (key->down && (s->pressed_keys & event)) {
1123 for (i = 0; i <= 7; i++) {
1124 if (event & (1 << i)) {
1125 qemu_set_irq(s->out[i], 1);
1129 for (i = 0; i <= 7; i++) {
1130 if (event & (1 << i)) {
1131 qemu_set_irq(s->out[i], !key->down);
1134 if (key->down) {
1135 s->pressed_keys |= event;
1136 } else {
1137 s->pressed_keys &= ~event;
1142 static void musicpal_key_init(Object *obj)
1144 SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
1145 DeviceState *dev = DEVICE(sbd);
1146 musicpal_key_state *s = MUSICPAL_KEY(dev);
1148 s->pressed_keys = 0;
1150 qdev_init_gpio_out(dev, s->out, ARRAY_SIZE(s->out));
1153 static const QemuInputHandler musicpal_key_handler = {
1154 .name = "musicpal_key",
1155 .mask = INPUT_EVENT_MASK_KEY,
1156 .event = musicpal_key_event,
1159 static void musicpal_key_realize(DeviceState *dev, Error **errp)
1161 qemu_input_handler_register(dev, &musicpal_key_handler);
1164 static const VMStateDescription musicpal_key_vmsd = {
1165 .name = "musicpal_key",
1166 .version_id = 2,
1167 .minimum_version_id = 2,
1168 .fields = (const VMStateField[]) {
1169 VMSTATE_UINT32(pressed_keys, musicpal_key_state),
1170 VMSTATE_END_OF_LIST()
1174 static void musicpal_key_class_init(ObjectClass *klass, void *data)
1176 DeviceClass *dc = DEVICE_CLASS(klass);
1178 dc->vmsd = &musicpal_key_vmsd;
1179 dc->realize = musicpal_key_realize;
1182 static const TypeInfo musicpal_key_info = {
1183 .name = TYPE_MUSICPAL_KEY,
1184 .parent = TYPE_SYS_BUS_DEVICE,
1185 .instance_size = sizeof(musicpal_key_state),
1186 .instance_init = musicpal_key_init,
1187 .class_init = musicpal_key_class_init,
1190 #define FLASH_SECTOR_SIZE (64 * KiB)
1192 static struct arm_boot_info musicpal_binfo = {
1193 .loader_start = 0x0,
1194 .board_id = 0x20e,
1197 static void musicpal_init(MachineState *machine)
1199 ARMCPU *cpu;
1200 DeviceState *dev;
1201 DeviceState *pic;
1202 DeviceState *uart_orgate;
1203 DeviceState *i2c_dev;
1204 DeviceState *lcd_dev;
1205 DeviceState *key_dev;
1206 I2CSlave *wm8750_dev;
1207 SysBusDevice *s;
1208 I2CBus *i2c;
1209 int i;
1210 unsigned long flash_size;
1211 DriveInfo *dinfo;
1212 MachineClass *mc = MACHINE_GET_CLASS(machine);
1213 MemoryRegion *address_space_mem = get_system_memory();
1214 MemoryRegion *sram = g_new(MemoryRegion, 1);
1216 /* For now we use a fixed - the original - RAM size */
1217 if (machine->ram_size != mc->default_ram_size) {
1218 char *sz = size_to_str(mc->default_ram_size);
1219 error_report("Invalid RAM size, should be %s", sz);
1220 g_free(sz);
1221 exit(EXIT_FAILURE);
1224 cpu = ARM_CPU(cpu_create(machine->cpu_type));
1226 memory_region_add_subregion(address_space_mem, 0, machine->ram);
1228 memory_region_init_ram(sram, NULL, "musicpal.sram", MP_SRAM_SIZE,
1229 &error_fatal);
1230 memory_region_add_subregion(address_space_mem, MP_SRAM_BASE, sram);
1232 pic = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE,
1233 qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));
1234 sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE,
1235 qdev_get_gpio_in(pic, MP_TIMER1_IRQ),
1236 qdev_get_gpio_in(pic, MP_TIMER2_IRQ),
1237 qdev_get_gpio_in(pic, MP_TIMER3_IRQ),
1238 qdev_get_gpio_in(pic, MP_TIMER4_IRQ), NULL);
1240 /* Logically OR both UART IRQs together */
1241 uart_orgate = DEVICE(object_new(TYPE_OR_IRQ));
1242 object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal);
1243 qdev_realize_and_unref(uart_orgate, NULL, &error_fatal);
1244 qdev_connect_gpio_out(uart_orgate, 0,
1245 qdev_get_gpio_in(pic, MP_UART_SHARED_IRQ));
1247 serial_mm_init(address_space_mem, MP_UART1_BASE, 2,
1248 qdev_get_gpio_in(uart_orgate, 0),
1249 1825000, serial_hd(0), DEVICE_NATIVE_ENDIAN);
1250 serial_mm_init(address_space_mem, MP_UART2_BASE, 2,
1251 qdev_get_gpio_in(uart_orgate, 1),
1252 1825000, serial_hd(1), DEVICE_NATIVE_ENDIAN);
1254 /* Register flash */
1255 dinfo = drive_get(IF_PFLASH, 0, 0);
1256 if (dinfo) {
1257 BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
1259 flash_size = blk_getlength(blk);
1260 if (flash_size != 8 * MiB && flash_size != 16 * MiB &&
1261 flash_size != 32 * MiB) {
1262 error_report("Invalid flash image size");
1263 exit(1);
1267 * The original U-Boot accesses the flash at 0xFE000000 instead of
1268 * 0xFF800000 (if there is 8 MB flash). So remap flash access if the
1269 * image is smaller than 32 MB.
1271 pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX,
1272 "musicpal.flash", flash_size,
1273 blk, FLASH_SECTOR_SIZE,
1274 MP_FLASH_SIZE_MAX / flash_size,
1275 2, 0x00BF, 0x236D, 0x0000, 0x0000,
1276 0x5555, 0x2AAA, 0);
1278 sysbus_create_simple(TYPE_MV88W8618_FLASHCFG, MP_FLASHCFG_BASE, NULL);
1280 dev = qdev_new(TYPE_MV88W8618_ETH);
1281 qemu_configure_nic_device(dev, true, "mv88w8618");
1282 object_property_set_link(OBJECT(dev), "dma-memory",
1283 OBJECT(get_system_memory()), &error_fatal);
1284 sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
1285 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, MP_ETH_BASE);
1286 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
1287 qdev_get_gpio_in(pic, MP_ETH_IRQ));
1289 sysbus_create_simple("mv88w8618_wlan", MP_WLAN_BASE, NULL);
1291 sysbus_create_simple(TYPE_MUSICPAL_MISC, MP_MISC_BASE, NULL);
1293 dev = sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE,
1294 qdev_get_gpio_in(pic, MP_GPIO_IRQ));
1295 i2c_dev = sysbus_create_simple(TYPE_GPIO_I2C, -1, NULL);
1296 i2c = (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c");
1298 lcd_dev = sysbus_create_simple(TYPE_MUSICPAL_LCD, MP_LCD_BASE, NULL);
1299 key_dev = sysbus_create_simple(TYPE_MUSICPAL_KEY, -1, NULL);
1301 /* I2C read data */
1302 qdev_connect_gpio_out(i2c_dev, 0,
1303 qdev_get_gpio_in(dev, MP_GPIO_I2C_DATA_BIT));
1304 /* I2C data */
1305 qdev_connect_gpio_out(dev, 3, qdev_get_gpio_in(i2c_dev, 0));
1306 /* I2C clock */
1307 qdev_connect_gpio_out(dev, 4, qdev_get_gpio_in(i2c_dev, 1));
1309 for (i = 0; i < 3; i++) {
1310 qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(lcd_dev, i));
1312 for (i = 0; i < 4; i++) {
1313 qdev_connect_gpio_out(key_dev, i, qdev_get_gpio_in(dev, i + 8));
1315 for (i = 4; i < 8; i++) {
1316 qdev_connect_gpio_out(key_dev, i, qdev_get_gpio_in(dev, i + 15));
1319 wm8750_dev = i2c_slave_new(TYPE_WM8750, MP_WM_ADDR);
1320 if (machine->audiodev) {
1321 qdev_prop_set_string(DEVICE(wm8750_dev), "audiodev", machine->audiodev);
1323 i2c_slave_realize_and_unref(wm8750_dev, i2c, &error_abort);
1325 dev = qdev_new(TYPE_MV88W8618_AUDIO);
1326 s = SYS_BUS_DEVICE(dev);
1327 object_property_set_link(OBJECT(dev), "wm8750", OBJECT(wm8750_dev),
1328 NULL);
1329 sysbus_realize_and_unref(s, &error_fatal);
1330 sysbus_mmio_map(s, 0, MP_AUDIO_BASE);
1331 sysbus_connect_irq(s, 0, qdev_get_gpio_in(pic, MP_AUDIO_IRQ));
1333 musicpal_binfo.ram_size = MP_RAM_DEFAULT_SIZE;
1334 arm_load_kernel(cpu, machine, &musicpal_binfo);
1337 static void musicpal_machine_init(MachineClass *mc)
1339 mc->desc = "Marvell 88w8618 / MusicPal (ARM926EJ-S)";
1340 mc->init = musicpal_init;
1341 mc->ignore_memory_transaction_failures = true;
1342 mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926");
1343 mc->default_ram_size = MP_RAM_DEFAULT_SIZE;
1344 mc->default_ram_id = "musicpal.ram";
1346 machine_add_audiodev_property(mc);
1349 DEFINE_MACHINE("musicpal", musicpal_machine_init)
1351 static void mv88w8618_wlan_class_init(ObjectClass *klass, void *data)
1353 DeviceClass *dc = DEVICE_CLASS(klass);
1355 dc->realize = mv88w8618_wlan_realize;
1358 static const TypeInfo mv88w8618_wlan_info = {
1359 .name = "mv88w8618_wlan",
1360 .parent = TYPE_SYS_BUS_DEVICE,
1361 .instance_size = sizeof(SysBusDevice),
1362 .class_init = mv88w8618_wlan_class_init,
1365 static void musicpal_register_types(void)
1367 type_register_static(&mv88w8618_pic_info);
1368 type_register_static(&mv88w8618_pit_info);
1369 type_register_static(&mv88w8618_flashcfg_info);
1370 type_register_static(&mv88w8618_wlan_info);
1371 type_register_static(&musicpal_lcd_info);
1372 type_register_static(&musicpal_gpio_info);
1373 type_register_static(&musicpal_key_info);
1374 type_register_static(&musicpal_misc_info);
1377 type_init(musicpal_register_types)