Statistics
| Branch: | Revision:

root / hw / omap.h @ 463ce4ae

History | View | Annotate | Download (34.6 kB)

1 c3d2689d balrog
/*
2 c3d2689d balrog
 * Texas Instruments OMAP processors.
3 c3d2689d balrog
 *
4 b4e3104b balrog
 * Copyright (C) 2006-2008 Andrzej Zaborowski  <balrog@zabor.org>
5 c3d2689d balrog
 *
6 c3d2689d balrog
 * This program is free software; you can redistribute it and/or
7 c3d2689d balrog
 * modify it under the terms of the GNU General Public License as
8 827df9f3 balrog
 * published by the Free Software Foundation; either version 2 or
9 827df9f3 balrog
 * (at your option) version 3 of the License.
10 c3d2689d balrog
 *
11 c3d2689d balrog
 * This program is distributed in the hope that it will be useful,
12 c3d2689d balrog
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 c3d2689d balrog
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 c3d2689d balrog
 * GNU General Public License for more details.
15 c3d2689d balrog
 *
16 fad6cb1a aurel32
 * You should have received a copy of the GNU General Public License along
17 8167ee88 Blue Swirl
 * with this program; if not, see <http://www.gnu.org/licenses/>.
18 c3d2689d balrog
 */
19 c3d2689d balrog
#ifndef hw_omap_h
20 64066a8f Avi Kivity
#include "memory.h"
21 c3d2689d balrog
# define hw_omap_h                "omap.h"
22 c3d2689d balrog
23 c3d2689d balrog
# define OMAP_EMIFS_BASE        0x00000000
24 827df9f3 balrog
# define OMAP2_Q0_BASE                0x00000000
25 c3d2689d balrog
# define OMAP_CS0_BASE                0x00000000
26 c3d2689d balrog
# define OMAP_CS1_BASE                0x04000000
27 c3d2689d balrog
# define OMAP_CS2_BASE                0x08000000
28 c3d2689d balrog
# define OMAP_CS3_BASE                0x0c000000
29 c3d2689d balrog
# define OMAP_EMIFF_BASE        0x10000000
30 c3d2689d balrog
# define OMAP_IMIF_BASE                0x20000000
31 c3d2689d balrog
# define OMAP_LOCALBUS_BASE        0x30000000
32 827df9f3 balrog
# define OMAP2_Q1_BASE                0x40000000
33 827df9f3 balrog
# define OMAP2_L4_BASE                0x48000000
34 827df9f3 balrog
# define OMAP2_SRAM_BASE        0x40200000
35 827df9f3 balrog
# define OMAP2_L3_BASE                0x68000000
36 827df9f3 balrog
# define OMAP2_Q2_BASE                0x80000000
37 827df9f3 balrog
# define OMAP2_Q3_BASE                0xc0000000
38 c3d2689d balrog
# define OMAP_MPUI_BASE                0xe1000000
39 c3d2689d balrog
40 c3d2689d balrog
# define OMAP730_SRAM_SIZE        0x00032000
41 c3d2689d balrog
# define OMAP15XX_SRAM_SIZE        0x00030000
42 c3d2689d balrog
# define OMAP16XX_SRAM_SIZE        0x00004000
43 c3d2689d balrog
# define OMAP1611_SRAM_SIZE        0x0003e800
44 827df9f3 balrog
# define OMAP242X_SRAM_SIZE        0x000a0000
45 827df9f3 balrog
# define OMAP243X_SRAM_SIZE        0x00010000
46 c3d2689d balrog
# define OMAP_CS0_SIZE                0x04000000
47 c3d2689d balrog
# define OMAP_CS1_SIZE                0x04000000
48 c3d2689d balrog
# define OMAP_CS2_SIZE                0x04000000
49 c3d2689d balrog
# define OMAP_CS3_SIZE                0x04000000
50 c3d2689d balrog
51 827df9f3 balrog
/* omap_clk.c */
52 c3d2689d balrog
struct omap_mpu_state_s;
53 c3d2689d balrog
typedef struct clk *omap_clk;
54 c3d2689d balrog
omap_clk omap_findclk(struct omap_mpu_state_s *mpu, const char *name);
55 c3d2689d balrog
void omap_clk_init(struct omap_mpu_state_s *mpu);
56 c3d2689d balrog
void omap_clk_adduser(struct clk *clk, qemu_irq user);
57 c3d2689d balrog
void omap_clk_get(omap_clk clk);
58 c3d2689d balrog
void omap_clk_put(omap_clk clk);
59 c3d2689d balrog
void omap_clk_onoff(omap_clk clk, int on);
60 c3d2689d balrog
void omap_clk_canidle(omap_clk clk, int can);
61 c3d2689d balrog
void omap_clk_setrate(omap_clk clk, int divide, int multiply);
62 c3d2689d balrog
int64_t omap_clk_getrate(omap_clk clk);
63 c3d2689d balrog
void omap_clk_reparent(omap_clk clk, omap_clk parent);
64 c3d2689d balrog
65 2c1d9ecb cmchao
/* OMAP2 l4 Interconnect */
66 827df9f3 balrog
struct omap_l4_s;
67 2c1d9ecb cmchao
struct omap_l4_region_s {
68 2c1d9ecb cmchao
    target_phys_addr_t offset;
69 2c1d9ecb cmchao
    size_t size;
70 2c1d9ecb cmchao
    int access;
71 2c1d9ecb cmchao
};
72 2c1d9ecb cmchao
struct omap_l4_agent_info_s {
73 2c1d9ecb cmchao
    int ta;
74 2c1d9ecb cmchao
    int region;
75 2c1d9ecb cmchao
    int regions;
76 2c1d9ecb cmchao
    int ta_region;
77 2c1d9ecb cmchao
};
78 2c1d9ecb cmchao
struct omap_target_agent_s {
79 2c1d9ecb cmchao
    struct omap_l4_s *bus;
80 2c1d9ecb cmchao
    int regions;
81 2c1d9ecb cmchao
    const struct omap_l4_region_s *start;
82 2c1d9ecb cmchao
    target_phys_addr_t base;
83 2c1d9ecb cmchao
    uint32_t component;
84 2c1d9ecb cmchao
    uint32_t control;
85 2c1d9ecb cmchao
    uint32_t status;
86 2c1d9ecb cmchao
};
87 c227f099 Anthony Liguori
struct omap_l4_s *omap_l4_init(target_phys_addr_t base, int ta_num);
88 827df9f3 balrog
89 827df9f3 balrog
struct omap_target_agent_s;
90 2c1d9ecb cmchao
struct omap_target_agent_s *omap_l4ta_get(
91 2c1d9ecb cmchao
    struct omap_l4_s *bus,
92 2c1d9ecb cmchao
    const struct omap_l4_region_s *regions,
93 2c1d9ecb cmchao
    const struct omap_l4_agent_info_s *agents,
94 2c1d9ecb cmchao
    int cs);
95 c227f099 Anthony Liguori
target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
96 827df9f3 balrog
                int iotype);
97 f9049203 Juha Riihimäki
target_phys_addr_t omap_l4_region_base(struct omap_target_agent_s *ta,
98 f9049203 Juha Riihimäki
                                       int region);
99 2c1d9ecb cmchao
int l4_register_io_memory(CPUReadMemoryFunc * const *mem_read,
100 2c1d9ecb cmchao
                CPUWriteMemoryFunc * const *mem_write, void *opaque);
101 827df9f3 balrog
102 0bf43016 cmchao
/* OMAP2 SDRAM controller */
103 827df9f3 balrog
struct omap_sdrc_s;
104 c227f099 Anthony Liguori
struct omap_sdrc_s *omap_sdrc_init(target_phys_addr_t base);
105 0bf43016 cmchao
void omap_sdrc_reset(struct omap_sdrc_s *s);
106 827df9f3 balrog
107 f3354b0e cmchao
/* OMAP2 general purpose memory controller */
108 827df9f3 balrog
struct omap_gpmc_s;
109 b5325c27 Juha Riihimäki
struct omap_gpmc_s *omap_gpmc_init(struct omap_mpu_state_s *mpu,
110 eee0a1c6 Peter Maydell
                                   target_phys_addr_t base,
111 eee0a1c6 Peter Maydell
                                   qemu_irq irq, qemu_irq drq);
112 f3354b0e cmchao
void omap_gpmc_reset(struct omap_gpmc_s *s);
113 07bc2f80 Peter Maydell
void omap_gpmc_attach(struct omap_gpmc_s *s, int cs, MemoryRegion *iomem);
114 2a952feb Peter Maydell
void omap_gpmc_attach_nand(struct omap_gpmc_s *s, int cs, DeviceState *nand);
115 29885477 balrog
116 c3d2689d balrog
/*
117 c3d2689d balrog
 * Common IRQ numbers for level 1 interrupt handler
118 c3d2689d balrog
 * See /usr/include/asm-arm/arch-omap/irqs.h in Linux.
119 c3d2689d balrog
 */
120 c3d2689d balrog
# define OMAP_INT_CAMERA                1
121 c3d2689d balrog
# define OMAP_INT_FIQ                        3
122 c3d2689d balrog
# define OMAP_INT_RTDX                        6
123 c3d2689d balrog
# define OMAP_INT_DSP_MMU_ABORT                7
124 c3d2689d balrog
# define OMAP_INT_HOST                        8
125 c3d2689d balrog
# define OMAP_INT_ABORT                        9
126 c3d2689d balrog
# define OMAP_INT_BRIDGE_PRIV                13
127 c3d2689d balrog
# define OMAP_INT_GPIO_BANK1                14
128 c3d2689d balrog
# define OMAP_INT_UART3                        15
129 c3d2689d balrog
# define OMAP_INT_TIMER3                16
130 c3d2689d balrog
# define OMAP_INT_DMA_CH0_6                19
131 c3d2689d balrog
# define OMAP_INT_DMA_CH1_7                20
132 c3d2689d balrog
# define OMAP_INT_DMA_CH2_8                21
133 c3d2689d balrog
# define OMAP_INT_DMA_CH3                22
134 c3d2689d balrog
# define OMAP_INT_DMA_CH4                23
135 c3d2689d balrog
# define OMAP_INT_DMA_CH5                24
136 c3d2689d balrog
# define OMAP_INT_DMA_LCD                25
137 c3d2689d balrog
# define OMAP_INT_TIMER1                26
138 c3d2689d balrog
# define OMAP_INT_WD_TIMER                27
139 c3d2689d balrog
# define OMAP_INT_BRIDGE_PUB                28
140 c3d2689d balrog
# define OMAP_INT_TIMER2                30
141 c3d2689d balrog
# define OMAP_INT_LCD_CTRL                31
142 c3d2689d balrog
143 c3d2689d balrog
/*
144 c3d2689d balrog
 * Common OMAP-15xx IRQ numbers for level 1 interrupt handler
145 c3d2689d balrog
 */
