Use bus reset detection for all ARC OTG devices. Remove conflict from LV24020LP drive...
[kugel-rb.git] / firmware / export / pp5020.h
blob36c88e00dfd35c4da9613bc4c17d0052cd060b02
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2004 by Thom Johansen
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef __PP5020_H__
22 #define __PP5020_H__
24 /* All info gleaned and/or copied from the iPodLinux project. */
26 /* USBOTG */
27 #define USB_NUM_ENDPOINTS 3
28 /* This needs to be 2048 byte aligned, but USB_QHARRAY_ATTR should take care
29 * of that */
30 #define USB_QHARRAY_ATTR __attribute__((section(".qharray"),nocommon,aligned(4)))
31 #define USB_DEVBSS_ATTR IBSS_ATTR
33 /* DRAM starts at 0x10000000, but in Rockbox we remap it to 0x00000000 */
34 #define DRAM_START 0x10000000
36 /* Processor ID */
37 #define PROCESSOR_ID (*(volatile unsigned long *)(0x60000000))
39 #define PROC_ID_CPU 0x55
40 #define PROC_ID_COP 0xaa
42 /* Mailboxes */
43 #define MBX_BASE (0x60001000)
44 /* Read bits in the mailbox */
45 #define MBX_MSG_STAT (*(volatile unsigned long *)(0x60001000))
46 /* Set bits in the mailbox */
47 #define MBX_MSG_SET (*(volatile unsigned long *)(0x60001004))
48 /* Clear bits in the mailbox */
49 #define MBX_MSG_CLR (*(volatile unsigned long *)(0x60001008))
50 /* Doesn't seem to be COP_REPLY at all :) */
51 #define MBX_UNKNOWN1 (*(volatile unsigned long *)(0x6000100c))
52 /* COP can set bit 29 - only CPU read clears it */
53 #define CPU_QUEUE (*(volatile unsigned long *)(0x60001010))
54 /* CPU can set bit 29 - only COP read clears it */
55 #define COP_QUEUE (*(volatile unsigned long *)(0x60001020))
57 #define PROC_QUEUE(core) ((&CPU_QUEUE)[(core)*4])
59 /* Interrupts */
60 #define CPU_INT_STAT (*(volatile unsigned long*)(0x60004000))
61 #define COP_INT_STAT (*(volatile unsigned long*)(0x60004004))
62 #define CPU_FIQ_STAT (*(volatile unsigned long*)(0x60004008))
63 #define COP_FIQ_STAT (*(volatile unsigned long*)(0x6000400c))
65 #define INT_STAT (*(volatile unsigned long*)(0x60004010))
66 #define INT_FORCED_STAT (*(volatile unsigned long*)(0x60004014))
67 #define INT_FORCED_SET (*(volatile unsigned long*)(0x60004018))
68 #define INT_FORCED_CLR (*(volatile unsigned long*)(0x6000401c))
70 #define CPU_INT_EN_STAT (*(volatile unsigned long*)(0x60004020))
71 #define CPU_INT_EN (*(volatile unsigned long*)(0x60004024))
72 #define CPU_INT_DIS (*(volatile unsigned long*)(0x60004028))
73 #define CPU_INT_PRIORITY (*(volatile unsigned long*)(0x6000402c))
75 #define COP_INT_EN_STAT (*(volatile unsigned long*)(0x60004030))
76 #define COP_INT_EN (*(volatile unsigned long*)(0x60004034))
77 #define COP_INT_DIS (*(volatile unsigned long*)(0x60004038))
78 #define COP_INT_PRIORITY (*(volatile unsigned long*)(0x6000403c))
80 #define CPU_HI_INT_STAT (*(volatile unsigned long*)(0x60004100))
81 #define COP_HI_INT_STAT (*(volatile unsigned long*)(0x60004104))
82 #define CPU_HI_FIQ_STAT (*(volatile unsigned long*)(0x60004108))
83 #define COP_HI_FIQ_STAT (*(volatile unsigned long*)(0x6000410c))
85 #define HI_INT_STAT (*(volatile unsigned long*)(0x60004110))
86 #define HI_INT_FORCED_STAT (*(volatile unsigned long*)(0x60004114))
87 #define HI_INT_FORCED_SET (*(volatile unsigned long*)(0x60004118))
88 #define HI_INT_FORCED_CLR (*(volatile unsigned long*)(0x6000411c))
90 #define CPU_HI_INT_EN_STAT (*(volatile unsigned long*)(0x60004120))
91 #define CPU_HI_INT_EN (*(volatile unsigned long*)(0x60004124))
92 #define CPU_HI_INT_DIS (*(volatile unsigned long*)(0x60004128))
93 #define CPU_HI_INT_PRIORITY (*(volatile unsigned long*)(0x6000412c))
95 #define COP_HI_INT_EN_STAT (*(volatile unsigned long*)(0x60004130))
96 #define COP_HI_INT_EN (*(volatile unsigned long*)(0x60004134))
97 #define COP_HI_INT_DIS (*(volatile unsigned long*)(0x60004138))
98 #define COP_HI_INT_PRIORITY (*(volatile unsigned long*)(0x6000413c))
100 #define TIMER1_IRQ 0
101 #define TIMER2_IRQ 1
102 #define MAILBOX_IRQ 4
103 #define IIS_IRQ 10
104 #define USB_IRQ 20
105 #define IDE_IRQ 23
106 #define FIREWIRE_IRQ 25
107 #define HI_IRQ 30
108 #define GPIO0_IRQ (32+0) /* Ports A..D */
109 #define GPIO1_IRQ (32+1) /* Ports E..H */
110 #define GPIO2_IRQ (32+2) /* Ports I..L */
111 #define SER0_IRQ (32+4)
112 #define SER1_IRQ (32+5)
113 #define I2C_IRQ (32+8)
115 #define TIMER1_MASK (1 << TIMER1_IRQ)
116 #define TIMER2_MASK (1 << TIMER2_IRQ)
117 #define MAILBOX_MASK (1 << MAILBOX_IRQ)
118 #define IIS_MASK (1 << IIS_IRQ)
119 #define IDE_MASK (1 << IDE_IRQ)
120 #define USB_MASK (1 << USB_IRQ)
121 #define FIREWIRE_MASK (1 << FIREWIRE_IRQ)
122 #define HI_MASK (1 << HI_IRQ)
123 #define GPIO0_MASK (1 << (GPIO0_IRQ-32))
124 #define GPIO1_MASK (1 << (GPIO1_IRQ-32))
125 #define GPIO2_MASK (1 << (GPIO2_IRQ-32))
126 #define SER0_MASK (1 << (SER0_IRQ-32))
127 #define SER1_MASK (1 << (SER1_IRQ-32))
128 #define I2C_MASK (1 << (I2C_IRQ-32))
130 /* Timers */
131 #define TIMER1_CFG (*(volatile unsigned long *)(0x60005000))
132 #define TIMER1_VAL (*(volatile unsigned long *)(0x60005004))
133 #define TIMER2_CFG (*(volatile unsigned long *)(0x60005008))
134 #define TIMER2_VAL (*(volatile unsigned long *)(0x6000500c))
135 #define USEC_TIMER (*(volatile unsigned long *)(0x60005010))
136 #define RTC (*(volatile unsigned long *)(0x60005014))
138 /* Device Controller */
139 #define DEV_RS (*(volatile unsigned long *)(0x60006004))
140 #define DEV_RS2 (*(volatile unsigned long *)(0x60006008))
141 #define DEV_EN (*(volatile unsigned long *)(0x6000600c))
142 #define DEV_EN2 (*(volatile unsigned long *)(0x60006010))
144 #define DEV_EXTCLOCKS 0x00000002
145 #define DEV_SYSTEM 0x00000004
146 #define DEV_USB0 0x00000008
147 #define DEV_SER0 0x00000040
148 #define DEV_SER1 0x00000080
149 #define DEV_I2S 0x00000800
150 #define DEV_I2C 0x00001000
151 #define DEV_ATA 0x00004000
152 #define DEV_OPTO 0x00010000
153 #define DEV_PIEZO 0x00010000
154 #define DEV_PWM 0x00020000
155 #define DEV_USB1 0x00400000
156 #define DEV_FIREWIRE 0x00800000
157 #define DEV_IDE0 0x02000000
158 #define DEV_LCD 0x04000000
160 /* clock control */
161 #define CLOCK_SOURCE (*(volatile unsigned long *)(0x60006020))
162 #define MLCD_SCLK_DIV (*(volatile unsigned long *)(0x6000602c))
163 /* bits 0..1: Mono LCD bridge serial clock divider: 1 / (n+1) */
164 #define PLL_CONTROL (*(volatile unsigned long *)(0x60006034))
165 #define PLL_STATUS (*(volatile unsigned long *)(0x6000603c))
166 #define ADC_CLOCK_SRC (*(volatile unsigned long *)(0x60006094))
167 #define CLCD_CLOCK_SRC (*(volatile unsigned long *)(0x600060a0))
169 /* Processors Control */
170 #define CPU_CTL (*(volatile unsigned long *)(0x60007000))
171 #define COP_CTL (*(volatile unsigned long *)(0x60007004))
172 #define PROC_CTL(core) ((&CPU_CTL)[core])
174 /* Control flags, can be ORed together */
175 #define PROC_SLEEP 0x80000000 /* Sleep until an interrupt occurs */
176 #define PROC_WAIT_CNT 0x40000000 /* Sleep until end of countdown */
177 #define PROC_WAKE_INT 0x20000000 /* Fire interrupt on wake-up. Auto-clears. */
179 /* Counter source, select one */
180 #define PROC_CNT_CLKS 0x08000000 /* Clock cycles */
181 #define PROC_CNT_USEC 0x02000000 /* Microseconds */
182 #define PROC_CNT_MSEC 0x01000000 /* Milliseconds */
183 #define PROC_CNT_SEC 0x00800000 /* Seconds. Works on PP5022+ only! */
185 #define PROC_WAKE 0x00000000
188 * [22:8] - Semaphore flags for core communication? No execution effect observed
189 * [11:8] seem to often be set to the core's own ID
190 * nybble when sleeping - 0x5 or 0xa.
191 * [7:0] - W: number of cycles to skip on next instruction
192 * R: cycles remaining
193 * Executing on CPU
194 * CPU_CTL = 0x68000080
195 * nop
196 * stalls the nop for 128 cycles
197 * Reading CPU_CTL after the nop will return 0x48000000
201 /* Cache Control */
202 #define CACHE_PRIORITY (*(volatile unsigned long *)(0x60006044))
203 #define CACHE_CTL (*(volatile unsigned long *)(0x6000c000))
204 #define CACHE_MASK (*(volatile unsigned long *)(0xf000f040))
205 #define CACHE_OPERATION (*(volatile unsigned long *)(0xf000f044))
206 #define CACHE_FLUSH_MASK (*(volatile unsigned long *)(0xf000f048))
208 /* CACHE_CTL bits */
209 #define CACHE_CTL_DISABLE 0x0000
210 #define CACHE_CTL_ENABLE 0x0001
211 #define CACHE_CTL_RUN 0x0002
212 #define CACHE_CTL_INIT 0x0004
213 #define CACHE_CTL_VECT_REMAP 0x0010
214 #define CACHE_CTL_READY 0x4000
215 #define CACHE_CTL_BUSY 0x8000
216 /* CACHE_OPERATION bits */
217 #define CACHE_OP_FLUSH 0x0002
218 #define CACHE_OP_INVALIDATE 0x0004
220 /* GPIO Ports */
221 #define GPIO_BASE_ADDR 0x6000d000
222 #define GPIOA_ENABLE (*(volatile unsigned long *)(0x6000d000))
223 #define GPIOB_ENABLE (*(volatile unsigned long *)(0x6000d004))
224 #define GPIOC_ENABLE (*(volatile unsigned long *)(0x6000d008))
225 #define GPIOD_ENABLE (*(volatile unsigned long *)(0x6000d00c))
226 #define GPIOA_OUTPUT_EN (*(volatile unsigned long *)(0x6000d010))
227 #define GPIOB_OUTPUT_EN (*(volatile unsigned long *)(0x6000d014))
228 #define GPIOC_OUTPUT_EN (*(volatile unsigned long *)(0x6000d018))
229 #define GPIOD_OUTPUT_EN (*(volatile unsigned long *)(0x6000d01c))
230 #define GPIOA_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d020))
231 #define GPIOB_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d024))
232 #define GPIOC_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d028))
233 #define GPIOD_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d02c))
234 #define GPIOA_INPUT_VAL (*(volatile unsigned long *)(0x6000d030))
235 #define GPIOB_INPUT_VAL (*(volatile unsigned long *)(0x6000d034))
236 #define GPIOC_INPUT_VAL (*(volatile unsigned long *)(0x6000d038))
237 #define GPIOD_INPUT_VAL (*(volatile unsigned long *)(0x6000d03c))
238 #define GPIOA_INT_STAT (*(volatile unsigned long *)(0x6000d040))
239 #define GPIOB_INT_STAT (*(volatile unsigned long *)(0x6000d044))
240 #define GPIOC_INT_STAT (*(volatile unsigned long *)(0x6000d048))
241 #define GPIOD_INT_STAT (*(volatile unsigned long *)(0x6000d04c))
242 #define GPIOA_INT_EN (*(volatile unsigned long *)(0x6000d050))
243 #define GPIOB_INT_EN (*(volatile unsigned long *)(0x6000d054))
244 #define GPIOC_INT_EN (*(volatile unsigned long *)(0x6000d058))
245 #define GPIOD_INT_EN (*(volatile unsigned long *)(0x6000d05c))
246 #define GPIOA_INT_LEV (*(volatile unsigned long *)(0x6000d060))
247 #define GPIOB_INT_LEV (*(volatile unsigned long *)(0x6000d064))
248 #define GPIOC_INT_LEV (*(volatile unsigned long *)(0x6000d068))
249 #define GPIOD_INT_LEV (*(volatile unsigned long *)(0x6000d06c))
250 #define GPIOA_INT_CLR (*(volatile unsigned long *)(0x6000d070))
251 #define GPIOB_INT_CLR (*(volatile unsigned long *)(0x6000d074))
252 #define GPIOC_INT_CLR (*(volatile unsigned long *)(0x6000d078))
253 #define GPIOD_INT_CLR (*(volatile unsigned long *)(0x6000d07c))
255 #define GPIOE_ENABLE (*(volatile unsigned long *)(0x6000d080))
256 #define GPIOF_ENABLE (*(volatile unsigned long *)(0x6000d084))
257 #define GPIOG_ENABLE (*(volatile unsigned long *)(0x6000d088))
258 #define GPIOH_ENABLE (*(volatile unsigned long *)(0x6000d08c))
259 #define GPIOE_OUTPUT_EN (*(volatile unsigned long *)(0x6000d090))
260 #define GPIOF_OUTPUT_EN (*(volatile unsigned long *)(0x6000d094))
261 #define GPIOG_OUTPUT_EN (*(volatile unsigned long *)(0x6000d098))
262 #define GPIOH_OUTPUT_EN (*(volatile unsigned long *)(0x6000d09c))
263 #define GPIOE_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d0a0))
264 #define GPIOF_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d0a4))
265 #define GPIOG_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d0a8))
266 #define GPIOH_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d0ac))
267 #define GPIOE_INPUT_VAL (*(volatile unsigned long *)(0x6000d0b0))
268 #define GPIOF_INPUT_VAL (*(volatile unsigned long *)(0x6000d0b4))
269 #define GPIOG_INPUT_VAL (*(volatile unsigned long *)(0x6000d0b8))
270 #define GPIOH_INPUT_VAL (*(volatile unsigned long *)(0x6000d0bc))
271 #define GPIOE_INT_STAT (*(volatile unsigned long *)(0x6000d0c0))
272 #define GPIOF_INT_STAT (*(volatile unsigned long *)(0x6000d0c4))
273 #define GPIOG_INT_STAT (*(volatile unsigned long *)(0x6000d0c8))
274 #define GPIOH_INT_STAT (*(volatile unsigned long *)(0x6000d0cc))
275 #define GPIOE_INT_EN (*(volatile unsigned long *)(0x6000d0d0))
276 #define GPIOF_INT_EN (*(volatile unsigned long *)(0x6000d0d4))
277 #define GPIOG_INT_EN (*(volatile unsigned long *)(0x6000d0d8))
278 #define GPIOH_INT_EN (*(volatile unsigned long *)(0x6000d0dc))
279 #define GPIOE_INT_LEV (*(volatile unsigned long *)(0x6000d0e0))
280 #define GPIOF_INT_LEV (*(volatile unsigned long *)(0x6000d0e4))
281 #define GPIOG_INT_LEV (*(volatile unsigned long *)(0x6000d0e8))
282 #define GPIOH_INT_LEV (*(volatile unsigned long *)(0x6000d0ec))
283 #define GPIOE_INT_CLR (*(volatile unsigned long *)(0x6000d0f0))
284 #define GPIOF_INT_CLR (*(volatile unsigned long *)(0x6000d0f4))
285 #define GPIOG_INT_CLR (*(volatile unsigned long *)(0x6000d0f8))
286 #define GPIOH_INT_CLR (*(volatile unsigned long *)(0x6000d0fc))
288 #define GPIOI_ENABLE (*(volatile unsigned long *)(0x6000d100))
289 #define GPIOJ_ENABLE (*(volatile unsigned long *)(0x6000d104))
290 #define GPIOK_ENABLE (*(volatile unsigned long *)(0x6000d108))
291 #define GPIOL_ENABLE (*(volatile unsigned long *)(0x6000d10c))
292 #define GPIOI_OUTPUT_EN (*(volatile unsigned long *)(0x6000d110))
293 #define GPIOJ_OUTPUT_EN (*(volatile unsigned long *)(0x6000d114))
294 #define GPIOK_OUTPUT_EN (*(volatile unsigned long *)(0x6000d118))
295 #define GPIOL_OUTPUT_EN (*(volatile unsigned long *)(0x6000d11c))
296 #define GPIOI_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d120))
297 #define GPIOJ_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d124))
298 #define GPIOK_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d128))
299 #define GPIOL_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d12c))
300 #define GPIOI_INPUT_VAL (*(volatile unsigned long *)(0x6000d130))
301 #define GPIOJ_INPUT_VAL (*(volatile unsigned long *)(0x6000d134))
302 #define GPIOK_INPUT_VAL (*(volatile unsigned long *)(0x6000d138))
303 #define GPIOL_INPUT_VAL (*(volatile unsigned long *)(0x6000d13c))
304 #define GPIOI_INT_STAT (*(volatile unsigned long *)(0x6000d140))
305 #define GPIOJ_INT_STAT (*(volatile unsigned long *)(0x6000d144))
306 #define GPIOK_INT_STAT (*(volatile unsigned long *)(0x6000d148))
307 #define GPIOL_INT_STAT (*(volatile unsigned long *)(0x6000d14c))
308 #define GPIOI_INT_EN (*(volatile unsigned long *)(0x6000d150))
309 #define GPIOJ_INT_EN (*(volatile unsigned long *)(0x6000d154))
310 #define GPIOK_INT_EN (*(volatile unsigned long *)(0x6000d158))
311 #define GPIOL_INT_EN (*(volatile unsigned long *)(0x6000d15c))
312 #define GPIOI_INT_LEV (*(volatile unsigned long *)(0x6000d160))
313 #define GPIOJ_INT_LEV (*(volatile unsigned long *)(0x6000d164))
314 #define GPIOK_INT_LEV (*(volatile unsigned long *)(0x6000d168))
315 #define GPIOL_INT_LEV (*(volatile unsigned long *)(0x6000d16c))
316 #define GPIOI_INT_CLR (*(volatile unsigned long *)(0x6000d170))
317 #define GPIOJ_INT_CLR (*(volatile unsigned long *)(0x6000d174))
318 #define GPIOK_INT_CLR (*(volatile unsigned long *)(0x6000d178))
319 #define GPIOL_INT_CLR (*(volatile unsigned long *)(0x6000d17c))
321 /* Standard GPIO addresses + 0x800 allow atomic port manipulation on PP502x.
322 * Bits 8..15 of the written word define which bits are changed, bits 0..7
323 * define the value of those bits. */
325 #define GPIO_SET_BITWISE(port, mask) \
326 do { *(&(port) + (0x800/sizeof(long))) = ((mask) << 8) | (mask); } while(0)
328 #define GPIO_CLEAR_BITWISE(port, mask) \
329 do { *(&(port) + (0x800/sizeof(long))) = (mask) << 8; } while(0)
331 #define GPIO_WRITE_BITWISE(port, val, mask) \
332 do { *(&(port) + (0x800/sizeof(long))) = ((mask) << 8) | (val); } while(0)
334 /* GPIO Module 0 */
335 #define GPIOA 0
336 #define GPIOB 1
337 #define GPIOC 2
338 #define GPIOD 3
339 /* GPIO Module 1 */
340 #define GPIOE 4
341 #define GPIOF 5
342 #define GPIOG 6
343 #define GPIOH 7
344 /* GPIO Module 2 */
345 #define GPIOI 8
346 #define GPIOJ 9
347 #define GPIOK 10
348 #define GPIOL 11
350 #define GPIO_MODULE_NUM(gpio) ((gpio)>>2)
351 #define GPIO_MAP_ADDR(gpio) (GPIO_BASE_ADDR+(GPIO_MODULE_NUM(gpio)<<7)+(((gpio)&3)<<2))
352 #define GPIO_ENABLE(gpio) (*(volatile unsigned long *)(GPIO_MAP_ADDR(gpio)+0x00))
353 #define GPIO_OUTPUT_EN(gpio) (*(volatile unsigned long *)(GPIO_MAP_ADDR(gpio)+0x10))
354 #define GPIO_OUTPUT_VAL(gpio) (*(volatile unsigned long *)(GPIO_MAP_ADDR(gpio)+0x20))
355 #define GPIO_INPUT_VAL(gpio) (*(volatile unsigned long *)(GPIO_MAP_ADDR(gpio)+0x30))
356 #define GPIO_INT_STAT(gpio) (*(volatile unsigned long *)(GPIO_MAP_ADDR(gpio)+0x40))
357 #define GPIO_INT_EN(gpio) (*(volatile unsigned long *)(GPIO_MAP_ADDR(gpio)+0x50))
358 #define GPIO_INT_LEV(gpio) (*(volatile unsigned long *)(GPIO_MAP_ADDR(gpio)+0x60))
359 #define GPIO_INT_CLR(gpio) (*(volatile unsigned long *)(GPIO_MAP_ADDR(gpio)+0x70))
360 #define GPIO_HI_INT_MASK(gpio) (1ul << GPIO_MODULE_NUM(gpio))
362 /* Device initialization */
363 #define PP_VER1 (*(volatile unsigned long *)(0x70000000))
364 #define PP_VER2 (*(volatile unsigned long *)(0x70000004))
365 #define STRAP_OPT_A (*(volatile unsigned long *)(0x70000008))
366 #define STRAP_OPT_B (*(volatile unsigned long *)(0x7000000c))
367 #define BUS_WIDTH_MASK 0x00000010
368 #define RAM_TYPE_MASK 0x000000c0
369 #define ROM_TYPE_MASK 0x00000008
371 #define DEV_INIT1 (*(volatile unsigned long *)(0x70000010))
372 #define DEV_INIT2 (*(volatile unsigned long *)(0x70000020))
373 /* some timing that needs to be handled during clock setup */
374 #define DEV_TIMING1 (*(volatile unsigned long *)(0x70000034))
375 #define XMB_NOR_CFG (*(volatile unsigned long *)(0x70000038))
376 #define XMB_RAM_CFG (*(volatile unsigned long *)(0x7000003c))
378 #define INIT_BUTTONS 0x00040000
379 #define INIT_PLL 0x40000000
380 #define INIT_USB 0x80000000
382 /* 32 bit GPO port */
383 #define GPO32_VAL (*(volatile unsigned long *)(0x70000080))
384 #define GPO32_ENABLE (*(volatile unsigned long *)(0x70000084))
386 /* IIS */
387 #define IISDIV (*(volatile unsigned long*)(0x60006080))
388 #define IISCONFIG (*(volatile unsigned long*)(0x70002800))
389 #define IISCLK (*(volatile unsigned long*)(0x70002808))
390 #define IISFIFO_CFG (*(volatile unsigned long*)(0x7000280c))
391 #define IISFIFO_WR (*(volatile unsigned long*)(0x70002840))
392 #define IISFIFO_WRH (*(volatile unsigned short*)(0x70002840))
393 #define IISFIFO_RD (*(volatile unsigned long*)(0x70002880))
394 #define IISFIFO_RDH (*(volatile unsigned short*)(0x70002880))
397 * IISCONFIG bits:
398 * | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
399 * | RESET | |TXFIFOEN|RXFIFOEN| | ???? | MS | ???? |
400 * | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
401 * | | | | | | | | |
402 * | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
403 * | | | | | Bus Format[1:0] | Size[1:0] |
404 * | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
405 * | | Size Format[2:0] | ???? | ???? | IRQTX | IRQRX |
408 /* All IIS formats send MSB first */
409 #define IIS_RESET (1 << 31)
410 #define IIS_TXFIFOEN (1 << 29)
411 #define IIS_RXFIFOEN (1 << 28)
412 #define IIS_MASTER (1 << 25)
413 #define IIS_IRQTX (1 << 1)
414 #define IIS_IRQRX (1 << 0)
416 #define IIS_IRQTX_REG IISCONFIG
417 #define IIS_IRQRX_REG IISCONFIG
419 /* Data format on the IIS bus */
420 #define IIS_FORMAT_MASK (0x3 << 10)
421 #define IIS_FORMAT_IIS (0x0 << 10) /* Standard IIS - leading dummy bit */
422 #define IIS_FORMAT_1 (0x1 << 10)
423 #define IIS_FORMAT_LJUST (0x2 << 10) /* Left justified - no dummy bit */
424 #define IIS_FORMAT_3 (0x3 << 10)
425 /* Other formats not yet known */
427 /* Data size on IIS bus */
428 #define IIS_SIZE_MASK (0x3 << 8)
429 #define IIS_SIZE_16BIT (0x0 << 8)
430 /* Other sizes not yet known */
432 /* Data size/format on IIS FIFO */
433 #define IIS_FIFO_FORMAT_MASK (0x7 << 4)
434 #define IIS_FIFO_FORMAT_LE_HALFWORD (0x0 << 4)
435 /* Big-endian formats - data sent to the FIFO must be big endian.
436 * I forgot which is which size but did test them. */
437 #define IIS_FIFO_FORMAT_1 (0x1 << 4)
438 #define IIS_FIFO_FORMAT_2 (0x2 << 4)
439 /* 32bit-MSB-little endian */
440 #define IIS_FIFO_FORMAT_LE32 (0x3 << 4)
441 /* 16bit-MSB-little endian */
442 #define IIS_FIFO_FORMAT_LE16 (0x4 << 4)
443 #define IIS_FIFO_FORMAT_5 (0x5 << 4)
444 #define IIS_FIFO_FORMAT_6 (0x6 << 4)
445 /* A second one like IIS_FIFO_FORMAT_LE16? PP5020 only? */
446 #define IIS_FIFO_FORMAT_LE16_2 (0x7 << 4)
448 /* FIFO formats 0x5 and above seem equivalent to 0x4 ?? */
451 * IISFIFO_CFG bits:
452 * | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
453 * | | | RXFull[5:0] |
454 * | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
455 * | | | TXFree[5:0] |
456 * | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
457 * | | | | RXCLR | | | | TXCLR |
458 * | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
459 * | | | RX_FULL_LVL | | | TX_EMPTY_LVL |
462 /* handy macros to extract the FIFO counts */
463 #define IIS_RX_FULL_MASK (0x3f << 24)
464 #define IIS_RX_FULL_COUNT \
465 ((IISFIFO_CFG & IIS_RX_FULL_MASK) >> 24)
467 #define IIS_TX_FREE_MASK (0x3f << 16)
468 #define IIS_TX_FREE_COUNT \
469 ((IISFIFO_CFG & IIS_TX_FREE_MASK) >> 16)
471 #define IIS_TX_IS_EMPTY \
472 ((IISFIFO_CFG & IIS_TX_FREE_MASK) >= (16 << 16))
474 #define IIS_RXCLR (1 << 12)
475 #define IIS_TXCLR (1 << 8)
476 /* Number of slots */
477 #define IIS_RX_FULL_LVL_4 (0x1 << 4)
478 #define IIS_RX_FULL_LVL_8 (0x2 << 4)
479 #define IIS_RX_FULL_LVL_12 (0x3 << 4)
481 #define IIS_TX_EMPTY_LVL_4 (0x1 << 0)
482 #define IIS_TX_EMPTY_LVL_8 (0x2 << 0)
483 #define IIS_TX_EMPTY_LVL_12 (0x3 << 0)
485 /* Note: didn't bother to see of levels 0 and 16 actually work */
487 /* First ("mono") LCD bridge */
488 #define LCD1_BASE 0x70003000
490 #define LCD1_CONTROL (*(volatile unsigned long *)(0x70003000))
491 #define LCD1_CMD (*(volatile unsigned long *)(0x70003008))
492 #define LCD1_DATA (*(volatile unsigned long *)(0x70003010))
494 #define LCD1_BUSY_MASK 0x8000
496 /* Serial Controller */
497 #define SER0_BASE (*(volatile unsigned long*)(0x70006000))
499 #define SER0_RBR (*(volatile unsigned long*)(0x70006000))
500 #define SER0_THR (*(volatile unsigned long*)(0x70006000))
501 #define SER0_IER (*(volatile unsigned long*)(0x70006004))
502 #define SER0_FCR (*(volatile unsigned long*)(0x70006008))
503 #define SER0_IIR (*(volatile unsigned long*)(0x70006008))
504 #define SER0_LCR (*(volatile unsigned long*)(0x7000600c))
505 #define SER0_MCR (*(volatile unsigned long*)(0x70006010))
506 #define SER0_LSR (*(volatile unsigned long*)(0x70006014))
507 #define SER0_MSR (*(volatile unsigned long*)(0x70006018))
508 #define SER0_SPR (*(volatile unsigned long*)(0x7000601c))
510 #define SER0_DLL (*(volatile unsigned long*)(0x70006000))
511 #define SER0_DLM (*(volatile unsigned long*)(0x70006004))
513 #define SER1_BASE (*(volatile unsigned long*)(0x70006040))
515 #define SER1_RBR (*(volatile unsigned long*)(0x70006040))
516 #define SER1_THR (*(volatile unsigned long*)(0x70006040))
517 #define SER1_IER (*(volatile unsigned long*)(0x70006044))
518 #define SER1_FCR (*(volatile unsigned long*)(0x70006048))
519 #define SER1_IIR (*(volatile unsigned long*)(0x70006048))
520 #define SER1_LCR (*(volatile unsigned long*)(0x7000604c))
521 #define SER1_MCR (*(volatile unsigned long*)(0x70006050))
522 #define SER1_LSR (*(volatile unsigned long*)(0x70006054))
523 #define SER1_MSR (*(volatile unsigned long*)(0x70006058))
524 #define SER1_SPR (*(volatile unsigned long*)(0x7000605c))
526 #define SER1_DLL (*(volatile unsigned long*)(0x70006040))
527 #define SER1_DLM (*(volatile unsigned long*)(0x70006044))
529 /* Second ("color") LCD bridge */
530 #define LCD2_BASE 0x70008a00
532 #define LCD2_PORT (*(volatile unsigned long*)(0x70008a0c))
533 #define LCD2_BLOCK_CTRL (*(volatile unsigned long*)(0x70008a20))
534 #define LCD2_BLOCK_CONFIG (*(volatile unsigned long*)(0x70008a24))
535 #define LCD2_BLOCK_DATA (*(volatile unsigned long*)(0x70008b00))
537 #define LCD2_BUSY_MASK 0x80000000
538 #define LCD2_CMD_MASK 0x80000000
539 #define LCD2_DATA_MASK 0x81000000
541 #define LCD2_BLOCK_READY 0x04000000
542 #define LCD2_BLOCK_TXOK 0x01000000
544 /* I2C */
545 #define I2C_BASE 0x7000c000
547 /* EIDE Controller */
548 #define IDE_BASE 0xc3000000
550 #define IDE0_PRI_TIMING0 (*(volatile unsigned long*)(0xc3000000))
551 #define IDE0_PRI_TIMING1 (*(volatile unsigned long*)(0xc3000004))
552 #define IDE0_SEC_TIMING0 (*(volatile unsigned long*)(0xc3000008))
553 #define IDE0_SEC_TIMING1 (*(volatile unsigned long*)(0xc300000c))
555 #define IDE1_PRI_TIMING0 (*(volatile unsigned long*)(0xc3000010))
556 #define IDE1_PRI_TIMING1 (*(volatile unsigned long*)(0xc3000014))
557 #define IDE1_SEC_TIMING0 (*(volatile unsigned long*)(0xc3000018))
558 #define IDE1_SEC_TIMING1 (*(volatile unsigned long*)(0xc300001c))
560 #define IDE0_CFG (*(volatile unsigned long*)(0xc3000028))
561 #define IDE1_CFG (*(volatile unsigned long*)(0xc300002c))
563 #define IDE0_CNTRLR_STAT (*(volatile unsigned long*)(0xc30001e0))
565 /* USB controller */
566 #define USB_BASE 0xc5000000
568 /* Firewire Controller */
569 #define FIREWIRE_BASE 0xc6000000
571 /* Memory controller */
572 #define CACHE_BASE (*(volatile unsigned long*)(0xf0000000))
573 /* 0xf0000000-0xf0001fff */
574 #define CACHE_DATA_BASE (*(volatile unsigned long*)(0xf0000000))
575 /* 0xf0002000-0xf0003fff */
576 #define CACHE_DATA_MIRROR_BASE (*(volatile unsigned long*)(0xf0002000))
577 /* 0xf0004000-0xf0007fff */
578 #define CACHE_STATUS_BASE (*(volatile unsigned long*)(0xf0004000))
579 #define CACHE_FLUSH_BASE (*(volatile unsigned long*)(0xf0008000))
580 #define CACHE_INVALID_BASE (*(volatile unsigned long*)(0xf000c000))
581 #define MMAP_PHYS_READ_MASK 0x0100
582 #define MMAP_PHYS_WRITE_MASK 0x0200
583 #define MMAP_PHYS_DATA_MASK 0x0400
584 #define MMAP_PHYS_CODE_MASK 0x0800
585 #define MMAP_FIRST (*(volatile unsigned long*)(0xf000f000))
586 #define MMAP_LAST (*(volatile unsigned long*)(0xf000f03c))
587 #define MMAP0_LOGICAL (*(volatile unsigned long*)(0xf000f000))
588 #define MMAP0_PHYSICAL (*(volatile unsigned long*)(0xf000f004))
589 #define MMAP1_LOGICAL (*(volatile unsigned long*)(0xf000f008))
590 #define MMAP1_PHYSICAL (*(volatile unsigned long*)(0xf000f00c))
591 #define MMAP2_LOGICAL (*(volatile unsigned long*)(0xf000f010))
592 #define MMAP2_PHYSICAL (*(volatile unsigned long*)(0xf000f014))
593 #define MMAP3_LOGICAL (*(volatile unsigned long*)(0xf000f018))
594 #define MMAP3_PHYSICAL (*(volatile unsigned long*)(0xf000f01c))
595 #define MMAP4_LOGICAL (*(volatile unsigned long*)(0xf000f020))
596 #define MMAP4_PHYSICAL (*(volatile unsigned long*)(0xf000f024))
597 #define MMAP5_LOGICAL (*(volatile unsigned long*)(0xf000f028))
598 #define MMAP5_PHYSICAL (*(volatile unsigned long*)(0xf000f02c))
599 #define MMAP6_LOGICAL (*(volatile unsigned long*)(0xf000f030))
600 #define MMAP6_PHYSICAL (*(volatile unsigned long*)(0xf000f034))
601 #define MMAP7_LOGICAL (*(volatile unsigned long*)(0xf000f038))
602 #define MMAP7_PHYSICAL (*(volatile unsigned long*)(0xf000f03c))
604 #endif /* __PP5020_H__ */