1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 Dave Chapman
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 #define CACHEALIGN_BITS (5)
26 /* General-purpose IO */
28 #define GPIOA (*(volatile unsigned long *)0x80000300)
29 #define GPIOB (*(volatile unsigned long *)0x80000310)
30 #define GPIOC (*(volatile unsigned long *)0x80000320)
31 #define GPIOD (*(volatile unsigned long *)0x80000330)
32 #define GPIOE (*(volatile unsigned long *)0x80000340)
34 #define GPIOA_DIR (*(volatile unsigned long *)0x80000304)
35 #define GPIOB_DIR (*(volatile unsigned long *)0x80000314)
36 #define GPIOC_DIR (*(volatile unsigned long *)0x80000324)
37 #define GPIOD_DIR (*(volatile unsigned long *)0x80000334)
38 #define GPIOE_DIR (*(volatile unsigned long *)0x80000344)
40 #define GPIOA_FUNC (*(volatile unsigned long *)0x80000308)
41 #define GPIOB_FUNC (*(volatile unsigned long *)0x80000318)
42 #define GPIOC_FUNC (*(volatile unsigned long *)0x80000328)
43 #define GPIOD_FUNC (*(volatile unsigned long *)0x80000338)
44 #define GPIOE_FUNC (*(volatile unsigned long *)0x80000348)
46 #define BMI (*(volatile unsigned long *)0x80000364)
50 #define CLKCTRL (*(volatile unsigned long *)0x80000400)
51 #define PLL0CFG (*(volatile unsigned long *)0x80000404)
52 #define CLKDIVC (*(volatile unsigned long *)0x8000040c)
53 #define MODECTR (*(volatile unsigned long *)0x80000410)
54 #define BCLKCTR (*(volatile unsigned long *)0x80000414)
55 #define SWRESET (*(volatile unsigned long *)0x80000418)
56 #define PCLKCFG0 (*(volatile unsigned long *)0x8000041c)
57 #define PCLKCFG1 (*(volatile unsigned long *)0x80000420)
58 #define PCLKCFG2 (*(volatile unsigned long *)0x80000424)
59 #define PCLKCFG3 (*(volatile unsigned long *)0x80000428)
60 #define PCLKCFG4 (*(volatile unsigned long *)0x8000042c)
61 #define PCLKCFG5 (*(volatile unsigned long *)0x80000430)
62 #define PCLKCFG6 (*(volatile unsigned long *)0x80000434)
64 #define PCLK_DAI PCLKCFG6
66 /* Device bits for SWRESET & BCLKCTR */
68 #define DEV_DAI (1<<0)
69 #define DEV_USBD (1<<4)
70 #define DEV_ECC (1<<9)
71 #define DEV_NAND (1<<16)
75 #define ADCCON (*(volatile unsigned long *)0x80000a00)
76 #define ADCDATA (*(volatile unsigned long *)0x80000a04)
77 #define ADCCONA (*(volatile unsigned long *)0x80000a80)
78 #define ADCSTATUS (*(volatile unsigned long *)0x80000a84)
79 #define ADCCFG (*(volatile unsigned long *)0x80000a88)
82 /* Memory Controller */
83 #define SDCFG (*(volatile unsigned long *)0xf0000000)
84 #define SDFSM (*(volatile unsigned long *)0xf0000004)
85 #define MCFG (*(volatile unsigned long *)0xf0000008)
86 #define TST (*(volatile unsigned long *)0xf000000c)
87 #define CSCFG0 (*(volatile unsigned long *)0xf0000010)
88 #define CSCFG1 (*(volatile unsigned long *)0xf0000014)
89 #define CSCFG2 (*(volatile unsigned long *)0xf0000018)
90 #define CSCFG3 (*(volatile unsigned long *)0xf000001c)
91 #define CLKCFG (*(volatile unsigned long *)0xf0000020)
92 #define SDCMD (*(volatile unsigned long *)0xf0000024)
96 #define EXT0_IRQ_MASK (1<<0)
97 #define EXT1_IRQ_MASK (1<<1)
98 #define EXT2_IRQ_MASK (1<<2)
99 #define EXT3_IRQ_MASK (1<<3)
100 #define I2SR_IRQ_MASK (1<<4)
101 #define I2ST_IRQ_MASK (1<<5)
102 #define TIMER0_IRQ_MASK (1<<6)
103 #define USBD_IRQ_MASK (1<<8) /* USB 2.0 device */
104 #define USBH_IRQ_MASK (1<<10) /* USB 1.1 host */
105 #define ADC_IRQ_MASK (1<<16)
106 #define USB_DMA_IRQ_MASK (1<<26) /* USB DMA */
107 #define ECC_IRQ_MASK (1<<27)
109 #define DAI_RX_IRQ_MASK I2SR_IRQ_MASK
110 #define DAI_TX_IRQ_MASK I2ST_IRQ_MASK
112 #define USB_DMA_IRQ_MASK (1<<26) /* USB DMA */
114 #define IEN (*(volatile unsigned long *)0x80000100)
115 #define CREQ (*(volatile unsigned long *)0x80000104)
116 #define IREQ (*(volatile unsigned long *)0x80000108)
117 #define IRQSEL (*(volatile unsigned long *)0x8000010c)
118 #define ICFG (*(volatile unsigned long *)0x80000110)
119 #define MREQ (*(volatile unsigned long *)0x80000114)
120 #define TSTREQ (*(volatile unsigned long *)0x80000118)
121 #define IRQ (*(volatile unsigned long *)0x80000120)
122 #define FIQ (*(volatile unsigned long *)0x80000124)
123 #define MIRQ (*(volatile unsigned long *)0x80000128)
124 #define MFIQ (*(volatile unsigned long *)0x8000012c)
125 #define TMODE (*(volatile unsigned long *)0x80000130)
126 #define SYNC (*(volatile unsigned long *)0x80000134)
127 #define WKUP (*(volatile unsigned long *)0x80000138)
129 /* Timer Controller */
131 #define TCFG0 (*(volatile unsigned long *)0x80000200)
132 #define TCNT0 (*(volatile unsigned long *)0x80000204)
133 #define TREF0 (*(volatile unsigned long *)0x80000208)
134 #define TMREF0 (*(volatile unsigned long *)0x8000020c)
135 #define TCFG1 (*(volatile unsigned long *)0x80000210)
136 #define TCNT1 (*(volatile unsigned long *)0x80000214)
137 #define TREF1 (*(volatile unsigned long *)0x80000218)
138 #define TMREF1 (*(volatile unsigned long *)0x8000021c)
139 #define TCFG2 (*(volatile unsigned long *)0x80000220)
140 #define TCNT2 (*(volatile unsigned long *)0x80000224)
141 #define TREF2 (*(volatile unsigned long *)0x80000228)
142 #define TMREF2 (*(volatile unsigned long *)0x8000022c)
143 #define TCFG3 (*(volatile unsigned long *)0x80000230)
144 #define TCNT3 (*(volatile unsigned long *)0x80000234)
145 #define TREF3 (*(volatile unsigned long *)0x80000238)
146 #define TMREF3 (*(volatile unsigned long *)0x8000023c)
147 #define TCFG4 (*(volatile unsigned long *)0x80000240)
148 #define TCNT4 (*(volatile unsigned long *)0x80000244)
149 #define TREF4 (*(volatile unsigned long *)0x80000248)
150 #define TCFG5 (*(volatile unsigned long *)0x80000250)
151 #define TCNT5 (*(volatile unsigned long *)0x80000254)
152 #define TREF5 (*(volatile unsigned long *)0x80000258)
153 #define TIREQ (*(volatile unsigned long *)0x80000260)
154 #define TWDCFG (*(volatile unsigned long *)0x80000270)
155 #define TWDCLR (*(volatile unsigned long *)0x80000274)
156 #define TC32EN (*(volatile unsigned long *)0x80000280)
157 #define TC32LDV (*(volatile unsigned long *)0x80000284)
158 #define TC32CMP0 (*(volatile unsigned long *)0x80000288)
159 #define TC32CMP1 (*(volatile unsigned long *)0x8000028c)
160 #define TC32PCNT (*(volatile unsigned long *)0x80000290)
161 #define TC32MCNT (*(volatile unsigned long *)0x80000294)
162 #define TC32IRQ (*(volatile unsigned long *)0x80000298)
165 #define TF0 (1<<8) /* Timer 0 reference value reached */
166 #define TF1 (1<<9) /* Timer 1 reference value reached */
167 #define TI0 (1<<0) /* Timer 0 IRQ flag */
168 #define TI1 (1<<1) /* Timer 1 IRQ flag */
170 /* NAND Flash Controller */
172 #define NFC_CMD (*(volatile unsigned long *)0x90000000)
173 #define NFC_SADDR (*(volatile unsigned long *)0x9000000C)
174 #define NFC_SDATA (*(volatile unsigned long *)0x90000040)
175 #define NFC_WDATA (*(volatile unsigned long *)0x90000010)
176 #define NFC_CTRL (*(volatile unsigned long *)0x90000050)
177 #define NFC_16BIT (1<<26)
178 #define NFC_CS0 (1<<23)
179 #define NFC_CS1 (1<<22)
180 #define NFC_READY (1<<20)
181 #define NFC_IREQ (*(volatile unsigned long *)0x90000060)
182 #define NFC_RST (*(volatile unsigned long *)0x90000064)
187 #define ECC_CTRL (*(volatile unsigned long *)0x80000900)
188 #define ECC_DMA_REQ (1<<28)
189 #define ECC_ENC (1<<27) /* MLC ECC3/4 */
190 #define ECC_READY (1<<26)
191 #define ECC_IEN (1<<25)
192 #define ECC_MANUAL (1<<22)
193 #define ECC_WCNT (1<<12) /* [21:12] */
194 #define ECC_HOLD (1<<7)
195 #define ECC_M4EN (1<<6)
196 #define ECC_ZERO (1<<5)
197 #define ECC_M3EN (1<<4)
198 #define ECC_CNT_MASK (7<<1)
199 #define ECC_CNT (1<<1)
200 #define ECC_SLC (1<<0)
202 #define ECC_BASE (*(volatile unsigned long *)0x80000904)
203 #define ECC_MASK (*(volatile unsigned long *)0x80000908)
204 #define ECC_CLR (*(volatile unsigned long *)0x8000090c)
205 #define SLC_ECC0 (*(volatile unsigned long *)0x80000910)
206 #define SLC_ECC1 (*(volatile unsigned long *)0x80000914)
207 #define SLC_ECC2 (*(volatile unsigned long *)0x80000918)
208 #define SLC_ECC3 (*(volatile unsigned long *)0x8000091c)
209 #define SLC_ECC4 (*(volatile unsigned long *)0x80000920)
210 #define SLC_ECC5 (*(volatile unsigned long *)0x80000924)
211 #define SLC_ECC6 (*(volatile unsigned long *)0x80000928)
212 #define SLC_ECC7 (*(volatile unsigned long *)0x8000092c)
213 #define MLC_ECC0W (*(volatile unsigned long *)0x80000930)
214 #define MLC_ECC1W (*(volatile unsigned long *)0x80000934)
215 #define MLC_ECC2W (*(volatile unsigned long *)0x80000938)
216 #define MLC_ECC0R (*(volatile unsigned long *)0x80000940)
217 #define MLC_ECC1R (*(volatile unsigned long *)0x80000944)
218 #define MLC_ECC2R (*(volatile unsigned long *)0x80000948)
219 #define ECC_CORR_START (*(volatile unsigned long *)0x8000094c)
220 #define ECC_ERRADDR(x) (*(volatile unsigned long *)(0x80000950+4*(x)))
221 #define ECC_ERRDATA(x) (*(volatile unsigned long *)(0x80000960+4*(x)))
222 #define ECC_ERR_NUM (*(volatile unsigned long *)0x80000970)
225 /* Digital Audio Interface */
226 #define DADI_L0 (*(volatile unsigned long *)0x80000000)
227 #define DADI_R0 (*(volatile unsigned long *)0x80000004)
228 #define DADI_L1 (*(volatile unsigned long *)0x80000008)
229 #define DADI_R1 (*(volatile unsigned long *)0x8000000C)
230 #define DADI_L2 (*(volatile unsigned long *)0x80000010)
231 #define DADI_R2 (*(volatile unsigned long *)0x80000014)
232 #define DADI_L3 (*(volatile unsigned long *)0x80000018)
233 #define DADI_R3 (*(volatile unsigned long *)0x8000001c)
235 #define DADO_L0 (*(volatile unsigned long *)0x80000020)
236 #define DADO_R0 (*(volatile unsigned long *)0x80000024)
237 #define DADO_L1 (*(volatile unsigned long *)0x80000028)
238 #define DADO_R1 (*(volatile unsigned long *)0x8000002C)
239 #define DADO_L2 (*(volatile unsigned long *)0x80000030)
240 #define DADO_R2 (*(volatile unsigned long *)0x80000034)
241 #define DADO_L3 (*(volatile unsigned long *)0x80000038)
242 #define DADO_R3 (*(volatile unsigned long *)0x8000003c)
244 #define DAMR (*(volatile unsigned long *)0x80000040)
245 #define DAVC (*(volatile unsigned long *)0x80000044)
247 #define DADI_L(x) (*(volatile unsigned long *)(0x80000000 + (x) * 8))
248 #define DADI_R(x) (*(volatile unsigned long *)(0x80000004 + (x) * 8))
249 #define DADO_L(x) (*(volatile unsigned long *)(0x80000020 + (x) * 8))
250 #define DADO_R(x) (*(volatile unsigned long *)(0x80000024 + (x) * 8))
252 /* USB 2.0 device system MMR base address */
253 #define USB_BASE 0x90000b00
255 #define USB_NUM_ENDPOINTS 3
256 #define USB_DEVBSS_ATTR IBSS_ATTR
258 /* Timer frequency */
259 /* timers are based on XIN (12Mhz) */
260 #define TIMER_FREQ (12000000)