blob: d982f00c5d8563b603b4f3741c0b3660f4ba7475 [file] [log] [blame]
balrogc1713132007-04-30 01:26:42 +00001/*
2 * Intel XScale PXA255/270 processor support.
3 *
4 * Copyright (c) 2006 Openedhand Ltd.
5 * Written by Andrzej Zaborowski <balrog@zabor.org>
6 *
balrog3efda492007-10-29 10:34:01 +00007 * This code is licenced under the GNU GPL v2.
balrogc1713132007-04-30 01:26:42 +00008 */
9#ifndef PXA_H
10# define PXA_H "pxa.h"
11
12/* Interrupt numbers */
13# define PXA2XX_PIC_SSP3 0
14# define PXA2XX_PIC_USBH2 2
15# define PXA2XX_PIC_USBH1 3
balrog31b87f22007-12-16 12:13:51 +000016# define PXA2XX_PIC_KEYPAD 4
balrogc1713132007-04-30 01:26:42 +000017# 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
39
40/* DMA requests */
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
60
balrogd95b2f82007-05-08 19:03:12 +000061# define PXA2XX_SDRAM_BASE 0xa0000000
62# define PXA2XX_INTERNAL_BASE 0x5c000000
balroga07dec22007-05-12 09:19:36 +000063# define PXA2XX_INTERNAL_SIZE 0x40000
balrogc1713132007-04-30 01:26:42 +000064
65/* pxa2xx_pic.c */
Dmitry Eremin-Solenikove1f8c722011-02-25 12:13:38 +010066DeviceState *pxa2xx_pic_init(target_phys_addr_t base, CPUState *env);
balrogc1713132007-04-30 01:26:42 +000067
68/* pxa2xx_gpio.c */
Dmitry Eremin-Solenikov0bb53332011-01-21 19:57:50 +030069DeviceState *pxa2xx_gpio_init(target_phys_addr_t base,
Dmitry Eremin-Solenikove1f8c722011-02-25 12:13:38 +010070 CPUState *env, DeviceState *pic, int lines);
Dmitry Eremin-Solenikov0bb53332011-01-21 19:57:50 +030071void pxa2xx_gpio_read_notifier(DeviceState *dev, qemu_irq handler);
balrogc1713132007-04-30 01:26:42 +000072
73/* pxa2xx_dma.c */
Andrzej Zaborowski2115c012011-03-03 15:04:51 +010074DeviceState *pxa255_dma_init(target_phys_addr_t base, qemu_irq irq);
75DeviceState *pxa27x_dma_init(target_phys_addr_t base, qemu_irq irq);
balrogc1713132007-04-30 01:26:42 +000076
balroga171fe32007-04-30 01:48:07 +000077/* pxa2xx_lcd.c */
Paul Brookbc24a222009-05-10 01:44:56 +010078typedef struct PXA2xxLCDState PXA2xxLCDState;
Anthony Liguoric227f092009-10-01 16:12:16 -050079PXA2xxLCDState *pxa2xx_lcdc_init(target_phys_addr_t base,
aliguori3023f3322009-01-16 19:04:14 +000080 qemu_irq irq);
Paul Brookbc24a222009-05-10 01:44:56 +010081void pxa2xx_lcd_vsync_notifier(PXA2xxLCDState *s, qemu_irq handler);
balroga171fe32007-04-30 01:48:07 +000082void pxa2xx_lcdc_oritentation(void *opaque, int angle);
83
84/* pxa2xx_mmci.c */
Paul Brookbc24a222009-05-10 01:44:56 +010085typedef struct PXA2xxMMCIState PXA2xxMMCIState;
Anthony Liguoric227f092009-10-01 16:12:16 -050086PXA2xxMMCIState *pxa2xx_mmci_init(target_phys_addr_t base,
Andrzej Zaborowski2115c012011-03-03 15:04:51 +010087 BlockDriverState *bd, qemu_irq irq,
88 qemu_irq rx_dma, qemu_irq tx_dma);
Paul Brookbc24a222009-05-10 01:44:56 +010089void pxa2xx_mmci_handlers(PXA2xxMMCIState *s, qemu_irq readonly,
balrog02ce6002007-11-17 14:34:44 +000090 qemu_irq coverswitch);
balroga171fe32007-04-30 01:48:07 +000091
92/* pxa2xx_pcmcia.c */
Paul Brookbc24a222009-05-10 01:44:56 +010093typedef struct PXA2xxPCMCIAState PXA2xxPCMCIAState;
Anthony Liguoric227f092009-10-01 16:12:16 -050094PXA2xxPCMCIAState *pxa2xx_pcmcia_init(target_phys_addr_t base);
Paul Brookbc24a222009-05-10 01:44:56 +010095int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card);
balroga171fe32007-04-30 01:48:07 +000096int pxa2xx_pcmcia_dettach(void *opaque);
97void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq);
98
balrog31b87f22007-12-16 12:13:51 +000099/* pxa2xx_keypad.c */
100struct keymap {
101 int column;
102 int row;
103};
Paul Brookbc24a222009-05-10 01:44:56 +0100104typedef struct PXA2xxKeyPadState PXA2xxKeyPadState;
Anthony Liguoric227f092009-10-01 16:12:16 -0500105PXA2xxKeyPadState *pxa27x_keypad_init(target_phys_addr_t base,
balrog31b87f22007-12-16 12:13:51 +0000106 qemu_irq irq);
Paul Brookbc24a222009-05-10 01:44:56 +0100107void pxa27x_register_keypad(PXA2xxKeyPadState *kp, struct keymap *map,
balrog31b87f22007-12-16 12:13:51 +0000108 int size);
109
balrogc1713132007-04-30 01:26:42 +0000110/* pxa2xx.c */
Paul Brookbc24a222009-05-10 01:44:56 +0100111typedef struct PXA2xxI2CState PXA2xxI2CState;
Anthony Liguoric227f092009-10-01 16:12:16 -0500112PXA2xxI2CState *pxa2xx_i2c_init(target_phys_addr_t base,
balrog2a163922007-05-28 11:26:15 +0000113 qemu_irq irq, uint32_t page_size);
Paul Brookbc24a222009-05-10 01:44:56 +0100114i2c_bus *pxa2xx_i2c_bus(PXA2xxI2CState *s);
balrog3f582262007-05-23 21:47:51 +0000115
Paul Brookbc24a222009-05-10 01:44:56 +0100116typedef struct PXA2xxI2SState PXA2xxI2SState;
117typedef struct PXA2xxFIrState PXA2xxFIrState;
balrogc1713132007-04-30 01:26:42 +0000118
Paul Brookbc24a222009-05-10 01:44:56 +0100119typedef struct {
balrogc1713132007-04-30 01:26:42 +0000120 CPUState *env;
Dmitry Eremin-Solenikove1f8c722011-02-25 12:13:38 +0100121 DeviceState *pic;
balrog38641a52007-11-17 14:07:13 +0000122 qemu_irq reset;
Andrzej Zaborowski2115c012011-03-03 15:04:51 +0100123 DeviceState *dma;
Dmitry Eremin-Solenikov0bb53332011-01-21 19:57:50 +0300124 DeviceState *gpio;
Paul Brookbc24a222009-05-10 01:44:56 +0100125 PXA2xxLCDState *lcd;
Paul Brooka984a692009-05-14 22:35:09 +0100126 SSIBus **ssp;
Paul Brookbc24a222009-05-10 01:44:56 +0100127 PXA2xxI2CState *i2c[2];
128 PXA2xxMMCIState *mmc;
129 PXA2xxPCMCIAState *pcmcia[2];
130 PXA2xxI2SState *i2s;
131 PXA2xxFIrState *fir;
132 PXA2xxKeyPadState *kp;
balrogc1713132007-04-30 01:26:42 +0000133
134 /* Power management */
Anthony Liguoric227f092009-10-01 16:12:16 -0500135 target_phys_addr_t pm_base;
balrogc1713132007-04-30 01:26:42 +0000136 uint32_t pm_regs[0x40];
137
138 /* Clock management */
Anthony Liguoric227f092009-10-01 16:12:16 -0500139 target_phys_addr_t cm_base;
balrogc1713132007-04-30 01:26:42 +0000140 uint32_t cm_regs[4];
141 uint32_t clkcfg;
142
143 /* Memory management */
Anthony Liguoric227f092009-10-01 16:12:16 -0500144 target_phys_addr_t mm_base;
balrogc1713132007-04-30 01:26:42 +0000145 uint32_t mm_regs[0x1a];
146
147 /* Performance monitoring */
148 uint32_t pmnc;
Paul Brookbc24a222009-05-10 01:44:56 +0100149} PXA2xxState;
balrogc1713132007-04-30 01:26:42 +0000150
Paul Brookbc24a222009-05-10 01:44:56 +0100151struct PXA2xxI2SState {
balrogc1713132007-04-30 01:26:42 +0000152 qemu_irq irq;
Andrzej Zaborowski2115c012011-03-03 15:04:51 +0100153 qemu_irq rx_dma;
154 qemu_irq tx_dma;
balrogc1713132007-04-30 01:26:42 +0000155 void (*data_req)(void *, int, int);
156
157 uint32_t control[2];
158 uint32_t status;
159 uint32_t mask;
160 uint32_t clk;
161
162 int enable;
163 int rx_len;
164 int tx_len;
165 void (*codec_out)(void *, uint32_t);
166 uint32_t (*codec_in)(void *);
167 void *opaque;
168
169 int fifo_len;
170 uint32_t fifo[16];
171};
172
173# define PA_FMT "0x%08lx"
bellard444ce242007-11-11 19:47:59 +0000174# define REG_FMT "0x" TARGET_FMT_plx
balrogc1713132007-04-30 01:26:42 +0000175
Paul Brookbc24a222009-05-10 01:44:56 +0100176PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision);
177PXA2xxState *pxa255_init(unsigned int sdram_size);
balrogc1713132007-04-30 01:26:42 +0000178
balrogc1713132007-04-30 01:26:42 +0000179#endif /* PXA_H */