blob: e938067544bf183a929e3d8c9705d1f410abcbc5 [file] [log] [blame]
Rob Purchase47ea0302008-01-14 22:04:48 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Rob Purchase
11 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * 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.
Rob Purchase47ea0302008-01-14 22:04:48 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef __TCC780X_H__
22#define __TCC780X_H__
23
24/* General-purpose IO */
25
26#define PORTCFG0 (*(volatile unsigned long *)0xF005A000)
27#define PORTCFG1 (*(volatile unsigned long *)0xF005A004)
28#define PORTCFG2 (*(volatile unsigned long *)0xF005A008)
29#define PORTCFG3 (*(volatile unsigned long *)0xF005A00C)
30
31#define GPIOA (*(volatile unsigned long *)0xF005A020)
32#define GPIOB (*(volatile unsigned long *)0xF005A040)
33#define GPIOC (*(volatile unsigned long *)0xF005A060)
34#define GPIOD (*(volatile unsigned long *)0xF005A080)
35#define GPIOE (*(volatile unsigned long *)0xF005A0A0)
36
37#define GPIOA_DIR (*(volatile unsigned long *)0xF005A024)
38#define GPIOB_DIR (*(volatile unsigned long *)0xF005A044)
39#define GPIOC_DIR (*(volatile unsigned long *)0xF005A064)
40#define GPIOD_DIR (*(volatile unsigned long *)0xF005A084)
41#define GPIOE_DIR (*(volatile unsigned long *)0xF005A0A4)
42
43#define GPIOA_SET (*(volatile unsigned long *)0xF005A028)
44#define GPIOB_SET (*(volatile unsigned long *)0xF005A048)
45#define GPIOC_SET (*(volatile unsigned long *)0xF005A068)
46#define GPIOD_SET (*(volatile unsigned long *)0xF005A088)
47#define GPIOE_SET (*(volatile unsigned long *)0xF005A0A8)
48
49#define GPIOA_CLEAR (*(volatile unsigned long *)0xF005A02C)
50#define GPIOB_CLEAR (*(volatile unsigned long *)0xF005A04C)
51#define GPIOC_CLEAR (*(volatile unsigned long *)0xF005A06C)
52#define GPIOD_CLEAR (*(volatile unsigned long *)0xF005A08C)
53#define GPIOE_CLEAR (*(volatile unsigned long *)0xF005A0AC)
54
55/* Clock Generator */
56
57#define CLKCTRL (*(volatile unsigned long *)0xF3000000)
58#define PLL0CFG (*(volatile unsigned long *)0xF3000004)
59#define PLL1CFG (*(volatile unsigned long *)0xF3000008)
60#define CLKDIVC (*(volatile unsigned long *)0xF300000C)
61#define CLKDIVC1 (*(volatile unsigned long *)0xF3000010)
62#define MODECTR (*(volatile unsigned long *)0xF3000014)
63#define BCLKCTR (*(volatile unsigned long *)0xF3000018)
64#define SWRESET (*(volatile unsigned long *)0xF300001C)
65#define PCLKCFG0 (*(volatile unsigned long *)0xF3000020)
66#define PCLKCFG1 (*(volatile unsigned long *)0xF3000024)
67#define PCLKCFG2 (*(volatile unsigned long *)0xF3000028)
68#define PCLKCFG3 (*(volatile unsigned long *)0xF300002C)
69#define PCLK_LCD (*(volatile unsigned long *)0xF3000030)
70#define PCLKCFG5 (*(volatile unsigned long *)0xF3000034)
71#define PCLKCFG6 (*(volatile unsigned long *)0xF3000038)
72#define PCLKCFG7 (*(volatile unsigned long *)0xF300003C)
73#define PCLKCFG8 (*(volatile unsigned long *)0xF3000040)
74#define PCLK_TCT (*(volatile unsigned long *)0xF3000044)
75#define PCLKCFG10 (*(volatile unsigned long *)0xF3000048)
76#define PCLKCFG11 (*(volatile unsigned long *)0xF300004C)
77#define PCLK_ADC (*(volatile unsigned long *)0xF3000050)
Rob Purchasefd773cb2008-04-21 20:16:18 +000078#define PCLK_DAI (*(volatile unsigned long *)0xF3000054)
Rob Purchase47ea0302008-01-14 22:04:48 +000079#define PCLKCFG14 (*(volatile unsigned long *)0xF3000058)
80#define PCLK_RFREQ (*(volatile unsigned long *)0xF300005C)
81#define PCLKCFG16 (*(volatile unsigned long *)0xF3000060)
82#define PCLKCFG17 (*(volatile unsigned long *)0xF3000064)
83
84#define PCK_EN (1<<28)
85
86#define CKSEL_PLL0 0
87#define CKSEL_PLL1 1
88#define CKSEL_XIN 4
89
Rob Purchase59914782008-01-25 21:37:59 +000090/* Device bits for SWRESET & BCLKCTR */
91
92#define DEV_LCDC (1<<2)
93#define DEV_SDMMC (1<<6)
94#define DEV_NAND (1<<9)
95#define DEV_DAI (1<<14)
96#define DEV_ECC (1<<16)
97#define DEV_RTC (1<<21)
98#define DEV_SDRAM (1<<22)
99#define DEV_COP (1<<23)
100#define DEV_ADC (1<<24)
101#define DEV_TIMER (1<<26)
102#define DEV_CPU (1<<27)
103#define DEV_IRQ (1<<28)
104#define DEV_MAIN (1<<31)
105
Rob Purchase47ea0302008-01-14 22:04:48 +0000106/* IRQ Controller */
107
108#define IEN (*(volatile unsigned long *)0xF3001000)
109#define CREQ (*(volatile unsigned long *)0xF3001004)
110#define IRQSEL (*(volatile unsigned long *)0xF300100C)
111#define MREQ (*(volatile unsigned long *)0xF3001014)
Rob Purchase4dc2d8d2008-03-22 19:41:51 +0000112#define POL (*(volatile unsigned long *)0xF300101C)
Rob Purchase47ea0302008-01-14 22:04:48 +0000113#define MIRQ (*(volatile unsigned long *)0xF3001028)
114#define MFIQ (*(volatile unsigned long *)0xF300102C)
Rob Purchase4dc2d8d2008-03-22 19:41:51 +0000115#define MODE (*(volatile unsigned long *)0xF3001030)
Rob Purchase47ea0302008-01-14 22:04:48 +0000116#define ALLMASK (*(volatile unsigned long *)0xF3001044)
117#define VAIRQ (*(volatile unsigned long *)0xF3001080)
118#define VAFIQ (*(volatile unsigned long *)0xF3001084)
119#define VNIRQ (*(volatile unsigned long *)0xF3001088)
120#define VNFIQ (*(volatile unsigned long *)0xF300108C)
Rob Purchase4dc2d8d2008-03-22 19:41:51 +0000121#define VCTRL (*(volatile unsigned long *)0xF3001090)
Rob Purchase47ea0302008-01-14 22:04:48 +0000122
Rob Purchase4dc2d8d2008-03-22 19:41:51 +0000123#define IRQ_PRIORITY_TABLE ((volatile unsigned int *)0xF30010A0)
124
Rob Purchaseb14c2de2008-04-12 18:17:15 +0000125#define EXT3_IRQ_MASK (1<<3)
Rob Purchase4dc2d8d2008-03-22 19:41:51 +0000126#define TIMER0_IRQ_MASK (1<<6)
127#define DAI_RX_IRQ_MASK (1<<14)
128#define DAI_TX_IRQ_MASK (1<<15)
Rob Purchase36f8fba2008-04-04 23:43:31 +0000129#define ADC_IRQ_MASK (1<<30)
Rob Purchase47ea0302008-01-14 22:04:48 +0000130
131/* Timer / Counters */
132
133#define TCFG0 (*(volatile unsigned long *)0xF3003000)
134#define TCNT0 (*(volatile unsigned long *)0xF3003004)
135#define TREF0 (*(volatile unsigned long *)0xF3003008)
136#define TCFG1 (*(volatile unsigned long *)0xF3003010)
137#define TCNT1 (*(volatile unsigned long *)0xF3003014)
138#define TREF1 (*(volatile unsigned long *)0xF3003018)
139
140#define TIREQ (*(volatile unsigned long *)0xF3003060)
Rob Purchase59914782008-01-25 21:37:59 +0000141
142/* TIREQ flags */
143#define TF0 (1<<8) /* Timer 0 reference value reached */
144#define TF1 (1<<9) /* Timer 1 reference value reached */
145#define TI0 (1<<0) /* Timer 0 IRQ flag */
146#define TI1 (1<<1) /* Timer 1 IRQ flag */
Rob Purchase47ea0302008-01-14 22:04:48 +0000147
148#define TC32EN (*(volatile unsigned long *)0xF3003080)
149#define TC32LDV (*(volatile unsigned long *)0xF3003084)
150#define TC32MCNT (*(volatile unsigned long *)0xF3003094)
151#define TC32IRQ (*(volatile unsigned long *)0xF3003098)
152
153/* ADC */
154
155#define ADCCON (*(volatile unsigned long *)0xF3004000)
156#define ADCDATA (*(volatile unsigned long *)0xF3004004)
157#define ADCCONA (*(volatile unsigned long *)0xF3004080)
158#define ADCSTATUS (*(volatile unsigned long *)0xF3004084)
159#define ADCCFG (*(volatile unsigned long *)0xF3004088)
160
161/* Memory Controller */
162
163#define SDCFG (*(volatile unsigned long *)0xF1000000)
164#define SDFSM (*(volatile unsigned long *)0xF1000004)
165#define MCFG (*(volatile unsigned long *)0xF1000008)
166#define CSCFG0 (*(volatile unsigned long *)0xF1000010)
167#define CSCFG1 (*(volatile unsigned long *)0xF1000014)
168#define CSCFG2 (*(volatile unsigned long *)0xF1000018)
169#define CSCFG3 (*(volatile unsigned long *)0xF100001C)
170#define CLKCFG (*(volatile unsigned long *)0xF1000020)
171#define SDCMD (*(volatile unsigned long *)0xF1000024)
172
173#define SDCFG1 (*(volatile unsigned long *)0xF1001000)
174#define MCFG1 (*(volatile unsigned long *)0xF1001008)
175
Rob Purchasefd773cb2008-04-21 20:16:18 +0000176/* DAI */
177
178#define DADO_L0 (*(volatile unsigned long *)0xF0059020)
179#define DADO_R0 (*(volatile unsigned long *)0xF0059024)
180#define DADO_L1 (*(volatile unsigned long *)0xF0059028)
181#define DADO_R1 (*(volatile unsigned long *)0xF005902c)
182#define DADO_L2 (*(volatile unsigned long *)0xF0059030)
183#define DADO_R2 (*(volatile unsigned long *)0xF0059034)
184#define DADO_L3 (*(volatile unsigned long *)0xF0059038)
185#define DADO_R3 (*(volatile unsigned long *)0xF005903c)
186#define DADO_L(_x_) (*(volatile unsigned int *)(0xF0059020+8*(_x_)))
187#define DADO_R(_x_) (*(volatile unsigned int *)(0xF0059024+8*(_x_)))
188#define DAMR (*(volatile unsigned long *)0xF0059040)
189#define DAVC (*(volatile unsigned long *)0xF0059044)
190
Rob Purchase47ea0302008-01-14 22:04:48 +0000191/* Misc */
192
193#define ECFG0 (*(volatile unsigned long *)0xF300500C)
194#define MBCFG (*(volatile unsigned long *)0xF3005020)
195
196#define TCC780_VER (*(volatile unsigned long *)0xE0001FFC)
197
198#endif