146 c3d2689d balrog
# define OMAP_INT_15XX_IH2_IRQ                0
147 c3d2689d balrog
# define OMAP_INT_15XX_LB_MMU                17
148 c3d2689d balrog
# define OMAP_INT_15XX_LOCAL_BUS        29
149 c3d2689d balrog
150 c3d2689d balrog
/*
151 c3d2689d balrog
 * OMAP-1510 specific IRQ numbers for level 1 interrupt handler
152 c3d2689d balrog
 */
153 c3d2689d balrog
# define OMAP_INT_1510_SPI_TX                4
154 c3d2689d balrog
# define OMAP_INT_1510_SPI_RX                5
155 c3d2689d balrog
# define OMAP_INT_1510_DSP_MAILBOX1        10
156 c3d2689d balrog
# define OMAP_INT_1510_DSP_MAILBOX2        11
157 c3d2689d balrog
158 c3d2689d balrog
/*
159 c3d2689d balrog
 * OMAP-310 specific IRQ numbers for level 1 interrupt handler
160 c3d2689d balrog
 */
161 c3d2689d balrog
# define OMAP_INT_310_McBSP2_TX                4
162 c3d2689d balrog
# define OMAP_INT_310_McBSP2_RX                5
163 c3d2689d balrog
# define OMAP_INT_310_HSB_MAILBOX1        12
164 c3d2689d balrog
# define OMAP_INT_310_HSAB_MMU                18
165 c3d2689d balrog
166 c3d2689d balrog
/*
167 c3d2689d balrog
 * OMAP-1610 specific IRQ numbers for level 1 interrupt handler
168 c3d2689d balrog
 */
169 c3d2689d balrog
# define OMAP_INT_1610_IH2_IRQ                0
170 c3d2689d balrog
# define OMAP_INT_1610_IH2_FIQ                2
171 c3d2689d balrog
# define OMAP_INT_1610_McBSP2_TX        4
172 c3d2689d balrog
# define OMAP_INT_1610_McBSP2_RX        5
173 c3d2689d balrog
# define OMAP_INT_1610_DSP_MAILBOX1        10
174 c3d2689d balrog
# define OMAP_INT_1610_DSP_MAILBOX2        11
175 c3d2689d balrog
# define OMAP_INT_1610_LCD_LINE                12
176 c3d2689d balrog
# define OMAP_INT_1610_GPTIMER1                17
177 c3d2689d balrog
# define OMAP_INT_1610_GPTIMER2                18
178 c3d2689d balrog
# define OMAP_INT_1610_SSR_FIFO_0        29
179 c3d2689d balrog
180 c3d2689d balrog
/*
181 c3d2689d balrog
 * OMAP-730 specific IRQ numbers for level 1 interrupt handler
182 c3d2689d balrog
 */
183 c3d2689d balrog
# define OMAP_INT_730_IH2_FIQ                0
184 c3d2689d balrog
# define OMAP_INT_730_IH2_IRQ                1
185 c3d2689d balrog
# define OMAP_INT_730_USB_NON_ISO        2
186 c3d2689d balrog
# define OMAP_INT_730_USB_ISO                3
187 c3d2689d balrog
# define OMAP_INT_730_ICR                4
188 c3d2689d balrog
# define OMAP_INT_730_EAC                5
189 c3d2689d balrog
# define OMAP_INT_730_GPIO_BANK1        6
190 c3d2689d balrog
# define OMAP_INT_730_GPIO_BANK2        7
191 c3d2689d balrog
# define OMAP_INT_730_GPIO_BANK3        8
192 c3d2689d balrog
# define OMAP_INT_730_McBSP2TX                10
193 c3d2689d balrog
# define OMAP_INT_730_McBSP2RX                11
194 c3d2689d balrog
# define OMAP_INT_730_McBSP2RX_OVF        12
195 c3d2689d balrog
# define OMAP_INT_730_LCD_LINE                14
196 c3d2689d balrog
# define OMAP_INT_730_GSM_PROTECT        15
197 c3d2689d balrog
# define OMAP_INT_730_TIMER3                16
198 c3d2689d balrog
# define OMAP_INT_730_GPIO_BANK5        17
199 c3d2689d balrog
# define OMAP_INT_730_GPIO_BANK6        18
200 c3d2689d balrog
# define OMAP_INT_730_SPGIO_WR                29
201 c3d2689d balrog
202 c3d2689d balrog
/*
203 c3d2689d balrog
 * Common IRQ numbers for level 2 interrupt handler
204 c3d2689d balrog
 */
205 c3d2689d balrog
# define OMAP_INT_KEYBOARD                1
206 c3d2689d balrog
# define OMAP_INT_uWireTX                2
207 c3d2689d balrog
# define OMAP_INT_uWireRX                3
208 c3d2689d balrog
# define OMAP_INT_I2C                        4
209 c3d2689d balrog
# define OMAP_INT_MPUIO                        5
210 c3d2689d balrog
# define OMAP_INT_USB_HHC_1                6
211 c3d2689d balrog
# define OMAP_INT_McBSP3TX                10
212 c3d2689d balrog
# define OMAP_INT_McBSP3RX                11
213 c3d2689d balrog
# define OMAP_INT_McBSP1TX                12
214 c3d2689d balrog
# define OMAP_INT_McBSP1RX                13
215 c3d2689d balrog
# define OMAP_INT_UART1                        14
216 c3d2689d balrog
# define OMAP_INT_UART2                        15
217 c3d2689d balrog
# define OMAP_INT_USB_W2FC                20
218 c3d2689d balrog
# define OMAP_INT_1WIRE                        21
219 c3d2689d balrog
# define OMAP_INT_OS_TIMER                22
220 b30bb3a2 balrog
# define OMAP_INT_OQN                        23
221 c3d2689d balrog
# define OMAP_INT_GAUGE_32K                24
222 c3d2689d balrog
# define OMAP_INT_RTC_TIMER                25
223 c3d2689d balrog
# define OMAP_INT_RTC_ALARM                26
224 c3d2689d balrog
# define OMAP_INT_DSP_MMU                28
225 c3d2689d balrog
226 c3d2689d balrog
/*
227 c3d2689d balrog
 * OMAP-1510 specific IRQ numbers for level 2 interrupt handler
228 c3d2689d balrog
 */
229 c3d2689d balrog
# define OMAP_INT_1510_BT_MCSI1TX        16
230 c3d2689d balrog
# define OMAP_INT_1510_BT_MCSI1RX        17
231 c3d2689d balrog
# define OMAP_INT_1510_SoSSI_MATCH        19
232 c3d2689d balrog
# define OMAP_INT_1510_MEM_STICK        27
233 c3d2689d balrog
# define OMAP_INT_1510_COM_SPI_RO        31
234 c3d2689d balrog
235 c3d2689d balrog
/*
236 c3d2689d balrog
 * OMAP-310 specific IRQ numbers for level 2 interrupt handler
237 c3d2689d balrog
 */
238 c3d2689d balrog
# define OMAP_INT_310_FAC                0
239 c3d2689d balrog
# define OMAP_INT_310_USB_HHC_2                7
240 c3d2689d balrog
# define OMAP_INT_310_MCSI1_FE                16
241 c3d2689d balrog
# define OMAP_INT_310_MCSI2_FE                17
242 c3d2689d balrog
# define OMAP_INT_310_USB_W2FC_ISO        29
243 c3d2689d balrog
# define OMAP_INT_310_USB_W2FC_NON_ISO        30
244 c3d2689d balrog
# define OMAP_INT_310_McBSP2RX_OF        31
245 c3d2689d balrog
246 c3d2689d balrog
/*
247 c3d2689d balrog
 * OMAP-1610 specific IRQ numbers for level 2 interrupt handler
248 c3d2689d balrog
 */
249 c3d2689d balrog
# define OMAP_INT_1610_FAC                0
250 c3d2689d balrog
# define OMAP_INT_1610_USB_HHC_2        7
251 c3d2689d balrog
# define OMAP_INT_1610_USB_OTG                8
252 c3d2689d balrog
# define OMAP_INT_1610_SoSSI                9
253 c3d2689d balrog
# define OMAP_INT_1610_BT_MCSI1TX        16
254 c3d2689d balrog
# define OMAP_INT_1610_BT_MCSI1RX        17
255 c3d2689d balrog
# define OMAP_INT_1610_SoSSI_MATCH        19
256 c3d2689d balrog
# define OMAP_INT_1610_MEM_STICK        27
257 c3d2689d balrog
# define OMAP_INT_1610_McBSP2RX_OF        31
258 c3d2689d balrog
# define OMAP_INT_1610_STI                32
259 c3d2689d balrog
# define OMAP_INT_1610_STI_WAKEUP        33
260 c3d2689d balrog
# define OMAP_INT_1610_GPTIMER3                34
261 c3d2689d balrog
# define OMAP_INT_1610_GPTIMER4                35
262 c3d2689d balrog
# define OMAP_INT_1610_GPTIMER5                36
263 c3d2689d balrog
# define OMAP_INT_1610_GPTIMER6                37
264 c3d2689d balrog
# define OMAP_INT_1610_GPTIMER7                38
265 c3d2689d balrog
# define OMAP_INT_1610_GPTIMER8                39
266 c3d2689d balrog
# define OMAP_INT_1610_GPIO_BANK2        40
267 c3d2689d balrog
# define OMAP_INT_1610_GPIO_BANK3        41
268 c3d2689d balrog
# define OMAP_INT_1610_MMC2                42
269 c3d2689d balrog
# define OMAP_INT_1610_CF                43
270 c3d2689d balrog
# define OMAP_INT_1610_WAKE_UP_REQ        46
271 c3d2689d balrog
# define OMAP_INT_1610_GPIO_BANK4        48
272 c3d2689d balrog
# define OMAP_INT_1610_SPI                49
273 c3d2689d balrog
# define OMAP_INT_1610_DMA_CH6                53
274 c3d2689d balrog
# define OMAP_INT_1610_DMA_CH7                54
275 c3d2689d balrog
# define OMAP_INT_1610_DMA_CH8                55
276 c3d2689d balrog
# define OMAP_INT_1610_DMA_CH9                56
277 c3d2689d balrog
# define OMAP_INT_1610_DMA_CH10                57
278 c3d2689d balrog
# define OMAP_INT_1610_DMA_CH11                58
279 c3d2689d balrog
# define OMAP_INT_1610_DMA_CH12                59
280 c3d2689d balrog
# define OMAP_INT_1610_DMA_CH13                60
281 c3d2689d balrog
# define OMAP_INT_1610_DMA_CH14                61
282 c3d2689d balrog
# define OMAP_INT_1610_DMA_CH15                62
283 c3d2689d balrog
# define OMAP_INT_1610_NAND                63
284 c3d2689d balrog
285 c3d2689d balrog
/*
286 c3d2689d balrog
 * OMAP-730 specific IRQ numbers for level 2 interrupt handler
287 c3d2689d balrog
 */
