4 #include <linux/types.h>
5 #include <linux/init.h>
8 * Macro to fetch bcm63xx cpu id and revision, should be optimized at
9 * compile time if only one CPU support is enabled (idea stolen from
12 #define BCM6338_CPU_ID 0x6338
13 #define BCM6345_CPU_ID 0x6345
14 #define BCM6348_CPU_ID 0x6348
15 #define BCM6358_CPU_ID 0x6358
17 void __init
bcm63xx_cpu_init(void);
18 u16
__bcm63xx_get_cpu_id(void);
19 u16
bcm63xx_get_cpu_rev(void);
20 unsigned int bcm63xx_get_cpu_freq(void);
22 #ifdef CONFIG_BCM63XX_CPU_6338
23 # ifdef bcm63xx_get_cpu_id
24 # undef bcm63xx_get_cpu_id
25 # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
26 # define BCMCPU_RUNTIME_DETECT
28 # define bcm63xx_get_cpu_id() BCM6338_CPU_ID
30 # define BCMCPU_IS_6338() (bcm63xx_get_cpu_id() == BCM6338_CPU_ID)
32 # define BCMCPU_IS_6338() (0)
35 #ifdef CONFIG_BCM63XX_CPU_6345
36 # ifdef bcm63xx_get_cpu_id
37 # undef bcm63xx_get_cpu_id
38 # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
39 # define BCMCPU_RUNTIME_DETECT
41 # define bcm63xx_get_cpu_id() BCM6345_CPU_ID
43 # define BCMCPU_IS_6345() (bcm63xx_get_cpu_id() == BCM6345_CPU_ID)
45 # define BCMCPU_IS_6345() (0)
48 #ifdef CONFIG_BCM63XX_CPU_6348
49 # ifdef bcm63xx_get_cpu_id
50 # undef bcm63xx_get_cpu_id
51 # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
52 # define BCMCPU_RUNTIME_DETECT
54 # define bcm63xx_get_cpu_id() BCM6348_CPU_ID
56 # define BCMCPU_IS_6348() (bcm63xx_get_cpu_id() == BCM6348_CPU_ID)
58 # define BCMCPU_IS_6348() (0)
61 #ifdef CONFIG_BCM63XX_CPU_6358
62 # ifdef bcm63xx_get_cpu_id
63 # undef bcm63xx_get_cpu_id
64 # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
65 # define BCMCPU_RUNTIME_DETECT
67 # define bcm63xx_get_cpu_id() BCM6358_CPU_ID
69 # define BCMCPU_IS_6358() (bcm63xx_get_cpu_id() == BCM6358_CPU_ID)
71 # define BCMCPU_IS_6358() (0)
74 #ifndef bcm63xx_get_cpu_id
75 #error "No CPU support configured"
79 * While registers sets are (mostly) the same across 63xx CPU, base
80 * address of these sets do change.
82 enum bcm63xx_regs_set
{
106 #define RSET_DSL_LMEM_SIZE (64 * 1024 * 4)
107 #define RSET_DSL_SIZE 4096
108 #define RSET_WDT_SIZE 12
109 #define RSET_ENET_SIZE 2048
110 #define RSET_ENETDMA_SIZE 2048
111 #define RSET_UART_SIZE 24
112 #define RSET_UDC_SIZE 256
113 #define RSET_OHCI_SIZE 256
114 #define RSET_EHCI_SIZE 256
115 #define RSET_PCMCIA_SIZE 12
118 * 6338 register sets base address
120 #define BCM_6338_DSL_LMEM_BASE (0xfff00000)
121 #define BCM_6338_PERF_BASE (0xfffe0000)
122 #define BCM_6338_BB_BASE (0xfffe0100)
123 #define BCM_6338_TIMER_BASE (0xfffe0200)
124 #define BCM_6338_WDT_BASE (0xfffe021c)
125 #define BCM_6338_UART0_BASE (0xfffe0300)
126 #define BCM_6338_GPIO_BASE (0xfffe0400)
127 #define BCM_6338_SPI_BASE (0xfffe0c00)
128 #define BCM_6338_UDC0_BASE (0xdeadbeef)
129 #define BCM_6338_USBDMA_BASE (0xfffe2400)
130 #define BCM_6338_OHCI0_BASE (0xdeadbeef)
131 #define BCM_6338_OHCI_PRIV_BASE (0xfffe3000)
132 #define BCM_6338_USBH_PRIV_BASE (0xdeadbeef)
133 #define BCM_6338_MPI_BASE (0xfffe3160)
134 #define BCM_6338_PCMCIA_BASE (0xdeadbeef)
135 #define BCM_6338_SDRAM_REGS_BASE (0xfffe3100)
136 #define BCM_6338_DSL_BASE (0xfffe1000)
137 #define BCM_6338_SAR_BASE (0xfffe2000)
138 #define BCM_6338_UBUS_BASE (0xdeadbeef)
139 #define BCM_6338_ENET0_BASE (0xfffe2800)
140 #define BCM_6338_ENET1_BASE (0xdeadbeef)
141 #define BCM_6338_ENETDMA_BASE (0xfffe2400)
142 #define BCM_6338_EHCI0_BASE (0xdeadbeef)
143 #define BCM_6338_SDRAM_BASE (0xfffe3100)
144 #define BCM_6338_MEMC_BASE (0xdeadbeef)
145 #define BCM_6338_DDR_BASE (0xdeadbeef)
148 * 6345 register sets base address
150 #define BCM_6345_DSL_LMEM_BASE (0xfff00000)
151 #define BCM_6345_PERF_BASE (0xfffe0000)
152 #define BCM_6345_BB_BASE (0xfffe0100)
153 #define BCM_6345_TIMER_BASE (0xfffe0200)
154 #define BCM_6345_WDT_BASE (0xfffe021c)
155 #define BCM_6345_UART0_BASE (0xfffe0300)
156 #define BCM_6345_GPIO_BASE (0xfffe0400)
157 #define BCM_6345_SPI_BASE (0xdeadbeef)
158 #define BCM_6345_UDC0_BASE (0xdeadbeef)
159 #define BCM_6345_USBDMA_BASE (0xfffe2800)
160 #define BCM_6345_ENET0_BASE (0xfffe1800)
161 #define BCM_6345_ENETDMA_BASE (0xfffe2800)
162 #define BCM_6345_PCMCIA_BASE (0xfffe2028)
163 #define BCM_6345_MPI_BASE (0xdeadbeef)
164 #define BCM_6345_OHCI0_BASE (0xfffe2100)
165 #define BCM_6345_OHCI_PRIV_BASE (0xfffe2200)
166 #define BCM_6345_USBH_PRIV_BASE (0xdeadbeef)
167 #define BCM_6345_SDRAM_REGS_BASE (0xfffe2300)
168 #define BCM_6345_DSL_BASE (0xdeadbeef)
169 #define BCM_6345_SAR_BASE (0xdeadbeef)
170 #define BCM_6345_UBUS_BASE (0xdeadbeef)
171 #define BCM_6345_ENET1_BASE (0xdeadbeef)
172 #define BCM_6345_EHCI0_BASE (0xdeadbeef)
173 #define BCM_6345_SDRAM_BASE (0xfffe2300)
174 #define BCM_6345_MEMC_BASE (0xdeadbeef)
175 #define BCM_6345_DDR_BASE (0xdeadbeef)
178 * 6348 register sets base address
180 #define BCM_6348_DSL_LMEM_BASE (0xfff00000)
181 #define BCM_6348_PERF_BASE (0xfffe0000)
182 #define BCM_6348_TIMER_BASE (0xfffe0200)
183 #define BCM_6348_WDT_BASE (0xfffe021c)
184 #define BCM_6348_UART0_BASE (0xfffe0300)
185 #define BCM_6348_GPIO_BASE (0xfffe0400)
186 #define BCM_6348_SPI_BASE (0xfffe0c00)
187 #define BCM_6348_UDC0_BASE (0xfffe1000)
188 #define BCM_6348_OHCI0_BASE (0xfffe1b00)
189 #define BCM_6348_OHCI_PRIV_BASE (0xfffe1c00)
190 #define BCM_6348_USBH_PRIV_BASE (0xdeadbeef)
191 #define BCM_6348_MPI_BASE (0xfffe2000)
192 #define BCM_6348_PCMCIA_BASE (0xfffe2054)
193 #define BCM_6348_SDRAM_REGS_BASE (0xfffe2300)
194 #define BCM_6348_DSL_BASE (0xfffe3000)
195 #define BCM_6348_ENET0_BASE (0xfffe6000)
196 #define BCM_6348_ENET1_BASE (0xfffe6800)
197 #define BCM_6348_ENETDMA_BASE (0xfffe7000)
198 #define BCM_6348_EHCI0_BASE (0xdeadbeef)
199 #define BCM_6348_SDRAM_BASE (0xfffe2300)
200 #define BCM_6348_MEMC_BASE (0xdeadbeef)
201 #define BCM_6348_DDR_BASE (0xdeadbeef)
204 * 6358 register sets base address
206 #define BCM_6358_DSL_LMEM_BASE (0xfff00000)
207 #define BCM_6358_PERF_BASE (0xfffe0000)
208 #define BCM_6358_TIMER_BASE (0xfffe0040)
209 #define BCM_6358_WDT_BASE (0xfffe005c)
210 #define BCM_6358_UART0_BASE (0xfffe0100)
211 #define BCM_6358_GPIO_BASE (0xfffe0080)
212 #define BCM_6358_SPI_BASE (0xdeadbeef)
213 #define BCM_6358_UDC0_BASE (0xfffe0800)
214 #define BCM_6358_OHCI0_BASE (0xfffe1400)
215 #define BCM_6358_OHCI_PRIV_BASE (0xdeadbeef)
216 #define BCM_6358_USBH_PRIV_BASE (0xfffe1500)
217 #define BCM_6358_MPI_BASE (0xfffe1000)
218 #define BCM_6358_PCMCIA_BASE (0xfffe1054)
219 #define BCM_6358_SDRAM_REGS_BASE (0xfffe2300)
220 #define BCM_6358_DSL_BASE (0xfffe3000)
221 #define BCM_6358_ENET0_BASE (0xfffe4000)
222 #define BCM_6358_ENET1_BASE (0xfffe4800)
223 #define BCM_6358_ENETDMA_BASE (0xfffe5000)
224 #define BCM_6358_EHCI0_BASE (0xfffe1300)
225 #define BCM_6358_SDRAM_BASE (0xdeadbeef)
226 #define BCM_6358_MEMC_BASE (0xfffe1200)
227 #define BCM_6358_DDR_BASE (0xfffe12a0)
230 extern const unsigned long *bcm63xx_regs_base
;
232 static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set
)
234 #ifdef BCMCPU_RUNTIME_DETECT
235 return bcm63xx_regs_base
[set
];
237 #ifdef CONFIG_BCM63XX_CPU_6338
240 return BCM_6338_DSL_LMEM_BASE
;
242 return BCM_6338_PERF_BASE
;
244 return BCM_6338_TIMER_BASE
;
246 return BCM_6338_WDT_BASE
;
248 return BCM_6338_UART0_BASE
;
250 return BCM_6338_GPIO_BASE
;
252 return BCM_6338_SPI_BASE
;
254 return BCM_6338_UDC0_BASE
;
256 return BCM_6338_OHCI0_BASE
;
258 return BCM_6338_OHCI_PRIV_BASE
;
260 return BCM_6338_USBH_PRIV_BASE
;
262 return BCM_6338_MPI_BASE
;
264 return BCM_6338_PCMCIA_BASE
;
266 return BCM_6338_DSL_BASE
;
268 return BCM_6338_ENET0_BASE
;
270 return BCM_6338_ENET1_BASE
;
272 return BCM_6338_ENETDMA_BASE
;
274 return BCM_6338_EHCI0_BASE
;
276 return BCM_6338_SDRAM_BASE
;
278 return BCM_6338_MEMC_BASE
;
280 return BCM_6338_DDR_BASE
;
283 #ifdef CONFIG_BCM63XX_CPU_6345
286 return BCM_6345_DSL_LMEM_BASE
;
288 return BCM_6345_PERF_BASE
;
290 return BCM_6345_TIMER_BASE
;
292 return BCM_6345_WDT_BASE
;
294 return BCM_6345_UART0_BASE
;
296 return BCM_6345_GPIO_BASE
;
298 return BCM_6345_SPI_BASE
;
300 return BCM_6345_UDC0_BASE
;
302 return BCM_6345_OHCI0_BASE
;
304 return BCM_6345_OHCI_PRIV_BASE
;
306 return BCM_6345_USBH_PRIV_BASE
;
308 return BCM_6345_MPI_BASE
;
310 return BCM_6345_PCMCIA_BASE
;
312 return BCM_6345_DSL_BASE
;
314 return BCM_6345_ENET0_BASE
;
316 return BCM_6345_ENET1_BASE
;
318 return BCM_6345_ENETDMA_BASE
;
320 return BCM_6345_EHCI0_BASE
;
322 return BCM_6345_SDRAM_BASE
;
324 return BCM_6345_MEMC_BASE
;
326 return BCM_6345_DDR_BASE
;
329 #ifdef CONFIG_BCM63XX_CPU_6348
332 return BCM_6348_DSL_LMEM_BASE
;
334 return BCM_6348_PERF_BASE
;
336 return BCM_6348_TIMER_BASE
;
338 return BCM_6348_WDT_BASE
;
340 return BCM_6348_UART0_BASE
;
342 return BCM_6348_GPIO_BASE
;
344 return BCM_6348_SPI_BASE
;
346 return BCM_6348_UDC0_BASE
;
348 return BCM_6348_OHCI0_BASE
;
350 return BCM_6348_OHCI_PRIV_BASE
;
352 return BCM_6348_USBH_PRIV_BASE
;
354 return BCM_6348_MPI_BASE
;
356 return BCM_6348_PCMCIA_BASE
;
358 return BCM_6348_DSL_BASE
;
360 return BCM_6348_ENET0_BASE
;
362 return BCM_6348_ENET1_BASE
;
364 return BCM_6348_ENETDMA_BASE
;
366 return BCM_6348_EHCI0_BASE
;
368 return BCM_6348_SDRAM_BASE
;
370 return BCM_6348_MEMC_BASE
;
372 return BCM_6348_DDR_BASE
;
375 #ifdef CONFIG_BCM63XX_CPU_6358
378 return BCM_6358_DSL_LMEM_BASE
;
380 return BCM_6358_PERF_BASE
;
382 return BCM_6358_TIMER_BASE
;
384 return BCM_6358_WDT_BASE
;
386 return BCM_6358_UART0_BASE
;
388 return BCM_6358_GPIO_BASE
;
390 return BCM_6358_SPI_BASE
;
392 return BCM_6358_UDC0_BASE
;
394 return BCM_6358_OHCI0_BASE
;
396 return BCM_6358_OHCI_PRIV_BASE
;
398 return BCM_6358_USBH_PRIV_BASE
;
400 return BCM_6358_MPI_BASE
;
402 return BCM_6358_PCMCIA_BASE
;
404 return BCM_6358_ENET0_BASE
;
406 return BCM_6358_ENET1_BASE
;
408 return BCM_6358_ENETDMA_BASE
;
410 return BCM_6358_DSL_BASE
;
412 return BCM_6358_EHCI0_BASE
;
414 return BCM_6358_SDRAM_BASE
;
416 return BCM_6358_MEMC_BASE
;
418 return BCM_6358_DDR_BASE
;
427 * IRQ number changes across CPU too
450 #define BCM_6338_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
451 #define BCM_6338_SPI_IRQ (IRQ_INTERNAL_BASE + 1)
452 #define BCM_6338_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
453 #define BCM_6338_DG_IRQ (IRQ_INTERNAL_BASE + 4)
454 #define BCM_6338_DSL_IRQ (IRQ_INTERNAL_BASE + 5)
455 #define BCM_6338_ATM_IRQ (IRQ_INTERNAL_BASE + 6)
456 #define BCM_6338_UDC0_IRQ (IRQ_INTERNAL_BASE + 7)
457 #define BCM_6338_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
458 #define BCM_6338_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
459 #define BCM_6338_SDRAM_IRQ (IRQ_INTERNAL_BASE + 10)
460 #define BCM_6338_USB_CNTL_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 11)
461 #define BCM_6338_USB_CNTL_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 12)
462 #define BCM_6338_USB_BULK_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 13)
463 #define BCM_6338_USB_BULK_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 14)
464 #define BCM_6338_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 15)
465 #define BCM_6338_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 16)
466 #define BCM_6338_SDIO_IRQ (IRQ_INTERNAL_BASE + 17)
471 #define BCM_6345_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
472 #define BCM_6345_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
473 #define BCM_6345_DSL_IRQ (IRQ_INTERNAL_BASE + 3)
474 #define BCM_6345_ATM_IRQ (IRQ_INTERNAL_BASE + 4)
475 #define BCM_6345_USB_IRQ (IRQ_INTERNAL_BASE + 5)
476 #define BCM_6345_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
477 #define BCM_6345_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12)
478 #define BCM_6345_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 13 + 1)
479 #define BCM_6345_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 13 + 2)
480 #define BCM_6345_EBI_RX_IRQ (IRQ_INTERNAL_BASE + 13 + 5)
481 #define BCM_6345_EBI_TX_IRQ (IRQ_INTERNAL_BASE + 13 + 6)
482 #define BCM_6345_RESERVED_RX_IRQ (IRQ_INTERNAL_BASE + 13 + 9)
483 #define BCM_6345_RESERVED_TX_IRQ (IRQ_INTERNAL_BASE + 13 + 10)
484 #define BCM_6345_USB_BULK_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 13)
485 #define BCM_6345_USB_BULK_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 14)
486 #define BCM_6345_USB_CNTL_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 15)
487 #define BCM_6345_USB_CNTL_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 16)
488 #define BCM_6345_USB_ISO_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 17)
489 #define BCM_6345_USB_ISO_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 18)
494 #define BCM_6348_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
495 #define BCM_6348_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
496 #define BCM_6348_DSL_IRQ (IRQ_INTERNAL_BASE + 4)
497 #define BCM_6348_ENET1_IRQ (IRQ_INTERNAL_BASE + 7)
498 #define BCM_6348_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
499 #define BCM_6348_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
500 #define BCM_6348_OHCI0_IRQ (IRQ_INTERNAL_BASE + 12)
501 #define BCM_6348_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 20)
502 #define BCM_6348_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 21)
503 #define BCM_6348_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 22)
504 #define BCM_6348_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 23)
505 #define BCM_6348_PCMCIA_IRQ (IRQ_INTERNAL_BASE + 24)
506 #define BCM_6348_PCI_IRQ (IRQ_INTERNAL_BASE + 24)
511 #define BCM_6358_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
512 #define BCM_6358_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
513 #define BCM_6358_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)
514 #define BCM_6358_ENET1_IRQ (IRQ_INTERNAL_BASE + 6)
515 #define BCM_6358_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
516 #define BCM_6358_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
517 #define BCM_6358_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10)
518 #define BCM_6358_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 15)
519 #define BCM_6358_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 16)
520 #define BCM_6358_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 17)
521 #define BCM_6358_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 18)
522 #define BCM_6358_DSL_IRQ (IRQ_INTERNAL_BASE + 29)
523 #define BCM_6358_PCI_IRQ (IRQ_INTERNAL_BASE + 31)
524 #define BCM_6358_PCMCIA_IRQ (IRQ_INTERNAL_BASE + 24)
526 extern const int *bcm63xx_irqs
;
528 static inline int bcm63xx_get_irq_number(enum bcm63xx_irq irq
)
530 return bcm63xx_irqs
[irq
];
534 * return installed memory size
536 unsigned int bcm63xx_get_memory_size(void);
538 #endif /* !BCM63XX_CPU_H_ */