www.usr.com/support/gpl/USR9107_release.1.4.tar.gz
[bcm963xx.git] / bcmdrivers / opensource / include / bcm963xx / 6338_map_part.h
1 /*
2 <:copyright-gpl 
3  Copyright 2004 Broadcom Corp. All Rights Reserved. 
4  
5  This program is free software; you can distribute it and/or modify it 
6  under the terms of the GNU General Public License (Version 2) as 
7  published by the Free Software Foundation. 
8  
9  This program is distributed in the hope it will be useful, but WITHOUT 
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
11  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
12  for more details. 
13  
14  You should have received a copy of the GNU General Public License along 
15  with this program; if not, write to the Free Software Foundation, Inc., 
16  59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
17 :>
18 */
19
20 #ifndef __BCM6338_MAP_H
21 #define __BCM6338_MAP_H
22
23 #if __cplusplus
24 extern "C" {
25 #endif
26
27 #include "bcmtypes.h"
28
29 #define PERF_BASE           0xfffe0000
30 #define TIMR_BASE           0xfffe0200 
31 #define UART_BASE           0xfffe0300
32 #define GPIO_BASE           0xfffe0400
33 #define SPI_BASE            0xfffe0c00
34
35 typedef struct PerfControl {
36   uint32        RevID;
37   uint16        testControl;
38   uint16        blkEnables;
39 #define EMAC_CLK_EN     0x0010
40 #define USBS_CLK_EN     0x0010
41 #define SAR_CLK_EN      0x0020
42
43 #define SPI_CLK_EN      0x0200
44
45   uint32        pll_control;
46 #define SOFT_RESET 0x00000001
47
48   uint32        IrqMask;
49   uint32        IrqStatus;
50
51   uint32        ExtIrqCfg;
52 #define EI_SENSE_SHFT   0
53 #define EI_STATUS_SHFT  5
54 #define EI_CLEAR_SHFT   10
55 #define EI_MASK_SHFT    15
56 #define EI_INSENS_SHFT  20
57 #define EI_LEVEL_SHFT   25
58
59   uint32        unused[4];      /* (18) */
60   uint32        BlockSoftReset; /* (28) */
61 #define BSR_SPI             0x00000001
62 #define BSR_EMAC            0x00000004
63 #define BSR_USBH            0x00000008
64 #define BSR_USBS            0x00000010
65 #define BSR_ADSL            0x00000020
66 #define BSR_DMAMEM          0x00000040
67 #define BSR_SAR             0x00000080
68 #define BSR_ACLC            0x00000100
69 #define BSR_ADSL_MIPS_PLL   0x00000400
70 #define BSR_ALL_BLOCKS      \
71     (BSR_SPI | BSR_EMAC | BSR_USBH | BSR_USBS | BSR_ADSL | BSR_DMAMEM | \
72      BSR_SAR | BSR_ACLC | BSR_ADSL_MIPS_PLL) 
73 } PerfControl;
74
75 #define PERF ((volatile PerfControl * const) PERF_BASE)
76
77
78 typedef struct Timer {
79   uint16        unused0;
80   byte          TimerMask;
81 #define TIMER0EN        0x01
82 #define TIMER1EN        0x02
83 #define TIMER2EN        0x04
84   byte          TimerInts;
85 #define TIMER0          0x01
86 #define TIMER1          0x02
87 #define TIMER2          0x04
88 #define WATCHDOG        0x08
89   uint32        TimerCtl0;
90   uint32        TimerCtl1;
91   uint32        TimerCtl2;
92 #define TIMERENABLE     0x80000000
93 #define RSTCNTCLR       0x40000000      
94   uint32        TimerCnt0;
95   uint32        TimerCnt1;
96   uint32        TimerCnt2;
97   uint32        WatchDogDefCount;
98
99   /* Write 0xff00 0x00ff to Start timer
100    * Write 0xee00 0x00ee to Stop and re-load default count
101    * Read from this register returns current watch dog count
102    */
103   uint32        WatchDogCtl;
104
105   /* Number of 40-MHz ticks for WD Reset pulse to last */
106   uint32        WDResetCount;
107 } Timer;
108
109 #define TIMER ((volatile Timer * const) TIMR_BASE)
110 typedef struct UartChannel {
111   byte          unused0;
112   byte          control;
113 #define BRGEN           0x80    /* Control register bit defs */
114 #define TXEN            0x40
115 #define RXEN            0x20
116 #define LOOPBK          0x10
117 #define TXPARITYEN      0x08
118 #define TXPARITYEVEN    0x04
119 #define RXPARITYEN      0x02
120 #define RXPARITYEVEN    0x01
121
122   byte          config;
123 #define XMITBREAK       0x40
124 #define BITS5SYM        0x00
125 #define BITS6SYM        0x10
126 #define BITS7SYM        0x20
127 #define BITS8SYM        0x30
128 #define ONESTOP         0x07
129 #define TWOSTOP         0x0f
130   /* 4-LSBS represent STOP bits/char
131    * in 1/8 bit-time intervals.  Zero
132    * represents 1/8 stop bit interval.
133    * Fifteen represents 2 stop bits.
134    */
135   byte          fifoctl;
136 #define RSTTXFIFOS      0x80
137 #define RSTRXFIFOS      0x40
138   /* 5-bit TimeoutCnt is in low bits of this register.
139    *  This count represents the number of characters 
140    *  idle times before setting receive Irq when below threshold
141    */
142   uint32        baudword;
143   /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
144    */
145
146   byte          txf_levl;       /* Read-only fifo depth */
147   byte          rxf_levl;       /* Read-only fifo depth */
148   byte          fifocfg;        /* Upper 4-bits are TxThresh, Lower are
149                                  *      RxThreshold.  Irq can be asserted
150                                  *      when rx fifo> thresh, txfifo<thresh
151                                  */
152   byte          prog_out;       /* Set value of DTR (Bit0), RTS (Bit1)
153                                  *  if these bits are also enabled to GPIO_o
154                                  */
155 #define DTREN   0x01
156 #define RTSEN   0x02
157
158   byte          unused1;
159   byte          DeltaIPEdgeNoSense;     /* Low 4-bits, set corr bit to 1 to 
160                                          * detect irq on rising AND falling 
161                                          * edges for corresponding GPIO_i
162                                          * if enabled (edge insensitive)
163                                          */
164   byte          DeltaIPConfig_Mask;     /* Upper 4 bits: 1 for posedge sense
165                                          *      0 for negedge sense if
166                                          *      not configured for edge
167                                          *      insensitive (see above)
168                                          * Lower 4 bits: Mask to enable change
169                                          *  detection IRQ for corresponding
170                                          *  GPIO_i
171                                          */
172   byte          DeltaIP_SyncIP;         /* Upper 4 bits show which bits
173                                          *  have changed (may set IRQ).
174                                          *  read automatically clears bit
175                                          * Lower 4 bits are actual status
176                                          */
177
178   uint16        intMask;                                /* Same Bit defs for Mask and status */
179   uint16        intStatus;
180 #define DELTAIP         0x0001
181 #define TXUNDERR        0x0002
182 #define TXOVFERR        0x0004
183 #define TXFIFOTHOLD     0x0008
184 #define TXREADLATCH     0x0010
185 #define TXFIFOEMT       0x0020
186 #define RXUNDERR        0x0040
187 #define RXOVFERR        0x0080
188 #define RXTIMEOUT       0x0100
189 #define RXFIFOFULL      0x0200
190 #define RXFIFOTHOLD     0x0400
191 #define RXFIFONE        0x0800
192 #define RXFRAMERR       0x1000
193 #define RXPARERR        0x2000
194 #define RXBRK           0x4000
195
196   uint16        unused2;
197   uint16        Data;                   /* Write to TX, Read from RX */
198                                         /* bits 11:8 are BRK,PAR,FRM errors */
199
200   uint32                unused3;
201   uint32                unused4;
202 } Uart;
203
204 #define UART ((volatile Uart * const) UART_BASE)
205
206 typedef struct GpioControl {
207   uint32        unused0;
208   uint32        GPIODir;      /* bits 7:0 */
209   uint32        unused1;
210   uint32        GPIOio;       /* bits 7:0 */
211   uint32        LEDCtrl;
212 #define         LED3_STROBE             0x08000000
213 #define         LED2_STROBE             0x04000000
214 #define         LED1_STROBE             0x02000000
215 #define         LED0_STROBE             0x01000000
216 #define         LED_TEST                0x00010000
217 #define         LED3_DISABLE_LINK_ACT   0x00008000
218 #define         LED2_DISABLE_LINK_ACT   0x00004000
219 #define         LED1_DISABLE_LINK_ACT   0x00002000
220 #define         LED0_DISABLE_LINK_ACT   0x00001000
221 #define         LED_INTERVAL_SET_MASK   0x00000f00
222 #define         LED_INTERVAL_SET_320MS  0x00000500
223 #define         LED_INTERVAL_SET_160MS  0x00000400
224 #define         LED_INTERVAL_SET_80MS   0x00000300
225 #define         LED_INTERVAL_SET_40MS   0x00000200
226 #define         LED_INTERVAL_SET_20MS   0x00000100
227 #define         LED3_ON                 0x00000080
228 #define         LED2_ON                 0x00000040
229 #define         LED1_ON                 0x00000020
230 #define         LED0_ON                 0x00000010
231 #define         LED3_ENABLE             0x00000008
232 #define         LED2_ENABLE             0x00000004
233 #define         LED1_ENABLE             0x00000002
234 #define         LED0_ENABLE             0x00000001
235   uint32        SpiSlaveCfg;
236 #define         SPI_SLAVE_RESET         0x00010000
237 #define         SPI_RESTRICT            0x00000400
238 #define         SPI_DELAY_DISABLE       0x00000200
239 #define         SPI_PROBE_MUX_SEL_MASK  0x000001e0
240 #define         SPI_SER_ADDR_CFG_MASK   0x0000000c
241 #define         SPI_MODE                0x00000001
242   uint32        vRegConfig;
243 } GpioControl;
244
245 #define GPIO ((volatile GpioControl * const) GPIO_BASE)
246
247 /* Number to mask conversion macro used for GPIODir and GPIOio */
248 #define GPIO_NUM_MAX_BITS_MASK          0x0f
249 #define GPIO_NUM_TO_MASK(X)             (1 << ((X) & GPIO_NUM_MAX_BITS_MASK))
250
251 /*
252 ** Spi Controller
253 */
254
255 typedef struct SpiControl {
256   uint16        spiCmd;                 /* (0x0): SPI command */
257 #define SPI_CMD_START_IMMEDIATE         3
258
259 #define SPI_CMD_COMMAND_SHIFT           0
260 #define SPI_CMD_DEVICE_ID_SHIFT         4
261 #define SPI_CMD_PREPEND_BYTE_CNT_SHIFT  8
262
263   byte          spiIntStatus;           /* (0x2): SPI interrupt status */
264   byte          spiMaskIntStatus;       /* (0x3): SPI masked interrupt status */
265
266   byte          spiIntMask;             /* (0x4): SPI interrupt mask */
267 #define SPI_INTR_CMD_DONE               0x01
268 #define SPI_INTR_CLEAR_ALL              0x1f
269
270   byte          spiStatus;              /* (0x5): SPI status */
271
272   byte          spiClkCfg;              /* (0x6): SPI clock configuration */
273
274   byte          spiFillByte;            /* (0x7): SPI fill byte */
275
276   byte          unused0; 
277   byte          spiMsgTail;             /* (0x9): msgtail */
278   byte          unused1; 
279   byte          spiRxTail;              /* (0xB): rxtail */
280
281   uint32        unused2[13];            /* (0x0c - 0x3c) reserved */
282
283   byte          spiMsgCtl;              /* (0x40) control byte */
284 #define HALF_DUPLEX_W                   1
285 #define HALF_DUPLEX_R                   2
286 #define SPI_MSG_TYPE_SHIFT              6
287 #define SPI_BYTE_CNT_SHIFT              0
288   byte          spiMsgData[63];         /* (0x41 - 0x7f) msg data */
289   byte          spiRxDataFifo[64];      /* (0x80 - 0xbf) rx data */
290   byte          unused3[64];            /* (0xc0 - 0xff) reserved */
291 } SpiControl;
292
293 #define SPI ((volatile SpiControl * const) SPI_BASE)
294
295 /*
296 ** External Bus Interface
297 */
298 typedef struct EbiChipSelect {
299   uint32        base;                   /* base address in upper 24 bits */
300 #define EBI_SIZE_8K         0
301 #define EBI_SIZE_16K        1
302 #define EBI_SIZE_32K        2
303 #define EBI_SIZE_64K        3
304 #define EBI_SIZE_128K       4
305 #define EBI_SIZE_256K       5
306 #define EBI_SIZE_512K       6
307 #define EBI_SIZE_1M         7
308 #define EBI_SIZE_2M         8
309 #define EBI_SIZE_4M         9
310 #define EBI_SIZE_8M         10
311 #define EBI_SIZE_16M        11
312 #define EBI_SIZE_32M        12
313 #define EBI_SIZE_64M        13
314 #define EBI_SIZE_128M       14
315 #define EBI_SIZE_256M       15
316   uint32        config;
317 #define EBI_ENABLE          0x00000001      /* .. enable this range */
318 #define EBI_WAIT_STATES     0x0000000e      /* .. mask for wait states */
319 #define EBI_WTST_SHIFT      1               /* .. for shifting wait states */
320 #define EBI_WORD_WIDE       0x00000010      /* .. 16-bit peripheral, else 8 */
321 #define EBI_WREN            0x00000020      /* enable posted writes */
322 #define EBI_POLARITY        0x00000040      /* .. set to invert something, 
323                                         **    don't know what yet */
324 #define EBI_TS_TA_MODE      0x00000080      /* .. use TS/TA mode */
325 #define EBI_TS_SEL          0x00000100      /* .. drive tsize, not bs_b */
326 #define EBI_FIFO            0x00000200      /* .. use fifo */
327 #define EBI_RE              0x00000400      /* .. Reverse Endian */
328 } EbiChipSelect;
329
330 typedef struct MpiRegisters {
331   EbiChipSelect cs[1];                  /* size chip select configuration */
332 } MpiRegisters;
333
334 #define MPI ((volatile MpiRegisters * const) MPI_BASE)
335
336 #if __cplusplus
337 }
338 #endif
339
340 #endif
341