288 c3d2689d balrog
# define OMAP_INT_730_HW_ERRORS                0
289 c3d2689d balrog
# define OMAP_INT_730_NFIQ_PWR_FAIL        1
290 c3d2689d balrog
# define OMAP_INT_730_CFCD                2
291 c3d2689d balrog
# define OMAP_INT_730_CFIREQ                3
292 c3d2689d balrog
# define OMAP_INT_730_I2C                4
293 c3d2689d balrog
# define OMAP_INT_730_PCC                5
294 c3d2689d balrog
# define OMAP_INT_730_MPU_EXT_NIRQ        6
295 c3d2689d balrog
# define OMAP_INT_730_SPI_100K_1        7
296 c3d2689d balrog
# define OMAP_INT_730_SYREN_SPI                8
297 c3d2689d balrog
# define OMAP_INT_730_VLYNQ                9
298 c3d2689d balrog
# define OMAP_INT_730_GPIO_BANK4        10
299 c3d2689d balrog
# define OMAP_INT_730_McBSP1TX                11
300 c3d2689d balrog
# define OMAP_INT_730_McBSP1RX                12
301 c3d2689d balrog
# define OMAP_INT_730_McBSP1RX_OF        13
302 c3d2689d balrog
# define OMAP_INT_730_UART_MODEM_IRDA_2        14
303 c3d2689d balrog
# define OMAP_INT_730_UART_MODEM_1        15
304 c3d2689d balrog
# define OMAP_INT_730_MCSI                16
305 c3d2689d balrog
# define OMAP_INT_730_uWireTX                17
306 c3d2689d balrog
# define OMAP_INT_730_uWireRX                18
307 c3d2689d balrog
# define OMAP_INT_730_SMC_CD                19
308 c3d2689d balrog
# define OMAP_INT_730_SMC_IREQ                20
309 c3d2689d balrog
# define OMAP_INT_730_HDQ_1WIRE                21
310 c3d2689d balrog
# define OMAP_INT_730_TIMER32K                22
311 c3d2689d balrog
# define OMAP_INT_730_MMC_SDIO                23
312 c3d2689d balrog
# define OMAP_INT_730_UPLD                24
313 c3d2689d balrog
# define OMAP_INT_730_USB_HHC_1                27
314 c3d2689d balrog
# define OMAP_INT_730_USB_HHC_2                28
315 c3d2689d balrog
# define OMAP_INT_730_USB_GENI                29
316 c3d2689d balrog
# define OMAP_INT_730_USB_OTG                30
317 c3d2689d balrog
# define OMAP_INT_730_CAMERA_IF                31
318 c3d2689d balrog
# define OMAP_INT_730_RNG                32
319 c3d2689d balrog
# define OMAP_INT_730_DUAL_MODE_TIMER        33
320 c3d2689d balrog
# define OMAP_INT_730_DBB_RF_EN                34
321 c3d2689d balrog
# define OMAP_INT_730_MPUIO_KEYPAD        35
322 c3d2689d balrog
# define OMAP_INT_730_SHA1_MD5                36
323 c3d2689d balrog
# define OMAP_INT_730_SPI_100K_2        37
324 c3d2689d balrog
# define OMAP_INT_730_RNG_IDLE                38
325 c3d2689d balrog
# define OMAP_INT_730_MPUIO                39
326 c3d2689d balrog
# define OMAP_INT_730_LLPC_LCD_CTRL_OFF        40
327 c3d2689d balrog
# define OMAP_INT_730_LLPC_OE_FALLING        41
328 c3d2689d balrog
# define OMAP_INT_730_LLPC_OE_RISING        42
329 c3d2689d balrog
# define OMAP_INT_730_LLPC_VSYNC        43
330 c3d2689d balrog
# define OMAP_INT_730_WAKE_UP_REQ        46
331 c3d2689d balrog
# define OMAP_INT_730_DMA_CH6                53
332 c3d2689d balrog
# define OMAP_INT_730_DMA_CH7                54
333 c3d2689d balrog
# define OMAP_INT_730_DMA_CH8                55
334 c3d2689d balrog
# define OMAP_INT_730_DMA_CH9                56
335 c3d2689d balrog
# define OMAP_INT_730_DMA_CH10                57
336 c3d2689d balrog
# define OMAP_INT_730_DMA_CH11                58
337 c3d2689d balrog
# define OMAP_INT_730_DMA_CH12                59
338 c3d2689d balrog
# define OMAP_INT_730_DMA_CH13                60
339 c3d2689d balrog
# define OMAP_INT_730_DMA_CH14                61
340 c3d2689d balrog
# define OMAP_INT_730_DMA_CH15                62
341 c3d2689d balrog
# define OMAP_INT_730_NAND                63
342 c3d2689d balrog
343 c3d2689d balrog
/*
344 c3d2689d balrog
 * OMAP-24xx common IRQ numbers
345 c3d2689d balrog
 */
346 54585ffe balrog
# define OMAP_INT_24XX_STI                4
347 c3d2689d balrog
# define OMAP_INT_24XX_SYS_NIRQ                7
348 827df9f3 balrog
# define OMAP_INT_24XX_L3_IRQ                10
349 827df9f3 balrog
# define OMAP_INT_24XX_PRCM_MPU_IRQ        11
350 c3d2689d balrog
# define OMAP_INT_24XX_SDMA_IRQ0        12
351 c3d2689d balrog
# define OMAP_INT_24XX_SDMA_IRQ1        13
352 c3d2689d balrog
# define OMAP_INT_24XX_SDMA_IRQ2        14
353 c3d2689d balrog
# define OMAP_INT_24XX_SDMA_IRQ3        15
354 827df9f3 balrog
# define OMAP_INT_243X_MCBSP2_IRQ        16
355 827df9f3 balrog
# define OMAP_INT_243X_MCBSP3_IRQ        17
356 827df9f3 balrog
# define OMAP_INT_243X_MCBSP4_IRQ        18
357 827df9f3 balrog
# define OMAP_INT_243X_MCBSP5_IRQ        19
358 827df9f3 balrog
# define OMAP_INT_24XX_GPMC_IRQ                20
359 827df9f3 balrog
# define OMAP_INT_24XX_GUFFAW_IRQ        21
360 827df9f3 balrog
# define OMAP_INT_24XX_IVA_IRQ                22
361 827df9f3 balrog
# define OMAP_INT_24XX_EAC_IRQ                23
362 c3d2689d balrog
# define OMAP_INT_24XX_CAM_IRQ                24
363 c3d2689d balrog
# define OMAP_INT_24XX_DSS_IRQ                25
364 c3d2689d balrog
# define OMAP_INT_24XX_MAIL_U0_MPU        26
365 c3d2689d balrog
# define OMAP_INT_24XX_DSP_UMA                27
366 c3d2689d balrog
# define OMAP_INT_24XX_DSP_MMU                28
367 c3d2689d balrog
# define OMAP_INT_24XX_GPIO_BANK1        29
368 c3d2689d balrog
# define OMAP_INT_24XX_GPIO_BANK2        30
369 c3d2689d balrog
# define OMAP_INT_24XX_GPIO_BANK3        31
370 c3d2689d balrog
# define OMAP_INT_24XX_GPIO_BANK4        32
371 827df9f3 balrog
# define OMAP_INT_243X_GPIO_BANK5        33
372 c3d2689d balrog
# define OMAP_INT_24XX_MAIL_U3_MPU        34
373 827df9f3 balrog
# define OMAP_INT_24XX_WDT3                35
374 827df9f3 balrog
# define OMAP_INT_24XX_WDT4                36
375 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER1                37
376 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER2                38
377 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER3                39
378 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER4                40
379 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER5                41
380 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER6                42
381 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER7                43
382 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER8                44
383 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER9                45
384 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER10        46
385 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER11        47
386 c3d2689d balrog
# define OMAP_INT_24XX_GPTIMER12        48
387 827df9f3 balrog
# define OMAP_INT_24XX_PKA_IRQ                50
388 827df9f3 balrog
# define OMAP_INT_24XX_SHA1MD5_IRQ        51
389 827df9f3 balrog
# define OMAP_INT_24XX_RNG_IRQ                52
390 827df9f3 balrog
# define OMAP_INT_24XX_MG_IRQ                53
391 827df9f3 balrog
# define OMAP_INT_24XX_I2C1_IRQ                56
392 827df9f3 balrog
# define OMAP_INT_24XX_I2C2_IRQ                57
393 c3d2689d balrog
# define OMAP_INT_24XX_MCBSP1_IRQ_TX        59
394 c3d2689d balrog
# define OMAP_INT_24XX_MCBSP1_IRQ_RX        60
395 c3d2689d balrog
# define OMAP_INT_24XX_MCBSP2_IRQ_TX        62
396 c3d2689d balrog
# define OMAP_INT_24XX_MCBSP2_IRQ_RX        63
397 827df9f3 balrog
# define OMAP_INT_243X_MCBSP1_IRQ        64
398 827df9f3 balrog
# define OMAP_INT_24XX_MCSPI1_IRQ        65
399 827df9f3 balrog
# define OMAP_INT_24XX_MCSPI2_IRQ        66
400 827df9f3 balrog
# define OMAP_INT_24XX_SSI1_IRQ0        67
401 827df9f3 balrog
# define OMAP_INT_24XX_SSI1_IRQ1        68
402 827df9f3 balrog
# define OMAP_INT_24XX_SSI2_IRQ0        69
403 827df9f3 balrog
# define OMAP_INT_24XX_SSI2_IRQ1        70
404 827df9f3 balrog
# define OMAP_INT_24XX_SSI_GDD_IRQ        71
405 c3d2689d balrog
# define OMAP_INT_24XX_UART1_IRQ        72
406 c3d2689d balrog
# define OMAP_INT_24XX_UART2_IRQ        73
407 c3d2689d balrog
# define OMAP_INT_24XX_UART3_IRQ        74
408 c3d2689d balrog
# define OMAP_INT_24XX_USB_IRQ_GEN        75
409 c3d2689d balrog
# define OMAP_INT_24XX_USB_IRQ_NISO        76
410 c3d2689d balrog
# define OMAP_INT_24XX_USB_IRQ_ISO        77
411 c3d2689d balrog
# define OMAP_INT_24XX_USB_IRQ_HGEN        78
412 c3d2689d balrog
# define OMAP_INT_24XX_USB_IRQ_HSOF        79
413 c3d2689d balrog
# define OMAP_INT_24XX_USB_IRQ_OTG        80
414 827df9f3 balrog
# define OMAP_INT_24XX_VLYNQ_IRQ        81
415 c3d2689d balrog
# define OMAP_INT_24XX_MMC_IRQ                83
416 827df9f3 balrog
# define OMAP_INT_24XX_MS_IRQ                84
417 827df9f3 balrog
# define OMAP_INT_24XX_FAC_IRQ                85
418 827df9f3 balrog
# define OMAP_INT_24XX_MCSPI3_IRQ        91
419 c3d2689d balrog
# define OMAP_INT_243X_HS_USB_MC        92
420 c3d2689d balrog
# define OMAP_INT_243X_HS_USB_DMA        93
421 c3d2689d balrog
# define OMAP_INT_243X_CARKIT                94
422 827df9f3 balrog
# define OMAP_INT_34XX_GPTIMER12        95
423 c3d2689d balrog
424 b4e3104b balrog
/* omap_dma.c */
425 089b7c0a balrog
enum omap_dma_model {
426 b4e3104b balrog
    omap_dma_3_0,
427 b4e3104b balrog
    omap_dma_3_1,
428 b4e3104b balrog
    omap_dma_3_2,
429 b4e3104b balrog
    omap_dma_4,
430 089b7c0a balrog
};
431 089b7c0a balrog
432 afbb5194 balrog
struct soc_dma_s;
433 c227f099 Anthony Liguori
struct soc_dma_s *omap_dma_init(target_phys_addr_t base, qemu_irq *irqs,
434 089b7c0a balrog
                qemu_irq lcd_irq, struct omap_mpu_state_s *mpu, omap_clk clk,
435 089b7c0a balrog
                enum omap_dma_model model);
