bcm53xx_reg.h revision 1.2 1 /*-
2 * Copyright (c) 2012 The NetBSD Foundation, Inc.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Matt Thomas of 3am Software Foundry.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 #ifndef _ARM_BROADCOM_BCM53XX_REG_H_
31 #define _ARM_BROADCOM_BCM53XX_REG_H_
32
33 /*
34 * 0x0000_0000..0x07ff_ffff 128MB DDR2/3 DRAM Memory Region (dual map)
35 * 0x0800_0000..0x0fff_ffff 128MB PCIe 0 Address Match Region
36 * 0x1800_0000..0x180f_ffff 1MB Core Register Region
37 * 0x1810_0000..0x181f_ffff 1MB IDM Register Region
38 * 0x1900_0000..0x190f_ffff 1MB ARMcore (CORTEX-A9) Register Region
39 * 0x1c00_0000..0x1dff_ffff 1MB NAND Flash Region
40 * 0x1e00_0000..0x1dff_ffff 1MB Serial Flash Region
41 * 0x4000_0000..0x47ff_ffff 128MB PCIe 1 Address Match Region
42 * 0x4800_0000..0x4fff_ffff 128MB PCIe 2 Address Match Region
43 * 0x8000_0000..0xbfff_ffff 1024MB DDR2/3 DRAM Memory Region
44 * 0xfffd_0000..0xfffe_ffff 128KB Internal Boot ROM Region
45 * 0xffff_0000..0xffff_043f 1088B Internal SKU ROM Region
46 * 0xffff_1000..0xffff_1fff 4KB Enumeration ROM Register Region
47 */
48 #define BCM53XX_IOREG_PBASE 0x18000000
49 #define BCM53XX_IOREG_SIZE 0x00200000
50
51 #define BCM53XX_ARMCORE_PBASE 0x19000000
52 #define BCM53XX_ARMCORE_SIZE 0x00100000
53
54 #define BCM53XX_NAND_PBASE 0x1c000000
55 #define BCM53XX_NAND_SIZE 0x01000000
56
57 #define BCM53XX_SPIFLASH_PBASE 0x1d000000
58 #define BCM53XX_SPIFLASH_SIZE 0x01000000
59
60 #define BCM53XX_IO_SIZE (BCM53XX_IOREG_SIZE + BCM53XX_ARMCORE_SIZE)
61
62 #define BCM53XX_REF_CLK (25*1000*1000)
63
64 #define CCA_UART_FREQ BCM53XX_REF_CLK
65
66 /* Chip Common A */
67 #define CCA_MISC_BASE 0x000000
68 #define CCA_MISC_SIZE 0x001000
69 #define CCA_UART0_BASE 0x000300
70 #define CCA_UART1_BASE 0x000400
71
72 /* Chip Common B */
73 #define CCB_BASE 0x000000
74 #define CCB_SIZE 0x030000
75 #define PWM_BASE 0x002000
76 #define MII_BASE 0x003000
77 #define RNG_BASE 0x004000
78 #define TIMER0_BASE 0x005000
79 #define TIMER1_BASE 0x006000
80 #define SRAB_BASE 0x007000
81 #define UART2_BASE 0x008000
82 #define SMBUS_BASE 0x009000
83
84 #define CRU_BASE 0x00b000
85 #define DMU_BASE 0x00c000
86
87 #define DDR_BASE 0x010000
88
89 #define PCIE0_BASE 0x012000
90 #define PCIE1_BASE 0x013000
91 #define PCIE2_BASE 0x014000
92
93 #define SDIO_BASE 0x020000
94 #define EHCI_BASE 0x021000
95 #define OHCI_BASE 0x022000
96
97 #define GMAC0_BASE 0x024000
98 #define GMAC1_BASE 0x025000
99 #define GMAC2_BASE 0x026000
100 #define GMAC3_BASE 0x027000
101
102 #define IDM_BASE 0x100000
103 #define IDM_SIZE 0x100000
104
105 /* Chip Common A */
106
107 #ifdef CCA_PRIVATE
108
109 #define MISC_CHIPID 0x000
110 #define CHIPID_REV __BITS(19,16)
111 #define CHIPID_ID __BITS(15,0)
112 #define ID_BCM53010 0xcf12 // 53010
113 #define ID_BCM53011 0xcf13 // 53011
114 #define ID_BCM53012 0xcf14 // 53012
115 #define ID_BCM53013 0xcf15 // 53013
116
117 #define MISC_CAPABILITY 0x004
118 #define CAPABILITY_JTAG_PRESENT __BIT(22)
119 #define CAPABILITY_UART_CLKSEL __BITS(4,3)
120 #define UART_CLKSEL_REFCLK 0
121 #define UART_CLKSEL_INTCLK 1
122 /* 2 & 3 are reserved */
123 #define CAPABILITY_BIG_ENDIAN __BIT(2)
124 #define CAPABILITY_UART_COUNT __BITS(1,0)
125
126 #define MISC_CORECTL 0x008
127 #define CORECTL_UART_CLK_EN __BIT(3)
128 #define CORECTL_GPIO_ASYNC_INT_EN __BIT(2)
129 #define CORECTL_UART_CLK_OVERRIDE __BIT(0)
130
131 #define MISC_INTSTATUS 0x020
132 #define INTSTATUS_WDRESET __BIT(31) // WO2C
133 #define INTSTATUS_UARTINT __BIT(6) // RO
134 #define INTSTATUS_GPIOINT __BIT(0) // RO
135
136 #define MISC_INTMASK 0x024
137 #define INTMASK_UARTINT __BIT(6) // 1 = enabled
138 #define INTMASK_GPIOINT __BIT(0) // 1 = enabled
139
140 /* Only bits [23:0] are used in the GPIO registers */
141 #define GPIO_INPUT 0x060 // RO
142 #define GPIO_OUT 0x064
143 #define GPIO_OUTEN 0x068
144 #define GPIO_INTPOLARITY 0x070 // 1 = active low
145 #define GPIO_INTMASK 0x074 // 1 = enabled (level)
146 #define GPIO_EVENT 0x078 // W1C, 1 = edge seen
147 #define GPIO_EVENT_INTMASK 0x07c // 1 = enabled (edge)
148 #define GPIO_EVENT_INTPOLARITY 0x084 // 1 = falling
149 #define GPIO_TIMER_VAL 0x088
150 #define TIMERVAL_ONCOUNT __BITS(31,16)
151 #define TIMERVAL_OFFCOUNT __BITS(15,0)
152 #define GPIO_TIMER_OUTMASK 0x08c
153 #define GPIO_DEBUG_SEL 0x0a8
154
155 #define MISC_WATCHDOG 0x080 // 0 disables, 1 resets
156
157 #define MISC_CLKDIV 0x0a4
158 #define CLKDIV_JTAG_MASTER_CLKDIV __BITS(13,9)
159 #define CLKDIV_UART_CLKDIV __BITS(7,1)
160
161 #define MISC_CAPABILITY2 0x0ac
162 #define CAPABILITY2_GSIO_PRESENT __BIT(1) // SPI exists
163
164 #define MISC_GSIOCTL 0x0e4
165 #define GSIOCTL_STARTBUSY __BIT(31)
166 #define GSIOCTL_GSIOMODE __BIT(30) // 0 = SPI
167 #define GSIOCTL_ERROR __BIT(23)
168 #define GSIOCTL_BIGENDIAN __BIT(22)
169 #define GSIOCTL_GSIOGO __BIT(21)
170 #define GSIOCTL_NUM_DATABYTES __BITS(17,16) // actual is + 1
171 #define GSIOCTL_NUM_WAITCYCLES __BITS(15,14) // actual is + 1
172 #define GSIOCTL_NUM_ADDRESSBYTES __BITS(13,12) // actual is + 1
173 #define GSIOCTL_GSIOCODE __BITS(10,8)
174 #define GSIOCODE_OP_RD1DATA 0
175 #define GSIOCODE_OP_WRADDR_RDADDR 1
176 #define GSIOCODE_OP_WRADDR_XFRDATA 2
177 #define GSIOCODE_OP_WRADDR_WAIT_XFRDATA 3
178 #define GSIOCODE_XFRDATA 4
179 #define GSIOCTL_GSIOOP __BITS(7,0)
180
181 #define MISC_GSIOADDRESS 0x0e8
182 #define MISC_GSIODATA 0x0ec
183
184 #define MISC_CLKDIV2 0x0f0
185 #define CLKDIV2_GSIODIV __BITS(20,5)
186
187 #define MISC_EROM_PTR_OFFSET 0x0fc
188
189 #endif /* CCA_PRIVATE */
190
191 /*
192 * UART0 & 1 use the standard 16550 register layout (normal 1 byte stride)
193 * and have 64-byte FIFOs
194 */
195
196 /* TIMER0 & 1 are implemented by the dtimer driver */
197
198 #define TIMER_FREQ BCM53XX_REF_CLK
199
200 #ifdef MII_PRIVATE
201 #define MII_INTERNAL 0x0038003 /* internal phy bitmask */
202 #define MIIMGT 0x000
203 #define MIIMGT_BYP __BIT(10)
204 #define MIIMGT_EXT __BIT(9)
205 #define MIIMGT_BSY __BIT(8)
206 #define MIIMGT_PRE __BIT(7)
207 #define MIIMGT_MDCDIV __BITS(6,0)
208 #define MIICMD 0x004
209 #define MIICMD_SB __BITS(31,30)
210 #define MIICMD_SB_DEF __SHIFTIN(1, MIICMD_OP)
211 #define MIICMD_OP __BITS(29,28)
212 #define MIICMD_OP_RD __SHIFTIN(2, MIICMD_OP)
213 #define MIICMD_OP_WR __SHIFTIN(1, MIICMD_OP)
214 #define MIICMD_PHY __BITS(27,23)
215 #define MIICMD_REG __BITS(22,18)
216 #define MIICMD_TA __BITS(17,16)
217 #define MIICMD_TA_DEF __SHIFTIN(2, MIICMD_OP)
218 #define MIICMD_DATA __BITS(15,0)
219
220 #define MIICMD_RD_DEF (MIICMD_SB_DEF|MIICMD_OP_RD|MIICMD_TA_DEF)
221 #define MIICMD_WR_DEF (MIICMD_SB_DEF|MIICMD_OP_WR|MIICMD_TA_DEF)
222 #define MIICMD__PHYREG(p,r) (__SHIFTIN(p,MIICMD_PHY)|__SHIFTIN(r,MIICMD_REG))
223 #define MIICMD_RD(p,r) (MIICMD_RD_DEF|MIICMD__PHYREG((p),(r)))
224 #define MIICMD_WR(p,r,v) (MIICMD_WR_DEF|MIICMD__PHYREG((p),(r))|(v))
225 #endif /* MII_PRIVATE */
226
227 #ifdef RNG_PRIVATE
228 #define RNG_CTRL 0x000
229 #define RNG_COMBLK2_OSC_DIS __BITS(27,22)
230 #define RNG_COMBLK1_OSC_DIS __BITS(21,16)
231 #define RNG_ICLK_BYP_DIV_CNT __BITS(15,8)
232 #define RNG_JCLK_BYP_SRC __BIT(5)
233 #define RNG_JCLK_BYP_SEL __BIT(4)
234 #define RNG_RBG2X __BIT(1)
235 #define RNG_RBGEN __BIT(0)
236 #define RNG_STATUS 0x004
237 #define RNG_VAL __BITS(31,24)
238 #define RNG_WARM_CNT __BITS(19,0)
239
240 #define RNG_DATA 0x008
241 #define RNG_FF_THRESHOLD 0x00c
242 #define RNG_INT_MASK 0x010
243 #define RNG_INT_OFF __BIT(0)
244 #endif /* RNG_PRIVATE */
245
246 #ifdef UART2_PRIVATE
247 /*
248 * UART2 (ChipCommonB) uses a 4-byte stride and 16-byte FIFO.
249 * Its frequency is the APB clock.
250 */
251 #define UART2_LPDLL 0x020
252 #define UART2_LPDLH 0x024
253 #endif
254
255 #ifdef CRU_PRIVATE
256
257 #define CRU_CONTROL 0x000
258 #define CRUCTL_QSPI_CLK_SEL __BITS(2,1)
259 #define QSPI_CLK_25MHZ 0 // iproc_ref_clk
260 #define QSPI_CLK_50MHZ 1 // iproc_sdio_clk / 4
261 #define QSPI_CLK_31dot25MHZ 2 // iproc_clk250 / 8
262 #define QSPI_CLK_62dot5MHZ 3 // iproc_clk250 / 4
263 #define CRUCTL_SW_RESET __BIT(0)
264
265 #define CRU_GENPLL_CONTROL5 0x1154
266 #define GENPLL_CONTROL5_NDIV_INT __BITS(29,20) // = (n ? n : 1024)
267 #define GENPLL_CONTROL5_NDIV_FRAC __BITS(19,0) // = 1 / n
268 #define CRU_GENPLL_CONTROL6 0x1158
269 #define GENPLL_CONTROL6_PDIV __BITS(26,24) // = (n ? n : 8)
270 #define GENPLL_CONTROL6_CH0_MDIV __BITS(23,16) // = (n ? n : 256), clk_mac
271 #define GENPLL_CONTROL6_CH1_MDIV __BITS(15,8) // = (n ? n : 256), clk_robo
272 #define GENPLL_CONTROL6_CH2_MDIV __BITS(7,0) // = (n ? n : 256), clf_usb2
273 #define CRU_GENPLL_CONTROL7 0x115c
274 #define GENPLL_CONTROL7_CH3_MDIV __BITS(23,16) // = (n ? n : 256), clk_iproc
275
276 #define USB2_REF_CLK (1920*1000*1000)
277 #define CRU_USB2_CONTROL 0x1164
278 #define USB2_CONTROL_KA __BITS(24,22)
279 #define USB2_CONTROL_KI __BITS(31,19)
280 #define USB2_CONTROL_KP __BITS(18,15)
281 #define USB2_CONTROL_PDIV __BITS(14,12) // = (n ? n : 8)
282 #define USB2_CONTROL_NDIV_INT __BITS(11,2) // = (n ? n : 1024)
283 #define USB2_CONTROL_PLL_PCIEUSB3_RESET __BIT(1) // inverted 1=normal
284 #define USB2_CONTROL_PLL_USB2_RESET __BIT(0) // inverted 1=normal
285
286 #define CRU_CLKSET_KEY 0x1180
287 #define CRU_CLKSET_KEY_MAGIC 0xea68
288
289 #define CRU_GPIO_SELECT 0x11c0 // CRU GPIO Select
290 #define CRU_GPIO_DRIVE_SEL2 0x11c4
291 #define CRU_GPIO_DRIVE_SEL1 0x11c8
292 #define CRU_GPIO_DRIVE_SEL0 0x11cc
293 #define CRU_GPIO_INPUT_DISABLE 0x11d0
294 #define CRU_GPIO_HYSTERESIS 0x11d4
295 #define CRU_GPIO_SLEW_RATE 0x11d8
296 #define CRU_GPIO_PULL_UP 0x11dc
297 #define CRU_GPIO_PULL_DOWN 0x11e0
298
299 #define CRU_STRAPS_CONTROL 0x12a0
300 #define STRAP_BOOT_DEV __BITS(17,16)
301 #define STRAP_NAND_TYPE __BITS(15,12)
302 #define STRAP_NAND_PAGE __BITS(11,10)
303 #define STRAP_DDR3 __BIT(9)
304 #define STRAP_P5_VOLT_15 __BIT(8)
305 #define STRAP_P5_MODE __BITS(7,6)
306 #define STRAP_PCIE0_MODE __BIT(5)
307 #define STRAP_USB3_SEL __BIT(4)
308 #define STRAP_EX_EXTCLK __BIT(3)
309 #define STRAP_HW_FWDG_EN __BIT(2)
310 #define STRAP_LED_SERIAL_MODE __BIT(1)
311 #define STRAP_BISR_BYPASS_AUTOLOAD __BIT(0)
312
313 #endif /* CRU_PRIVATE */
314
315 #ifdef DMU_PRIVATE
316
317 #define DMU_LCPLL_CONTROL0 0x100
318 #define DMU_LCPLL_CONTROL1 0x104
319 #define LCPLL_CONTROL1_PDIV __BITS(30,28) // = (n ? n : 8)
320 #define LCPLL_CONTROL1_NDIV_INT __BITS(27,20) // = (n ? n : 256)
321 #define LCPLL_CONTROL1_NDIV_FRAC __BITS(19,0) // = 1 / n
322 /*
323 * SYS_CLK = (1 / pdiv) * (ndiv_int + (ndiv_frac / 0x40000000)) x F(ref)
324 */
325 #define DMU_LCPLL_CONTROL2 0x108
326 #define LCPLL_CONTROL2_CH0_MDIV __BITS(31,24) // = (n ? n : 256), clk_pcie_ref
327 #define LCPLL_CONTROL2_CH1_MDIV __BITS(23,16) // = (n ? n : 256), clk_sdio
328 #define LCPLL_CONTROL2_CH2_MDIV __BITS(15,8) // = (n ? n : 256), clk_ddr
329 #define LCPLL_CONTROL2_CH3_MDIV __BITS(7,0) // = (n ? n : 256), clf_dft
330
331 #endif /* DMU_PRIVATE */
332
333 #ifdef DDR_PRIVATE
334 /*
335 * DDR CTL register has such inspired names.
336 */
337 #define DDR_CTL_01 0x004
338 #define CTL_01_MAX_CHIP_SEL __BITS(18,16) // not documented as such
339 #define CTL_01_MAX_COL __BITS(11,8)
340 #define CTL_01_MAX_ROW __BITS(4,0)
341
342 #define DDR_CTL_82 0x148
343 #define CTL_82_COL_DIFF __BITS(26,24)
344 #define CTL_82_ROW_DIFF __BITS(18,16)
345 #define CTL_82_BANK_DIFF __BITS(9,8)
346 #define CTL_82_ZQCS_ROTATE __BIT(0)
347
348 #define DDR_CTL_86 0x158
349 #define CTL_86_CS_MAP __BITS(27,24)
350 #define CTL_86_INHIBIT_DRAM_CMD __BIT(16)
351 #define CTL_86_DIS_RD_INTRLV __BIT(8)
352 #define CTL_86_NUM_QENT_ACT_DIS __BITS(2,0)
353
354 #define DDR_CTL_87 0x15c
355 #define CTL_87_IN_ORDER_ACCEPT __BIT(24)
356 #define CTL_87_Q_FULLNESS __BITS(18,16)
357 #define CTL_87_REDUC __BIT(8)
358 #define CTL_87_BURST_ON_FLY_BIT __BITS(3,0)
359
360 #define DDR_PHY_CTL_PLL_STATUS 0x810
361 #define PLL_STATUS_LOCK_LOST __BIT(26)
362 #define PLL_STATUS_MHZ __BITS(25,14)
363 #define PLL_STATUS_CLOCKING_4X __BIT(13)
364 #define PLL_STATUS_STATUS __BITS(12,1)
365 #define PLL_STATUS_LOCK __BIT(0)
366
367 #define DDR_PHY_CTL_PLL_DIVIDERS 0x81c
368 #define PLL_DIVIDERS_POST_DIV __BITS(13,11)
369 #define PLL_DIVIDERS_PDIV __BITS(10,8) // 4x: (n ? n : 8), n = n - 4, 4x
370 #define PLL_DIVIDERS_NDIV __BITS(7,0)
371
372 #endif /* DDR_PRIVATE */
373
374 #ifdef PCIE_PRIVATE
375
376 #define PCIE_CLK_CONTROL 0x000
377
378 #define PCIE_CFG_IND_ADDR 0x120
379 #define CFG_IND_ADDR_FUNC __BITS(15,13)
380 #define CFG_IND_ADDR_LAYER __BITS(12,11)
381 #define CFG_IND_ADDR_REG __BITS(10,2)
382 #define PCIE_CFG_IND_DATA 0x124
383 #define PCIE_CFG_ADDR 0x1f8
384 #define CFG_ADDR_BUS __BITS(27,20)
385 #define CFG_ADDR_DEV __BITS(27,15)
386 #define CFG_ADDR_FUNC __BITS(14,12)
387 #define CFG_ADDR_REG __BITS(11,2)
388 #define CFG_ADDR_TYPE __BITS(1,0)
389 #define CFG_ADDR_TYPE0 __SHIFTIN(0, CFG_ADDR_TYPE)
390 #define CFG_ADDR_TYPE1 __SHIFTIN(1, CFG_ADDR_TYPE)
391 #define PCIE_CFG_DATA 0x1fc
392 #define PCIE_EQ_PAGE 0x200
393 #define PCIE_MSI_PAGE 0x204
394 #define PCIE_MSI_INTR_EN 0x208
395 #define PCIE_MSI_CTRL_0 0x210
396 #define PCIE_MSI_CTRL_1 0x214
397 #define PCIE_MSI_CTRL_2 0x218
398 #define PCIE_MSI_CTRL_3 0x21c
399 #define PCIE_MSI_CTRL_4 0x220
400 #define PCIE_MSI_CTRL_5 0x224
401 #define PCIE_SYS_EQ_HEAD_0 0x250
402 #define PCIE_SYS_EQ_TAIL_0 0x254
403 #define PCIE_SYS_EQ_HEAD_1 0x258
404 #define PCIE_SYS_EQ_TAIL_1 0x25c
405 #define PCIE_SYS_EQ_HEAD_2 0x260
406 #define PCIE_SYS_EQ_TAIL_2 0x264
407 #define PCIE_SYS_EQ_HEAD_3 0x268
408 #define PCIE_SYS_EQ_TAIL_3 0x26c
409 #define PCIE_SYS_EQ_HEAD_4 0x270
410 #define PCIE_SYS_EQ_TAIL_4 0x274
411 #define PCIE_SYS_EQ_HEAD_5 0x278
412 #define PCIE_SYS_EQ_TAIL_5 0x27c
413 #define PCIE_SYS_RC_INTX_EN 0x330
414 #define PCIE_SYS_RC_INTX_CSR 0x334
415
416 #define PCIE_FUNC0_IMAP0_0 0xc00
417 #define PCIE_FUNC0_IMAP0_1 0xc04
418 #define PCIE_FUNC0_IMAP0_2 0xc08
419 #define PCIE_FUNC0_IMAP0_3 0xc0c
420 #define PCIE_FUNC0_IMAP0_4 0xc10
421 #define PCIE_FUNC0_IMAP0_5 0xc14
422 #define PCIE_FUNC0_IMAP0_6 0xc18
423 #define PCIE_FUNC0_IMAP0_7 0xc1c
424
425 #define PCIE_FUNC0_IMAP1 0xc80
426 #define PCIE_FUNC1_IMAP1 0xc88
427 #define PCIE_FUNC0_IMAP2 0xcc0
428 #define PCIE_FUNC1_IMAP2 0xcc8
429
430 #define PCIE_IARR_0_LOWER 0xd00
431 #define PCIE_IARR_0_UPPER 0xd04
432 #define PCIE_IARR_1_LOWER 0xd08
433 #define PCIE_IARR_1_UPPER 0xd0c
434 #define PCIE_IARR_2_LOWER 0xd10
435 #define PCIE_IARR_2_UPPER 0xd14
436
437 #define PCIE_OARR_0 0xd20
438 #define PCIE_OARR_1 0xd28
439
440 #define PCIE_OMAP_0_LOWER 0xd40
441 #define PCIE_OMAP_0_UPPER 0xd44
442 #define PCIE_OMAP_1_LOWER 0xd48
443 #define PCIE_OMAP_1_UPPER 0xd4c
444
445 #define PCIE_FUNC1_IARR_1_SIZE 0xd58
446 #define PCIE_FUNC1_IARR_2_SIZE 0xd5c
447
448 #define PCIE_MEM_CONTROL 0xf00
449 #define PCIE_MEM_ECC_ERR_LOG_0 0xf04
450 #define PCIE_MEM_ECC_ERR_LOG_1 0xf08
451
452 #define PCIE_LINK_STATUS 0xf0c
453 #define PCIE_PHYLINKUP __BIT(3)
454 #define PCIE_DL_ACTIVE __BIT(2)
455 #define PCIE_RX_LOS_TIMEOUT __BIT(1)
456 #define PCIE_LINK_IN_L1 __BIT(0)
457 #define PCIE_STRAP_STATUS 0xf10
458 #define STRAP_PCIE_REPLAY_BUF_TM __BITS(8,4)
459 #define STRAP_PCIE_USER_FOR_CE_GEN1 __BIT(3)
460 #define STRAP_PCIE_USER_FOR_CE_1LANE __BIT(2)
461 #define STRAP_PCIE_IF_ENABLE __BIT(1)
462 #define STRAP_PCIE_USER_RC_MODE __BIT(0)
463 #define PCIE_RESET_STATUS 0xf14
464
465 #define PCIE_RESET_ENABLE_IN_PCIE_LINK_DOWN 0xf18
466
467 #define PCIE_MISC_INTR_EN 0xf1c
468 #define PCIE_TX_DEBUG_CFG 0xf20
469
470
471 // PCIE_SYS_MSI_INTR_EN
472 #define MSI_INTR_EN_EQ_5 __BIT(5)
473 #define MSI_INTR_EN_EQ_4 __BIT(4)
474 #define MSI_INTR_EN_EQ_3 __BIT(3)
475 #define MSI_INTR_EN_EQ_2 __BIT(2)
476 #define MSI_INTR_EN_EQ_1 __BIT(1)
477 #define MSI_INTR_EN_EQ_0 __BIT(0)
478
479 // PCIE_SYS_MSI_CTRL<n>
480 #define INT_N_DELAY __BITS(9,6)
481 #define INT_N_EVENT __BITS(1,1)
482 #define EQ_ENABLE __BIT(0)
483
484 // PCIE_SYS_EQ_HEAD<n>
485 #define HEAD_PTR __BITS(5,0)
486
487 // PCIE_SYS_EQ_TAIL<n>
488 #define EQ_OVERFLOW __BIT(6)
489 #define TAIL_PTR __BITS(5,0)
490
491 // PCIE_SYS_RC_INTRX_EN
492 #define RC_EN_INTD __BIT(3)
493 #define RC_EN_INTC __BIT(2)
494 #define RC_EN_INTB __BIT(1)
495 #define RC_EN_INTA __BIT(0)
496
497 // PCIE_SYS_RC_INTRX_CSR
498 #define RC_INTD __BIT(3)
499 #define RC_INTC __BIT(2)
500 #define RC_INTB __BIT(1)
501 #define RC_INTA __BIT(0)
502
503 // PCIE_IARR_0_LOWER / UPPER
504 #define IARR0_ADDR __BIT(31,15)
505 #define IARR0_VALID __BIT(0)
506
507 // PCIE_IARR_1_LOWER / UPPER
508 #define IARR1_ADDR __BIT(31,20)
509 #define IARR1_SIZE __BIT(7,0)
510 #define IARR0_VALID __BIT(0)
511
512 #define REGS_DEVICE_CAPACITY 0x04d4
513 #define REGS_LINK_CAPACITY 0x03dc
514 #define REGS_TL_CONTROL_0 0x0800
515 #define REGS_DL_STATUS 0x1048
516
517 #endif /* PCIE_PRIVATE */
518
519 #define ARMCORE_SCU_BASE 0x20000 /* CBAR is 19020000 */
520
521 #ifdef ARMCORE_PRIVATE
522
523 #define ARMCORE_CLK_POLICY_FREQ 0x008
524 #define CLK_POLICY_FREQ_PRIVED __BIT(31)
525 #define CLK_POLICY_FREQ_POLICY3 __BITS(26,24)
526 #define CLK_POLICY_FREQ_POLICY2 __BITS(18,16)
527 #define CLK_POLICY_FREQ_POLICY1 __BITS(10,8)
528 #define CLK_POLICY_FREQ_POLICY0 __BITS(2,0)
529 #define CLK_POLICY_REF_CLK 0 // 25 MHZ
530 #define CLK_POLICY_SYS_CLK 1 // sys clk (200MHZ)
531 #define CLK_POLICY_ARM_PLL_CH0 6 // slow clock
532 #define CLK_POLICY_ARM_PLL_CH1 7 // fast clock
533
534 #define ARMCORE_CLK_APB_DIV 0xa10
535 #define CLK_APB_DIV_PRIVED __BIT(31)
536 #define CLK_APB_DIV_VALUE __BITS(1,0) // n = n + 1
537
538 #define ARMCORE_CLK_APB_DIV_TRIGGER 0xa10
539 #define CLK_APB_DIV_TRIGGER_PRIVED __BIT(31)
540 #define CLK_APB_DIV_TRIGGER_OVERRIDE __BIT(0)
541
542 #define ARMCORE_CLK_PLLARMA 0xc00
543 #define CLK_PLLARMA_PDIV __BITS(26,24) // = (n ? n : 16(?))
544 #define CLK_PLLARMA_NDIV_INT __BITS(17,8) // = (n ? n : 1024)
545
546 #define ARMCORE_CLK_PLLARMB 0xc04
547 #define CLK_PLLARMB_NDIV_FRAC __BITS(19,0) // = 1 / n
548
549 #endif
550
551 #ifdef IDM_PRIVATE
552
553 #define IDM_ARMCORE_M0_BASE 0x00000
554 #define IDM_PCIE_M0_BASE 0x01000
555 #define IDM_PCIE_M1_BASE 0x02000
556 #define IDM_PCIE_M2_BASE 0x03000
557 #define IDM_USB3_BASE 0x05000
558 #define IDM_ARMCORE_S1_BASE 0x06000
559 #define IDM_ARMCORE_S0_BASE 0x07000
560 #define IDM_DDR_S1_BASE 0x08000
561 #define IDM_DDR_S2_BASE 0x09000
562 #define IDM_ROM_S0_BASE 0x0d000
563 #define IDM_AMAC0_BASE 0x10000
564 #define IDM_AMAC1_BASE 0x11000
565 #define IDM_AMAC2_BASE 0x12000
566 #define IDM_AMAC3_BASE 0x13000
567 #define IDM_DMAC_M0_BASE 0x14000
568 #define IDM_USB2_BASE 0x15000
569 #define IDM_SDIO_BASE 0x16000
570 #define IDM_I2S_M0_BASE 0x17000
571 #define IDM_A9JTAG_M0_BASE 0x18000
572 #define IDM_NAND_BASE 0x1a000
573 #define IDM_QSPI_BASE 0x1b000
574 #define IDM_APBX_BASE 0x21000
575
576 #define IDM_IO_CONTROL_DIRECT 0x0408
577 #define IDM_IO_STATUS 0x0500
578 #define IDM_RESET_CONTROL 0x0800
579 #define IDM_RESET_STATUS 0x0804
580 #define IDM_INTERRUPT_STATUS 0x0a00
581
582 #define IO_CONTROL_DIRECT_UARTCLKSEL __BIT(17)
583
584 #define RESET_CONTROL_RESET __BIT(0)
585
586 #endif /* IDM_PRIVATE */
587
588 #ifdef GMAC_PRIVATE
589
590 struct gmac_txdb {
591 uint32_t txdb_flags;
592 uint16_t txdb_buflen;
593 uint16_t txdb_addrext;
594 uint32_t txdb_addrlo;
595 uint32_t txdb_addrhi;
596 };
597 #define TXDB_FLAG_SF __BIT(31) // Start oF Frame
598 #define TXDB_FLAG_EF __BIT(30) // End oF Frame
599 #define TXDB_FLAG_IC __BIT(29) // Interupt on Completetion
600 #define TXDB_FLAG_ET __BIT(28) // End Of Table
601
602 struct gmac_rxdb {
603 uint32_t rxdb_flags;
604 uint16_t rxdb_buflen;
605 uint16_t rxdb_addrext;
606 uint32_t rxdb_addrlo;
607 uint32_t rxdb_addrhi;
608 };
609 #define RXDB_FLAG_SF __BIT(31) // Start oF Frame (ignored)
610 #define RXDB_FLAG_EF __BIT(30) // End oF Frame (ignored)
611 #define RXDB_FLAG_IC __BIT(29) // Interupt on Completetion
612 #define RXDB_FLAG_ET __BIT(28) // End Of Table
613
614 #define RXSTS_FRAMELEN __BITS(15,0) // # of bytes (including padding)
615 #define RXSTS_PKTTYPE __BITS(17,16)
616 #define RXSTS_PKTTYPE_UC 0 // Unicast
617 #define RXSTS_PKTTYPE_MC 1 // Multicast
618 #define RXSTS_PKTTYPE_BC 2 // Broadcast
619 #define RXSTS_VLAN_PRESENT __BIT(18)
620 #define RXSTS_CRC_ERROR __BIT(19)
621 #define RXSTS_OVERSIZED __BIT(20)
622 #define RXSTS_CTF_HIT __BIT(21)
623 #define RXSTS_CTF_ERROR __BIT(22)
624 #define RXSTS_PKT_OVERFLOW __BIT(23)
625 #define RXSTS_DESC_COUNT __BITS(27,24) // # of descriptors - 1
626
627 #define GMAC_DEVCONTROL 0x000
628 #define GMAC_DEVSTATUS 0x004
629 #define GMAC_BISTSTATUS 0x00c
630 #define GMAC_INTSTATUS 0x020
631 #define GMAC_INTMASK 0x024
632 #define GMAC_GPTIMER 0x028
633
634 #define GMAC_INTRCVLAZY 0x100
635 #define GMAC_FLOWCNTL_TH 0x104
636 #define GMAC_TXARB_WRR_TH 0x108
637 #define GMAC_GMACIDLE_CNT_TH 0x10c
638
639 #define GMAC_FIFOACCESSADDR 0x120
640 #define GMAC_FIFOACCESSBYTE 0x124
641 #define GMAC_FIFOACCESSDATA 0x128
642
643 #define GMAC_PHYACCESS 0x180
644 #define GMAC_PHYCONTROL 0x188
645 #define GMAC_TXQCONTROL 0x18c
646 #define GMAC_RXQCONTROL 0x190
647 #define GMAC_GPIOSELECT 0x194
648 #define GMAC_GPIOOUTPUTEN 0x198
649 #define GMAC_TXQRXQMEMORYCONTROL 0x1a0
650 #define GMAC_MEMORYECCSTATUS 0x1a4
651
652 #define GMAC_CLOCKCONTROLSTATUS 0x1e0
653 #define GMAC_POWERCONTROL 0x1e8
654
655 #define GMAC_XMTCONTROL_0 0x200
656 #define GMAC_XMTPTR_0 0x204
657 #define GMAC_XMTADDR_LOW_0 0x208
658 #define GMAC_XMTADDR_HIGH_0 0x20c
659 #define GMAC_XMTSTATUS0_0 0x210
660 #define GMAC_XMTSTATUS1_0 0x214
661 #define GMAC_RCVCONTROL 0x220
662 #define GMAC_RCVPTR 0x224
663 #define GMAC_RCVADDR_LOW 0x228
664 #define GMAC_RCVADDR_HIGH 0x22c
665 #define GMAC_RCVSTATUS0 0x230
666 #define GMAC_RCVSTATUS1 0x234
667
668 #define GMAC_TX_GD_OCTETS_LO 0x300
669
670
671 #define UNIMAC_IPG_HD_BPG_CNTL 0x804
672 #define UNIMAC_COMMAND_CONFIG 0x808
673 #define UNIMAC_MAC_0 0x80c // bits 16:47 of macaddr
674 #define UNIMAC_MAC_1 0x810 // bits 0:15 of macaddr
675 #define UNIMAC_FRAME_LEN 0x814
676 #define UNIMAC_PAUSE_QUANTA 0x818
677 #define UNIMAC_TX_TS_SEQ_ID 0x83c
678 #define UNIMAC_MAC_MODE 0x844
679 #define UNIMAC_TAG_0 0x848
680 #define UNIMAC_TAG_1 0x84c
681 #define UNIMAC_RX_PAUSE_QUANTA_SCALE 0x850
682 #define UNIMAC_TX_PREAMBLE 0x854
683 #define UNIMAC_TX_IPG_LENGTH 0x85c
684 #define UNIMAC_PRF_XOFF_TIMER 0x860
685 #define UNIMAC_UMAC_EEE_CTRL 0x864
686 #define UNIMAC_MII_EEE_DELAY_ENTRY_TIMER 0x868
687 #define UNIMAC_GMII_EEE_DELAY_ENTRY_TIMER 0x86c
688 #define UNIMAC_UMAC_EEE_REF_COUNT 0x870
689 #define UNIMAC_UMAX_RX_PKT_DROP_STATUS 0x878
690
691 #define UNIMAC_UMAC_SYMMETRIC_IDLE_THRESHOLD 0x87c // RX IDLE threshold for LPI prediction
692 #define UNIMAC_MII_EEE_WAKE_TIMER 0x880 // MII_EEE Wake timer
693 #define UNIMAC_GMII_EEE_WAKE_TIMER 0x884 // GMII_EEE Wake timer
694 #define UNIMAC_UMAC_REV_ID 0x888 // UNIMAC_REV_ID
695 #define UNIMAC_MAC_PFC_TYPE 0xb00 // Programmable ethertype (GNAT 13440)
696 #define UNIMAC_MAC_PFC_OPCODE 0xb04 // Programmable opcode (GNAT 13440)
697 #define UNIMAC_MAC_PFC_DA_0 0xb08 // lower 32 bits of programmable DA for PPP (GNAT 13897)
698 #define UNIMAC_MAC_PFC_DA_1 0xb0c // upper 16 bits of programmable DA for PPP (GNAT 13897)
699 #define UNIMAC_MACSEC_CNTRL 0xb14 // Miscellaneous control for MACSEC (GNAT 11599,11600,12078,12198)
700 #define UNIMAC_TS_STATUS_CNTRL 0xb18 // Timestamp control/status
701 #define UNIMAC_TX_TS_DATA 0xb1c // Transmit Timestamp data
702 #define UNIMAC_PAUSE_CONTROL 0xb30 // PAUSE frame timer control register
703 #define UNIMAC_FLUSH_CONTROL 0xb34 // Flush enable control register
704 #define UNIMAC_RXFIFO_STAT 0xb38 // RXFIFO status register
705 #define UNIMAC_TXFIFO_STAT 0xb3c // TXFIFO status register
706 #define UNIMAC_MAC_PFC_CTRL 0xb40 // PPP control register
707 #define UNIMAC_MAC_PFC_REFRESH_CTRL 0xb44 // PPP refresh control register
708
709 #endif /* GMAC_PRIVATE */
710
711 #endif /* _ARM_BROADCOM_BCM53XX_REG_H_ */
712