3 Copyright 2002 Broadcom Corp. All Rights Reserved.
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.
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
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.
20 #ifndef __BCM6348_MAP_H
21 #define __BCM6348_MAP_H
29 #define PERF_BASE 0xfffe0000
30 #define TIMR_BASE 0xfffe0200
31 #define UART_BASE 0xfffe0300
32 #define GPIO_BASE 0xfffe0400
33 #define MPI_BASE 0xfffe2000 /* MPI control registers */
34 #define USB_OHCI_BASE 0xfffe1b00 /* USB host registers */
35 #define USBH_CFG_BASE 0xfffe1c00 /* USB host non-OHCI registers */
37 typedef struct PerfControl {
41 #define EMAC_CLK_EN 0x0010
42 #define SAR_CLK_EN 0x0020
43 #define USBS_CLK_EN 0x0040
44 #define USBH_CLK_EN 0x0100
47 #define SOFT_RESET 0x00000001
48 #define MPI_UTOPIA_25MHZ 0x00000002
49 #define MPI_UTOPIA_50MZH 0x00000000
50 #define MPI_UTOPIA_MASK 0x00000002
51 #define MPI_CLK_50MHZ 0x00000000
52 #define MPI_CLK_40MHZ 0x00000008
53 #define MPI_CLK_33MHZ 0x00000010
54 #define MPI_CLK_25MHZ 0x00000018
55 #define MPI_CLK_MASK 0x00000018
61 #define EI_SENSE_SHFT 0
62 #define EI_STATUS_SHFT 5
63 #define EI_CLEAR_SHFT 10
64 #define EI_MASK_SHFT 15
65 #define EI_INSENS_SHFT 20
66 #define EI_LEVEL_SHFT 25
68 uint32 unused[4]; /* (18) */
69 uint32 BlockSoftReset; /* (28) */
70 #define BSR_SPI 0x00000001
71 #define BSR_EMAC 0x00000004
72 #define BSR_USBH 0x00000008
73 #define BSR_USBS 0x00000010
74 #define BSR_ADSL 0x00000020
75 #define BSR_DMAMEM 0x00000040
76 #define BSR_SAR 0x00000080
77 #define BSR_ACLC 0x00000100
78 #define BSR_ADSL_MIPS_PLL 0x00000400
79 #define BSR_ALL_BLOCKS \
80 (BSR_SPI | BSR_EMAC | BSR_USBH | BSR_USBS | BSR_ADSL | BSR_DMAMEM | \
81 BSR_SAR | BSR_ACLC | BSR_ADSL_MIPS_PLL)
82 uint32 unused2[2]; /* (2c) */
83 uint32 PllStrap; /* (34) */
84 #define PLL_N1_SHFT 20
85 #define PLL_N1_MASK (7<<PLL_N1_SHFT)
86 #define PLL_N2_SHFT 15
87 #define PLL_N2_MASK (0x1f<<PLL_N2_SHFT)
88 #define PLL_M1_REF_SHFT 12
89 #define PLL_M1_REF_MASK (7<<PLL_M1_REF_SHFT)
90 #define PLL_M2_REF_SHFT 9
91 #define PLL_M2_REF_MASK (7<<PLL_M2_REF_SHFT)
92 #define PLL_M1_CPU_SHFT 6
93 #define PLL_M1_CPU_MASK (7<<PLL_M1_CPU_SHFT)
94 #define PLL_M1_BUS_SHFT 3
95 #define PLL_M1_BUS_MASK (7<<PLL_M1_BUS_SHFT)
96 #define PLL_M2_BUS_SHFT 0
97 #define PLL_M2_BUS_MASK (7<<PLL_M2_BUS_SHFT)
100 #define PERF ((volatile PerfControl * const) PERF_BASE)
102 typedef struct Timer {
105 #define TIMER0EN 0x01
106 #define TIMER1EN 0x02
107 #define TIMER2EN 0x04
112 #define WATCHDOG 0x08
116 #define TIMERENABLE 0x80000000
117 #define RSTCNTCLR 0x40000000
121 uint32 WatchDogDefCount;
123 /* Write 0xff00 0x00ff to Start timer
124 * Write 0xee00 0x00ee to Stop and re-load default count
125 * Read from this register returns current watch dog count
129 /* Number of 40-MHz ticks for WD Reset pulse to last */
133 #define TIMER ((volatile Timer * const) TIMR_BASE)
135 typedef struct UartChannel {
138 #define BRGEN 0x80 /* Control register bit defs */
142 #define TXPARITYEN 0x08
143 #define TXPARITYEVEN 0x04
144 #define RXPARITYEN 0x02
145 #define RXPARITYEVEN 0x01
148 #define XMITBREAK 0x40
149 #define BITS5SYM 0x00
150 #define BITS6SYM 0x10
151 #define BITS7SYM 0x20
152 #define BITS8SYM 0x30
155 /* 4-LSBS represent STOP bits/char
156 * in 1/8 bit-time intervals. Zero
157 * represents 1/8 stop bit interval.
158 * Fifteen represents 2 stop bits.
161 #define RSTTXFIFOS 0x80
162 #define RSTRXFIFOS 0x40
163 /* 5-bit TimeoutCnt is in low bits of this register.
164 * This count represents the number of characters
165 * idle times before setting receive Irq when below threshold
168 /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
171 byte txf_levl; /* Read-only fifo depth */
172 byte rxf_levl; /* Read-only fifo depth */
173 byte fifocfg; /* Upper 4-bits are TxThresh, Lower are
174 * RxThreshold. Irq can be asserted
175 * when rx fifo> thresh, txfifo<thresh
177 byte prog_out; /* Set value of DTR (Bit0), RTS (Bit1)
178 * if these bits are also enabled to GPIO_o
184 byte DeltaIPEdgeNoSense; /* Low 4-bits, set corr bit to 1 to
185 * detect irq on rising AND falling
186 * edges for corresponding GPIO_i
187 * if enabled (edge insensitive)
189 byte DeltaIPConfig_Mask; /* Upper 4 bits: 1 for posedge sense
190 * 0 for negedge sense if
191 * not configured for edge
192 * insensitive (see above)
193 * Lower 4 bits: Mask to enable change
194 * detection IRQ for corresponding
197 byte DeltaIP_SyncIP; /* Upper 4 bits show which bits
198 * have changed (may set IRQ).
199 * read automatically clears bit
200 * Lower 4 bits are actual status
203 uint16 intMask; /* Same Bit defs for Mask and status */
205 #define DELTAIP 0x0001
206 #define TXUNDERR 0x0002
207 #define TXOVFERR 0x0004
208 #define TXFIFOTHOLD 0x0008
209 #define TXREADLATCH 0x0010
210 #define TXFIFOEMT 0x0020
211 #define RXUNDERR 0x0040
212 #define RXOVFERR 0x0080
213 #define RXTIMEOUT 0x0100
214 #define RXFIFOFULL 0x0200
215 #define RXFIFOTHOLD 0x0400
216 #define RXFIFONE 0x0800
217 #define RXFRAMERR 0x1000
218 #define RXPARERR 0x2000
222 uint16 Data; /* Write to TX, Read from RX */
223 /* bits 11:8 are BRK,PAR,FRM errors */
229 #define UART ((volatile Uart * const) UART_BASE)
231 typedef struct GpioControl {
232 uint32 GPIODir_high; /* bits 36:32 */
233 uint32 GPIODir; /* bits 31:00 */
234 uint32 GPIOio_high; /* bits 36:32 */
235 uint32 GPIOio; /* bits 31:00 */
237 #define LED3_STROBE 0x08000000
238 #define LED2_STROBE 0x04000000
239 #define LED1_STROBE 0x02000000
240 #define LED0_STROBE 0x01000000
241 #define LED_TEST 0x00010000
242 #define LED3_DISABLE_LINK_ACT 0x00008000
243 #define LED2_DISABLE_LINK_ACT 0x00004000
244 #define LED1_DISABLE_LINK_ACT 0x00002000
245 #define LED0_DISABLE_LINK_ACT 0x00001000
246 #define LED_INTERVAL_SET_MASK 0x00000f00
247 #define LED_INTERVAL_SET_320MS 0x00000500
248 #define LED_INTERVAL_SET_160MS 0x00000400
249 #define LED_INTERVAL_SET_80MS 0x00000300
250 #define LED_INTERVAL_SET_40MS 0x00000200
251 #define LED_INTERVAL_SET_20MS 0x00000100
252 #define LED3_ON 0x00000080
253 #define LED2_ON 0x00000040
254 #define LED1_ON 0x00000020
255 #define LED0_ON 0x00000010
256 #define LED3_ENABLE 0x00000008
257 #define LED2_ENABLE 0x00000004
258 #define LED1_ENABLE 0x00000002
259 #define LED0_ENABLE 0x00000001
261 #define SPI_SLAVE_RESET 0x00010000
262 #define SPI_RESTRICT 0x00000400
263 #define SPI_DELAY_DISABLE 0x00000200
264 #define SPI_PROBE_MUX_SEL_MASK 0x000001e0
265 #define SPI_SER_ADDR_CFG_MASK 0x0000000c
266 #define SPI_MODE 0x00000001
268 #define GROUP4_DIAG 0x00090000
269 #define GROUP4_UTOPIA 0x00080000
270 #define GROUP4_LEGACY_LED 0x00030000
271 #define GROUP4_MII_SNOOP 0x00020000
272 #define GROUP4_EXT_EPHY 0x00010000
273 #define GROUP3_DIAG 0x00009000
274 #define GROUP3_UTOPIA 0x00008000
275 #define GROUP3_EXT_MII 0x00007000
276 #define GROUP2_DIAG 0x00000900
277 #define GROUP2_PCI 0x00000500
278 #define GROUP1_DIAG 0x00000090
279 #define GROUP1_UTOPIA 0x00000080
280 #define GROUP1_SPI_UART 0x00000060
281 #define GROUP1_SPI_MASTER 0x00000060
282 #define GROUP1_MII_PCCARD 0x00000040
283 #define GROUP1_MII_SNOOP 0x00000020
284 #define GROUP1_EXT_EPHY 0x00000010
285 #define GROUP0_DIAG 0x00000009
286 #define GROUP0_EXT_MII 0x00000007
290 #define GPIO ((volatile GpioControl * const) GPIO_BASE)
292 /* Number to mask conversion macro used for GPIODir and GPIOio */
293 #define GPIO_NUM_TOTAL_BITS_MASK 0x3f
294 #define GPIO_NUM_MAX_BITS_MASK 0x1f
295 #define GPIO_NUM_TO_MASK(X) ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) < 32) ? (1 << ((X) & GPIO_NUM_MAX_BITS_MASK)) : (0) )
297 /* Number to mask conversion macro used for GPIODir_high and GPIOio_high */
298 #define GPIO_NUM_MAX_BITS_MASK_HIGH 0x07
299 #define GPIO_NUM_TO_MASK_HIGH(X) ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) >= 32) ? (1 << ((X-32) & GPIO_NUM_MAX_BITS_MASK_HIGH)) : (0) )
303 ** External Bus Interface
305 typedef struct EbiChipSelect {
306 uint32 base; /* base address in upper 24 bits */
307 #define EBI_SIZE_8K 0
308 #define EBI_SIZE_16K 1
309 #define EBI_SIZE_32K 2
310 #define EBI_SIZE_64K 3
311 #define EBI_SIZE_128K 4
312 #define EBI_SIZE_256K 5
313 #define EBI_SIZE_512K 6
314 #define EBI_SIZE_1M 7
315 #define EBI_SIZE_2M 8
316 #define EBI_SIZE_4M 9
317 #define EBI_SIZE_8M 10
318 #define EBI_SIZE_16M 11
319 #define EBI_SIZE_32M 12
320 #define EBI_SIZE_64M 13
321 #define EBI_SIZE_128M 14
322 #define EBI_SIZE_256M 15
324 #define EBI_ENABLE 0x00000001 /* .. enable this range */
325 #define EBI_WAIT_STATES 0x0000000e /* .. mask for wait states */
326 #define EBI_WTST_SHIFT 1 /* .. for shifting wait states */
327 #define EBI_WORD_WIDE 0x00000010 /* .. 16-bit peripheral, else 8 */
328 #define EBI_WREN 0x00000020 /* enable posted writes */
329 #define EBI_POLARITY 0x00000040 /* .. set to invert something,
330 ** don't know what yet */
331 #define EBI_TS_TA_MODE 0x00000080 /* .. use TS/TA mode */
332 #define EBI_TS_SEL 0x00000100 /* .. drive tsize, not bs_b */
333 #define EBI_FIFO 0x00000200 /* .. use fifo */
334 #define EBI_RE 0x00000400 /* .. Reverse Endian */
335 #define EBI_SETUP_SHIFT 16
336 #define EBI_HOLD_SHIFT 20
337 #define EBI_SETUP_STATES 0x0f0000
338 #define EBI_HOLD_STATES 0xf00000
341 typedef struct MpiRegisters {
342 EbiChipSelect cs[7]; /* size chip select configuration */
343 #define EBI_CS0_BASE 0
344 #define EBI_CS1_BASE 1
345 #define EBI_CS2_BASE 2
346 #define EBI_CS3_BASE 3
347 #define PCMCIA_COMMON_BASE 4
348 #define PCMCIA_ATTRIBUTE_BASE 5
349 #define PCMCIA_IO_BASE 6
350 uint32 unused0[2]; /* reserved */
351 uint32 ebi_control; /* ebi control */
352 uint32 unused1[4]; /* reserved */
353 #define EBI_ACCESS_TIMEOUT 0x000007FF
354 uint32 pcmcia_cntl1; /* pcmcia control 1 */
355 #define PCCARD_CARD_RESET 0x00040000
356 #define CARDBUS_ENABLE 0x00008000
357 #define PCMCIA_ENABLE 0x00004000
358 #define PCMCIA_GPIO_ENABLE 0x00002000
359 #define CARDBUS_IDSEL 0x00001F00
360 #define VS2_OEN 0x00000080
361 #define VS1_OEN 0x00000040
362 #define VS2_OUT 0x00000020
363 #define VS1_OUT 0x00000010
364 #define VS2_IN 0x00000008
365 #define VS1_IN 0x00000004
366 #define CD2_IN 0x00000002
367 #define CD1_IN 0x00000001
368 #define VS_MASK 0x0000000C
369 #define CD_MASK 0x00000003
370 uint32 unused2; /* reserved */
371 uint32 pcmcia_cntl2; /* pcmcia control 2 */
372 #define PCMCIA_BYTESWAP_DIS 0x00000002
373 #define PCMCIA_HALFWORD_EN 0x00000001
374 #define RW_ACTIVE_CNT_BIT 2
375 #define INACTIVE_CNT_BIT 8
376 #define CE_SETUP_CNT_BIT 16
377 #define CE_HOLD_CNT_BIT 24
378 uint32 unused3[40]; /* reserved */
380 uint32 sp0range; /* PCI to internal system bus address space */
389 uint32 l2pcfgctl; /* internal system bus to PCI IO/Cfg control */
390 #define DIR_CFG_SEL 0x80000000 /* change from PCI I/O access to PCI config access */
391 #define DIR_CFG_USEREG 0x40000000 /* use this register info for PCI configuration access */
392 #define DEVICE_NUMBER 0x00007C00 /* device number for the PCI configuration access */
393 #define FUNC_NUMBER 0x00000300 /* function number for the PCI configuration access */
394 #define REG_NUMBER 0x000000FC /* register number for the PCI configuration access */
395 #define CONFIG_TYPE 0x00000003 /* configuration type for the PCI configuration access */
397 uint32 l2pmrange1; /* internal system bus to PCI memory space */
398 #define PCI_SIZE_64K 0xFFFF0000
399 #define PCI_SIZE_128K 0xFFFE0000
400 #define PCI_SIZE_256K 0xFFFC0000
401 #define PCI_SIZE_512K 0xFFF80000
402 #define PCI_SIZE_1M 0xFFF00000
403 #define PCI_SIZE_2M 0xFFE00000
404 #define PCI_SIZE_4M 0xFFC00000
405 #define PCI_SIZE_8M 0xFF800000
406 #define PCI_SIZE_16M 0xFF000000
407 #define PCI_SIZE_32M 0xFE000000
408 uint32 l2pmbase1; /* kseg0 or kseg1 address & 0x1FFFFFFF */
410 #define CARDBUS_MEM 0x00000004
411 #define MEM_WINDOW_EN 0x00000001
415 uint32 l2piorange; /* internal system bus to PCI I/O space */
420 #define PCI_INT_BUS_RD_PREFETCH 0x000001F0
421 #define PCI_BAR2_NOSWAP 0x00000002 /* BAR at offset 0x20 */
422 #define PCI_BAR1_NOSWAP 0x00000001 /* BAR at affset 0x1c */
424 uint32 pciintstat; /* PCI interrupt mask/status */
425 #define MAILBOX1_SENT 0x08
426 #define MAILBOX0_SENT 0x04
427 #define MAILBOX1_MSG_RCV 0x02
428 #define MAILBOX0_MSG_RCV 0x01
429 uint32 locbuscntrl; /* internal system bus control */
430 #define DIR_U2P_NOSWAP 0x00000002
431 #define EN_PCI_GPIO 0x00000001
432 uint32 locintstat; /* internal system bus interrupt mask/status */
435 #define EXT_PCI_INT 0x0080
436 #define DIR_FAILED 0x0040
437 #define DIR_COMPLETE 0x0020
438 #define PCI_CFG 0x0010
444 uint32 pcicfgcntrl; /* internal system bus PCI configuration control */
445 #define PCI_CFG_REG_WRITE_EN 0x00000080
446 #define PCI_CFG_ADDR 0x0000003C
447 uint32 pcicfgdata; /* internal system bus PCI configuration data */
449 uint32 locch2ctl; /* PCI to interrnal system bus DMA (downstream) local control */
450 #define MPI_DMA_HALT 0x00000008 /* idle after finish current memory burst */
451 #define MPI_DMA_PKT_HALT 0x00000004 /* idle after an EOP flag is detected */
452 #define MPI_DMA_STALL 0x00000002 /* idle after an EOP flag is detected */
453 #define MPI_DMA_ENABLE 0x00000001 /* set to enable channel */
454 uint32 locch2intStat;
455 #define MPI_DMA_NO_DESC 0x00000004 /* no valid descriptors */
456 #define MPI_DMA_DONE 0x00000002 /* packet xfer complete */
457 #define MPI_DMA_BUFF_DONE 0x00000001 /* buffer done */
458 uint32 locch2intMask;
460 uint32 locch2descaddr;
461 uint32 locch2status1;
462 #define LOCAL_DESC_STATE 0xE0000000
463 #define PCI_DESC_STATE 0x1C000000
464 #define BYTE_DONE 0x03FFC000
465 #define RING_ADDR 0x00003FFF
466 uint32 locch2status2;
467 #define BUFPTR_OFFSET 0x1FFF0000
468 #define PCI_MASTER_STATE 0x000000C0
469 #define LOC_MASTER_STATE 0x00000038
470 #define CONTROL_STATE 0x00000007
473 uint32 locch1Ctl; /*internal system bus to PCI DMA (upstream) local control */
474 #define DMA_U2P_LE 0x00000200 /* local bus is little endian */
475 #define DMA_U2P_NOSWAP 0x00000100 /* lccal bus is little endian but no data swapped */
476 uint32 locch1intstat;
477 uint32 locch1intmask;
479 uint32 locch1descaddr;
480 uint32 locch1status1;
481 uint32 locch1status2;
484 uint32 pcich1ctl; /* internal system bus to PCI DMA PCI control */
485 uint32 pcich1intstat;
486 uint32 pcich1intmask;
487 uint32 pcich1descaddr;
488 uint32 pcich1status1;
489 uint32 pcich1status2;
491 uint32 pcich2Ctl; /* PCI to internal system bus DMA PCI control */
492 uint32 pcich2intstat;
493 uint32 pcich2intmask;
494 uint32 pcich2descaddr;
495 uint32 pcich2status1;
496 uint32 pcich2status2;
498 uint32 perm_id; /* permanent device and vendor id */
499 uint32 perm_rev; /* permanent revision id */
502 #define MPI ((volatile MpiRegisters * const) MPI_BASE)
504 /* PCI configuration address space start offset 0x40 */
505 #define BRCM_PCI_CONFIG_TIMER 0x40
506 #define BRCM_PCI_CONFIG_TIMER_RETRY_MASK 0x0000FF00
507 #define BRCM_PCI_CONFIG_TIMER_TRDY_MASK 0x000000FF
509 /* USB host non-Open HCI register, USB_HOST_NON_OHCI, bit definitions. */
510 #define USBH_ENABLE_PORT1 0x00000001 /* Use USB port 1 for host, not dev */
511 #define USBH_BYTE_SWAP 0x00000008 /* Swap USB host registers */
513 #define USBH ((volatile unsigned long * const) USBH_CFG_BASE)