436 c227f099 Anthony Liguori
struct soc_dma_s *omap_dma4_init(target_phys_addr_t base, qemu_irq *irqs,
437 827df9f3 balrog
                struct omap_mpu_state_s *mpu, int fifo,
438 827df9f3 balrog
                int chans, omap_clk iclk, omap_clk fclk);
439 afbb5194 balrog
void omap_dma_reset(struct soc_dma_s *s);
440 c3d2689d balrog
441 b4e3104b balrog
struct dma_irq_map {
442 b4e3104b balrog
    int ih;
443 b4e3104b balrog
    int intr;
444 b4e3104b balrog
};
445 b4e3104b balrog
446 b4e3104b balrog
/* Only used in OMAP DMA 3.x gigacells */
447 c3d2689d balrog
enum omap_dma_port {
448 c3d2689d balrog
    emiff = 0,
449 c3d2689d balrog
    emifs,
450 089b7c0a balrog
    imif,        /* omap16xx: ocp_t1 */
451 c3d2689d balrog
    tipb,
452 089b7c0a balrog
    local,        /* omap16xx: ocp_t2 */
453 c3d2689d balrog
    tipb_mpui,
454 827df9f3 balrog
    __omap_dma_port_last,
455 c3d2689d balrog
};
456 c3d2689d balrog
457 089b7c0a balrog
typedef enum {
458 089b7c0a balrog
    constant = 0,
459 089b7c0a balrog
    post_incremented,
460 089b7c0a balrog
    single_index,
461 089b7c0a balrog
    double_index,
462 c227f099 Anthony Liguori
} omap_dma_addressing_t;
463 089b7c0a balrog
464 b4e3104b balrog
/* Only used in OMAP DMA 3.x gigacells */
465 c3d2689d balrog
struct omap_dma_lcd_channel_s {
466 c3d2689d balrog
    enum omap_dma_port src;
467 c227f099 Anthony Liguori
    target_phys_addr_t src_f1_top;
468 c227f099 Anthony Liguori
    target_phys_addr_t src_f1_bottom;
469 c227f099 Anthony Liguori
    target_phys_addr_t src_f2_top;
470 c227f099 Anthony Liguori
    target_phys_addr_t src_f2_bottom;
471 089b7c0a balrog
472 089b7c0a balrog
    /* Used in OMAP DMA 3.2 gigacell */
473 089b7c0a balrog
    unsigned char brust_f1;
474 089b7c0a balrog
    unsigned char pack_f1;
475 089b7c0a balrog
    unsigned char data_type_f1;
476 089b7c0a balrog
    unsigned char brust_f2;
477 089b7c0a balrog
    unsigned char pack_f2;
478 089b7c0a balrog
    unsigned char data_type_f2;
479 089b7c0a balrog
    unsigned char end_prog;
480 089b7c0a balrog
    unsigned char repeat;
481 089b7c0a balrog
    unsigned char auto_init;
482 089b7c0a balrog
    unsigned char priority;
483 089b7c0a balrog
    unsigned char fs;
484 089b7c0a balrog
    unsigned char running;
485 089b7c0a balrog
    unsigned char bs;
486 089b7c0a balrog
    unsigned char omap_3_1_compatible_disable;
487 089b7c0a balrog
    unsigned char dst;
488 089b7c0a balrog
    unsigned char lch_type;
489 089b7c0a balrog
    int16_t element_index_f1;
490 089b7c0a balrog
    int16_t element_index_f2;
491 089b7c0a balrog
    int32_t frame_index_f1;
492 089b7c0a balrog
    int32_t frame_index_f2;
493 089b7c0a balrog
    uint16_t elements_f1;
494 089b7c0a balrog
    uint16_t frames_f1;
495 089b7c0a balrog
    uint16_t elements_f2;
496 089b7c0a balrog
    uint16_t frames_f2;
497 c227f099 Anthony Liguori
    omap_dma_addressing_t mode_f1;
498 c227f099 Anthony Liguori
    omap_dma_addressing_t mode_f2;
499 089b7c0a balrog
500 c3d2689d balrog
    /* Destination port is fixed.  */
501 c3d2689d balrog
    int interrupts;
502 c3d2689d balrog
    int condition;
503 c3d2689d balrog
    int dual;
504 c3d2689d balrog
505 c3d2689d balrog
    int current_frame;
506 c227f099 Anthony Liguori
    target_phys_addr_t phys_framebuffer[2];
507 c3d2689d balrog
    qemu_irq irq;
508 c3d2689d balrog
    struct omap_mpu_state_s *mpu;
509 afbb5194 balrog
} *omap_dma_get_lcdch(struct soc_dma_s *s);
510 c3d2689d balrog
511 c3d2689d balrog
/*
512 c3d2689d balrog
 * DMA request numbers for OMAP1
513 c3d2689d balrog
 * See /usr/include/asm-arm/arch-omap/dma.h in Linux.
514 c3d2689d balrog
 */
515 c3d2689d balrog
# define OMAP_DMA_NO_DEVICE                0
516 c3d2689d balrog
# define OMAP_DMA_MCSI1_TX                1
517 c3d2689d balrog
# define OMAP_DMA_MCSI1_RX                2
518 c3d2689d balrog
# define OMAP_DMA_I2C_RX                3
519 c3d2689d balrog
# define OMAP_DMA_I2C_TX                4
520 c3d2689d balrog
# define OMAP_DMA_EXT_NDMA_REQ0                5
521 c3d2689d balrog
# define OMAP_DMA_EXT_NDMA_REQ1                6
522 c3d2689d balrog
# define OMAP_DMA_UWIRE_TX                7
523 c3d2689d balrog
# define OMAP_DMA_MCBSP1_TX                8
524 c3d2689d balrog
# define OMAP_DMA_MCBSP1_RX                9
525 c3d2689d balrog
# define OMAP_DMA_MCBSP3_TX                10
526 c3d2689d balrog
# define OMAP_DMA_MCBSP3_RX                11
527 c3d2689d balrog
# define OMAP_DMA_UART1_TX                12
528 c3d2689d balrog
# define OMAP_DMA_UART1_RX                13
529 c3d2689d balrog
# define OMAP_DMA_UART2_TX                14
530 c3d2689d balrog
# define OMAP_DMA_UART2_RX                15
531 c3d2689d balrog
# define OMAP_DMA_MCBSP2_TX                16
532 c3d2689d balrog
# define OMAP_DMA_MCBSP2_RX                17
533 c3d2689d balrog
# define OMAP_DMA_UART3_TX                18
534 c3d2689d balrog
# define OMAP_DMA_UART3_RX                19
535 c3d2689d balrog
# define OMAP_DMA_CAMERA_IF_RX                20
536 c3d2689d balrog
# define OMAP_DMA_MMC_TX                21
537 c3d2689d balrog
# define OMAP_DMA_MMC_RX                22
538 c3d2689d balrog
# define OMAP_DMA_NAND                        23        /* Not in OMAP310 */
539 c3d2689d balrog
# define OMAP_DMA_IRQ_LCD_LINE                24        /* Not in OMAP310 */
540 c3d2689d balrog
# define OMAP_DMA_MEMORY_STICK                25        /* Not in OMAP310 */
541 c3d2689d balrog
# define OMAP_DMA_USB_W2FC_RX0                26
542 c3d2689d balrog
# define OMAP_DMA_USB_W2FC_RX1                27
543 c3d2689d balrog
# define OMAP_DMA_USB_W2FC_RX2                28
544 c3d2689d balrog
# define OMAP_DMA_USB_W2FC_TX0                29
545 c3d2689d balrog
# define OMAP_DMA_USB_W2FC_TX1                30
546 c3d2689d balrog
# define OMAP_DMA_USB_W2FC_TX2                31
547 c3d2689d balrog
548 c3d2689d balrog
/* These are only for 1610 */
549 c3d2689d balrog
# define OMAP_DMA_CRYPTO_DES_IN                32
550 c3d2689d balrog
# define OMAP_DMA_SPI_TX                33
551 c3d2689d balrog
# define OMAP_DMA_SPI_RX                34
552 c3d2689d balrog
# define OMAP_DMA_CRYPTO_HASH                35
553 c3d2689d balrog
# define OMAP_DMA_CCP_ATTN                36
554 c3d2689d balrog
# define OMAP_DMA_CCP_FIFO_NOT_EMPTY        37
555 c3d2689d balrog
# define OMAP_DMA_CMT_APE_TX_CHAN_0        38
556 c3d2689d balrog
# define OMAP_DMA_CMT_APE_RV_CHAN_0        39
557 c3d2689d balrog
# define OMAP_DMA_CMT_APE_TX_CHAN_1        40
558 c3d2689d balrog
# define OMAP_DMA_CMT_APE_RV_CHAN_1        41
559 c3d2689d balrog
# define OMAP_DMA_CMT_APE_TX_CHAN_2        42
560 c3d2689d balrog
# define OMAP_DMA_CMT_APE_RV_CHAN_2        43
561 c3d2689d balrog
# define OMAP_DMA_CMT_APE_TX_CHAN_3        44
562 c3d2689d balrog
# define OMAP_DMA_CMT_APE_RV_CHAN_3        45
563 c3d2689d balrog
# define OMAP_DMA_CMT_APE_TX_CHAN_4        46
564 c3d2689d balrog
# define OMAP_DMA_CMT_APE_RV_CHAN_4        47
565 c3d2689d balrog
# define OMAP_DMA_CMT_APE_TX_CHAN_5        48
566 c3d2689d balrog
# define OMAP_DMA_CMT_APE_RV_CHAN_5        49
567 c3d2689d balrog
# define OMAP_DMA_CMT_APE_TX_CHAN_6        50
568 c3d2689d balrog
# define OMAP_DMA_CMT_APE_RV_CHAN_6        51
569 c3d2689d balrog
# define OMAP_DMA_CMT_APE_TX_CHAN_7        52
570 c3d2689d balrog
# define OMAP_DMA_CMT_APE_RV_CHAN_7        53
571 c3d2689d balrog
# define OMAP_DMA_MMC2_TX                54
572 c3d2689d balrog
# define OMAP_DMA_MMC2_RX                55
573 c3d2689d balrog
# define OMAP_DMA_CRYPTO_DES_OUT        56
574 c3d2689d balrog
575 827df9f3 balrog
/*
576 827df9f3 balrog
 * DMA request numbers for the OMAP2
577 827df9f3 balrog
 */
