1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 ****************************************************************************/
24 /* Much info gleaned and/or copied from the iPodLinux project. */
26 #define CACHEALIGN_BITS (4) /* 2^4 = 16 bytes */
28 #define DRAM_START 0x28000000
31 #define LCD1_BASE 0xc0001000
33 #define LCD1_CONTROL (*(volatile unsigned long *)(0xc0001000))
34 #define LCD1_CMD (*(volatile unsigned long *)(0xc0001008))
35 #define LCD1_DATA (*(volatile unsigned long *)(0xc0001010))
37 #define LCD1_BUSY_MASK 0x8000
41 /* FIFO slot bits 7-0 are not implemented and so use of packed samples
42 * appears to be impossible. */
43 #define IISCONFIG (*(volatile unsigned long *)(0xc0002500))
44 #define IISFIFO_CFG (*(volatile unsigned long *)(0xc000251c))
45 #define IISFIFO_WR (*(volatile unsigned long *)(0xc0002540))
46 #define IISFIFO_RD (*(volatile unsigned long *)(0xc0002580))
50 * | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
52 * | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
54 * | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
56 * | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
57 * | rw | rw | rw | MS | rw |TXFENB# | rw | ENB |
59 * # No effect observed on iPod 3g
61 #define IIS_ENABLE (1 << 0)
62 #define IIS_TXFIFOEN (1 << 2)
63 #define IIS_MASTER (1 << 4)
67 * | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
68 * | | RXFull[3:0]$ | TXFree[3:1] >
69 * | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
70 * >TXFre[0]| | | | | | RXCLR | TXCLR |
71 * | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
72 * | rw | rw | rw | rw | rw | rw | IRQTX | rw |
73 * | 7* | 6* | 5* | 4* | 3 | 2 | 1 | 0 |
74 * |RXEMPTY | RXSAFE | RXDNGR | RXFULL | TXFULL | TXSAFE | TXDNGR |TXEMPTY |
77 * *Meaning isn't certain yet.
78 * More concerted recording work will reveal.
80 #define IIS_IRQTX_REG IISFIFO_CFG
81 #define IIS_IRQRX_REG IISFIFO_CFG
83 #define IIS_RX_FULL_MASK (0xf << 27)
84 #define IIS_RX_FULL_COUNT ((IISFIFO_CFG & IIS_RX_FULL_MASK) >> 27)
85 #define IIS_TX_FREE_MASK (0xf << 23) /* 0xf = 16 or 15 free */
86 #define IIS_TX_FREE_COUNT ((IISFIFO_CFG & IIS_TX_FREE_MASK) >> 23)
87 #define IIS_TX_IS_EMPTY ((IISFIFO_CFG & IIS_TXEMPTY) != 0)
89 #define IIS_RXCLR (1 << 17) /* Resets *could* be reversed */
90 #define IIS_TXCLR (1 << 16)
91 #define IIS_IRQTX (1 << 9)
92 #define IIS_TXFULL (1 << 3) /* All slots occupied */
93 #define IIS_TXSAFE (1 << 2) /* FIFO >= 3/4 full */
94 #define IIS_TXDANGER (1 << 1) /* FIFO <= 1/4 full */
95 #define IIS_TXEMPTY (1 << 0) /* No samples in FIFO */
97 #define IIS_RXEMPTY (1 << 4) /* FIFO is empty */
99 #define IDE_BASE 0xc0003000
101 #define IDE_CFG_STATUS (*(volatile unsigned long *)(0xc0003024))
103 #define USB_BASE 0xc0005000
105 #define I2C_BASE 0xc0008000
108 #define PROCESSOR_ID (*(volatile unsigned long *)(0xc4000000))
110 #define PROC_ID_CPU 0x55
111 #define PROC_ID_COP 0xaa
113 #define GPIOA_ENABLE (*(volatile unsigned char *)(0xcf000000))
114 #define GPIOB_ENABLE (*(volatile unsigned char *)(0xcf000004))
115 #define GPIOC_ENABLE (*(volatile unsigned char *)(0xcf000008))
116 #define GPIOD_ENABLE (*(volatile unsigned char *)(0xcf00000c))
117 #define GPIOA_OUTPUT_EN (*(volatile unsigned char *)(0xcf000010))
118 #define GPIOB_OUTPUT_EN (*(volatile unsigned char *)(0xcf000014))
119 #define GPIOC_OUTPUT_EN (*(volatile unsigned char *)(0xcf000018))
120 #define GPIOD_OUTPUT_EN (*(volatile unsigned char *)(0xcf00001c))
121 #define GPIOA_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000020))
122 #define GPIOB_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000024))
123 #define GPIOC_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000028))
124 #define GPIOD_OUTPUT_VAL (*(volatile unsigned char *)(0xcf00002c))
125 #define GPIOA_INPUT_VAL (*(volatile unsigned char *)(0xcf000030))
126 #define GPIOB_INPUT_VAL (*(volatile unsigned char *)(0xcf000034))
127 #define GPIOC_INPUT_VAL (*(volatile unsigned char *)(0xcf000038))
128 #define GPIOD_INPUT_VAL (*(volatile unsigned char *)(0xcf00003c))
129 #define GPIOA_INT_STAT (*(volatile unsigned char *)(0xcf000040))
130 #define GPIOB_INT_STAT (*(volatile unsigned char *)(0xcf000044))
131 #define GPIOC_INT_STAT (*(volatile unsigned char *)(0xcf000048))
132 #define GPIOD_INT_STAT (*(volatile unsigned char *)(0xcf00004c))
133 #define GPIOA_INT_EN (*(volatile unsigned char *)(0xcf000050))
134 #define GPIOB_INT_EN (*(volatile unsigned char *)(0xcf000054))
135 #define GPIOC_INT_EN (*(volatile unsigned char *)(0xcf000058))
136 #define GPIOD_INT_EN (*(volatile unsigned char *)(0xcf00005c))
137 #define GPIOA_INT_LEV (*(volatile unsigned char *)(0xcf000060))
138 #define GPIOB_INT_LEV (*(volatile unsigned char *)(0xcf000064))
139 #define GPIOC_INT_LEV (*(volatile unsigned char *)(0xcf000068))
140 #define GPIOD_INT_LEV (*(volatile unsigned char *)(0xcf00006c))
141 #define GPIOA_INT_CLR (*(volatile unsigned char *)(0xcf000070))
142 #define GPIOB_INT_CLR (*(volatile unsigned char *)(0xcf000074))
143 #define GPIOC_INT_CLR (*(volatile unsigned char *)(0xcf000078))
144 #define GPIOD_INT_CLR (*(volatile unsigned char *)(0xcf00007c))
146 #define CPU_INT_STAT (*(volatile unsigned long *)(0xcf001000))
147 #define COP_INT_STAT (*(volatile unsigned long *)(0xcf001004))
148 #define CPU_FIQ_STAT (*(volatile unsigned long *)(0xcf001008))
149 #define COP_FIQ_STAT (*(volatile unsigned long *)(0xcf00100c))
151 #define INT_STAT (*(volatile unsigned long *)(0xcf001010))
152 #define INT_FORCED_STAT (*(volatile unsigned long *)(0xcf001014))
153 #define INT_FORCED_SET (*(volatile unsigned long *)(0xcf001018))
154 #define INT_FORCED_CLR (*(volatile unsigned long *)(0xcf00101c))
156 #define CPU_INT_EN_STAT (*(volatile unsigned long *)(0xcf001020))
157 #define CPU_INT_EN (*(volatile unsigned long *)(0xcf001024))
158 #define CPU_INT_DIS (*(volatile unsigned long *)(0xcf001028))
159 #define CPU_INT_PRIORITY (*(volatile unsigned long *)(0xcf00102c))
161 #define COP_INT_EN_STAT (*(volatile unsigned long *)(0xcf001030))
162 #define COP_INT_EN (*(volatile unsigned long *)(0xcf001034))
163 #define COP_INT_DIS (*(volatile unsigned long *)(0xcf001038))
164 #define COP_INT_PRIORITY (*(volatile unsigned long *)(0xcf00103c))
170 #define TIMER1_IRQ 11
171 #define TIMER2_IRQ 12
173 #define DMA_OUT_IRQ 30
174 #define DMA_IN_IRQ 31
176 #define IDE_MASK (1 << IDE_IRQ)
177 #define SER0_MASK (1 << SER0_IRQ)
178 #define I2S_MASK (1 << I2S_IRQ)
179 #define SER1_MASK (1 << SER1_IRQ)
180 #define TIMER1_MASK (1 << TIMER1_IRQ)
181 #define TIMER2_MASK (1 << TIMER2_IRQ)
182 #define GPIO_MASK (1 << GPIO_IRQ)
183 #define DMA_OUT_MASK (1 << DMA_OUT_IRQ)
184 #define DMA_IN_MASK (1 << DMA_IN_IRQ)
186 /* Yes, there is I2S_MASK but this cleans up the pcm code */
187 #define IIS_MASK DMA_OUT_MASK
189 #define TIMER1_CFG (*(volatile unsigned long *)(0xcf001100))
190 #define TIMER1_VAL (*(volatile unsigned long *)(0xcf001104))
191 #define TIMER2_CFG (*(volatile unsigned long *)(0xcf001108))
192 #define TIMER2_VAL (*(volatile unsigned long *)(0xcf00110c))
194 #define USEC_TIMER (*(volatile unsigned long *)(0xcf001110))
196 #define TIMING1_CTL (*(volatile unsigned long *)(0xcf004000))
197 #define TIMING2_CTL (*(volatile unsigned long *)(0xcf004008))
199 #define PP_VER1 (*(volatile unsigned long *)(0xcf004030))
200 #define PP_VER2 (*(volatile unsigned long *)(0xcf004034))
201 #define PP_VER3 (*(volatile unsigned long *)(0xcf004038))
202 #define PP_VER4 (*(volatile unsigned long *)(0xcf00403c))
204 /* Processors Control */
205 #define PROC_STAT (*(volatile unsigned long *)(0xcf004050))
206 #define CPU_CTL (*(volatile unsigned char *)(0xcf004054))
207 #define COP_CTL (*(volatile unsigned char *)(0xcf004058))
209 #define CPU_SLEEPING 0x8000
210 #define COP_SLEEPING 0x4000
211 #define PROC_SLEEPING(core) (0x8000 >> (core))
213 #define PROC_CTL(core) ((&CPU_CTL)[(core)*4])
215 #define PROC_SLEEP 0xca
216 #define PROC_WAKE 0xce
219 #define CACHE_CTL (*(volatile unsigned long *)(0xcf004024))
220 #define CACHE_CTL_DISABLE 0x0
221 #define CACHE_CTL_RUN 0x1
222 #define CACHE_CTL_INIT 0x2
224 #define CACHE_MASK (*(volatile unsigned long *)(0xf000f020))
225 #define CACHE_OPERATION (*(volatile unsigned long *)(0xf000f024))
226 #define CACHE_FLUSH_BASE (*(volatile unsigned long *)(0xf000c000))
227 #define CACHE_INVALIDATE_BASE (*(volatile unsigned long *)(0xf0004000))
228 #define CACHE_SIZE 0x2000 /* PP5002 has 8KB cache */
230 #define CACHE_OP_UNKNOWN1 (1<<11) /* 0x800 */
232 #define DEV_EN (*(volatile unsigned long *)(0xcf005000))
233 #define DEV_RS (*(volatile unsigned long *)(0xcf005030))
235 #define DEV_I2C (1<<8)
236 #define DEV_I2S (1<<7)
237 #define DEV_USB 0x400000
239 #define CLOCK_ENABLE (*(volatile unsigned long *)(0xcf005008))
240 #define CLOCK_SOURCE (*(volatile unsigned long *)(0xcf00500c))
241 #define PLL_CONTROL (*(volatile unsigned long *)(0xcf005010))
242 #define PLL_DIV (*(volatile unsigned long *)(0xcf005018))
243 #define PLL_MULT (*(volatile unsigned long *)(0xcf00501c))
244 #define PLL_UNLOCK (*(volatile unsigned long *)(0xcf005038))
246 #define MMAP_FIRST (*(volatile unsigned long *)(0xf000f000))
247 #define MMAP_LAST (*(volatile unsigned long *)(0xf000f01c))
248 #define MMAP0_LOGICAL (*(volatile unsigned long *)(0xf000f000))
249 #define MMAP0_PHYSICAL (*(volatile unsigned long *)(0xf000f004))
250 #define MMAP1_LOGICAL (*(volatile unsigned long *)(0xf000f008))
251 #define MMAP1_PHYSICAL (*(volatile unsigned long *)(0xf000f00c))
252 #define MMAP2_LOGICAL (*(volatile unsigned long *)(0xf000f010))
253 #define MMAP2_PHYSICAL (*(volatile unsigned long *)(0xf000f014))
254 #define MMAP3_LOGICAL (*(volatile unsigned long *)(0xf000f018))
255 #define MMAP3_PHYSICAL (*(volatile unsigned long *)(0xf000f01c))
257 /* Timer frequency */
258 /* Portalplayer chips use a microsecond timer. */
259 #define TIMER_FREQ 1000000