Change r22610 a bit. The new parent viewport isn't really suitable.
[kugel-rb.git] / firmware / export / tcc780x.h
blobaca3bec2bd8f87f95a5321ffa53e6cfb0ebe86c6
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Rob Purchase
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 __TCC780X_H__
22 #define __TCC780X_H__
24 #define TTB_SIZE (0x4000)
25 /* must be 16Kb (0x4000) aligned */
26 #define TTB_BASE_ADDR (0x20000000 + (MEMORYSIZE*1024*1024) - TTB_SIZE)
27 #define TTB_BASE ((unsigned long *)TTB_BASE_ADDR) /* End of memory */
29 /* General-purpose IO */
31 #define PORTCFG0 (*(volatile unsigned long *)0xF005A000)
32 #define PORTCFG1 (*(volatile unsigned long *)0xF005A004)
33 #define PORTCFG2 (*(volatile unsigned long *)0xF005A008)
34 #define PORTCFG3 (*(volatile unsigned long *)0xF005A00C)
36 #define GPIOA (*(volatile unsigned long *)0xF005A020)
37 #define GPIOB (*(volatile unsigned long *)0xF005A040)
38 #define GPIOC (*(volatile unsigned long *)0xF005A060)
39 #define GPIOD (*(volatile unsigned long *)0xF005A080)
40 #define GPIOE (*(volatile unsigned long *)0xF005A0A0)
42 #define GPIOA_DIR (*(volatile unsigned long *)0xF005A024)
43 #define GPIOB_DIR (*(volatile unsigned long *)0xF005A044)
44 #define GPIOC_DIR (*(volatile unsigned long *)0xF005A064)
45 #define GPIOD_DIR (*(volatile unsigned long *)0xF005A084)
46 #define GPIOE_DIR (*(volatile unsigned long *)0xF005A0A4)
48 #define GPIOA_SET (*(volatile unsigned long *)0xF005A028)
49 #define GPIOB_SET (*(volatile unsigned long *)0xF005A048)
50 #define GPIOC_SET (*(volatile unsigned long *)0xF005A068)
51 #define GPIOD_SET (*(volatile unsigned long *)0xF005A088)
52 #define GPIOE_SET (*(volatile unsigned long *)0xF005A0A8)
54 #define GPIOA_CLEAR (*(volatile unsigned long *)0xF005A02C)
55 #define GPIOB_CLEAR (*(volatile unsigned long *)0xF005A04C)
56 #define GPIOC_CLEAR (*(volatile unsigned long *)0xF005A06C)
57 #define GPIOD_CLEAR (*(volatile unsigned long *)0xF005A08C)
58 #define GPIOE_CLEAR (*(volatile unsigned long *)0xF005A0AC)
60 /* Clock Generator */
62 #define CLKCTRL (*(volatile unsigned long *)0xF3000000)
63 #define PLL0CFG (*(volatile unsigned long *)0xF3000004)
64 #define PLL1CFG (*(volatile unsigned long *)0xF3000008)
65 #define CLKDIVC (*(volatile unsigned long *)0xF300000C)
66 #define CLKDIVC1 (*(volatile unsigned long *)0xF3000010)
67 #define MODECTR (*(volatile unsigned long *)0xF3000014)
68 #define BCLKCTR (*(volatile unsigned long *)0xF3000018)
69 #define SWRESET (*(volatile unsigned long *)0xF300001C)
70 #define PCLKCFG0 (*(volatile unsigned long *)0xF3000020)
71 #define PCLK_SDMMC (*(volatile unsigned long *)0xF3000024)
72 #define PCLKCFG2 (*(volatile unsigned long *)0xF3000028)
73 #define PCLKCFG3 (*(volatile unsigned long *)0xF300002C)
74 #define PCLK_LCD (*(volatile unsigned long *)0xF3000030)
75 #define PCLKCFG5 (*(volatile unsigned long *)0xF3000034)
76 #define PCLKCFG6 (*(volatile unsigned long *)0xF3000038)
77 #define PCLKCFG7 (*(volatile unsigned long *)0xF300003C)
78 #define PCLKCFG8 (*(volatile unsigned long *)0xF3000040)
79 #define PCLK_TCT (*(volatile unsigned long *)0xF3000044)
80 #define PCLKCFG10 (*(volatile unsigned long *)0xF3000048)
81 #define PCLKCFG11 (*(volatile unsigned long *)0xF300004C)
82 #define PCLK_ADC (*(volatile unsigned long *)0xF3000050)
83 #define PCLK_DAI (*(volatile unsigned long *)0xF3000054)
84 #define PCLKCFG14 (*(volatile unsigned long *)0xF3000058)
85 #define PCLK_RFREQ (*(volatile unsigned long *)0xF300005C)
86 #define PCLKCFG16 (*(volatile unsigned long *)0xF3000060)
87 #define PCLKCFG17 (*(volatile unsigned long *)0xF3000064)
89 #define PCK_EN (1<<28)
91 #define CKSEL_PLL0 0
92 #define CKSEL_PLL1 1
93 #define CKSEL_XIN 4
95 /* Device bits for SWRESET & BCLKCTR */
97 #define DEV_USBD (1<<1)
98 #define DEV_LCDC (1<<2)
99 #define DEV_SDMMC (1<<6)
100 #define DEV_NAND (1<<9)
101 #define DEV_DAI (1<<14)
102 #define DEV_ECC (1<<16)
103 #define DEV_RTC (1<<21)
104 #define DEV_SDRAM (1<<22)
105 #define DEV_COP (1<<23)
106 #define DEV_ADC (1<<24)
107 #define DEV_TIMER (1<<26)
108 #define DEV_CPU (1<<27)
109 #define DEV_IRQ (1<<28)
110 #define DEV_MAIN (1<<31)
112 /* IRQ Controller */
114 #define IEN (*(volatile unsigned long *)0xF3001000)
115 #define CREQ (*(volatile unsigned long *)0xF3001004)
116 #define IRQSEL (*(volatile unsigned long *)0xF300100C)
117 #define MREQ (*(volatile unsigned long *)0xF3001014)
118 #define POL (*(volatile unsigned long *)0xF300101C)
119 #define MIRQ (*(volatile unsigned long *)0xF3001028)
120 #define MFIQ (*(volatile unsigned long *)0xF300102C)
121 #define TMODE (*(volatile unsigned long *)0xF3001030)
122 #define TMODEA (*(volatile unsigned long *)0xF300103C)
123 #define ALLMASK (*(volatile unsigned long *)0xF3001044)
124 #define VAIRQ (*(volatile unsigned long *)0xF3001080)
125 #define VAFIQ (*(volatile unsigned long *)0xF3001084)
126 #define VNIRQ (*(volatile unsigned long *)0xF3001088)
127 #define VNFIQ (*(volatile unsigned long *)0xF300108C)
128 #define VCTRL (*(volatile unsigned long *)0xF3001090)
130 #define IRQ_PRIORITY_TABLE ((volatile unsigned int *)0xF30010A0)
132 #define EXT0_IRQ_MASK (1<<0)
133 #define EXT3_IRQ_MASK (1<<3)
134 #define TIMER0_IRQ_MASK (1<<6)
135 #define DAI_RX_IRQ_MASK (1<<14)
136 #define DAI_TX_IRQ_MASK (1<<15)
137 #define USBD_IRQ_MASK (1<<21)
138 #define ADC_IRQ_MASK (1<<30)
140 /* Timer / Counters */
142 /* Note: Timers 0-3 have a 16 bit counter, 4-5 have 20 bits */
143 #define TCFG(_x_) (*(volatile unsigned int *)(0xF3003000+0x10*(_x_)))
144 #define TCNT(_x_) (*(volatile unsigned int *)(0xF3003004+0x10*(_x_)))
145 #define TREF(_x_) (*(volatile unsigned int *)(0xF3003008+0x10*(_x_)))
147 #define TIREQ (*(volatile unsigned long *)0xF3003060)
149 /* TCFG flags */
150 #define TCFG_EN (1<<0) /* enable timer */
151 #define TCFG_CONT (1<<1) /* continue from zero once TREF is reached */
152 #define TCFG_PWM (1<<2) /* PWM mode */
153 #define TCFG_IEN (1<<3) /* IRQ enable */
154 #define TCFG_SEL (1<<4) /* clock source & divider */
155 #define TCFG_POL (1<<7) /* polarity */
156 #define TCFG_CLEAR (1<<8) /* reset TCNT to zero */
157 #define TCFG_STOP (1<<9) /* stop counting once TREF reached */
159 /* TIREQ flags */
160 #define TIREQ_TI0 (1<<0) /* Timer N IRQ flag */
161 #define TIREQ_TI1 (1<<1)
162 #define TIREQ_TI2 (1<<2)
163 #define TIREQ_TI3 (1<<3)
164 #define TIREQ_TI4 (1<<4)
165 #define TIREQ_TI5 (1<<5)
167 #define TIREQ_TF0 (1<<8) /* Timer N reference value reached */
168 #define TIREQ_TF1 (1<<9)
169 #define TIREQ_TF2 (1<<10)
170 #define TIREQ_TF3 (1<<11)
171 #define TIREQ_TF4 (1<<12)
172 #define TIREQ_TF5 (1<<13)
174 #define TC32EN (*(volatile unsigned long *)0xF3003080)
175 #define TC32LDV (*(volatile unsigned long *)0xF3003084)
176 #define TC32MCNT (*(volatile unsigned long *)0xF3003094)
177 #define TC32IRQ (*(volatile unsigned long *)0xF3003098)
179 /* ADC */
181 #define ADCCON (*(volatile unsigned long *)0xF3004000)
182 #define ADCDATA (*(volatile unsigned long *)0xF3004004)
183 #define ADCCONA (*(volatile unsigned long *)0xF3004080)
184 #define ADCSTATUS (*(volatile unsigned long *)0xF3004084)
185 #define ADCCFG (*(volatile unsigned long *)0xF3004088)
187 /* Memory Controller */
189 #define SDCFG (*(volatile unsigned long *)0xF1000000)
190 #define SDFSM (*(volatile unsigned long *)0xF1000004)
191 #define MCFG (*(volatile unsigned long *)0xF1000008)
192 #define CSCFG0 (*(volatile unsigned long *)0xF1000010)
193 #define CSCFG1 (*(volatile unsigned long *)0xF1000014)
194 #define CSCFG2 (*(volatile unsigned long *)0xF1000018)
195 #define CSCFG3 (*(volatile unsigned long *)0xF100001C)
196 #define CLKCFG (*(volatile unsigned long *)0xF1000020)
197 #define SDCMD (*(volatile unsigned long *)0xF1000024)
199 #define SDCFG1 (*(volatile unsigned long *)0xF1001000)
200 #define MCFG1 (*(volatile unsigned long *)0xF1001008)
202 /* DAI */
204 #define DADO_L0 (*(volatile unsigned long *)0xF0059020)
205 #define DADO_R0 (*(volatile unsigned long *)0xF0059024)
206 #define DADO_L1 (*(volatile unsigned long *)0xF0059028)
207 #define DADO_R1 (*(volatile unsigned long *)0xF005902c)
208 #define DADO_L2 (*(volatile unsigned long *)0xF0059030)
209 #define DADO_R2 (*(volatile unsigned long *)0xF0059034)
210 #define DADO_L3 (*(volatile unsigned long *)0xF0059038)
211 #define DADO_R3 (*(volatile unsigned long *)0xF005903c)
212 #define DADO_L(_x_) (*(volatile unsigned int *)(0xF0059020+8*(_x_)))
213 #define DADO_R(_x_) (*(volatile unsigned int *)(0xF0059024+8*(_x_)))
214 #define DAMR (*(volatile unsigned long *)0xF0059040)
215 #define DAVC (*(volatile unsigned long *)0xF0059044)
217 /* Misc */
219 #define ECFG0 (*(volatile unsigned long *)0xF300500C)
220 #define MBCFG (*(volatile unsigned long *)0xF3005020)
222 #define TCC780_VER (*(volatile unsigned long *)0xE0001FFC)
224 /* NAND Flash Controller */
226 #define NFC_CMD (*(volatile unsigned long *)0xF0053000)
227 #define NFC_SADDR (*(volatile unsigned long *)0xF005300C)
228 #define NFC_SDATA (*(volatile unsigned long *)0xF0053040)
229 #define NFC_WDATA (*(volatile unsigned long *)0xF0053010)
230 #define NFC_CTRL (*(volatile unsigned long *)0xF0053050)
231 #define NFC_16BIT (1<<26)
232 #define NFC_CS0 (1<<23)
233 #define NFC_CS1 (1<<22)
234 #define NFC_READY (1<<20)
235 #define NFC_IREQ (*(volatile unsigned long *)0xF0053060)
236 #define NFC_RST (*(volatile unsigned long *)0xF0053064)
238 /* ECC Controller */
240 #define ECC_CTRL (*(volatile unsigned long *)0xF005B000)
241 #define ECC_ENC (1<<27)
242 #define ECC_READY (1<<26)
243 #define ECC_M4EN (1<<6)
244 #define ECC_BASE (*(volatile unsigned long *)0xF005B004)
245 #define ECC_CLR (*(volatile unsigned long *)0xF005B00C)
246 #define MLC_ECC0W (*(volatile unsigned long *)0xF005B030)
247 #define MLC_ECC1W (*(volatile unsigned long *)0xF005B034)
248 #define MLC_ECC2W (*(volatile unsigned long *)0xF005B038)
249 #define ECC_ERRADDR(x) (*(volatile unsigned long *)(0xF005B050+4*(x)))
250 #define ECC_ERRDATA(x) (*(volatile unsigned long *)(0xF005B060+4*(x)))
251 #define ECC_ERR_NUM (*(volatile unsigned long *)0xF005B070)
253 /* SD/MMC Controller */
255 #define SDICLK (*(volatile unsigned long *)0xF0058004)
256 #define SDIARGU (*(volatile unsigned long *)0xF0058008)
257 #define SDICMD (*(volatile unsigned long *)0xF005800C)
258 #define SDIRSPCMD (*(volatile unsigned long *)0xF0058010)
259 #define SDIRSPARGU0 (*(volatile unsigned long *)0xF0058014)
260 #define SDIRSPARGU1 (*(volatile unsigned long *)0xF0058018)
261 #define SDIRSPARGU2 (*(volatile unsigned long *)0xF005801C)
262 #define SDIRSPARGU3 (*(volatile unsigned long *)0xF0058020)
263 #define SDIDTIMER (*(volatile unsigned long *)0xF0058024)
264 #define SDIDCTRL2 (*(volatile unsigned long *)0xF0058028)
265 #define SDIDCTRL (*(volatile unsigned long *)0xF005802C)
266 #define SDISTATUS (*(volatile unsigned long *)0xF0058030)
267 #define SDIIFLAG (*(volatile unsigned long *)0xF0058034)
268 #define SDIWDATA (*(volatile unsigned long *)0xF0058038)
269 #define SDIRDATA (*(volatile unsigned long *)0xF005803C)
270 #define SDIIENABLE (*(volatile unsigned long *)0xF0058040)
272 #define SDICMD_RES_TYPE1 1
273 #define SDICMD_RES_TYPE1b 2
274 #define SDICMD_RES_TYPE2 3
275 #define SDICMD_RES_TYPE3 4
276 #define SDICMD_RES_TYPE4 5
277 #define SDICMD_RES_TYPE5 6
278 #define SDICMD_RES_TYPE6 7
280 #define SDISTATUS_RESP_RCVD (1<<7)
281 #define SDISTATUS_FIFO_LOAD_REQ (1<<17)
282 #define SDISTATUS_FIFO_FETCH_REQ (1<<18)
283 #define SDISTATUS_CMD_PATH_RDY (1<<21)
284 #define SDISTATUS_MULTIBLOCK_END (1<<25)
286 /* USB 2.0 device system MMR base address */
287 #define USB_BASE 0xf0010000
289 #define USB_NUM_ENDPOINTS 3
290 #define USB_DEVBSS_ATTR IBSS_ATTR
292 /* Timer frequency */
293 /* Timer is based on PCK_TCT (set to 2Mhz in system.c) */
294 #define TIMER_FREQ (2000000)
296 #endif