578 827df9f3 balrog
# define OMAP24XX_DMA_NO_DEVICE                0
579 827df9f3 balrog
# define OMAP24XX_DMA_XTI_DMA                1        /* Not in OMAP2420 */
580 827df9f3 balrog
# define OMAP24XX_DMA_EXT_DMAREQ0        2
581 827df9f3 balrog
# define OMAP24XX_DMA_EXT_DMAREQ1        3
582 827df9f3 balrog
# define OMAP24XX_DMA_GPMC                4
583 827df9f3 balrog
# define OMAP24XX_DMA_GFX                5        /* Not in OMAP2420 */
584 827df9f3 balrog
# define OMAP24XX_DMA_DSS                6
585 827df9f3 balrog
# define OMAP24XX_DMA_VLYNQ_TX                7        /* Not in OMAP2420 */
586 827df9f3 balrog
# define OMAP24XX_DMA_CWT                8        /* Not in OMAP2420 */
587 827df9f3 balrog
# define OMAP24XX_DMA_AES_TX                9        /* Not in OMAP2420 */
588 827df9f3 balrog
# define OMAP24XX_DMA_AES_RX                10        /* Not in OMAP2420 */
589 827df9f3 balrog
# define OMAP24XX_DMA_DES_TX                11        /* Not in OMAP2420 */
590 827df9f3 balrog
# define OMAP24XX_DMA_DES_RX                12        /* Not in OMAP2420 */
591 827df9f3 balrog
# define OMAP24XX_DMA_SHA1MD5_RX        13        /* Not in OMAP2420 */
592 827df9f3 balrog
# define OMAP24XX_DMA_EXT_DMAREQ2        14
593 827df9f3 balrog
# define OMAP24XX_DMA_EXT_DMAREQ3        15
594 827df9f3 balrog
# define OMAP24XX_DMA_EXT_DMAREQ4        16
595 827df9f3 balrog
# define OMAP24XX_DMA_EAC_AC_RD                17
596 827df9f3 balrog
# define OMAP24XX_DMA_EAC_AC_WR                18
597 827df9f3 balrog
# define OMAP24XX_DMA_EAC_MD_UL_RD        19
598 827df9f3 balrog
# define OMAP24XX_DMA_EAC_MD_UL_WR        20
599 827df9f3 balrog
# define OMAP24XX_DMA_EAC_MD_DL_RD        21
600 827df9f3 balrog
# define OMAP24XX_DMA_EAC_MD_DL_WR        22
601 827df9f3 balrog
# define OMAP24XX_DMA_EAC_BT_UL_RD        23
602 827df9f3 balrog
# define OMAP24XX_DMA_EAC_BT_UL_WR        24
603 827df9f3 balrog
# define OMAP24XX_DMA_EAC_BT_DL_RD        25
604 827df9f3 balrog
# define OMAP24XX_DMA_EAC_BT_DL_WR        26
605 827df9f3 balrog
# define OMAP24XX_DMA_I2C1_TX                27
606 827df9f3 balrog
# define OMAP24XX_DMA_I2C1_RX                28
607 827df9f3 balrog
# define OMAP24XX_DMA_I2C2_TX                29
608 827df9f3 balrog
# define OMAP24XX_DMA_I2C2_RX                30
609 827df9f3 balrog
# define OMAP24XX_DMA_MCBSP1_TX                31
610 827df9f3 balrog
# define OMAP24XX_DMA_MCBSP1_RX                32
611 827df9f3 balrog
# define OMAP24XX_DMA_MCBSP2_TX                33
612 827df9f3 balrog
# define OMAP24XX_DMA_MCBSP2_RX                34
613 827df9f3 balrog
# define OMAP24XX_DMA_SPI1_TX0                35
614 827df9f3 balrog
# define OMAP24XX_DMA_SPI1_RX0                36
615 827df9f3 balrog
# define OMAP24XX_DMA_SPI1_TX1                37
616 827df9f3 balrog
# define OMAP24XX_DMA_SPI1_RX1                38
617 827df9f3 balrog
# define OMAP24XX_DMA_SPI1_TX2                39
618 827df9f3 balrog
# define OMAP24XX_DMA_SPI1_RX2                40
619 827df9f3 balrog
# define OMAP24XX_DMA_SPI1_TX3                41
620 827df9f3 balrog
# define OMAP24XX_DMA_SPI1_RX3                42
621 827df9f3 balrog
# define OMAP24XX_DMA_SPI2_TX0                43
622 827df9f3 balrog
# define OMAP24XX_DMA_SPI2_RX0                44
623 827df9f3 balrog
# define OMAP24XX_DMA_SPI2_TX1                45
624 827df9f3 balrog
# define OMAP24XX_DMA_SPI2_RX1                46
625 827df9f3 balrog
626 827df9f3 balrog
# define OMAP24XX_DMA_UART1_TX                49
627 827df9f3 balrog
# define OMAP24XX_DMA_UART1_RX                50
628 827df9f3 balrog
# define OMAP24XX_DMA_UART2_TX                51
629 827df9f3 balrog
# define OMAP24XX_DMA_UART2_RX                52
630 827df9f3 balrog
# define OMAP24XX_DMA_UART3_TX                53
631 827df9f3 balrog
# define OMAP24XX_DMA_UART3_RX                54
632 827df9f3 balrog
# define OMAP24XX_DMA_USB_W2FC_TX0        55
633 827df9f3 balrog
# define OMAP24XX_DMA_USB_W2FC_RX0        56
634 827df9f3 balrog
# define OMAP24XX_DMA_USB_W2FC_TX1        57
635 827df9f3 balrog
# define OMAP24XX_DMA_USB_W2FC_RX1        58
636 827df9f3 balrog
# define OMAP24XX_DMA_USB_W2FC_TX2        59
637 827df9f3 balrog
# define OMAP24XX_DMA_USB_W2FC_RX2        60
638 827df9f3 balrog
# define OMAP24XX_DMA_MMC1_TX                61
639 827df9f3 balrog
# define OMAP24XX_DMA_MMC1_RX                62
640 827df9f3 balrog
# define OMAP24XX_DMA_MS                63        /* Not in OMAP2420 */
641 827df9f3 balrog
# define OMAP24XX_DMA_EXT_DMAREQ5        64
642 827df9f3 balrog
643 b4e3104b balrog
/* omap[123].c */
644 c58d37cf cmchao
/* OMAP2 gp timer */
645 827df9f3 balrog
struct omap_gp_timer_s;
646 827df9f3 balrog
struct omap_gp_timer_s *omap_gp_timer_init(struct omap_target_agent_s *ta,
647 827df9f3 balrog
                qemu_irq irq, omap_clk fclk, omap_clk iclk);
648 c58d37cf cmchao
void omap_gp_timer_reset(struct omap_gp_timer_s *s);
649 827df9f3 balrog
650 011d87d0 cmchao
/* OMAP2 sysctimer */
651 011d87d0 cmchao
struct omap_synctimer_s;
652 011d87d0 cmchao
struct omap_synctimer_s *omap_synctimer_init(struct omap_target_agent_s *ta,
653 827df9f3 balrog
                struct omap_mpu_state_s *mpu, omap_clk fclk, omap_clk iclk);
654 011d87d0 cmchao
void omap_synctimer_reset(struct omap_synctimer_s *s);
655 827df9f3 balrog
656 c3d2689d balrog
struct omap_uart_s;
657 c227f099 Anthony Liguori
struct omap_uart_s *omap_uart_init(target_phys_addr_t base,
658 827df9f3 balrog
                qemu_irq irq, omap_clk fclk, omap_clk iclk,
659 6a8aabd3 Stefan Weil
                qemu_irq txdma, qemu_irq rxdma,
660 6a8aabd3 Stefan Weil
                const char *label, CharDriverState *chr);
661 827df9f3 balrog
struct omap_uart_s *omap2_uart_init(struct omap_target_agent_s *ta,
662 827df9f3 balrog
                qemu_irq irq, omap_clk fclk, omap_clk iclk,
663 6a8aabd3 Stefan Weil
                qemu_irq txdma, qemu_irq rxdma,
664 6a8aabd3 Stefan Weil
                const char *label, CharDriverState *chr);
665 827df9f3 balrog
void omap_uart_reset(struct omap_uart_s *s);
666 75554a3c balrog
void omap_uart_attach(struct omap_uart_s *s, CharDriverState *chr);
667 c3d2689d balrog
668 fe71e81a balrog
struct omap_mpuio_s;
669 e7aa0ae0 Avi Kivity
struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *system_memory,
670 e7aa0ae0 Avi Kivity
                target_phys_addr_t base,
671 fe71e81a balrog
                qemu_irq kbd_int, qemu_irq gpio_int, qemu_irq wakeup,
