blob: 025be34f86df27bd034383f293f28f168cc9e47e [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 *
Matthew Fernandez8e31bf32011-06-26 12:21:35 +10007 * This code is licensed under the GNU GPL v2.
balrogc1713132007-04-30 01:26:42 +00008 */
9#ifndef PXA_H
10# define PXA_H "pxa.h"
11
Richard Hendersona6dc4c22011-08-11 16:07:19 -070012#include "memory.h"
13
balrogc1713132007-04-30 01:26:42 +000014/* Interrupt numbers */
15# define PXA2XX_PIC_SSP3 0
16# define PXA2XX_PIC_USBH2 2
17# define PXA2XX_PIC_USBH1 3
balrog31b87f22007-12-16 12:13:51 +000018# define PXA2XX_PIC_KEYPAD 4
balrogc1713132007-04-30 01:26:42 +000019# define PXA2XX_PIC_PWRI2C 6
20# define PXA25X_PIC_HWUART 7
21# define PXA27X_PIC_OST_4_11 7
22# define PXA2XX_PIC_GPIO_0 8
23# define PXA2XX_PIC_GPIO_1 9
24# define PXA2XX_PIC_GPIO_X 10
25# define PXA2XX_PIC_I2S 13
26# define PXA26X_PIC_ASSP 15
27# define PXA25X_PIC_NSSP 16
28# define PXA27X_PIC_SSP2 16
29# define PXA2XX_PIC_LCD 17
30# define PXA2XX_PIC_I2C 18
31# define PXA2XX_PIC_ICP 19
32# define PXA2XX_PIC_STUART 20
33# define PXA2XX_PIC_BTUART 21
34# define PXA2XX_PIC_FFUART 22
35# define PXA2XX_PIC_MMC 23
36# define PXA2XX_PIC_SSP 24
37# define PXA2XX_PIC_DMA 25
38# define PXA2XX_PIC_OST_0 26
39# define PXA2XX_PIC_RTC1HZ 30
40# define PXA2XX_PIC_RTCALARM 31
41
42/* DMA requests */
43# define PXA2XX_RX_RQ_I2S 2
44# define PXA2XX_TX_RQ_I2S 3
45# define PXA2XX_RX_RQ_BTUART 4
46# define PXA2XX_TX_RQ_BTUART 5
47# define PXA2XX_RX_RQ_FFUART 6
48# define PXA2XX_TX_RQ_FFUART 7
49# define PXA2XX_RX_RQ_SSP1 13
50# define PXA2XX_TX_RQ_SSP1 14
51# define PXA2XX_RX_RQ_SSP2 15
52# define PXA2XX_TX_RQ_SSP2 16
53# define PXA2XX_RX_RQ_ICP 17
54# define PXA2XX_TX_RQ_ICP 18
55# define PXA2XX_RX_RQ_STUART 19
56# define PXA2XX_TX_RQ_STUART 20
57# define PXA2XX_RX_RQ_MMCI 21
58# define PXA2XX_TX_RQ_MMCI 22
59# define PXA2XX_USB_RQ(x) ((x) + 24)
60# define PXA2XX_RX_RQ_SSP3 66
61# define PXA2XX_TX_RQ_SSP3 67
62
balrogd95b2f82007-05-08 19:03:12 +000063# define PXA2XX_SDRAM_BASE 0xa0000000
64# define PXA2XX_INTERNAL_BASE 0x5c000000
balroga07dec22007-05-12 09:19:36 +000065# define PXA2XX_INTERNAL_SIZE 0x40000
balrogc1713132007-04-30 01:26:42 +000066
67/* pxa2xx_pic.c */
Andreas Färber5ae93302012-03-14 01:38:23 +010068DeviceState *pxa2xx_pic_init(target_phys_addr_t base, CPUARMState *env);
balrogc1713132007-04-30 01:26:42 +000069
70/* pxa2xx_gpio.c */
Dmitry Eremin-Solenikov0bb53332011-01-21 19:57:50 +030071DeviceState *pxa2xx_gpio_init(target_phys_addr_t base,
Andreas Färber5ae93302012-03-14 01:38:23 +010072 CPUARMState *env, DeviceState *pic, int lines);
Dmitry Eremin-Solenikov0bb53332011-01-21 19:57:50 +030073void pxa2xx_gpio_read_notifier(DeviceState *dev, qemu_irq handler);
balrogc1713132007-04-30 01:26:42 +000074
75/* pxa2xx_dma.c */
Andrzej Zaborowski2115c012011-03-03 15:04:51 +010076DeviceState *pxa255_dma_init(target_phys_addr_t base, qemu_irq irq);
77DeviceState *pxa27x_dma_init(target_phys_addr_t base, qemu_irq irq);
balrogc1713132007-04-30 01:26:42 +000078
balroga171fe32007-04-30 01:48:07 +000079/* pxa2xx_lcd.c */
Paul Brookbc24a222009-05-10 01:44:56 +010080typedef struct PXA2xxLCDState PXA2xxLCDState;
Benoît Canet5a6fdd92011-10-30 14:50:19 +010081PXA2xxLCDState *pxa2xx_lcdc_init(MemoryRegion *sysmem,
82 target_phys_addr_t base, qemu_irq irq);
Paul Brookbc24a222009-05-10 01:44:56 +010083void pxa2xx_lcd_vsync_notifier(PXA2xxLCDState *s, qemu_irq handler);
balroga171fe32007-04-30 01:48:07 +000084void pxa2xx_lcdc_oritentation(void *opaque, int angle);
85
86/* pxa2xx_mmci.c */
Paul Brookbc24a222009-05-10 01:44:56 +010087typedef struct PXA2xxMMCIState PXA2xxMMCIState;
Benoît Canet2bf90452011-10-30 14:50:18 +010088PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem,
89 target_phys_addr_t base,
Andrzej Zaborowski2115c012011-03-03 15:04:51 +010090 BlockDriverState *bd, qemu_irq irq,
91 qemu_irq rx_dma, qemu_irq tx_dma);
Paul Brookbc24a222009-05-10 01:44:56 +010092void pxa2xx_mmci_handlers(PXA2xxMMCIState *s, qemu_irq readonly,
balrog02ce6002007-11-17 14:34:44 +000093 qemu_irq coverswitch);
balroga171fe32007-04-30 01:48:07 +000094
95/* pxa2xx_pcmcia.c */
Paul Brookbc24a222009-05-10 01:44:56 +010096typedef struct PXA2xxPCMCIAState PXA2xxPCMCIAState;
Benoît Canet354a8c02011-10-30 14:50:12 +010097PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem,
98 target_phys_addr_t base);
Paul Brookbc24a222009-05-10 01:44:56 +010099int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card);
balroga171fe32007-04-30 01:48:07 +0000100int pxa2xx_pcmcia_dettach(void *opaque);
101void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq);
102
balrog31b87f22007-12-16 12:13:51 +0000103/* pxa2xx_keypad.c */
104struct keymap {
105 int column;
106 int row;
107};
Paul Brookbc24a222009-05-10 01:44:56 +0100108typedef struct PXA2xxKeyPadState PXA2xxKeyPadState;
Benoît Canet6cd816b2011-10-30 14:50:15 +0100109PXA2xxKeyPadState *pxa27x_keypad_init(MemoryRegion *sysmem,
110 target_phys_addr_t base,
111 qemu_irq irq);
Paul Brookbc24a222009-05-10 01:44:56 +0100112void pxa27x_register_keypad(PXA2xxKeyPadState *kp, struct keymap *map,
balrog31b87f22007-12-16 12:13:51 +0000113 int size);
114
balrogc1713132007-04-30 01:26:42 +0000115/* pxa2xx.c */
Paul Brookbc24a222009-05-10 01:44:56 +0100116typedef struct PXA2xxI2CState PXA2xxI2CState;
Anthony Liguoric227f092009-10-01 16:12:16 -0500117PXA2xxI2CState *pxa2xx_i2c_init(target_phys_addr_t base,
balrog2a163922007-05-28 11:26:15 +0000118 qemu_irq irq, uint32_t page_size);
Paul Brookbc24a222009-05-10 01:44:56 +0100119i2c_bus *pxa2xx_i2c_bus(PXA2xxI2CState *s);
balrog3f582262007-05-23 21:47:51 +0000120
Paul Brookbc24a222009-05-10 01:44:56 +0100121typedef struct PXA2xxI2SState PXA2xxI2SState;
122typedef struct PXA2xxFIrState PXA2xxFIrState;
balrogc1713132007-04-30 01:26:42 +0000123
Paul Brookbc24a222009-05-10 01:44:56 +0100124typedef struct {
Andreas Färber5ae93302012-03-14 01:38:23 +0100125 CPUARMState *env;
Dmitry Eremin-Solenikove1f8c722011-02-25 12:13:38 +0100126 DeviceState *pic;
balrog38641a52007-11-17 14:07:13 +0000127 qemu_irq reset;
Avi Kivityadfc39e2011-09-25 18:19:19 +0300128 MemoryRegion sdram;
129 MemoryRegion internal;
130 MemoryRegion cm_iomem;
131 MemoryRegion mm_iomem;
132 MemoryRegion pm_iomem;
Andrzej Zaborowski2115c012011-03-03 15:04:51 +0100133 DeviceState *dma;
Dmitry Eremin-Solenikov0bb53332011-01-21 19:57:50 +0300134 DeviceState *gpio;
Paul Brookbc24a222009-05-10 01:44:56 +0100135 PXA2xxLCDState *lcd;
Paul Brooka984a692009-05-14 22:35:09 +0100136 SSIBus **ssp;
Paul Brookbc24a222009-05-10 01:44:56 +0100137 PXA2xxI2CState *i2c[2];
138 PXA2xxMMCIState *mmc;
139 PXA2xxPCMCIAState *pcmcia[2];
140 PXA2xxI2SState *i2s;
141 PXA2xxFIrState *fir;
142 PXA2xxKeyPadState *kp;
balrogc1713132007-04-30 01:26:42 +0000143
144 /* Power management */
Anthony Liguoric227f092009-10-01 16:12:16 -0500145 target_phys_addr_t pm_base;
balrogc1713132007-04-30 01:26:42 +0000146 uint32_t pm_regs[0x40];
147
148 /* Clock management */
Anthony Liguoric227f092009-10-01 16:12:16 -0500149 target_phys_addr_t cm_base;
balrogc1713132007-04-30 01:26:42 +0000150 uint32_t cm_regs[4];
151 uint32_t clkcfg;
152
153 /* Memory management */
Anthony Liguoric227f092009-10-01 16:12:16 -0500154 target_phys_addr_t mm_base;
balrogc1713132007-04-30 01:26:42 +0000155 uint32_t mm_regs[0x1a];
156
157 /* Performance monitoring */
158 uint32_t pmnc;
Paul Brookbc24a222009-05-10 01:44:56 +0100159} PXA2xxState;
balrogc1713132007-04-30 01:26:42 +0000160
Paul Brookbc24a222009-05-10 01:44:56 +0100161struct PXA2xxI2SState {
Avi Kivity9c843932011-09-25 18:19:19 +0300162 MemoryRegion iomem;
balrogc1713132007-04-30 01:26:42 +0000163 qemu_irq irq;
Andrzej Zaborowski2115c012011-03-03 15:04:51 +0100164 qemu_irq rx_dma;
165 qemu_irq tx_dma;
balrogc1713132007-04-30 01:26:42 +0000166 void (*data_req)(void *, int, int);
167
168 uint32_t control[2];
169 uint32_t status;
170 uint32_t mask;
171 uint32_t clk;
172
173 int enable;
174 int rx_len;
175 int tx_len;
176 void (*codec_out)(void *, uint32_t);
177 uint32_t (*codec_in)(void *);
178 void *opaque;
179
180 int fifo_len;
181 uint32_t fifo[16];
182};
183
184# define PA_FMT "0x%08lx"
bellard444ce242007-11-11 19:47:59 +0000185# define REG_FMT "0x" TARGET_FMT_plx
balrogc1713132007-04-30 01:26:42 +0000186
Richard Hendersona6dc4c22011-08-11 16:07:19 -0700187PXA2xxState *pxa270_init(MemoryRegion *address_space, unsigned int sdram_size,
188 const char *revision);
189PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size);
balrogc1713132007-04-30 01:26:42 +0000190
balrogc1713132007-04-30 01:26:42 +0000191#endif /* PXA_H */