3 Copyright 2004 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 __BCM6338_MAP_H
21 #define __BCM6338_MAP_H
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
35 typedef struct PerfControl {
39 #define EMAC_CLK_EN 0x0010
40 #define USBS_CLK_EN 0x0010
41 #define SAR_CLK_EN 0x0020
43 #define SPI_CLK_EN 0x0200
46 #define SOFT_RESET 0x00000001
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
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)
75 #define PERF ((volatile PerfControl * const) PERF_BASE)
78 typedef struct Timer {
92 #define TIMERENABLE 0x80000000
93 #define RSTCNTCLR 0x40000000
97 uint32 WatchDogDefCount;
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
105 /* Number of 40-MHz ticks for WD Reset pulse to last */
109 #define TIMER ((volatile Timer * const) TIMR_BASE)
110 typedef struct UartChannel {
113 #define BRGEN 0x80 /* Control register bit defs */
117 #define TXPARITYEN 0x08
118 #define TXPARITYEVEN 0x04
119 #define RXPARITYEN 0x02
120 #define RXPARITYEVEN 0x01
123 #define XMITBREAK 0x40
124 #define BITS5SYM 0x00
125 #define BITS6SYM 0x10
126 #define BITS7SYM 0x20
127 #define BITS8SYM 0x30
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.
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
143 /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
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
152 byte prog_out; /* Set value of DTR (Bit0), RTS (Bit1)
153 * if these bits are also enabled to GPIO_o
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)
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
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
178 uint16 intMask; /* Same Bit defs for Mask and status */
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
197 uint16 Data; /* Write to TX, Read from RX */
198 /* bits 11:8 are BRK,PAR,FRM errors */
204 #define UART ((volatile Uart * const) UART_BASE)
206 typedef struct GpioControl {
208 uint32 GPIODir; /* bits 7:0 */
210 uint32 GPIOio; /* bits 7:0 */
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
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
245 #define GPIO ((volatile GpioControl * const) GPIO_BASE)
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))
255 typedef struct SpiControl {
256 uint16 spiCmd; /* (0x0): SPI command */
257 #define SPI_CMD_START_IMMEDIATE 3
259 #define SPI_CMD_COMMAND_SHIFT 0
260 #define SPI_CMD_DEVICE_ID_SHIFT 4
261 #define SPI_CMD_PREPEND_BYTE_CNT_SHIFT 8
263 byte spiIntStatus; /* (0x2): SPI interrupt status */
264 byte spiMaskIntStatus; /* (0x3): SPI masked interrupt status */
266 byte spiIntMask; /* (0x4): SPI interrupt mask */
267 #define SPI_INTR_CMD_DONE 0x01
268 #define SPI_INTR_CLEAR_ALL 0x1f
270 byte spiStatus; /* (0x5): SPI status */
272 byte spiClkCfg; /* (0x6): SPI clock configuration */
274 byte spiFillByte; /* (0x7): SPI fill byte */
277 byte spiMsgTail; /* (0x9): msgtail */
279 byte spiRxTail; /* (0xB): rxtail */
281 uint32 unused2[13]; /* (0x0c - 0x3c) reserved */
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 */
293 #define SPI ((volatile SpiControl * const) SPI_BASE)
296 ** External Bus Interface
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
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 */
330 typedef struct MpiRegisters {
331 EbiChipSelect cs[1]; /* size chip select configuration */
334 #define MPI ((volatile MpiRegisters * const) MPI_BASE)