672 fe71e81a balrog
                omap_clk clk);
673 fe71e81a balrog
qemu_irq *omap_mpuio_in_get(struct omap_mpuio_s *s);
674 fe71e81a balrog
void omap_mpuio_out_set(struct omap_mpuio_s *s, int line, qemu_irq handler);
675 fe71e81a balrog
void omap_mpuio_key(struct omap_mpuio_s *s, int row, int col, int down);
676 fe71e81a balrog
677 bc24a225 Paul Brook
struct uWireSlave {
678 d951f6ff balrog
    uint16_t (*receive)(void *opaque);
679 d951f6ff balrog
    void (*send)(void *opaque, uint16_t data);
680 d951f6ff balrog
    void *opaque;
681 d951f6ff balrog
};
682 d951f6ff balrog
struct omap_uwire_s;
683 d951f6ff balrog
void omap_uwire_attach(struct omap_uwire_s *s,
684 bc24a225 Paul Brook
                uWireSlave *slave, int chipselect);
685 d951f6ff balrog
686 2d08cc7c cmchao
/* OMAP2 spi */
687 827df9f3 balrog
struct omap_mcspi_s;
688 827df9f3 balrog
struct omap_mcspi_s *omap_mcspi_init(struct omap_target_agent_s *ta, int chnum,
689 827df9f3 balrog
                qemu_irq irq, qemu_irq *drq, omap_clk fclk, omap_clk iclk);
690 827df9f3 balrog
void omap_mcspi_attach(struct omap_mcspi_s *s,
691 e927bb00 balrog
                uint32_t (*txrx)(void *opaque, uint32_t, int), void *opaque,
692 827df9f3 balrog
                int chipselect);
693 2d08cc7c cmchao
void omap_mcspi_reset(struct omap_mcspi_s *s);
694 827df9f3 balrog
695 bc24a225 Paul Brook
struct I2SCodec {
696 d8f699cb balrog
    void *opaque;
697 d8f699cb balrog
698 d8f699cb balrog
    /* The CPU can call this if it is generating the clock signal on the
699 d8f699cb balrog
     * i2s port.  The CODEC can ignore it if it is set up as a clock
700 d8f699cb balrog
     * master and generates its own clock.  */
701 d8f699cb balrog
    void (*set_rate)(void *opaque, int in, int out);
702 d8f699cb balrog
703 d8f699cb balrog
    void (*tx_swallow)(void *opaque);
704 d8f699cb balrog
    qemu_irq rx_swallow;
705 d8f699cb balrog
    qemu_irq tx_start;
706 d8f699cb balrog
707 73560bc8 balrog
    int tx_rate;
708 73560bc8 balrog
    int cts;
709 73560bc8 balrog
    int rx_rate;
710 73560bc8 balrog
    int rts;
711 73560bc8 balrog
712 d8f699cb balrog
    struct i2s_fifo_s {
713 d8f699cb balrog
        uint8_t *fifo;
714 d8f699cb balrog
        int len;
715 d8f699cb balrog
        int start;
716 d8f699cb balrog
        int size;
717 d8f699cb balrog
    } in, out;
718 d8f699cb balrog
};
719 d8f699cb balrog
struct omap_mcbsp_s;
720 bc24a225 Paul Brook
void omap_mcbsp_i2s_attach(struct omap_mcbsp_s *s, I2SCodec *slave);
721 d8f699cb balrog
722 827df9f3 balrog
void omap_tap_init(struct omap_target_agent_s *ta,
723 827df9f3 balrog
                struct omap_mpu_state_s *mpu);
724 827df9f3 balrog
725 c3d2689d balrog
/* omap_lcdc.c */
726 c3d2689d balrog
struct omap_lcd_panel_s;
727 c3d2689d balrog
void omap_lcdc_reset(struct omap_lcd_panel_s *s);
728 c227f099 Anthony Liguori
struct omap_lcd_panel_s *omap_lcdc_init(target_phys_addr_t base, qemu_irq irq,
729 9898b79a Avi Kivity
                struct omap_dma_lcd_channel_s *dma, omap_clk clk);
730 c3d2689d balrog
731 827df9f3 balrog
/* omap_dss.c */
732 827df9f3 balrog
struct rfbi_chip_s {
733 827df9f3 balrog
    void *opaque;
734 827df9f3 balrog
    void (*write)(void *opaque, int dc, uint16_t value);
735 827df9f3 balrog
    void (*block)(void *opaque, int dc, void *buf, size_t len, int pitch);
736 827df9f3 balrog
    uint16_t (*read)(void *opaque, int dc);
737 827df9f3 balrog
};
738 827df9f3 balrog
struct omap_dss_s;
739 827df9f3 balrog
void omap_dss_reset(struct omap_dss_s *s);
740 827df9f3 balrog
struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta,
741 c227f099 Anthony Liguori
                target_phys_addr_t l3_base,
742 827df9f3 balrog
                qemu_irq irq, qemu_irq drq,
743 827df9f3 balrog
                omap_clk fck1, omap_clk fck2, omap_clk ck54m,
744 827df9f3 balrog
                omap_clk ick1, omap_clk ick2);
745 827df9f3 balrog
void omap_rfbi_attach(struct omap_dss_s *s, int cs, struct rfbi_chip_s *chip);
746 827df9f3 balrog
747 b30bb3a2 balrog
/* omap_mmc.c */
748 b30bb3a2 balrog
struct omap_mmc_s;
749 c227f099 Anthony Liguori
struct omap_mmc_s *omap_mmc_init(target_phys_addr_t base,
750 87ecb68b pbrook
                BlockDriverState *bd,
751 b30bb3a2 balrog
                qemu_irq irq, qemu_irq dma[], omap_clk clk);
752 827df9f3 balrog
struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
753 827df9f3 balrog
                BlockDriverState *bd, qemu_irq irq, qemu_irq dma[],
754 827df9f3 balrog
                omap_clk fclk, omap_clk iclk);
755 b30bb3a2 balrog
void omap_mmc_reset(struct omap_mmc_s *s);
756 8e129e07 balrog
void omap_mmc_handlers(struct omap_mmc_s *s, qemu_irq ro, qemu_irq cover);
757 827df9f3 balrog
void omap_mmc_enable(struct omap_mmc_s *s, int enable);
758 b30bb3a2 balrog
759 02645926 balrog
/* omap_i2c.c */
760 02645926 balrog
struct omap_i2c_s;
761 c227f099 Anthony Liguori
struct omap_i2c_s *omap_i2c_init(target_phys_addr_t base,
762 02645926 balrog
                qemu_irq irq, qemu_irq *dma, omap_clk clk);
763 29885477 balrog
struct omap_i2c_s *omap2_i2c_init(struct omap_target_agent_s *ta,
764 29885477 balrog
                qemu_irq irq, qemu_irq *dma, omap_clk fclk, omap_clk iclk);
765 02645926 balrog
void omap_i2c_reset(struct omap_i2c_s *s);
766 02645926 balrog
i2c_bus *omap_i2c_bus(struct omap_i2c_s *s);
767 02645926 balrog
768 c3d2689d balrog
# define cpu_is_omap310(cpu)                (cpu->mpu_model == omap310)
769 c3d2689d balrog
# define cpu_is_omap1510(cpu)                (cpu->mpu_model == omap1510)
770 827df9f3 balrog
# define cpu_is_omap1610(cpu)                (cpu->mpu_model == omap1610)
771 827df9f3 balrog
# define cpu_is_omap1710(cpu)                (cpu->mpu_model == omap1710)
772 827df9f3 balrog
# define cpu_is_omap2410(cpu)                (cpu->mpu_model == omap2410)
773 827df9f3 balrog
# define cpu_is_omap2420(cpu)                (cpu->mpu_model == omap2420)
774 827df9f3 balrog
# define cpu_is_omap2430(cpu)                (cpu->mpu_model == omap2430)
775 827df9f3 balrog
# define cpu_is_omap3430(cpu)                (cpu->mpu_model == omap3430)
776 f13e656e Peter Maydell
# define cpu_is_omap3630(cpu)           (cpu->mpu_model == omap3630)
777 827df9f3 balrog
778 c3d2689d balrog
# define cpu_is_omap15xx(cpu)                \
779 c3d2689d balrog
        (cpu_is_omap310(cpu) || cpu_is_omap1510(cpu))
780 827df9f3 balrog
# define cpu_is_omap16xx(cpu)                \
781 827df9f3 balrog
        (cpu_is_omap1610(cpu) || cpu_is_omap1710(cpu))
782 827df9f3 balrog
# define cpu_is_omap24xx(cpu)                \
783 827df9f3 balrog
        (cpu_is_omap2410(cpu) || cpu_is_omap2420(cpu) || cpu_is_omap2430(cpu))
784 827df9f3 balrog
785 827df9f3 balrog
# define cpu_class_omap1(cpu)                \
786 827df9f3 balrog
        (cpu_is_omap15xx(cpu) || cpu_is_omap16xx(cpu))
787 827df9f3 balrog
# define cpu_class_omap2(cpu)                cpu_is_omap24xx(cpu)
788 f13e656e Peter Maydell
# define cpu_class_omap3(cpu) \
789 f13e656e Peter Maydell
        (cpu_is_omap3430(cpu) || cpu_is_omap3630(cpu))
