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
{
107 #define RSET_DSL_LMEM_SIZE (64 * 1024 * 4)
108 #define RSET_DSL_SIZE 4096
109 #define RSET_WDT_SIZE 12
110 #define RSET_ENET_SIZE 2048
111 #define RSET_ENETDMA_SIZE 2048
112 #define RSET_UART_SIZE 24
113 #define RSET_UDC_SIZE 256
114 #define RSET_OHCI_SIZE 256
115 #define RSET_EHCI_SIZE 256
116 #define RSET_PCMCIA_SIZE 12
119 * 6338 register sets base address
121 #define BCM_6338_DSL_LMEM_BASE (0xfff00000)
122 #define BCM_6338_PERF_BASE (0xfffe0000)
123 #define BCM_6338_BB_BASE (0xfffe0100)
124 #define BCM_6338_TIMER_BASE (0xfffe0200)
125 #define BCM_6338_WDT_BASE (0xfffe021c)
126 #define BCM_6338_UART0_BASE (0xfffe0300)
127 #define BCM_6338_UART1_BASE (0xdeadbeef)
128 #define BCM_6338_GPIO_BASE (0xfffe0400)
129 #define BCM_6338_SPI_BASE (0xfffe0c00)
130 #define BCM_6338_UDC0_BASE (0xdeadbeef)
131 #define BCM_6338_USBDMA_BASE (0xfffe2400)
132 #define BCM_6338_OHCI0_BASE (0xdeadbeef)
133 #define BCM_6338_OHCI_PRIV_BASE (0xfffe3000)
134 #define BCM_6338_USBH_PRIV_BASE (0xdeadbeef)
135 #define BCM_6338_MPI_BASE (0xfffe3160)
136 #define BCM_6338_PCMCIA_BASE (0xdeadbeef)
137 #define BCM_6338_SDRAM_REGS_BASE (0xfffe3100)
138 #define BCM_6338_DSL_BASE (0xfffe1000)
139 #define BCM_6338_SAR_BASE (0xfffe2000)
140 #define BCM_6338_UBUS_BASE (0xdeadbeef)
141 #define BCM_6338_ENET0_BASE (0xfffe2800)
142 #define BCM_6338_ENET1_BASE (0xdeadbeef)
143 #define BCM_6338_ENETDMA_BASE (0xfffe2400)
144 #define BCM_6338_EHCI0_BASE (0xdeadbeef)
145 #define BCM_6338_SDRAM_BASE (0xfffe3100)
146 #define BCM_6338_MEMC_BASE (0xdeadbeef)
147 #define BCM_6338_DDR_BASE (0xdeadbeef)
150 * 6345 register sets base address
152 #define BCM_6345_DSL_LMEM_BASE (0xfff00000)
153 #define BCM_6345_PERF_BASE (0xfffe0000)
154 #define BCM_6345_BB_BASE (0xfffe0100)
155 #define BCM_6345_TIMER_BASE (0xfffe0200)
156 #define BCM_6345_WDT_BASE (0xfffe021c)
157 #define BCM_6345_UART0_BASE (0xfffe0300)
158 #define BCM_6345_UART1_BASE (0xdeadbeef)
159 #define BCM_6345_GPIO_BASE (0xfffe0400)
160 #define BCM_6345_SPI_BASE (0xdeadbeef)
161 #define BCM_6345_UDC0_BASE (0xdeadbeef)
162 #define BCM_6345_USBDMA_BASE (0xfffe2800)
163 #define BCM_6345_ENET0_BASE (0xfffe1800)
164 #define BCM_6345_ENETDMA_BASE (0xfffe2800)
165 #define BCM_6345_PCMCIA_BASE (0xfffe2028)
166 #define BCM_6345_MPI_BASE (0xdeadbeef)
167 #define BCM_6345_OHCI0_BASE (0xfffe2100)
168 #define BCM_6345_OHCI_PRIV_BASE (0xfffe2200)
169 #define BCM_6345_USBH_PRIV_BASE (0xdeadbeef)
170 #define BCM_6345_SDRAM_REGS_BASE (0xfffe2300)
171 #define BCM_6345_DSL_BASE (0xdeadbeef)
172 #define BCM_6345_SAR_BASE (0xdeadbeef)
173 #define BCM_6345_UBUS_BASE (0xdeadbeef)
174 #define BCM_6345_ENET1_BASE (0xdeadbeef)
175 #define BCM_6345_EHCI0_BASE (0xdeadbeef)
176 #define BCM_6345_SDRAM_BASE (0xfffe2300)
177 #define BCM_6345_MEMC_BASE (0xdeadbeef)
178 #define BCM_6345_DDR_BASE (0xdeadbeef)
181 * 6348 register sets base address
183 #define BCM_6348_DSL_LMEM_BASE (0xfff00000)
184 #define BCM_6348_PERF_BASE (0xfffe0000)
185 #define BCM_6348_TIMER_BASE (0xfffe0200)
186 #define BCM_6348_WDT_BASE (0xfffe021c)
187 #define BCM_6348_UART0_BASE (0xfffe0300)
188 #define BCM_6348_UART1_BASE (0xdeadbeef)
189 #define BCM_6348_GPIO_BASE (0xfffe0400)
190 #define BCM_6348_SPI_BASE (0xfffe0c00)
191 #define BCM_6348_UDC0_BASE (0xfffe1000)
192 #define BCM_6348_OHCI0_BASE (0xfffe1b00)
193 #define BCM_6348_OHCI_PRIV_BASE (0xfffe1c00)
194 #define BCM_6348_USBH_PRIV_BASE (0xdeadbeef)
195 #define BCM_6348_MPI_BASE (0xfffe2000)
196 #define BCM_6348_PCMCIA_BASE (0xfffe2054)
197 #define BCM_6348_SDRAM_REGS_BASE (0xfffe2300)
198 #define BCM_6348_DSL_BASE (0xfffe3000)
199 #define BCM_6348_ENET0_BASE (0xfffe6000)
200 #define BCM_6348_ENET1_BASE (0xfffe6800)
201 #define BCM_6348_ENETDMA_BASE (0xfffe7000)
202 #define BCM_6348_EHCI0_BASE (0xdeadbeef)
203 #define BCM_6348_SDRAM_BASE (0xfffe2300)
204 #define BCM_6348_MEMC_BASE (0xdeadbeef)
205 #define BCM_6348_DDR_BASE (0xdeadbeef)
208 * 6358 register sets base address
210 #define BCM_6358_DSL_LMEM_BASE (0xfff00000)
211 #define BCM_6358_PERF_BASE (0xfffe0000)
212 #define BCM_6358_TIMER_BASE (0xfffe0040)
213 #define BCM_6358_WDT_BASE (0xfffe005c)
214 #define BCM_6358_UART0_BASE (0xfffe0100)
215 #define BCM_6358_UART1_BASE (0xfffe0120)
216 #define BCM_6358_GPIO_BASE (0xfffe0080)
217 #define BCM_6358_SPI_BASE (0xdeadbeef)
218 #define BCM_6358_UDC0_BASE (0xfffe0800)
219 #define BCM_6358_OHCI0_BASE (0xfffe1400)
220 #define BCM_6358_OHCI_PRIV_BASE (0xdeadbeef)
221 #define BCM_6358_USBH_PRIV_BASE (0xfffe1500)
222 #define BCM_6358_MPI_BASE (0xfffe1000)
223 #define BCM_6358_PCMCIA_BASE (0xfffe1054)
224 #define BCM_6358_SDRAM_REGS_BASE (0xfffe2300)
225 #define BCM_6358_DSL_BASE (0xfffe3000)
226 #define BCM_6358_ENET0_BASE (0xfffe4000)
227 #define BCM_6358_ENET1_BASE (0xfffe4800)
228 #define BCM_6358_ENETDMA_BASE (0xfffe5000)
229 #define BCM_6358_EHCI0_BASE (0xfffe1300)
230 #define BCM_6358_SDRAM_BASE (0xdeadbeef)
231 #define BCM_6358_MEMC_BASE (0xfffe1200)
232 #define BCM_6358_DDR_BASE (0xfffe12a0)
235 extern const unsigned long *bcm63xx_regs_base
;
237 static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set
)
239 #ifdef BCMCPU_RUNTIME_DETECT
240 return bcm63xx_regs_base
[set
];
242 #ifdef CONFIG_BCM63XX_CPU_6338
245 return BCM_6338_DSL_LMEM_BASE
;
247 return BCM_6338_PERF_BASE
;
249 return BCM_6338_TIMER_BASE
;
251 return BCM_6338_WDT_BASE
;
253 return BCM_6338_UART0_BASE
;
255 return BCM_6338_UART1_BASE
;
257 return BCM_6338_GPIO_BASE
;
259 return BCM_6338_SPI_BASE
;
261 return BCM_6338_UDC0_BASE
;
263 return BCM_6338_OHCI0_BASE
;
265 return BCM_6338_OHCI_PRIV_BASE
;
267 return BCM_6338_USBH_PRIV_BASE
;
269 return BCM_6338_MPI_BASE
;
271 return BCM_6338_PCMCIA_BASE
;
273 return BCM_6338_DSL_BASE
;
275 return BCM_6338_ENET0_BASE
;
277 return BCM_6338_ENET1_BASE
;
279 return BCM_6338_ENETDMA_BASE
;
281 return BCM_6338_EHCI0_BASE
;
283 return BCM_6338_SDRAM_BASE
;
285 return BCM_6338_MEMC_BASE
;
287 return BCM_6338_DDR_BASE
;
290 #ifdef CONFIG_BCM63XX_CPU_6345
293 return BCM_6345_DSL_LMEM_BASE
;
295 return BCM_6345_PERF_BASE
;
297 return BCM_6345_TIMER_BASE
;
299 return BCM_6345_WDT_BASE
;
301 return BCM_6345_UART0_BASE
;
303 return BCM_6345_UART1_BASE
;
305 return BCM_6345_GPIO_BASE
;
307 return BCM_6345_SPI_BASE
;
309 return BCM_6345_UDC0_BASE
;
311 return BCM_6345_OHCI0_BASE
;
313 return BCM_6345_OHCI_PRIV_BASE
;
315 return BCM_6345_USBH_PRIV_BASE
;
317 return BCM_6345_MPI_BASE
;
319 return BCM_6345_PCMCIA_BASE
;
321 return BCM_6345_DSL_BASE
;
323 return BCM_6345_ENET0_BASE
;
325 return BCM_6345_ENET1_BASE
;
327 return BCM_6345_ENETDMA_BASE
;
329 return BCM_6345_EHCI0_BASE
;
331 return BCM_6345_SDRAM_BASE
;
333 return BCM_6345_MEMC_BASE
;
335 return BCM_6345_DDR_BASE
;
338 #ifdef CONFIG_BCM63XX_CPU_6348
341 return BCM_6348_DSL_LMEM_BASE
;
343 return BCM_6348_PERF_BASE
;
345 return BCM_6348_TIMER_BASE
;
347 return BCM_6348_WDT_BASE
;
349 return BCM_6348_UART0_BASE
;
351 return BCM_6348_UART1_BASE
;
353 return BCM_6348_GPIO_BASE
;
355 return BCM_6348_SPI_BASE
;
357 return BCM_6348_UDC0_BASE
;
359 return BCM_6348_OHCI0_BASE
;
361 return BCM_6348_OHCI_PRIV_BASE
;
363 return BCM_6348_USBH_PRIV_BASE
;
365 return BCM_6348_MPI_BASE
;
367 return BCM_6348_PCMCIA_BASE
;
369 return BCM_6348_DSL_BASE
;
371 return BCM_6348_ENET0_BASE
;
373 return BCM_6348_ENET1_BASE
;
375 return BCM_6348_ENETDMA_BASE
;
377 return BCM_6348_EHCI0_BASE
;
379 return BCM_6348_SDRAM_BASE
;
381 return BCM_6348_MEMC_BASE
;
383 return BCM_6348_DDR_BASE
;
386 #ifdef CONFIG_BCM63XX_CPU_6358
389 return BCM_6358_DSL_LMEM_BASE
;
391 return BCM_6358_PERF_BASE
;
393 return BCM_6358_TIMER_BASE
;
395 return BCM_6358_WDT_BASE
;
397 return BCM_6358_UART0_BASE
;
399 return BCM_6358_UART1_BASE
;
401 return BCM_6358_GPIO_BASE
;
403 return BCM_6358_SPI_BASE
;
405 return BCM_6358_UDC0_BASE
;
407 return BCM_6358_OHCI0_BASE
;
409 return BCM_6358_OHCI_PRIV_BASE
;
411 return BCM_6358_USBH_PRIV_BASE
;
413 return BCM_6358_MPI_BASE
;
415 return BCM_6358_PCMCIA_BASE
;
417 return BCM_6358_ENET0_BASE
;
419 return BCM_6358_ENET1_BASE
;
421 return BCM_6358_ENETDMA_BASE
;
423 return BCM_6358_DSL_BASE
;
425 return BCM_6358_EHCI0_BASE
;
427 return BCM_6358_SDRAM_BASE
;
429 return BCM_6358_MEMC_BASE
;
431 return BCM_6358_DDR_BASE
;
440 * IRQ number changes across CPU too
464 #define BCM_6338_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
465 #define BCM_6338_SPI_IRQ (IRQ_INTERNAL_BASE + 1)
466 #define BCM_6338_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
467 #define BCM_6338_DG_IRQ (IRQ_INTERNAL_BASE + 4)
468 #define BCM_6338_DSL_IRQ (IRQ_INTERNAL_BASE + 5)
469 #define BCM_6338_ATM_IRQ (IRQ_INTERNAL_BASE + 6)
470 #define BCM_6338_UDC0_IRQ (IRQ_INTERNAL_BASE + 7)
471 #define BCM_6338_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
472 #define BCM_6338_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
473 #define BCM_6338_SDRAM_IRQ (IRQ_INTERNAL_BASE + 10)
474 #define BCM_6338_USB_CNTL_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 11)
475 #define BCM_6338_USB_CNTL_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 12)
476 #define BCM_6338_USB_BULK_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 13)
477 #define BCM_6338_USB_BULK_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 14)
478 #define BCM_6338_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 15)
479 #define BCM_6338_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 16)
480 #define BCM_6338_SDIO_IRQ (IRQ_INTERNAL_BASE + 17)
485 #define BCM_6345_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
486 #define BCM_6345_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
487 #define BCM_6345_DSL_IRQ (IRQ_INTERNAL_BASE + 3)
488 #define BCM_6345_ATM_IRQ (IRQ_INTERNAL_BASE + 4)
489 #define BCM_6345_USB_IRQ (IRQ_INTERNAL_BASE + 5)
490 #define BCM_6345_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
491 #define BCM_6345_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12)
492 #define BCM_6345_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 13 + 1)
493 #define BCM_6345_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 13 + 2)
494 #define BCM_6345_EBI_RX_IRQ (IRQ_INTERNAL_BASE + 13 + 5)
495 #define BCM_6345_EBI_TX_IRQ (IRQ_INTERNAL_BASE + 13 + 6)
496 #define BCM_6345_RESERVED_RX_IRQ (IRQ_INTERNAL_BASE + 13 + 9)
497 #define BCM_6345_RESERVED_TX_IRQ (IRQ_INTERNAL_BASE + 13 + 10)
498 #define BCM_6345_USB_BULK_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 13)
499 #define BCM_6345_USB_BULK_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 14)
500 #define BCM_6345_USB_CNTL_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 15)
501 #define BCM_6345_USB_CNTL_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 16)
502 #define BCM_6345_USB_ISO_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 17)
503 #define BCM_6345_USB_ISO_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 13 + 18)
508 #define BCM_6348_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
509 #define BCM_6348_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
510 #define BCM_6348_DSL_IRQ (IRQ_INTERNAL_BASE + 4)
511 #define BCM_6348_ENET1_IRQ (IRQ_INTERNAL_BASE + 7)
512 #define BCM_6348_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
513 #define BCM_6348_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
514 #define BCM_6348_OHCI0_IRQ (IRQ_INTERNAL_BASE + 12)
515 #define BCM_6348_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 20)
516 #define BCM_6348_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 21)
517 #define BCM_6348_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 22)
518 #define BCM_6348_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 23)
519 #define BCM_6348_PCMCIA_IRQ (IRQ_INTERNAL_BASE + 24)
520 #define BCM_6348_PCI_IRQ (IRQ_INTERNAL_BASE + 24)
525 #define BCM_6358_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
526 #define BCM_6358_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
527 #define BCM_6358_UART1_IRQ (IRQ_INTERNAL_BASE + 3)
528 #define BCM_6358_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)
529 #define BCM_6358_ENET1_IRQ (IRQ_INTERNAL_BASE + 6)
530 #define BCM_6358_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
531 #define BCM_6358_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
532 #define BCM_6358_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10)
533 #define BCM_6358_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 15)
534 #define BCM_6358_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 16)
535 #define BCM_6358_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 17)
536 #define BCM_6358_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 18)
537 #define BCM_6358_DSL_IRQ (IRQ_INTERNAL_BASE + 29)
538 #define BCM_6358_PCI_IRQ (IRQ_INTERNAL_BASE + 31)
539 #define BCM_6358_PCMCIA_IRQ (IRQ_INTERNAL_BASE + 24)
541 extern const int *bcm63xx_irqs
;
543 static inline int bcm63xx_get_irq_number(enum bcm63xx_irq irq
)
545 return bcm63xx_irqs
[irq
];
549 * return installed memory size
551 unsigned int bcm63xx_get_memory_size(void);
553 #endif /* !BCM63XX_CPU_H_ */