2 * Intel XScale PXA255/270 processor support.
4 * Copyright (c) 2006 Openedhand Ltd.
5 * Written by Andrzej Zaborowski <balrog@zabor.org>
7 * This code is licenced under the GNU GPL v2.
10 # define PXA_H "pxa.h"
12 /* Interrupt numbers */
13 # define PXA2XX_PIC_SSP3 0
14 # define PXA2XX_PIC_USBH2 2
15 # define PXA2XX_PIC_USBH1 3
16 # define PXA2XX_PIC_KEYPAD 4
17 # define PXA2XX_PIC_PWRI2C 6
18 # define PXA25X_PIC_HWUART 7
19 # define PXA27X_PIC_OST_4_11 7
20 # define PXA2XX_PIC_GPIO_0 8
21 # define PXA2XX_PIC_GPIO_1 9
22 # define PXA2XX_PIC_GPIO_X 10
23 # define PXA2XX_PIC_I2S 13
24 # define PXA26X_PIC_ASSP 15
25 # define PXA25X_PIC_NSSP 16
26 # define PXA27X_PIC_SSP2 16
27 # define PXA2XX_PIC_LCD 17
28 # define PXA2XX_PIC_I2C 18
29 # define PXA2XX_PIC_ICP 19
30 # define PXA2XX_PIC_STUART 20
31 # define PXA2XX_PIC_BTUART 21
32 # define PXA2XX_PIC_FFUART 22
33 # define PXA2XX_PIC_MMC 23
34 # define PXA2XX_PIC_SSP 24
35 # define PXA2XX_PIC_DMA 25
36 # define PXA2XX_PIC_OST_0 26
37 # define PXA2XX_PIC_RTC1HZ 30
38 # define PXA2XX_PIC_RTCALARM 31
41 # define PXA2XX_RX_RQ_I2S 2
42 # define PXA2XX_TX_RQ_I2S 3
43 # define PXA2XX_RX_RQ_BTUART 4
44 # define PXA2XX_TX_RQ_BTUART 5
45 # define PXA2XX_RX_RQ_FFUART 6
46 # define PXA2XX_TX_RQ_FFUART 7
47 # define PXA2XX_RX_RQ_SSP1 13
48 # define PXA2XX_TX_RQ_SSP1 14
49 # define PXA2XX_RX_RQ_SSP2 15
50 # define PXA2XX_TX_RQ_SSP2 16
51 # define PXA2XX_RX_RQ_ICP 17
52 # define PXA2XX_TX_RQ_ICP 18
53 # define PXA2XX_RX_RQ_STUART 19
54 # define PXA2XX_TX_RQ_STUART 20
55 # define PXA2XX_RX_RQ_MMCI 21
56 # define PXA2XX_TX_RQ_MMCI 22
57 # define PXA2XX_USB_RQ(x) ((x) + 24)
58 # define PXA2XX_RX_RQ_SSP3 66
59 # define PXA2XX_TX_RQ_SSP3 67
61 # define PXA2XX_SDRAM_BASE 0xa0000000
62 # define PXA2XX_INTERNAL_BASE 0x5c000000
63 # define PXA2XX_INTERNAL_SIZE 0x40000
66 qemu_irq
*pxa2xx_pic_init(target_phys_addr_t base
, CPUState
*env
);
69 void pxa25x_timer_init(target_phys_addr_t base
, qemu_irq
*irqs
);
70 void pxa27x_timer_init(target_phys_addr_t base
, qemu_irq
*irqs
, qemu_irq irq4
);
73 typedef struct PXA2xxGPIOInfo PXA2xxGPIOInfo
;
74 PXA2xxGPIOInfo
*pxa2xx_gpio_init(target_phys_addr_t base
,
75 CPUState
*env
, qemu_irq
*pic
, int lines
);
76 qemu_irq
*pxa2xx_gpio_in_get(PXA2xxGPIOInfo
*s
);
77 void pxa2xx_gpio_out_set(PXA2xxGPIOInfo
*s
,
78 int line
, qemu_irq handler
);
79 void pxa2xx_gpio_read_notifier(PXA2xxGPIOInfo
*s
, qemu_irq handler
);
82 typedef struct PXA2xxDMAState PXA2xxDMAState
;
83 PXA2xxDMAState
*pxa255_dma_init(target_phys_addr_t base
,
85 PXA2xxDMAState
*pxa27x_dma_init(target_phys_addr_t base
,
87 void pxa2xx_dma_request(PXA2xxDMAState
*s
, int req_num
, int on
);
90 typedef struct PXA2xxLCDState PXA2xxLCDState
;
91 PXA2xxLCDState
*pxa2xx_lcdc_init(target_phys_addr_t base
,
93 void pxa2xx_lcd_vsync_notifier(PXA2xxLCDState
*s
, qemu_irq handler
);
94 void pxa2xx_lcdc_oritentation(void *opaque
, int angle
);
97 typedef struct PXA2xxMMCIState PXA2xxMMCIState
;
98 PXA2xxMMCIState
*pxa2xx_mmci_init(target_phys_addr_t base
,
99 BlockDriverState
*bd
, qemu_irq irq
, void *dma
);
100 void pxa2xx_mmci_handlers(PXA2xxMMCIState
*s
, qemu_irq readonly
,
101 qemu_irq coverswitch
);
103 /* pxa2xx_pcmcia.c */
104 typedef struct PXA2xxPCMCIAState PXA2xxPCMCIAState
;
105 PXA2xxPCMCIAState
*pxa2xx_pcmcia_init(target_phys_addr_t base
);
106 int pxa2xx_pcmcia_attach(void *opaque
, PCMCIACardState
*card
);
107 int pxa2xx_pcmcia_dettach(void *opaque
);
108 void pxa2xx_pcmcia_set_irq_cb(void *opaque
, qemu_irq irq
, qemu_irq cd_irq
);
110 /* pxa2xx_keypad.c */
115 typedef struct PXA2xxKeyPadState PXA2xxKeyPadState
;
116 PXA2xxKeyPadState
*pxa27x_keypad_init(target_phys_addr_t base
,
118 void pxa27x_register_keypad(PXA2xxKeyPadState
*kp
, struct keymap
*map
,
122 typedef struct PXA2xxSSPState PXA2xxSSPState
;
123 void pxa2xx_ssp_attach(PXA2xxSSPState
*port
,
124 uint32_t (*readfn
)(void *opaque
),
125 void (*writefn
)(void *opaque
, uint32_t value
), void *opaque
);
127 typedef struct PXA2xxI2CState PXA2xxI2CState
;
128 PXA2xxI2CState
*pxa2xx_i2c_init(target_phys_addr_t base
,
129 qemu_irq irq
, uint32_t page_size
);
130 i2c_bus
*pxa2xx_i2c_bus(PXA2xxI2CState
*s
);
132 typedef struct PXA2xxI2SState PXA2xxI2SState
;
133 typedef struct PXA2xxFIrState PXA2xxFIrState
;
140 PXA2xxGPIOInfo
*gpio
;
142 PXA2xxSSPState
**ssp
;
143 PXA2xxI2CState
*i2c
[2];
144 PXA2xxMMCIState
*mmc
;
145 PXA2xxPCMCIAState
*pcmcia
[2];
148 PXA2xxKeyPadState
*kp
;
150 /* Power management */
151 target_phys_addr_t pm_base
;
152 uint32_t pm_regs
[0x40];
154 /* Clock management */
155 target_phys_addr_t cm_base
;
159 /* Memory management */
160 target_phys_addr_t mm_base
;
161 uint32_t mm_regs
[0x1a];
163 /* Performance monitoring */
166 /* Real-Time clock */
167 target_phys_addr_t rtc_base
;
182 uint32_t last_rtcpicr
;
187 QEMUTimer
*rtc_rdal1
;
188 QEMUTimer
*rtc_rdal2
;
189 QEMUTimer
*rtc_swal1
;
190 QEMUTimer
*rtc_swal2
;
194 struct PXA2xxI2SState
{
197 void (*data_req
)(void *, int, int);
207 void (*codec_out
)(void *, uint32_t);
208 uint32_t (*codec_in
)(void *);
215 # define PA_FMT "0x%08lx"
216 # define REG_FMT "0x" TARGET_FMT_plx
218 PXA2xxState
*pxa270_init(unsigned int sdram_size
, const char *revision
);
219 PXA2xxState
*pxa255_init(unsigned int sdram_size
);
222 void usb_ohci_init_pxa(target_phys_addr_t base
, int num_ports
, int devfn
,