790 c3d2689d balrog
791 c3d2689d balrog
struct omap_mpu_state_s {
792 827df9f3 balrog
    enum omap_mpu_model {
793 c3d2689d balrog
        omap310,
794 c3d2689d balrog
        omap1510,
795 827df9f3 balrog
        omap1610,
796 827df9f3 balrog
        omap1710,
797 827df9f3 balrog
        omap2410,
798 827df9f3 balrog
        omap2420,
799 827df9f3 balrog
        omap2422,
800 827df9f3 balrog
        omap2423,
801 827df9f3 balrog
        omap2430,
802 827df9f3 balrog
        omap3430,
803 f13e656e Peter Maydell
        omap3630,
804 c3d2689d balrog
    } mpu_model;
805 c3d2689d balrog
806 c3d2689d balrog
    CPUState *env;
807 c3d2689d balrog
808 c3d2689d balrog
    qemu_irq *drq;
809 c3d2689d balrog
810 c3d2689d balrog
    qemu_irq wakeup;
811 c3d2689d balrog
812 4b3fedf3 Avi Kivity
    MemoryRegion ulpd_pm_iomem;
813 4b3fedf3 Avi Kivity
    MemoryRegion pin_cfg_iomem;
814 4b3fedf3 Avi Kivity
    MemoryRegion id_iomem;
815 4b3fedf3 Avi Kivity
    MemoryRegion id_iomem_e18;
816 4b3fedf3 Avi Kivity
    MemoryRegion id_iomem_ed4;
817 4b3fedf3 Avi Kivity
    MemoryRegion id_iomem_e20;
818 4b3fedf3 Avi Kivity
    MemoryRegion mpui_iomem;
819 e7aa0ae0 Avi Kivity
    MemoryRegion tcmi_iomem;
820 e7aa0ae0 Avi Kivity
    MemoryRegion clkm_iomem;
821 e7aa0ae0 Avi Kivity
    MemoryRegion clkdsp_iomem;
822 a4ebbd18 Avi Kivity
    MemoryRegion pwl_iomem;
823 a4ebbd18 Avi Kivity
    MemoryRegion pwt_iomem;
824 60fe76e3 Avi Kivity
    MemoryRegion mpui_io_iomem;
825 2654c962 Avi Kivity
    MemoryRegion imif_ram;
826 2654c962 Avi Kivity
    MemoryRegion emiff_ram;
827 4b3fedf3 Avi Kivity
828 c3d2689d balrog
    struct omap_dma_port_if_s {
829 5fafdf24 ths
        uint32_t (*read[3])(struct omap_mpu_state_s *s,
830 c227f099 Anthony Liguori
                        target_phys_addr_t offset);
831 c3d2689d balrog
        void (*write[3])(struct omap_mpu_state_s *s,
832 c227f099 Anthony Liguori
                        target_phys_addr_t offset, uint32_t value);
833 c3d2689d balrog
        int (*addr_valid)(struct omap_mpu_state_s *s,
834 c227f099 Anthony Liguori
                        target_phys_addr_t addr);
835 827df9f3 balrog
    } port[__omap_dma_port_last];
836 c3d2689d balrog
837 c3d2689d balrog
    unsigned long sdram_size;
838 c3d2689d balrog
    unsigned long sram_size;
839 c3d2689d balrog
840 c3d2689d balrog
    /* MPUI-TIPB peripherals */
841 d951f6ff balrog
    struct omap_uart_s *uart[3];
842 d951f6ff balrog
843 77831c20 Juha Riihimäki
    DeviceState *gpio;
844 c3d2689d balrog
845 d8f699cb balrog
    struct omap_mcbsp_s *mcbsp1;
846 d8f699cb balrog
    struct omap_mcbsp_s *mcbsp3;
847 d8f699cb balrog
848 c3d2689d balrog
    /* MPU public TIPB peripherals */
849 c3d2689d balrog
    struct omap_32khz_timer_s *os_timer;
850 c3d2689d balrog
851 b30bb3a2 balrog
    struct omap_mmc_s *mmc;
852 b30bb3a2 balrog
853 d951f6ff balrog
    struct omap_mpuio_s *mpuio;
854 d951f6ff balrog
855 d951f6ff balrog
    struct omap_uwire_s *microwire;
856 d951f6ff balrog
857 66450b15 balrog
    struct {
858 66450b15 balrog
        uint8_t output;
859 66450b15 balrog
        uint8_t level;
860 66450b15 balrog
        uint8_t enable;
861 66450b15 balrog
        int clk;
862 66450b15 balrog
    } pwl;
863 66450b15 balrog
864 f34c417b balrog
    struct {
865 f34c417b balrog
        uint8_t frc;
866 f34c417b balrog
        uint8_t vrc;
867 f34c417b balrog
        uint8_t gcr;
868 f34c417b balrog
        omap_clk clk;
869 f34c417b balrog
    } pwt;
870 f34c417b balrog
871 827df9f3 balrog
    struct omap_i2c_s *i2c[2];
872 4a2c8ac2 balrog
873 02645926 balrog
    struct omap_rtc_s *rtc;
874 02645926 balrog
875 d8f699cb balrog
    struct omap_mcbsp_s *mcbsp2;
876 d8f699cb balrog
877 f9d43072 balrog
    struct omap_lpg_s *led[2];
878 f9d43072 balrog
879 c3d2689d balrog
    /* MPU private TIPB peripherals */
880 0919ac78 Peter Maydell
    DeviceState *ih[2];
881 c3d2689d balrog
882 afbb5194 balrog
    struct soc_dma_s *dma;
883 c3d2689d balrog
884 c3d2689d balrog
    struct omap_mpu_timer_s *timer[3];
885 c3d2689d balrog
    struct omap_watchdog_timer_s *wdt;
886 c3d2689d balrog
887 c3d2689d balrog
    struct omap_lcd_panel_s *lcd;
888 c3d2689d balrog
889 c3d2689d balrog
    uint32_t ulpd_pm_regs[21];
890 c3d2689d balrog
    int64_t ulpd_gauge_start;
891 c3d2689d balrog
892 c3d2689d balrog
    uint32_t func_mux_ctrl[14];
893 c3d2689d balrog
    uint32_t comp_mode_ctrl[1];
894 c3d2689d balrog
    uint32_t pull_dwn_ctrl[4];
895 c3d2689d balrog
    uint32_t gate_inh_ctrl[1];
896 c3d2689d balrog
    uint32_t voltage_ctrl[1];
897 c3d2689d balrog
    uint32_t test_dbg_ctrl[1];
898 c3d2689d balrog
    uint32_t mod_conf_ctrl[1];
899 c3d2689d balrog
    int compat1509;
900 c3d2689d balrog
901 c3d2689d balrog
    uint32_t mpui_ctrl;
902 c3d2689d balrog
903 c3d2689d balrog
    struct omap_tipb_bridge_s *private_tipb;
904 c3d2689d balrog
    struct omap_tipb_bridge_s *public_tipb;
905 c3d2689d balrog
906 c3d2689d balrog
    uint32_t tcmi_regs[17];
907 c3d2689d balrog
908 c3d2689d balrog
    struct dpll_ctl_s {
909 e7aa0ae0 Avi Kivity
        MemoryRegion iomem;
910 c3d2689d balrog
        uint16_t mode;
911 c3d2689d balrog
        omap_clk dpll;
912 c3d2689d balrog
    } dpll[3];
913 c3d2689d balrog
914 c3d2689d balrog
    omap_clk clks;
915 c3d2689d balrog
    struct {
916 c3d2689d balrog
        int cold_start;
917 c3d2689d balrog
        int clocking_scheme;
918 c3d2689d balrog
        uint16_t arm_ckctl;
919 c3d2689d balrog
        uint16_t arm_idlect1;
920 c3d2689d balrog
        uint16_t arm_idlect2;
921 c3d2689d balrog
        uint16_t arm_ewupct;
922 c3d2689d balrog
        uint16_t arm_rstct1;
923 c3d2689d balrog
        uint16_t arm_rstct2;
924 c3d2689d balrog
        uint16_t arm_ckout1;
925 c3d2689d balrog
        int dpll1_mode;
926 c3d2689d balrog
        uint16_t dsp_idlect1;
927 c3d2689d balrog
        uint16_t dsp_idlect2;
928 c3d2689d balrog
        uint16_t dsp_rstct2;
929 c3d2689d balrog
    } clkm;
930 827df9f3 balrog
931 827df9f3 balrog
    /* OMAP2-only peripherals */
932 827df9f3 balrog
    struct omap_l4_s *l4;
933 827df9f3 balrog
934 827df9f3 balrog
    struct omap_gp_timer_s *gptimer[12];
935 011d87d0 cmchao
    struct omap_synctimer_s *synctimer;
936 827df9f3 balrog
937 827df9f3 balrog
    struct omap_prcm_s *prcm;
938 827df9f3 balrog
    struct omap_sdrc_s *sdrc;
939 827df9f3 balrog
    struct omap_gpmc_s *gpmc;
940 827df9f3 balrog
    struct omap_sysctl_s *sysc;
941 827df9f3 balrog
942 827df9f3 balrog
    struct omap_mcspi_s *mcspi[2];
943 827df9f3 balrog
944 827df9f3 balrog
    struct omap_dss_s *dss;
945 99570a40 balrog
946 99570a40 balrog
    struct omap_eac_s *eac;
947 827df9f3 balrog
};
948 827df9f3 balrog
949 827df9f3 balrog
/* omap1.c */
950 4b3fedf3 Avi Kivity
struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
951 4b3fedf3 Avi Kivity
                unsigned long sdram_size,
952 3023f332 aliguori
                const char *core);
953 827df9f3 balrog
954 827df9f3 balrog
/* omap2.c */
955 827df9f3 balrog
struct omap_mpu_state_s *omap2420_mpu_init(unsigned long sdram_size,
956 3023f332 aliguori
                const char *core);
957 c3d2689d balrog
958 c3d2689d balrog
# if TARGET_PHYS_ADDR_BITS == 32
959 c3d2689d balrog
#  define OMAP_FMT_plx "%#08x"
960 c3d2689d balrog
# elif TARGET_PHYS_ADDR_BITS == 64
961 c3d2689d balrog
#  define OMAP_FMT_plx "%#08" PRIx64
962 c3d2689d balrog
# else
963 c3d2689d balrog
#  error TARGET_PHYS_ADDR_BITS undefined
964 c3d2689d balrog
# endif
965 c3d2689d balrog
966 c227f099 Anthony Liguori
uint32_t omap_badwidth_read8(void *opaque, target_phys_addr_t addr);
967 c227f099 Anthony Liguori
void omap_badwidth_write8(void *opaque, target_phys_addr_t addr,
968 9596ebb7 pbrook
                uint32_t value);
969 c227f099 Anthony Liguori
uint32_t omap_badwidth_read16(void *opaque, target_phys_addr_t addr);
970 c227f099 Anthony Liguori
void omap_badwidth_write16(void *opaque, target_phys_addr_t addr,
971 b30bb3a2 balrog
                uint32_t value);
972 c227f099 Anthony Liguori
uint32_t omap_badwidth_read32(void *opaque, target_phys_addr_t addr);
973 c227f099 Anthony Liguori
void omap_badwidth_write32(void *opaque, target_phys_addr_t addr,
974 b30bb3a2 balrog
                uint32_t value);
975 b30bb3a2 balrog
976 827df9f3 balrog
void omap_mpu_wakeup(void *opaque, int irq, int req);
977 827df9f3 balrog
978 c3d2689d balrog
# define OMAP_BAD_REG(paddr)                \
979 827df9f3 balrog
        fprintf(stderr, "%s: Bad register " OMAP_FMT_plx "\n",        \
980 827df9f3 balrog
                        __FUNCTION__, paddr)
981 c3d2689d balrog
# define OMAP_RO_REG(paddr)                \
982 827df9f3 balrog
        fprintf(stderr, "%s: Read-only register " OMAP_FMT_plx "\n",        \
983 c3d2689d balrog
                        __FUNCTION__, paddr)
