2 * Marvell MV88W8618 / Freecom MusicPal emulation.
4 * Copyright (c) 2008 Jan Kiszka
6 * This code is licenced under the GNU GPL v2.
16 #include "qemu-timer.h"
20 #include "audio/audio.h"
23 #define MP_MISC_BASE 0x80002000
24 #define MP_MISC_SIZE 0x00001000
26 #define MP_ETH_BASE 0x80008000
27 #define MP_ETH_SIZE 0x00001000
29 #define MP_WLAN_BASE 0x8000C000
30 #define MP_WLAN_SIZE 0x00000800
32 #define MP_UART1_BASE 0x8000C840
33 #define MP_UART2_BASE 0x8000C940
35 #define MP_GPIO_BASE 0x8000D000
36 #define MP_GPIO_SIZE 0x00001000
38 #define MP_FLASHCFG_BASE 0x90006000
39 #define MP_FLASHCFG_SIZE 0x00001000
41 #define MP_AUDIO_BASE 0x90007000
42 #define MP_AUDIO_SIZE 0x00001000
44 #define MP_PIC_BASE 0x90008000
45 #define MP_PIC_SIZE 0x00001000
47 #define MP_PIT_BASE 0x90009000
48 #define MP_PIT_SIZE 0x00001000
50 #define MP_LCD_BASE 0x9000c000
51 #define MP_LCD_SIZE 0x00001000
53 #define MP_SRAM_BASE 0xC0000000
54 #define MP_SRAM_SIZE 0x00020000
56 #define MP_RAM_DEFAULT_SIZE 32*1024*1024
57 #define MP_FLASH_SIZE_MAX 32*1024*1024
59 #define MP_TIMER1_IRQ 4
60 #define MP_TIMER2_IRQ 5
61 #define MP_TIMER3_IRQ 6
62 #define MP_TIMER4_IRQ 7
65 #define MP_UART1_IRQ 11
66 #define MP_UART2_IRQ 11
67 #define MP_GPIO_IRQ 12
69 #define MP_AUDIO_IRQ 30
71 static uint32_t gpio_in_state
= 0xffffffff;
72 static uint32_t gpio_isr
;
73 static uint32_t gpio_out_state
;
74 static ram_addr_t sram_off
;
76 typedef enum i2c_state
{
99 typedef struct i2c_interface
{
108 static void i2c_enter_stop(i2c_interface
*i2c
)
110 if (i2c
->current_addr
>= 0)
111 i2c_end_transfer(i2c
->bus
);
112 i2c
->current_addr
= -1;
113 i2c
->state
= STOPPED
;
116 static void i2c_state_update(i2c_interface
*i2c
, int data
, int clock
)
121 switch (i2c
->state
) {
123 if (data
== 0 && i2c
->last_data
== 1 && clock
== 1)
124 i2c
->state
= INITIALIZING
;
128 if (clock
== 0 && i2c
->last_clock
== 1 && data
== 0)
129 i2c
->state
= SENDING_BIT7
;
134 case SENDING_BIT7
... SENDING_BIT0
:
135 if (clock
== 0 && i2c
->last_clock
== 1) {
136 i2c
->buffer
= (i2c
->buffer
<< 1) | data
;
137 i2c
->state
++; /* will end up in WAITING_FOR_ACK */
138 } else if (data
== 1 && i2c
->last_data
== 0 && clock
== 1)
142 case WAITING_FOR_ACK
:
143 if (clock
== 0 && i2c
->last_clock
== 1) {
144 if (i2c
->current_addr
< 0) {
145 i2c
->current_addr
= i2c
->buffer
;
146 i2c_start_transfer(i2c
->bus
, i2c
->current_addr
& 0xfe,
149 i2c_send(i2c
->bus
, i2c
->buffer
);
150 if (i2c
->current_addr
& 1) {
151 i2c
->state
= RECEIVING_BIT7
;
152 i2c
->buffer
= i2c_recv(i2c
->bus
);
154 i2c
->state
= SENDING_BIT7
;
155 } else if (data
== 1 && i2c
->last_data
== 0 && clock
== 1)
159 case RECEIVING_BIT7
... RECEIVING_BIT0
:
160 if (clock
== 0 && i2c
->last_clock
== 1) {
161 i2c
->state
++; /* will end up in SENDING_ACK */
163 } else if (data
== 1 && i2c
->last_data
== 0 && clock
== 1)
168 if (clock
== 0 && i2c
->last_clock
== 1) {
169 i2c
->state
= RECEIVING_BIT7
;
171 i2c
->buffer
= i2c_recv(i2c
->bus
);
174 } else if (data
== 1 && i2c
->last_data
== 0 && clock
== 1)
179 i2c
->last_data
= data
;
180 i2c
->last_clock
= clock
;
183 static int i2c_get_data(i2c_interface
*i2c
)
188 switch (i2c
->state
) {
189 case RECEIVING_BIT7
... RECEIVING_BIT0
:
190 return (i2c
->buffer
>> 7);
192 case WAITING_FOR_ACK
:
198 static i2c_interface
*mixer_i2c
;
202 /* Audio register offsets */
203 #define MP_AUDIO_PLAYBACK_MODE 0x00
204 #define MP_AUDIO_CLOCK_DIV 0x18
205 #define MP_AUDIO_IRQ_STATUS 0x20
206 #define MP_AUDIO_IRQ_ENABLE 0x24
207 #define MP_AUDIO_TX_START_LO 0x28
208 #define MP_AUDIO_TX_THRESHOLD 0x2C
209 #define MP_AUDIO_TX_STATUS 0x38
210 #define MP_AUDIO_TX_START_HI 0x40
212 /* Status register and IRQ enable bits */
213 #define MP_AUDIO_TX_HALF (1 << 6)
214 #define MP_AUDIO_TX_FULL (1 << 7)
216 /* Playback mode bits */
217 #define MP_AUDIO_16BIT_SAMPLE (1 << 0)
218 #define MP_AUDIO_PLAYBACK_EN (1 << 7)
219 #define MP_AUDIO_CLOCK_24MHZ (1 << 9)
220 #define MP_AUDIO_MONO (1 << 14)
222 /* Wolfson 8750 I2C address */
223 #define MP_WM_ADDR 0x34
225 static const char audio_name
[] = "mv88w8618";
227 typedef struct musicpal_audio_state
{
229 uint32_t playback_mode
;
232 unsigned long phys_buf
;
233 uint32_t target_buffer
;
234 unsigned int threshold
;
235 unsigned int play_pos
;
236 unsigned int last_free
;
239 } musicpal_audio_state
;
241 static void audio_callback(void *opaque
, int free_out
, int free_in
)
243 musicpal_audio_state
*s
= opaque
;
244 int16_t *codec_buffer
;
249 if (!(s
->playback_mode
& MP_AUDIO_PLAYBACK_EN
))
252 if (s
->playback_mode
& MP_AUDIO_16BIT_SAMPLE
)
255 if (!(s
->playback_mode
& MP_AUDIO_MONO
))
258 block_size
= s
->threshold
/2;
259 if (free_out
- s
->last_free
< block_size
)
262 if (block_size
> 4096)
265 cpu_physical_memory_read(s
->target_buffer
+ s
->play_pos
, (void *)buf
,
268 if (s
->playback_mode
& MP_AUDIO_16BIT_SAMPLE
) {
269 if (s
->playback_mode
& MP_AUDIO_MONO
) {
270 codec_buffer
= wm8750_dac_buffer(s
->wm
, block_size
>> 1);
271 for (pos
= 0; pos
< block_size
; pos
+= 2) {
272 *codec_buffer
++ = *(int16_t *)mem_buffer
;
273 *codec_buffer
++ = *(int16_t *)mem_buffer
;
277 memcpy(wm8750_dac_buffer(s
->wm
, block_size
>> 2),
278 (uint32_t *)mem_buffer
, block_size
);
280 if (s
->playback_mode
& MP_AUDIO_MONO
) {
281 codec_buffer
= wm8750_dac_buffer(s
->wm
, block_size
);
282 for (pos
= 0; pos
< block_size
; pos
++) {
283 *codec_buffer
++ = cpu_to_le16(256 * *mem_buffer
);
284 *codec_buffer
++ = cpu_to_le16(256 * *mem_buffer
++);
287 codec_buffer
= wm8750_dac_buffer(s
->wm
, block_size
>> 1);
288 for (pos
= 0; pos
< block_size
; pos
+= 2) {
289 *codec_buffer
++ = cpu_to_le16(256 * *mem_buffer
++);
290 *codec_buffer
++ = cpu_to_le16(256 * *mem_buffer
++);
294 wm8750_dac_commit(s
->wm
);
296 s
->last_free
= free_out
- block_size
;
298 if (s
->play_pos
== 0) {
299 s
->status
|= MP_AUDIO_TX_HALF
;
300 s
->play_pos
= block_size
;
302 s
->status
|= MP_AUDIO_TX_FULL
;
306 if (s
->status
& s
->irq_enable
)
307 qemu_irq_raise(s
->irq
);
310 static void musicpal_audio_clock_update(musicpal_audio_state
*s
)
314 if (s
->playback_mode
& MP_AUDIO_CLOCK_24MHZ
)
315 rate
= 24576000 / 64; /* 24.576MHz */
317 rate
= 11289600 / 64; /* 11.2896MHz */
319 rate
/= ((s
->clock_div
>> 8) & 0xff) + 1;
321 wm8750_set_bclk_in(s
->wm
, rate
);
324 static uint32_t musicpal_audio_read(void *opaque
, target_phys_addr_t offset
)
326 musicpal_audio_state
*s
= opaque
;
329 case MP_AUDIO_PLAYBACK_MODE
:
330 return s
->playback_mode
;
332 case MP_AUDIO_CLOCK_DIV
:
335 case MP_AUDIO_IRQ_STATUS
:
338 case MP_AUDIO_IRQ_ENABLE
:
339 return s
->irq_enable
;
341 case MP_AUDIO_TX_STATUS
:
342 return s
->play_pos
>> 2;
349 static void musicpal_audio_write(void *opaque
, target_phys_addr_t offset
,
352 musicpal_audio_state
*s
= opaque
;
355 case MP_AUDIO_PLAYBACK_MODE
:
356 if (value
& MP_AUDIO_PLAYBACK_EN
&&
357 !(s
->playback_mode
& MP_AUDIO_PLAYBACK_EN
)) {
362 s
->playback_mode
= value
;
363 musicpal_audio_clock_update(s
);
366 case MP_AUDIO_CLOCK_DIV
:
367 s
->clock_div
= value
;
370 musicpal_audio_clock_update(s
);
373 case MP_AUDIO_IRQ_STATUS
:
377 case MP_AUDIO_IRQ_ENABLE
:
378 s
->irq_enable
= value
;
379 if (s
->status
& s
->irq_enable
)
380 qemu_irq_raise(s
->irq
);
383 case MP_AUDIO_TX_START_LO
:
384 s
->phys_buf
= (s
->phys_buf
& 0xFFFF0000) | (value
& 0xFFFF);
385 s
->target_buffer
= s
->phys_buf
;
390 case MP_AUDIO_TX_THRESHOLD
:
391 s
->threshold
= (value
+ 1) * 4;
394 case MP_AUDIO_TX_START_HI
:
395 s
->phys_buf
= (s
->phys_buf
& 0xFFFF) | (value
<< 16);
396 s
->target_buffer
= s
->phys_buf
;
403 static void musicpal_audio_reset(void *opaque
)
405 musicpal_audio_state
*s
= opaque
;
407 s
->playback_mode
= 0;
412 static CPUReadMemoryFunc
*musicpal_audio_readfn
[] = {
418 static CPUWriteMemoryFunc
*musicpal_audio_writefn
[] = {
419 musicpal_audio_write
,
420 musicpal_audio_write
,
424 static i2c_interface
*musicpal_audio_init(qemu_irq irq
)
426 musicpal_audio_state
*s
;
430 s
= qemu_mallocz(sizeof(musicpal_audio_state
));
433 i2c
= qemu_mallocz(sizeof(i2c_interface
));
434 i2c
->bus
= i2c_init_bus();
435 i2c
->current_addr
= -1;
437 s
->wm
= i2c_create_slave(i2c
->bus
, "wm8750", MP_WM_ADDR
);
438 wm8750_data_req_set(s
->wm
, audio_callback
, s
);
440 iomemtype
= cpu_register_io_memory(0, musicpal_audio_readfn
,
441 musicpal_audio_writefn
, s
);
442 cpu_register_physical_memory(MP_AUDIO_BASE
, MP_AUDIO_SIZE
, iomemtype
);
444 qemu_register_reset(musicpal_audio_reset
, s
);
448 #else /* !HAS_AUDIO */
449 static i2c_interface
*musicpal_audio_init(qemu_irq irq
)
453 #endif /* !HAS_AUDIO */
455 /* Ethernet register offsets */
456 #define MP_ETH_SMIR 0x010
457 #define MP_ETH_PCXR 0x408
458 #define MP_ETH_SDCMR 0x448
459 #define MP_ETH_ICR 0x450
460 #define MP_ETH_IMR 0x458
461 #define MP_ETH_FRDP0 0x480
462 #define MP_ETH_FRDP1 0x484
463 #define MP_ETH_FRDP2 0x488
464 #define MP_ETH_FRDP3 0x48C
465 #define MP_ETH_CRDP0 0x4A0
466 #define MP_ETH_CRDP1 0x4A4
467 #define MP_ETH_CRDP2 0x4A8
468 #define MP_ETH_CRDP3 0x4AC
469 #define MP_ETH_CTDP0 0x4E0
470 #define MP_ETH_CTDP1 0x4E4
471 #define MP_ETH_CTDP2 0x4E8
472 #define MP_ETH_CTDP3 0x4EC
475 #define MP_ETH_SMIR_DATA 0x0000FFFF
476 #define MP_ETH_SMIR_ADDR 0x03FF0000
477 #define MP_ETH_SMIR_OPCODE (1 << 26) /* Read value */
478 #define MP_ETH_SMIR_RDVALID (1 << 27)
481 #define MP_ETH_PHY1_BMSR 0x00210000
482 #define MP_ETH_PHY1_PHYSID1 0x00410000
483 #define MP_ETH_PHY1_PHYSID2 0x00610000
485 #define MP_PHY_BMSR_LINK 0x0004
486 #define MP_PHY_BMSR_AUTONEG 0x0008
488 #define MP_PHY_88E3015 0x01410E20
490 /* TX descriptor status */
491 #define MP_ETH_TX_OWN (1 << 31)
493 /* RX descriptor status */
494 #define MP_ETH_RX_OWN (1 << 31)
496 /* Interrupt cause/mask bits */
497 #define MP_ETH_IRQ_RX_BIT 0
498 #define MP_ETH_IRQ_RX (1 << MP_ETH_IRQ_RX_BIT)
499 #define MP_ETH_IRQ_TXHI_BIT 2
500 #define MP_ETH_IRQ_TXLO_BIT 3
502 /* Port config bits */
503 #define MP_ETH_PCXR_2BSM_BIT 28 /* 2-byte incoming suffix */
505 /* SDMA command bits */
506 #define MP_ETH_CMD_TXHI (1 << 23)
507 #define MP_ETH_CMD_TXLO (1 << 22)
509 typedef struct mv88w8618_tx_desc
{
517 typedef struct mv88w8618_rx_desc
{
520 uint16_t buffer_size
;
525 typedef struct mv88w8618_eth_state
{
533 uint32_t tx_queue
[2];
534 uint32_t rx_queue
[4];
535 uint32_t frx_queue
[4];
538 } mv88w8618_eth_state
;
540 static void eth_rx_desc_put(uint32_t addr
, mv88w8618_rx_desc
*desc
)
542 cpu_to_le32s(&desc
->cmdstat
);
543 cpu_to_le16s(&desc
->bytes
);
544 cpu_to_le16s(&desc
->buffer_size
);
545 cpu_to_le32s(&desc
->buffer
);
546 cpu_to_le32s(&desc
->next
);
547 cpu_physical_memory_write(addr
, (void *)desc
, sizeof(*desc
));
550 static void eth_rx_desc_get(uint32_t addr
, mv88w8618_rx_desc
*desc
)
552 cpu_physical_memory_read(addr
, (void *)desc
, sizeof(*desc
));
553 le32_to_cpus(&desc
->cmdstat
);
554 le16_to_cpus(&desc
->bytes
);
555 le16_to_cpus(&desc
->buffer_size
);
556 le32_to_cpus(&desc
->buffer
);
557 le32_to_cpus(&desc
->next
);
560 static int eth_can_receive(void *opaque
)
565 static void eth_receive(void *opaque
, const uint8_t *buf
, int size
)
567 mv88w8618_eth_state
*s
= opaque
;
569 mv88w8618_rx_desc desc
;
572 for (i
= 0; i
< 4; i
++) {
573 desc_addr
= s
->cur_rx
[i
];
577 eth_rx_desc_get(desc_addr
, &desc
);
578 if ((desc
.cmdstat
& MP_ETH_RX_OWN
) && desc
.buffer_size
>= size
) {
579 cpu_physical_memory_write(desc
.buffer
+ s
->vlan_header
,
581 desc
.bytes
= size
+ s
->vlan_header
;
582 desc
.cmdstat
&= ~MP_ETH_RX_OWN
;
583 s
->cur_rx
[i
] = desc
.next
;
585 s
->icr
|= MP_ETH_IRQ_RX
;
587 qemu_irq_raise(s
->irq
);
588 eth_rx_desc_put(desc_addr
, &desc
);
591 desc_addr
= desc
.next
;
592 } while (desc_addr
!= s
->rx_queue
[i
]);
596 static void eth_tx_desc_put(uint32_t addr
, mv88w8618_tx_desc
*desc
)
598 cpu_to_le32s(&desc
->cmdstat
);
599 cpu_to_le16s(&desc
->res
);
600 cpu_to_le16s(&desc
->bytes
);
601 cpu_to_le32s(&desc
->buffer
);
602 cpu_to_le32s(&desc
->next
);
603 cpu_physical_memory_write(addr
, (void *)desc
, sizeof(*desc
));
606 static void eth_tx_desc_get(uint32_t addr
, mv88w8618_tx_desc
*desc
)
608 cpu_physical_memory_read(addr
, (void *)desc
, sizeof(*desc
));
609 le32_to_cpus(&desc
->cmdstat
);
610 le16_to_cpus(&desc
->res
);
611 le16_to_cpus(&desc
->bytes
);
612 le32_to_cpus(&desc
->buffer
);
613 le32_to_cpus(&desc
->next
);
616 static void eth_send(mv88w8618_eth_state
*s
, int queue_index
)
618 uint32_t desc_addr
= s
->tx_queue
[queue_index
];
619 mv88w8618_tx_desc desc
;
625 eth_tx_desc_get(desc_addr
, &desc
);
626 if (desc
.cmdstat
& MP_ETH_TX_OWN
) {
629 cpu_physical_memory_read(desc
.buffer
, buf
, len
);
630 qemu_send_packet(s
->vc
, buf
, len
);
632 desc
.cmdstat
&= ~MP_ETH_TX_OWN
;
633 s
->icr
|= 1 << (MP_ETH_IRQ_TXLO_BIT
- queue_index
);
634 eth_tx_desc_put(desc_addr
, &desc
);
636 desc_addr
= desc
.next
;
637 } while (desc_addr
!= s
->tx_queue
[queue_index
]);
640 static uint32_t mv88w8618_eth_read(void *opaque
, target_phys_addr_t offset
)
642 mv88w8618_eth_state
*s
= opaque
;
646 if (s
->smir
& MP_ETH_SMIR_OPCODE
) {
647 switch (s
->smir
& MP_ETH_SMIR_ADDR
) {
648 case MP_ETH_PHY1_BMSR
:
649 return MP_PHY_BMSR_LINK
| MP_PHY_BMSR_AUTONEG
|
651 case MP_ETH_PHY1_PHYSID1
:
652 return (MP_PHY_88E3015
>> 16) | MP_ETH_SMIR_RDVALID
;
653 case MP_ETH_PHY1_PHYSID2
:
654 return (MP_PHY_88E3015
& 0xFFFF) | MP_ETH_SMIR_RDVALID
;
656 return MP_ETH_SMIR_RDVALID
;
667 case MP_ETH_FRDP0
... MP_ETH_FRDP3
:
668 return s
->frx_queue
[(offset
- MP_ETH_FRDP0
)/4];
670 case MP_ETH_CRDP0
... MP_ETH_CRDP3
:
671 return s
->rx_queue
[(offset
- MP_ETH_CRDP0
)/4];
673 case MP_ETH_CTDP0
... MP_ETH_CTDP3
:
674 return s
->tx_queue
[(offset
- MP_ETH_CTDP0
)/4];
681 static void mv88w8618_eth_write(void *opaque
, target_phys_addr_t offset
,
684 mv88w8618_eth_state
*s
= opaque
;
692 s
->vlan_header
= ((value
>> MP_ETH_PCXR_2BSM_BIT
) & 1) * 2;
696 if (value
& MP_ETH_CMD_TXHI
)
698 if (value
& MP_ETH_CMD_TXLO
)
700 if (value
& (MP_ETH_CMD_TXHI
| MP_ETH_CMD_TXLO
) && s
->icr
& s
->imr
)
701 qemu_irq_raise(s
->irq
);
711 qemu_irq_raise(s
->irq
);
714 case MP_ETH_FRDP0
... MP_ETH_FRDP3
:
715 s
->frx_queue
[(offset
- MP_ETH_FRDP0
)/4] = value
;
718 case MP_ETH_CRDP0
... MP_ETH_CRDP3
:
719 s
->rx_queue
[(offset
- MP_ETH_CRDP0
)/4] =
720 s
->cur_rx
[(offset
- MP_ETH_CRDP0
)/4] = value
;
723 case MP_ETH_CTDP0
... MP_ETH_CTDP3
:
724 s
->tx_queue
[(offset
- MP_ETH_CTDP0
)/4] = value
;
729 static CPUReadMemoryFunc
*mv88w8618_eth_readfn
[] = {
735 static CPUWriteMemoryFunc
*mv88w8618_eth_writefn
[] = {
741 static void eth_cleanup(VLANClientState
*vc
)
743 mv88w8618_eth_state
*s
= vc
->opaque
;
745 cpu_unregister_io_memory(s
->mmio_index
);
750 static void mv88w8618_eth_init(SysBusDevice
*dev
)
752 mv88w8618_eth_state
*s
= FROM_SYSBUS(mv88w8618_eth_state
, dev
);
754 sysbus_init_irq(dev
, &s
->irq
);
755 s
->vc
= qdev_get_vlan_client(&dev
->qdev
,
756 eth_receive
, eth_can_receive
,
758 s
->mmio_index
= cpu_register_io_memory(0, mv88w8618_eth_readfn
,
759 mv88w8618_eth_writefn
, s
);
760 sysbus_init_mmio(dev
, MP_ETH_SIZE
, s
->mmio_index
);
763 /* LCD register offsets */
764 #define MP_LCD_IRQCTRL 0x180
765 #define MP_LCD_IRQSTAT 0x184
766 #define MP_LCD_SPICTRL 0x1ac
767 #define MP_LCD_INST 0x1bc
768 #define MP_LCD_DATA 0x1c0
771 #define MP_LCD_SPI_DATA 0x00100011
772 #define MP_LCD_SPI_CMD 0x00104011
773 #define MP_LCD_SPI_INVALID 0x00000000
776 #define MP_LCD_INST_SETPAGE0 0xB0
778 #define MP_LCD_INST_SETPAGE7 0xB7
780 #define MP_LCD_TEXTCOLOR 0xe0e0ff /* RRGGBB */
782 typedef struct musicpal_lcd_state
{
789 uint8_t video_ram
[128*64/8];
790 } musicpal_lcd_state
;
792 static uint32_t lcd_brightness
;
794 static uint8_t scale_lcd_color(uint8_t col
)
798 switch (lcd_brightness
) {
799 case 0x00000007: /* 0 */
802 case 0x00020000: /* 1 */
803 return (tmp
* 1) / 7;
805 case 0x00020001: /* 2 */
806 return (tmp
* 2) / 7;
808 case 0x00040000: /* 3 */
809 return (tmp
* 3) / 7;
811 case 0x00010006: /* 4 */
812 return (tmp
* 4) / 7;
814 case 0x00020005: /* 5 */
815 return (tmp
* 5) / 7;
817 case 0x00040003: /* 6 */
818 return (tmp
* 6) / 7;
820 case 0x00030004: /* 7 */
826 #define SET_LCD_PIXEL(depth, type) \
827 static inline void glue(set_lcd_pixel, depth) \
828 (musicpal_lcd_state *s, int x, int y, type col) \
831 type *pixel = &((type *) ds_get_data(s->ds))[(y * 128 * 3 + x) * 3]; \
833 for (dy = 0; dy < 3; dy++, pixel += 127 * 3) \
834 for (dx = 0; dx < 3; dx++, pixel++) \
837 SET_LCD_PIXEL(8, uint8_t)
838 SET_LCD_PIXEL(16, uint16_t)
839 SET_LCD_PIXEL(32, uint32_t)
841 #include "pixel_ops.h"
843 static void lcd_refresh(void *opaque
)
845 musicpal_lcd_state
*s
= opaque
;
848 switch (ds_get_bits_per_pixel(s
->ds
)) {
851 #define LCD_REFRESH(depth, func) \
853 col = func(scale_lcd_color((MP_LCD_TEXTCOLOR >> 16) & 0xff), \
854 scale_lcd_color((MP_LCD_TEXTCOLOR >> 8) & 0xff), \
855 scale_lcd_color(MP_LCD_TEXTCOLOR & 0xff)); \
856 for (x = 0; x < 128; x++) \
857 for (y = 0; y < 64; y++) \
858 if (s->video_ram[x + (y/8)*128] & (1 << (y % 8))) \
859 glue(set_lcd_pixel, depth)(s, x, y, col); \
861 glue(set_lcd_pixel, depth)(s, x, y, 0); \
863 LCD_REFRESH(8, rgb_to_pixel8
)
864 LCD_REFRESH(16, rgb_to_pixel16
)
865 LCD_REFRESH(32, (is_surface_bgr(s
->ds
->surface
) ?
866 rgb_to_pixel32bgr
: rgb_to_pixel32
))
868 hw_error("unsupported colour depth %i\n",
869 ds_get_bits_per_pixel(s
->ds
));
872 dpy_update(s
->ds
, 0, 0, 128*3, 64*3);
875 static void lcd_invalidate(void *opaque
)
879 static uint32_t musicpal_lcd_read(void *opaque
, target_phys_addr_t offset
)
881 musicpal_lcd_state
*s
= opaque
;
892 static void musicpal_lcd_write(void *opaque
, target_phys_addr_t offset
,
895 musicpal_lcd_state
*s
= opaque
;
903 if (value
== MP_LCD_SPI_DATA
|| value
== MP_LCD_SPI_CMD
)
906 s
->mode
= MP_LCD_SPI_INVALID
;
910 if (value
>= MP_LCD_INST_SETPAGE0
&& value
<= MP_LCD_INST_SETPAGE7
) {
911 s
->page
= value
- MP_LCD_INST_SETPAGE0
;
917 if (s
->mode
== MP_LCD_SPI_CMD
) {
918 if (value
>= MP_LCD_INST_SETPAGE0
&&
919 value
<= MP_LCD_INST_SETPAGE7
) {
920 s
->page
= value
- MP_LCD_INST_SETPAGE0
;
923 } else if (s
->mode
== MP_LCD_SPI_DATA
) {
924 s
->video_ram
[s
->page
*128 + s
->page_off
] = value
;
925 s
->page_off
= (s
->page_off
+ 1) & 127;
931 static CPUReadMemoryFunc
*musicpal_lcd_readfn
[] = {
937 static CPUWriteMemoryFunc
*musicpal_lcd_writefn
[] = {
943 static void musicpal_lcd_init(SysBusDevice
*dev
)
945 musicpal_lcd_state
*s
= FROM_SYSBUS(musicpal_lcd_state
, dev
);
948 iomemtype
= cpu_register_io_memory(0, musicpal_lcd_readfn
,
949 musicpal_lcd_writefn
, s
);
950 sysbus_init_mmio(dev
, MP_LCD_SIZE
, iomemtype
);
951 cpu_register_physical_memory(MP_LCD_BASE
, MP_LCD_SIZE
, iomemtype
);
953 s
->ds
= graphic_console_init(lcd_refresh
, lcd_invalidate
,
955 qemu_console_resize(s
->ds
, 128*3, 64*3);
958 /* PIC register offsets */
959 #define MP_PIC_STATUS 0x00
960 #define MP_PIC_ENABLE_SET 0x08
961 #define MP_PIC_ENABLE_CLR 0x0C
963 typedef struct mv88w8618_pic_state
969 } mv88w8618_pic_state
;
971 static void mv88w8618_pic_update(mv88w8618_pic_state
*s
)
973 qemu_set_irq(s
->parent_irq
, (s
->level
& s
->enabled
));
976 static void mv88w8618_pic_set_irq(void *opaque
, int irq
, int level
)
978 mv88w8618_pic_state
*s
= opaque
;
981 s
->level
|= 1 << irq
;
983 s
->level
&= ~(1 << irq
);
984 mv88w8618_pic_update(s
);
987 static uint32_t mv88w8618_pic_read(void *opaque
, target_phys_addr_t offset
)
989 mv88w8618_pic_state
*s
= opaque
;
993 return s
->level
& s
->enabled
;
1000 static void mv88w8618_pic_write(void *opaque
, target_phys_addr_t offset
,
1003 mv88w8618_pic_state
*s
= opaque
;
1006 case MP_PIC_ENABLE_SET
:
1007 s
->enabled
|= value
;
1010 case MP_PIC_ENABLE_CLR
:
1011 s
->enabled
&= ~value
;
1015 mv88w8618_pic_update(s
);
1018 static void mv88w8618_pic_reset(void *opaque
)
1020 mv88w8618_pic_state
*s
= opaque
;
1026 static CPUReadMemoryFunc
*mv88w8618_pic_readfn
[] = {
1032 static CPUWriteMemoryFunc
*mv88w8618_pic_writefn
[] = {
1033 mv88w8618_pic_write
,
1034 mv88w8618_pic_write
,
1038 static void mv88w8618_pic_init(SysBusDevice
*dev
)
1040 mv88w8618_pic_state
*s
= FROM_SYSBUS(mv88w8618_pic_state
, dev
);
1043 qdev_init_irq_sink(&dev
->qdev
, mv88w8618_pic_set_irq
, 32);
1044 sysbus_init_irq(dev
, &s
->parent_irq
);
1045 iomemtype
= cpu_register_io_memory(0, mv88w8618_pic_readfn
,
1046 mv88w8618_pic_writefn
, s
);
1047 sysbus_init_mmio(dev
, MP_PIC_SIZE
, iomemtype
);
1049 qemu_register_reset(mv88w8618_pic_reset
, s
);
1052 /* PIT register offsets */
1053 #define MP_PIT_TIMER1_LENGTH 0x00
1055 #define MP_PIT_TIMER4_LENGTH 0x0C
1056 #define MP_PIT_CONTROL 0x10
1057 #define MP_PIT_TIMER1_VALUE 0x14
1059 #define MP_PIT_TIMER4_VALUE 0x20
1060 #define MP_BOARD_RESET 0x34
1062 /* Magic board reset value (probably some watchdog behind it) */
1063 #define MP_BOARD_RESET_MAGIC 0x10000
1065 typedef struct mv88w8618_timer_state
{
1066 ptimer_state
*ptimer
;
1070 } mv88w8618_timer_state
;
1072 typedef struct mv88w8618_pit_state
{
1073 SysBusDevice busdev
;
1074 mv88w8618_timer_state timer
[4];
1076 } mv88w8618_pit_state
;
1078 static void mv88w8618_timer_tick(void *opaque
)
1080 mv88w8618_timer_state
*s
= opaque
;
1082 qemu_irq_raise(s
->irq
);
1085 static void mv88w8618_timer_init(SysBusDevice
*dev
, mv88w8618_timer_state
*s
,
1090 sysbus_init_irq(dev
, &s
->irq
);
1093 bh
= qemu_bh_new(mv88w8618_timer_tick
, s
);
1094 s
->ptimer
= ptimer_init(bh
);
1097 static uint32_t mv88w8618_pit_read(void *opaque
, target_phys_addr_t offset
)
1099 mv88w8618_pit_state
*s
= opaque
;
1100 mv88w8618_timer_state
*t
;
1103 case MP_PIT_TIMER1_VALUE
... MP_PIT_TIMER4_VALUE
:
1104 t
= &s
->timer
[(offset
-MP_PIT_TIMER1_VALUE
) >> 2];
1105 return ptimer_get_count(t
->ptimer
);
1112 static void mv88w8618_pit_write(void *opaque
, target_phys_addr_t offset
,
1115 mv88w8618_pit_state
*s
= opaque
;
1116 mv88w8618_timer_state
*t
;
1120 case MP_PIT_TIMER1_LENGTH
... MP_PIT_TIMER4_LENGTH
:
1121 t
= &s
->timer
[offset
>> 2];
1123 ptimer_set_limit(t
->ptimer
, t
->limit
, 1);
1126 case MP_PIT_CONTROL
:
1127 for (i
= 0; i
< 4; i
++) {
1130 ptimer_set_limit(t
->ptimer
, t
->limit
, 0);
1131 ptimer_set_freq(t
->ptimer
, t
->freq
);
1132 ptimer_run(t
->ptimer
, 0);
1138 case MP_BOARD_RESET
:
1139 if (value
== MP_BOARD_RESET_MAGIC
)
1140 qemu_system_reset_request();
1145 static CPUReadMemoryFunc
*mv88w8618_pit_readfn
[] = {
1151 static CPUWriteMemoryFunc
*mv88w8618_pit_writefn
[] = {
1152 mv88w8618_pit_write
,
1153 mv88w8618_pit_write
,
1157 static void mv88w8618_pit_init(SysBusDevice
*dev
)
1160 mv88w8618_pit_state
*s
= FROM_SYSBUS(mv88w8618_pit_state
, dev
);
1163 /* Letting them all run at 1 MHz is likely just a pragmatic
1164 * simplification. */
1165 for (i
= 0; i
< 4; i
++) {
1166 mv88w8618_timer_init(dev
, &s
->timer
[i
], 1000000);
1169 iomemtype
= cpu_register_io_memory(0, mv88w8618_pit_readfn
,
1170 mv88w8618_pit_writefn
, s
);
1171 sysbus_init_mmio(dev
, MP_PIT_SIZE
, iomemtype
);
1174 /* Flash config register offsets */
1175 #define MP_FLASHCFG_CFGR0 0x04
1177 typedef struct mv88w8618_flashcfg_state
{
1178 SysBusDevice busdev
;
1180 } mv88w8618_flashcfg_state
;
1182 static uint32_t mv88w8618_flashcfg_read(void *opaque
,
1183 target_phys_addr_t offset
)
1185 mv88w8618_flashcfg_state
*s
= opaque
;
1188 case MP_FLASHCFG_CFGR0
:
1196 static void mv88w8618_flashcfg_write(void *opaque
, target_phys_addr_t offset
,
1199 mv88w8618_flashcfg_state
*s
= opaque
;
1202 case MP_FLASHCFG_CFGR0
:
1208 static CPUReadMemoryFunc
*mv88w8618_flashcfg_readfn
[] = {
1209 mv88w8618_flashcfg_read
,
1210 mv88w8618_flashcfg_read
,
1211 mv88w8618_flashcfg_read
1214 static CPUWriteMemoryFunc
*mv88w8618_flashcfg_writefn
[] = {
1215 mv88w8618_flashcfg_write
,
1216 mv88w8618_flashcfg_write
,
1217 mv88w8618_flashcfg_write
1220 static void mv88w8618_flashcfg_init(SysBusDevice
*dev
)
1223 mv88w8618_flashcfg_state
*s
= FROM_SYSBUS(mv88w8618_flashcfg_state
, dev
);
1225 s
->cfgr0
= 0xfffe4285; /* Default as set by U-Boot for 8 MB flash */
1226 iomemtype
= cpu_register_io_memory(0, mv88w8618_flashcfg_readfn
,
1227 mv88w8618_flashcfg_writefn
, s
);
1228 sysbus_init_mmio(dev
, MP_FLASHCFG_SIZE
, iomemtype
);
1231 /* Misc register offsets */
1232 #define MP_MISC_BOARD_REVISION 0x18
1234 #define MP_BOARD_REVISION 0x31
1236 static uint32_t musicpal_misc_read(void *opaque
, target_phys_addr_t offset
)
1239 case MP_MISC_BOARD_REVISION
:
1240 return MP_BOARD_REVISION
;
1247 static void musicpal_misc_write(void *opaque
, target_phys_addr_t offset
,
1252 static CPUReadMemoryFunc
*musicpal_misc_readfn
[] = {
1258 static CPUWriteMemoryFunc
*musicpal_misc_writefn
[] = {
1259 musicpal_misc_write
,
1260 musicpal_misc_write
,
1261 musicpal_misc_write
,
1264 static void musicpal_misc_init(void)
1268 iomemtype
= cpu_register_io_memory(0, musicpal_misc_readfn
,
1269 musicpal_misc_writefn
, NULL
);
1270 cpu_register_physical_memory(MP_MISC_BASE
, MP_MISC_SIZE
, iomemtype
);
1273 /* WLAN register offsets */
1274 #define MP_WLAN_MAGIC1 0x11c
1275 #define MP_WLAN_MAGIC2 0x124
1277 static uint32_t mv88w8618_wlan_read(void *opaque
, target_phys_addr_t offset
)
1280 /* Workaround to allow loading the binary-only wlandrv.ko crap
1281 * from the original Freecom firmware. */
1282 case MP_WLAN_MAGIC1
:
1284 case MP_WLAN_MAGIC2
:
1292 static void mv88w8618_wlan_write(void *opaque
, target_phys_addr_t offset
,
1297 static CPUReadMemoryFunc
*mv88w8618_wlan_readfn
[] = {
1298 mv88w8618_wlan_read
,
1299 mv88w8618_wlan_read
,
1300 mv88w8618_wlan_read
,
1303 static CPUWriteMemoryFunc
*mv88w8618_wlan_writefn
[] = {
1304 mv88w8618_wlan_write
,
1305 mv88w8618_wlan_write
,
1306 mv88w8618_wlan_write
,
1309 static void mv88w8618_wlan_init(SysBusDevice
*dev
)
1313 iomemtype
= cpu_register_io_memory(0, mv88w8618_wlan_readfn
,
1314 mv88w8618_wlan_writefn
, NULL
);
1315 sysbus_init_mmio(dev
, MP_WLAN_SIZE
, iomemtype
);
1318 /* GPIO register offsets */
1319 #define MP_GPIO_OE_LO 0x008
1320 #define MP_GPIO_OUT_LO 0x00c
1321 #define MP_GPIO_IN_LO 0x010
1322 #define MP_GPIO_ISR_LO 0x020
1323 #define MP_GPIO_OE_HI 0x508
1324 #define MP_GPIO_OUT_HI 0x50c
1325 #define MP_GPIO_IN_HI 0x510
1326 #define MP_GPIO_ISR_HI 0x520
1328 /* GPIO bits & masks */
1329 #define MP_GPIO_WHEEL_VOL (1 << 8)
1330 #define MP_GPIO_WHEEL_VOL_INV (1 << 9)
1331 #define MP_GPIO_WHEEL_NAV (1 << 10)
1332 #define MP_GPIO_WHEEL_NAV_INV (1 << 11)
1333 #define MP_GPIO_LCD_BRIGHTNESS 0x00070000
1334 #define MP_GPIO_BTN_FAVORITS (1 << 19)
1335 #define MP_GPIO_BTN_MENU (1 << 20)
1336 #define MP_GPIO_BTN_VOLUME (1 << 21)
1337 #define MP_GPIO_BTN_NAVIGATION (1 << 22)
1338 #define MP_GPIO_I2C_DATA_BIT 29
1339 #define MP_GPIO_I2C_DATA (1 << MP_GPIO_I2C_DATA_BIT)
1340 #define MP_GPIO_I2C_CLOCK_BIT 30
1342 /* LCD brightness bits in GPIO_OE_HI */
1343 #define MP_OE_LCD_BRIGHTNESS 0x0007
1345 static uint32_t musicpal_gpio_read(void *opaque
, target_phys_addr_t offset
)
1348 case MP_GPIO_OE_HI
: /* used for LCD brightness control */
1349 return lcd_brightness
& MP_OE_LCD_BRIGHTNESS
;
1351 case MP_GPIO_OUT_LO
:
1352 return gpio_out_state
& 0xFFFF;
1353 case MP_GPIO_OUT_HI
:
1354 return gpio_out_state
>> 16;
1357 return gpio_in_state
& 0xFFFF;
1359 /* Update received I2C data */
1360 gpio_in_state
= (gpio_in_state
& ~MP_GPIO_I2C_DATA
) |
1361 (i2c_get_data(mixer_i2c
) << MP_GPIO_I2C_DATA_BIT
);
1362 return gpio_in_state
>> 16;
1364 case MP_GPIO_ISR_LO
:
1365 return gpio_isr
& 0xFFFF;
1366 case MP_GPIO_ISR_HI
:
1367 return gpio_isr
>> 16;
1374 static void musicpal_gpio_write(void *opaque
, target_phys_addr_t offset
,
1378 case MP_GPIO_OE_HI
: /* used for LCD brightness control */
1379 lcd_brightness
= (lcd_brightness
& MP_GPIO_LCD_BRIGHTNESS
) |
1380 (value
& MP_OE_LCD_BRIGHTNESS
);
1383 case MP_GPIO_OUT_LO
:
1384 gpio_out_state
= (gpio_out_state
& 0xFFFF0000) | (value
& 0xFFFF);
1386 case MP_GPIO_OUT_HI
:
1387 gpio_out_state
= (gpio_out_state
& 0xFFFF) | (value
<< 16);
1388 lcd_brightness
= (lcd_brightness
& 0xFFFF) |
1389 (gpio_out_state
& MP_GPIO_LCD_BRIGHTNESS
);
1390 i2c_state_update(mixer_i2c
,
1391 (gpio_out_state
>> MP_GPIO_I2C_DATA_BIT
) & 1,
1392 (gpio_out_state
>> MP_GPIO_I2C_CLOCK_BIT
) & 1);
1398 static CPUReadMemoryFunc
*musicpal_gpio_readfn
[] = {
1404 static CPUWriteMemoryFunc
*musicpal_gpio_writefn
[] = {
1405 musicpal_gpio_write
,
1406 musicpal_gpio_write
,
1407 musicpal_gpio_write
,
1410 static void musicpal_gpio_init(void)
1414 iomemtype
= cpu_register_io_memory(0, musicpal_gpio_readfn
,
1415 musicpal_gpio_writefn
, NULL
);
1416 cpu_register_physical_memory(MP_GPIO_BASE
, MP_GPIO_SIZE
, iomemtype
);
1419 /* Keyboard codes & masks */
1420 #define KEY_RELEASED 0x80
1421 #define KEY_CODE 0x7f
1423 #define KEYCODE_TAB 0x0f
1424 #define KEYCODE_ENTER 0x1c
1425 #define KEYCODE_F 0x21
1426 #define KEYCODE_M 0x32
1428 #define KEYCODE_EXTENDED 0xe0
1429 #define KEYCODE_UP 0x48
1430 #define KEYCODE_DOWN 0x50
1431 #define KEYCODE_LEFT 0x4b
1432 #define KEYCODE_RIGHT 0x4d
1434 static void musicpal_key_event(void *opaque
, int keycode
)
1436 qemu_irq irq
= opaque
;
1438 static int kbd_extended
;
1440 if (keycode
== KEYCODE_EXTENDED
) {
1446 switch (keycode
& KEY_CODE
) {
1448 event
= MP_GPIO_WHEEL_NAV
| MP_GPIO_WHEEL_NAV_INV
;
1452 event
= MP_GPIO_WHEEL_NAV
;
1456 event
= MP_GPIO_WHEEL_VOL
| MP_GPIO_WHEEL_VOL_INV
;
1460 event
= MP_GPIO_WHEEL_VOL
;
1464 switch (keycode
& KEY_CODE
) {
1466 event
= MP_GPIO_BTN_FAVORITS
;
1470 event
= MP_GPIO_BTN_VOLUME
;
1474 event
= MP_GPIO_BTN_NAVIGATION
;
1478 event
= MP_GPIO_BTN_MENU
;
1481 /* Do not repeat already pressed buttons */
1482 if (!(keycode
& KEY_RELEASED
) && !(gpio_in_state
& event
))
1487 if (keycode
& KEY_RELEASED
) {
1488 gpio_in_state
|= event
;
1490 gpio_in_state
&= ~event
;
1492 qemu_irq_raise(irq
);
1499 static struct arm_boot_info musicpal_binfo
= {
1500 .loader_start
= 0x0,
1504 static void musicpal_init(ram_addr_t ram_size
,
1505 const char *boot_device
,
1506 const char *kernel_filename
, const char *kernel_cmdline
,
1507 const char *initrd_filename
, const char *cpu_model
)
1515 unsigned long flash_size
;
1518 cpu_model
= "arm926";
1520 env
= cpu_init(cpu_model
);
1522 fprintf(stderr
, "Unable to find CPU definition\n");
1525 cpu_pic
= arm_pic_init_cpu(env
);
1527 /* For now we use a fixed - the original - RAM size */
1528 cpu_register_physical_memory(0, MP_RAM_DEFAULT_SIZE
,
1529 qemu_ram_alloc(MP_RAM_DEFAULT_SIZE
));
1531 sram_off
= qemu_ram_alloc(MP_SRAM_SIZE
);
1532 cpu_register_physical_memory(MP_SRAM_BASE
, MP_SRAM_SIZE
, sram_off
);
1534 dev
= sysbus_create_simple("mv88w8618_pic", MP_PIC_BASE
,
1535 cpu_pic
[ARM_PIC_CPU_IRQ
]);
1536 for (i
= 0; i
< 32; i
++) {
1537 pic
[i
] = qdev_get_irq_sink(dev
, i
);
1539 sysbus_create_varargs("mv88w8618_pit", MP_PIT_BASE
, pic
[MP_TIMER1_IRQ
],
1540 pic
[MP_TIMER2_IRQ
], pic
[MP_TIMER3_IRQ
],
1541 pic
[MP_TIMER4_IRQ
], NULL
);
1544 serial_mm_init(MP_UART1_BASE
, 2, pic
[MP_UART1_IRQ
], 1825000,
1547 serial_mm_init(MP_UART2_BASE
, 2, pic
[MP_UART2_IRQ
], 1825000,
1550 /* Register flash */
1551 index
= drive_get_index(IF_PFLASH
, 0, 0);
1553 flash_size
= bdrv_getlength(drives_table
[index
].bdrv
);
1554 if (flash_size
!= 8*1024*1024 && flash_size
!= 16*1024*1024 &&
1555 flash_size
!= 32*1024*1024) {
1556 fprintf(stderr
, "Invalid flash image size\n");
1561 * The original U-Boot accesses the flash at 0xFE000000 instead of
1562 * 0xFF800000 (if there is 8 MB flash). So remap flash access if the
1563 * image is smaller than 32 MB.
1565 pflash_cfi02_register(0-MP_FLASH_SIZE_MAX
, qemu_ram_alloc(flash_size
),
1566 drives_table
[index
].bdrv
, 0x10000,
1567 (flash_size
+ 0xffff) >> 16,
1568 MP_FLASH_SIZE_MAX
/ flash_size
,
1569 2, 0x00BF, 0x236D, 0x0000, 0x0000,
1572 sysbus_create_simple("mv88w8618_flashcfg", MP_FLASHCFG_BASE
, NULL
);
1574 sysbus_create_simple("musicpal_lcd", MP_LCD_BASE
, NULL
);
1576 qemu_add_kbd_event_handler(musicpal_key_event
, pic
[MP_GPIO_IRQ
]);
1578 qemu_check_nic_model(&nd_table
[0], "mv88w8618");
1579 dev
= qdev_create(NULL
, "mv88w8618_eth");
1580 qdev_set_netdev(dev
, &nd_table
[0]);
1582 sysbus_mmio_map(sysbus_from_qdev(dev
), 0, MP_ETH_BASE
);
1583 sysbus_connect_irq(sysbus_from_qdev(dev
), 0, pic
[MP_ETH_IRQ
]);
1585 mixer_i2c
= musicpal_audio_init(pic
[MP_AUDIO_IRQ
]);
1587 sysbus_create_simple("mv88w8618_wlan", MP_WLAN_BASE
, NULL
);
1589 musicpal_misc_init();
1590 musicpal_gpio_init();
1592 musicpal_binfo
.ram_size
= MP_RAM_DEFAULT_SIZE
;
1593 musicpal_binfo
.kernel_filename
= kernel_filename
;
1594 musicpal_binfo
.kernel_cmdline
= kernel_cmdline
;
1595 musicpal_binfo
.initrd_filename
= initrd_filename
;
1596 arm_load_kernel(env
, &musicpal_binfo
);
1599 static QEMUMachine musicpal_machine
= {
1601 .desc
= "Marvell 88w8618 / MusicPal (ARM926EJ-S)",
1602 .init
= musicpal_init
,
1605 static void musicpal_machine_init(void)
1607 qemu_register_machine(&musicpal_machine
);
1610 machine_init(musicpal_machine_init
);
1612 static void musicpal_register_devices(void)
1614 sysbus_register_dev("mv88w8618_pic", sizeof(mv88w8618_pic_state
),
1615 mv88w8618_pic_init
);
1616 sysbus_register_dev("mv88w8618_pit", sizeof(mv88w8618_pit_state
),
1617 mv88w8618_pit_init
);
1618 sysbus_register_dev("mv88w8618_flashcfg", sizeof(mv88w8618_flashcfg_state
),
1619 mv88w8618_flashcfg_init
);
1620 sysbus_register_dev("mv88w8618_eth", sizeof(mv88w8618_eth_state
),
1621 mv88w8618_eth_init
);
1622 sysbus_register_dev("mv88w8618_wlan", sizeof(SysBusDevice
),
1623 mv88w8618_wlan_init
);
1624 sysbus_register_dev("musicpal_lcd", sizeof(musicpal_lcd_state
),
1628 device_init(musicpal_register_devices
)