http://www.hht-eu.com/pls/hht/docs/F3140/bcm963xx_Speedport500V.0.09.04L.300L01.V27_c...
[bcm963xx.git] / bcmdrivers / opensource / include / bcm963xx / 6348_map_part.h
1 /*
2 <:copyright-gpl 
3  Copyright 2002 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 __BCM6348_MAP_H
21 #define __BCM6348_MAP_H
22
23 #if __cplusplus
24 extern "C" {
25 #endif
26
27 #include "bcmtypes.h"
28
29 #define PERF_BASE           0xfffe0000
30 #define UART_BASE           0xfffe0300
31 #define GPIO_BASE           0xfffe0400
32 #define MPI_BASE            0xfffe2000    /* MPI control registers */
33 #define USB_HOST_BASE       0xfffe1b00    /* USB host registers */
34 #define USB_HOST_NON_OHCI   0xfffe1c00    /* USB host non-OHCI registers */
35
36 typedef struct PerfControl {
37   uint32        RevID;
38   uint16        testControl;
39   uint16        blkEnables;
40 #define USBH_CLK_EN     0x0100
41
42   uint32        pll_control;
43 #define SOFT_RESET 0x00000001
44
45   uint32        IrqMask;
46   uint32        IrqStatus;
47
48   uint32        ExtIrqCfg;
49 #define EI_SENSE_SHFT   0
50 #define EI_STATUS_SHFT  5
51 #define EI_CLEAR_SHFT   10
52 #define EI_MASK_SHFT    15
53 #define EI_INSENS_SHFT  20
54 #define EI_LEVEL_SHFT   25
55
56   uint32        unused[4];      /* (18) */
57   uint32        BlockSoftReset; /* (28) */
58 #define BSR_SPI             0x00000001
59 #define BSR_EMAC            0x00000004
60 #define BSR_USBH            0x00000008
61 #define BSR_USBS            0x00000010
62 #define BSR_ADSL            0x00000020
63 #define BSR_DMAMEM          0x00000040
64 #define BSR_SAR             0x00000080
65 #define BSR_ACLC            0x00000100
66 #define BSR_ADSL_MIPS_PLL   0x00000400
67 #define BSR_ALL_BLOCKS      \
68     (BSR_SPI | BSR_EMAC | BSR_USBH | BSR_USBS | BSR_ADSL | BSR_DMAMEM | \
69      BSR_SAR | BSR_ACLC | BSR_ADSL_MIPS_PLL) 
70   uint32        unused2[2];     /* (2c) */
71   uint32        PllStrap;       /* (34) */
72 #define PLL_N1_SHFT         20
73 #define PLL_N1_MASK         (7<<PLL_N1_SHFT)
74 #define PLL_N2_SHFT         15
75 #define PLL_N2_MASK         (0x1f<<PLL_N2_SHFT)
76 #define PLL_M1_REF_SHFT     12
77 #define PLL_M1_REF_MASK     (7<<PLL_M1_REF_SHFT)
78 #define PLL_M2_REF_SHFT     9
79 #define PLL_M2_REF_MASK     (7<<PLL_M2_REF_SHFT)
80 #define PLL_M1_CPU_SHFT     6
81 #define PLL_M1_CPU_MASK     (7<<PLL_M1_CPU_SHFT)
82 #define PLL_M1_BUS_SHFT     3
83 #define PLL_M1_BUS_MASK     (7<<PLL_M1_BUS_SHFT)
84 #define PLL_M2_BUS_SHFT     0
85 #define PLL_M2_BUS_MASK     (7<<PLL_M2_BUS_SHFT)
86 } PerfControl;
87
88 #define PERF ((volatile PerfControl * const) PERF_BASE)
89
90 typedef struct UartChannel {
91   byte          unused0;
92   byte          control;
93 #define BRGEN           0x80    /* Control register bit defs */
94 #define TXEN            0x40
95 #define RXEN            0x20
96 #define LOOPBK          0x10
97 #define TXPARITYEN      0x08
98 #define TXPARITYEVEN    0x04
99 #define RXPARITYEN      0x02
100 #define RXPARITYEVEN    0x01
101
102   byte          config;
103 #define XMITBREAK       0x40
104 #define BITS5SYM        0x00
105 #define BITS6SYM        0x10
106 #define BITS7SYM        0x20
107 #define BITS8SYM        0x30
108 #define ONESTOP         0x07
109 #define TWOSTOP         0x0f
110   /* 4-LSBS represent STOP bits/char
111    * in 1/8 bit-time intervals.  Zero
112    * represents 1/8 stop bit interval.
113    * Fifteen represents 2 stop bits.
114    */
115   byte          fifoctl;
116 #define RSTTXFIFOS      0x80
117 #define RSTRXFIFOS      0x40
118   /* 5-bit TimeoutCnt is in low bits of this register.
119    *  This count represents the number of characters 
120    *  idle times before setting receive Irq when below threshold
121    */
122   uint32        baudword;
123   /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
124    */
125
126   byte          txf_levl;       /* Read-only fifo depth */
127   byte          rxf_levl;       /* Read-only fifo depth */
128   byte          fifocfg;        /* Upper 4-bits are TxThresh, Lower are
129                                  *      RxThreshold.  Irq can be asserted
130                                  *      when rx fifo> thresh, txfifo<thresh
131                                  */
132   byte          prog_out;       /* Set value of DTR (Bit0), RTS (Bit1)
133                                  *  if these bits are also enabled to GPIO_o
134                                  */
135 #define DTREN   0x01
136 #define RTSEN   0x02
137
138   byte          unused1;
139   byte          DeltaIPEdgeNoSense;     /* Low 4-bits, set corr bit to 1 to 
140                                          * detect irq on rising AND falling 
141                                          * edges for corresponding GPIO_i
142                                          * if enabled (edge insensitive)
143                                          */
144   byte          DeltaIPConfig_Mask;     /* Upper 4 bits: 1 for posedge sense
145                                          *      0 for negedge sense if
146                                          *      not configured for edge
147                                          *      insensitive (see above)
148                                          * Lower 4 bits: Mask to enable change
149                                          *  detection IRQ for corresponding
150                                          *  GPIO_i
151                                          */
152   byte          DeltaIP_SyncIP;         /* Upper 4 bits show which bits
153                                          *  have changed (may set IRQ).
154                                          *  read automatically clears bit
155                                          * Lower 4 bits are actual status
156                                          */
157
158   uint16        intMask;                                /* Same Bit defs for Mask and status */
159   uint16        intStatus;
160 #define DELTAIP         0x0001
161 #define TXUNDERR        0x0002
162 #define TXOVFERR        0x0004
163 #define TXFIFOTHOLD     0x0008
164 #define TXREADLATCH     0x0010
165 #define TXFIFOEMT       0x0020
166 #define RXUNDERR        0x0040
167 #define RXOVFERR        0x0080
168 #define RXTIMEOUT       0x0100
169 #define RXFIFOFULL      0x0200
170 #define RXFIFOTHOLD     0x0400
171 #define RXFIFONE        0x0800
172 #define RXFRAMERR       0x1000
173 #define RXPARERR        0x2000
174 #define RXBRK           0x4000
175
176   uint16        unused2;
177   uint16        Data;                   /* Write to TX, Read from RX */
178                                         /* bits 11:8 are BRK,PAR,FRM errors */
179
180   uint32                unused3;
181   uint32                unused4;
182 } Uart;
183
184 #define UART ((volatile Uart * const) UART_BASE)
185
186 typedef struct GpioControl {
187   uint32        GPIODir_high; /* bits 36:32 */
188   uint32        GPIODir;      /* bits 31:00 */
189   uint32        GPIOio_high;  /* bits 36:32 */
190   uint32        GPIOio;       /* bits 31:00 */
191   uint32        LEDCtrl;
192 #define         LED3_STROBE             0x08000000
193 #define         LED2_STROBE             0x04000000
194 #define         LED1_STROBE             0x02000000
195 #define         LED0_STROBE             0x01000000
196 #define         LED_TEST                0x00010000
197 #define         LED3_DISABLE_LINK_ACT   0x00008000
198 #define         LED2_DISABLE_LINK_ACT   0x00004000
199 #define         LED1_DISABLE_LINK_ACT   0x00002000
200 #define         LED0_DISABLE_LINK_ACT   0x00001000
201 #define         LED_INTERVAL_SET_MASK   0x00000f00
202 #define         LED_INTERVAL_SET_320MS  0x00000500
203 #define         LED_INTERVAL_SET_160MS  0x00000400
204 #define         LED_INTERVAL_SET_80MS   0x00000300
205 #define         LED_INTERVAL_SET_40MS   0x00000200
206 #define         LED_INTERVAL_SET_20MS   0x00000100
207 #define         LED3_ON                 0x00000080
208 #define         LED2_ON                 0x00000040
209 #define         LED1_ON                 0x00000020
210 #define         LED0_ON                 0x00000010
211 #define         LED3_ENABLE             0x00000008
212 #define         LED2_ENABLE             0x00000004
213 #define         LED1_ENABLE             0x00000002
214 #define         LED0_ENABLE             0x00000001
215   uint32        SpiSlaveCfg;
216 #define         SPI_SLAVE_RESET         0x00010000
217 #define         SPI_RESTRICT            0x00000400
218 #define         SPI_DELAY_DISABLE       0x00000200
219 #define         SPI_PROBE_MUX_SEL_MASK  0x000001e0
220 #define         SPI_SER_ADDR_CFG_MASK   0x0000000c
221 #define         SPI_MODE                0x00000001
222   uint32        GPIOMode;
223 #define         GROUP4_DIAG             0x00090000
224 #define         GROUP4_UTOPIA           0x00080000
225 #define         GROUP4_LEGACY_LED       0x00030000
226 #define         GROUP4_MII_SNOOP        0x00020000
227 #define         GROUP4_EXT_EPHY         0x00010000
228 #define         GROUP3_DIAG             0x00009000
229 #define         GROUP3_UTOPIA           0x00008000
230 #define         GROUP3_EXT_MII          0x00007000
231 #define         GROUP2_DIAG             0x00000900
232 #define         GROUP2_PCI              0x00000500
233 #define         GROUP1_DIAG             0x00000090
234 #define         GROUP1_UTOPIA           0x00000080
235 #define         GROUP1_SPI_UART         0x00000060
236 #define         GROUP1_SPI_MASTER       0x00000060
237 #define         GROUP1_MII_PCCARD       0x00000040
238 #define         GROUP1_MII_SNOOP        0x00000020
239 #define         GROUP1_EXT_EPHY         0x00000010
240 #define         GROUP0_DIAG             0x00000009
241 #define         GROUP0_EXT_MII          0x00000007
242
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_TOTAL_BITS_MASK        0x3f
249 #define GPIO_NUM_MAX_BITS_MASK          0x1f
250 #define GPIO_NUM_TO_MASK(X)             ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) < 32) ? (1 << ((X) & GPIO_NUM_MAX_BITS_MASK)) : (0) )
251
252 /* Number to mask conversion macro used for GPIODir_high and GPIOio_high */
253 #define GPIO_NUM_MAX_BITS_MASK_HIGH     0x07
254 #define GPIO_NUM_TO_MASK_HIGH(X)        ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) >= 32) ? (1 << ((X-32) & GPIO_NUM_MAX_BITS_MASK_HIGH)) : (0) )
255
256
257 /*
258 ** External Bus Interface
259 */
260 typedef struct EbiChipSelect {
261   uint32        base;                   /* base address in upper 24 bits */
262 #define EBI_SIZE_8K         0
263 #define EBI_SIZE_16K        1
264 #define EBI_SIZE_32K        2
265 #define EBI_SIZE_64K        3
266 #define EBI_SIZE_128K       4
267 #define EBI_SIZE_256K       5
268 #define EBI_SIZE_512K       6
269 #define EBI_SIZE_1M         7
270 #define EBI_SIZE_2M         8
271 #define EBI_SIZE_4M         9
272 #define EBI_SIZE_8M         10
273 #define EBI_SIZE_16M        11
274 #define EBI_SIZE_32M        12
275 #define EBI_SIZE_64M        13
276 #define EBI_SIZE_128M       14
277 #define EBI_SIZE_256M       15
278   uint32        config;
279 #define EBI_ENABLE          0x00000001      /* .. enable this range */
280 #define EBI_WAIT_STATES     0x0000000e      /* .. mask for wait states */
281 #define EBI_WTST_SHIFT      1               /* .. for shifting wait states */
282 #define EBI_WORD_WIDE       0x00000010      /* .. 16-bit peripheral, else 8 */
283 #define EBI_WREN            0x00000020      /* enable posted writes */
284 #define EBI_POLARITY        0x00000040      /* .. set to invert something, 
285                                         **    don't know what yet */
286 #define EBI_TS_TA_MODE      0x00000080      /* .. use TS/TA mode */
287 #define EBI_TS_SEL          0x00000100      /* .. drive tsize, not bs_b */
288 #define EBI_FIFO            0x00000200      /* .. use fifo */
289 #define EBI_RE              0x00000400      /* .. Reverse Endian */
290 } EbiChipSelect;
291
292 typedef struct MpiRegisters {
293   EbiChipSelect cs[7];                  /* size chip select configuration */
294 #define EBI_CS0_BASE            0
295 #define EBI_CS1_BASE            1
296 #define EBI_CS2_BASE            2
297 #define EBI_CS3_BASE            3
298 #define PCMCIA_COMMON_BASE      4
299 #define PCMCIA_ATTRIBUTE_BASE   5
300 #define PCMCIA_IO_BASE          6
301   uint32        unused0[2];             /* reserved */
302   uint32        ebi_control;            /* ebi control */
303   uint32        unused1[4];             /* reserved */
304 #define EBI_ACCESS_TIMEOUT      0x000007FF
305   uint32        pcmcia_cntl1;           /* pcmcia control 1 */
306 #define PCCARD_CARD_RESET       0x00040000
307 #define CARDBUS_ENABLE          0x00008000
308 #define PCMCIA_ENABLE           0x00004000
309 #define PCMCIA_GPIO_ENABLE      0x00002000
310 #define CARDBUS_IDSEL           0x00001F00
311 #define VS2_OEN                 0x00000080
312 #define VS1_OEN                 0x00000040
313 #define VS2_OUT                 0x00000020
314 #define VS1_OUT                 0x00000010
315 #define VS2_IN                  0x00000008
316 #define VS1_IN                  0x00000004
317 #define CD2_IN                  0x00000002
318 #define CD1_IN                  0x00000001
319 #define VS_MASK                 0x0000000C
320 #define CD_MASK                 0x00000003
321   uint32        unused2;                /* reserved */
322   uint32        pcmcia_cntl2;           /* pcmcia control 2 */
323 #define PCMCIA_BYTESWAP_DIS     0x00000002
324 #define PCMCIA_HALFWORD_EN      0x00000001
325 #define RW_ACTIVE_CNT_BIT       2
326 #define INACTIVE_CNT_BIT        8
327 #define CE_SETUP_CNT_BIT        16
328 #define CE_HOLD_CNT_BIT         24
329   uint32        unused3[41];            /* reserved */
330
331   uint32        sp0remap;
332   uint32        sp0cfg;
333   uint32        unused4;
334   uint32        sp1remap;
335   uint32        sp1cfg;
336
337   uint32        EndianCfg;
338
339   uint32        l2pcfgctl;              /* internal system bus to PCI IO/Cfg control */
340 #define DIR_CFG_SEL             0x80000000 /* change from PCI I/O access to PCI config access */
341 #define DIR_CFG_USEREG          0x40000000 /* use this register info for PCI configuration access */
342 #define DEVICE_NUMBER           0x00007C00 /* device number for the PCI configuration access */
343 #define FUNC_NUMBER             0x00000300 /* function number for the PCI configuration access */
344 #define REG_NUMBER              0x000000FC /* register number for the PCI configuration access */
345 #define CONFIG_TYPE             0x00000003 /* configuration type for the PCI configuration access */
346
347   uint32        l2pmrange1;             /* internal system bus to PCI memory space */
348 #define PCI_SIZE_64K            0xFFFF0000
349 #define PCI_SIZE_128K           0xFFFE0000
350 #define PCI_SIZE_256K           0xFFFC0000
351 #define PCI_SIZE_512K           0xFFF80000
352 #define PCI_SIZE_1M             0xFFF00000
353 #define PCI_SIZE_2M             0xFFE00000
354 #define PCI_SIZE_4M             0xFFC00000
355 #define PCI_SIZE_8M             0xFF800000
356 #define PCI_SIZE_16M            0xFF000000
357   uint32        l2pmbase1;              /* kseg0 or kseg1 address & 0x1FFFFFFF */
358   uint32        l2pmremap1;
359 #define CARDBUS_MEM             0x00000004
360 #define MEM_WINDOW_EN           0x00000001
361   uint32        l2pmrange2;
362   uint32        l2pmbase2;
363   uint32        l2pmremap2;
364   uint32        l2piorange;             /* internal system bus to PCI I/O space */
365   uint32        l2piobase;
366   uint32        l2pioremap;
367
368   uint32        pcimodesel;
369 #define PCI2_INT_BUS_RD_PREFECH 0x000000F0
370 #define PCI_BAR2_NOSWAP         0x00000002 /* BAR at offset 0x20 */
371 #define PCI_BAR1_NOSWAP         0x00000001 /* BAR at affset 0x1c */
372
373   uint32        pciintstat;             /* PCI interrupt mask/status */
374 #define MAILBOX1_SENT           0x08
375 #define MAILBOX0_SENT           0x04
376 #define MAILBOX1_MSG_RCV        0x02
377 #define MAILBOX0_MSG_RCV        0x01
378   uint32        locbuscntrl;            /* internal system bus control */
379 #define DIR_U2P_NOSWAP          0x00000002
380 #define EN_PCI_GPIO             0x00000001
381   uint32        locintstat;             /* internal system bus interrupt mask/status */
382 #define CSERR                   0x0200
383 #define SERR                    0x0100
384 #define EXT_PCI_INT             0x0080
385 #define DIR_FAILED              0x0040
386 #define DIR_COMPLETE            0x0020
387 #define PCI_CFG                 0x0010
388   uint32        unused5[7];
389
390   uint32        mailbox0;
391   uint32        mailbox1;
392
393   uint32        pcicfgcntrl;            /* internal system bus PCI configuration control */
394 #define PCI_CFG_REG_WRITE_EN    0x00000080
395 #define PCI_CFG_ADDR            0x0000003C
396   uint32        pcicfgdata;             /* internal system bus PCI configuration data */
397
398   uint32        locch2ctl;              /* PCI to interrnal system bus DMA (downstream) local control */
399 #define MPI_DMA_HALT            0x00000008  /* idle after finish current memory burst */
400 #define MPI_DMA_PKT_HALT        0x00000004  /* idle after an EOP flag is detected */
401 #define MPI_DMA_STALL           0x00000002  /* idle after an EOP flag is detected */
402 #define MPI_DMA_ENABLE          0x00000001  /* set to enable channel */
403   uint32        locch2intStat;
404 #define MPI_DMA_NO_DESC         0x00000004  /* no valid descriptors */
405 #define MPI_DMA_DONE            0x00000002  /* packet xfer complete */
406 #define MPI_DMA_BUFF_DONE       0x00000001  /* buffer done */
407   uint32        locch2intMask;
408   uint32        unused6;
409   uint32        locch2descaddr;
410   uint32        locch2status1;
411 #define LOCAL_DESC_STATE        0xE0000000
412 #define PCI_DESC_STATE          0x1C000000
413 #define BYTE_DONE               0x03FFC000
414 #define RING_ADDR               0x00003FFF
415   uint32        locch2status2;
416 #define BUFPTR_OFFSET           0x1FFF0000
417 #define PCI_MASTER_STATE        0x000000C0
418 #define LOC_MASTER_STATE        0x00000038
419 #define CONTROL_STATE           0x00000007
420   uint32        unused7;
421
422   uint32        locch1Ctl;              /*internal system bus to PCI DMA (upstream) local control */
423 #define DMA_U2P_LE              0x00000200  /* local bus is little endian */
424 #define DMA_U2P_NOSWAP          0x00000100  /* lccal bus is little endian but no data swapped */
425   uint32        locch1intstat;
426   uint32        locch1intmask;
427   uint32        unused8;
428   uint32        locch1descaddr;
429   uint32        locch1status1;
430   uint32        locch1status2;
431   uint32        unused9;
432
433   uint32        pcich1ctl;              /* internal system bus to PCI DMA PCI control */
434   uint32        pcich1intstat;
435   uint32        pcich1intmask;
436   uint32        pcich1descaddr;
437   uint32        pcich1status1;
438   uint32        pcich1status2;
439
440   uint32        pcich2Ctl;              /* PCI to internal system bus DMA PCI control */
441   uint32        pcich2intstat;
442   uint32        pcich2intmask;
443   uint32        pcich2descaddr;
444   uint32        pcich2status1;
445   uint32        pcich2status2;
446
447   uint32        perm_id;                /* permanent device and vendor id */
448   uint32        perm_rev;               /* permanent revision id */
449 } MpiRegisters;
450
451 #define MPI ((volatile MpiRegisters * const) MPI_BASE)
452
453 /* PCI configuration address space start offset 0x40 */
454 #define BRCM_PCI_CONFIG_TIMER               0x40
455 #define BRCM_PCI_CONFIG_TIMER_RETRY_MASK        0x0000FF00
456 #define BRCM_PCI_CONFIG_TIMER_TRDY_MASK         0x000000FF
457
458 /* USB host non-Open HCI register, USB_HOST_NON_OHCI, bit definitions. */
459 #define NON_OHCI_ENABLE_PORT1   0x00000001 /* Use USB port 1 for host, not dev */
460 #define NON_OHCI_BYTE_SWAP      0x00000008 /* Swap USB host registers */
461
462 #define USBH_NON_OHCI ((volatile unsigned long * const) USB_HOST_NON_OHCI)
463
464 #if __cplusplus
465 }
466 #endif
467
468 #endif
469