984 b854bc19 balrog
985 827df9f3 balrog
/* OMAP-specific Linux bootloader tags for the ATAG_BOARD area
986 827df9f3 balrog
   (Board-specifc tags are not here)  */
987 827df9f3 balrog
#define OMAP_TAG_CLOCK                0x4f01
988 827df9f3 balrog
#define OMAP_TAG_MMC                0x4f02
989 827df9f3 balrog
#define OMAP_TAG_SERIAL_CONSOLE        0x4f03
990 827df9f3 balrog
#define OMAP_TAG_USB                0x4f04
991 827df9f3 balrog
#define OMAP_TAG_LCD                0x4f05
992 827df9f3 balrog
#define OMAP_TAG_GPIO_SWITCH        0x4f06
993 827df9f3 balrog
#define OMAP_TAG_UART                0x4f07
994 827df9f3 balrog
#define OMAP_TAG_FBMEM                0x4f08
995 827df9f3 balrog
#define OMAP_TAG_STI_CONSOLE        0x4f09
996 827df9f3 balrog
#define OMAP_TAG_CAMERA_SENSOR        0x4f0a
997 827df9f3 balrog
#define OMAP_TAG_PARTITION        0x4f0b
998 827df9f3 balrog
#define OMAP_TAG_TEA5761        0x4f10
999 827df9f3 balrog
#define OMAP_TAG_TMP105                0x4f11
1000 827df9f3 balrog
#define OMAP_TAG_BOOT_REASON        0x4f80
1001 827df9f3 balrog
#define OMAP_TAG_FLASH_PART_STR        0x4f81
1002 827df9f3 balrog
#define OMAP_TAG_VERSION_STR        0x4f82
1003 827df9f3 balrog
1004 e927bb00 balrog
enum {
1005 e927bb00 balrog
    OMAP_GPIOSW_TYPE_COVER        = 0 << 4,
1006 e927bb00 balrog
    OMAP_GPIOSW_TYPE_CONNECTION        = 1 << 4,
1007 e927bb00 balrog
    OMAP_GPIOSW_TYPE_ACTIVITY        = 2 << 4,
1008 e927bb00 balrog
};
1009 e927bb00 balrog
1010 e927bb00 balrog
#define OMAP_GPIOSW_INVERTED        0x0001
1011 e927bb00 balrog
#define OMAP_GPIOSW_OUTPUT        0x0002
1012 e927bb00 balrog
1013 b854bc19 balrog
# define TCMI_VERBOSE                        1
1014 d8f699cb balrog
//# define MEM_VERBOSE                        1
1015 b854bc19 balrog
1016 b854bc19 balrog
# ifdef TCMI_VERBOSE
1017 b854bc19 balrog
#  define OMAP_8B_REG(paddr)                \
1018 827df9f3 balrog
        fprintf(stderr, "%s: 8-bit register " OMAP_FMT_plx "\n",        \
1019 66450b15 balrog
                        __FUNCTION__, paddr)
1020 b854bc19 balrog
#  define OMAP_16B_REG(paddr)                \
1021 827df9f3 balrog
        fprintf(stderr, "%s: 16-bit register " OMAP_FMT_plx "\n",        \
1022 c3d2689d balrog
                        __FUNCTION__, paddr)
1023 b854bc19 balrog
#  define OMAP_32B_REG(paddr)                \
1024 827df9f3 balrog
        fprintf(stderr, "%s: 32-bit register " OMAP_FMT_plx "\n",        \
1025 c3d2689d balrog
                        __FUNCTION__, paddr)
1026 b854bc19 balrog
# else
1027 b854bc19 balrog
#  define OMAP_8B_REG(paddr)
1028 b854bc19 balrog
#  define OMAP_16B_REG(paddr)
1029 b854bc19 balrog
#  define OMAP_32B_REG(paddr)
1030 b854bc19 balrog
# endif
1031 c3d2689d balrog
1032 cf965d24 balrog
# define OMAP_MPUI_REG_MASK                0x000007ff
1033 cf965d24 balrog
1034 d8f699cb balrog
# ifdef MEM_VERBOSE
1035 d8f699cb balrog
struct io_fn {
1036 d60efc6b Blue Swirl
    CPUReadMemoryFunc * const *mem_read;
1037 d60efc6b Blue Swirl
    CPUWriteMemoryFunc * const *mem_write;
1038 d8f699cb balrog
    void *opaque;
1039 d8f699cb balrog
    int in;
1040 d8f699cb balrog
};
1041 d8f699cb balrog
1042 c227f099 Anthony Liguori
static uint32_t io_readb(void *opaque, target_phys_addr_t addr)
1043 d8f699cb balrog
{
1044 d8f699cb balrog
    struct io_fn *s = opaque;
1045 d8f699cb balrog
    uint32_t ret;
1046 d8f699cb balrog
1047 d8f699cb balrog
    s->in ++;
1048 d8f699cb balrog
    ret = s->mem_read[0](s->opaque, addr);
1049 d8f699cb balrog
    s->in --;
1050 d8f699cb balrog
    if (!s->in)
1051 d8f699cb balrog
        fprintf(stderr, "%08x ---> %02x\n", (uint32_t) addr, ret);
1052 d8f699cb balrog
    return ret;
1053 d8f699cb balrog
}
1054 c227f099 Anthony Liguori
static uint32_t io_readh(void *opaque, target_phys_addr_t addr)
1055 d8f699cb balrog
{
1056 d8f699cb balrog
    struct io_fn *s = opaque;
1057 d8f699cb balrog
    uint32_t ret;
1058 d8f699cb balrog
1059 d8f699cb balrog
    s->in ++;
1060 d8f699cb balrog
    ret = s->mem_read[1](s->opaque, addr);
1061 d8f699cb balrog
    s->in --;
1062 d8f699cb balrog
    if (!s->in)
1063 d8f699cb balrog
        fprintf(stderr, "%08x ---> %04x\n", (uint32_t) addr, ret);
1064 d8f699cb balrog
    return ret;
1065 d8f699cb balrog
}
1066 c227f099 Anthony Liguori
static uint32_t io_readw(void *opaque, target_phys_addr_t addr)
1067 d8f699cb balrog
{
1068 d8f699cb balrog
    struct io_fn *s = opaque;
1069 d8f699cb balrog
    uint32_t ret;
1070 d8f699cb balrog
1071 d8f699cb balrog
    s->in ++;
1072 d8f699cb balrog
    ret = s->mem_read[2](s->opaque, addr);
1073 d8f699cb balrog
    s->in --;
1074 d8f699cb balrog
    if (!s->in)
1075 d8f699cb balrog
        fprintf(stderr, "%08x ---> %08x\n", (uint32_t) addr, ret);
1076 d8f699cb balrog
    return ret;
1077 d8f699cb balrog
}
1078 c227f099 Anthony Liguori
static void io_writeb(void *opaque, target_phys_addr_t addr, uint32_t value)
1079 d8f699cb balrog
{
1080 d8f699cb balrog
    struct io_fn *s = opaque;
1081 d8f699cb balrog
1082 d8f699cb balrog
    if (!s->in)
1083 d8f699cb balrog
        fprintf(stderr, "%08x <--- %02x\n", (uint32_t) addr, value);
1084 d8f699cb balrog
    s->in ++;
1085 d8f699cb balrog
    s->mem_write[0](s->opaque, addr, value);
1086 d8f699cb balrog
    s->in --;
1087 d8f699cb balrog
}
1088 c227f099 Anthony Liguori
static void io_writeh(void *opaque, target_phys_addr_t addr, uint32_t value)
1089 d8f699cb balrog
{
1090 d8f699cb balrog
    struct io_fn *s = opaque;
1091 d8f699cb balrog
1092 d8f699cb balrog
    if (!s->in)
1093 d8f699cb balrog
        fprintf(stderr, "%08x <--- %04x\n", (uint32_t) addr, value);
1094 d8f699cb balrog
    s->in ++;
1095 d8f699cb balrog
    s->mem_write[1](s->opaque, addr, value);
1096 d8f699cb balrog
    s->in --;
1097 d8f699cb balrog
}
1098 c227f099 Anthony Liguori
static void io_writew(void *opaque, target_phys_addr_t addr, uint32_t value)
1099 d8f699cb balrog
{
1100 d8f699cb balrog
    struct io_fn *s = opaque;
1101 d8f699cb balrog
1102 d8f699cb balrog
    if (!s->in)
1103 d8f699cb balrog
        fprintf(stderr, "%08x <--- %08x\n", (uint32_t) addr, value);
1104 d8f699cb balrog
    s->in ++;
1105 d8f699cb balrog
    s->mem_write[2](s->opaque, addr, value);
1106 d8f699cb balrog
    s->in --;
1107 d8f699cb balrog
}
1108 d8f699cb balrog
1109 d60efc6b Blue Swirl
static CPUReadMemoryFunc * const io_readfn[] = { io_readb, io_readh, io_readw, };
1110 d60efc6b Blue Swirl
static CPUWriteMemoryFunc * const io_writefn[] = { io_writeb, io_writeh, io_writew, };
1111 d8f699cb balrog
1112 d60efc6b Blue Swirl
inline static int debug_register_io_memory(CPUReadMemoryFunc * const *mem_read,
1113 d60efc6b Blue Swirl
                                           CPUWriteMemoryFunc * const *mem_write,
1114 d60efc6b Blue Swirl
                                           void *opaque)
1115 d8f699cb balrog
{
1116 7267c094 Anthony Liguori
    struct io_fn *s = g_malloc(sizeof(struct io_fn));
1117 d8f699cb balrog
1118 d8f699cb balrog
    s->mem_read = mem_read;
1119 d8f699cb balrog
    s->mem_write = mem_write;
1120 d8f699cb balrog
    s->opaque = opaque;
1121 d8f699cb balrog
    s->in = 0;
1122 2507c12a Alexander Graf
    return cpu_register_io_memory(io_readfn, io_writefn, s,
1123 2507c12a Alexander Graf
                                  DEVICE_NATIVE_ENDIAN);
1124 d8f699cb balrog
}
1125 d8f699cb balrog
#  define cpu_register_io_memory        debug_register_io_memory
1126 d8f699cb balrog
# endif
1127 d8f699cb balrog
1128 c66fb5bc balrog
/* Define when we want to reduce the number of IO regions registered.  */
1129 477b24ef balrog
/*# define L4_MUX_HACK*/
1130 c66fb5bc balrog
1131 c3d2689d balrog
#endif /* hw_omap_h */