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 BCM6348_CPU_ID 0x6348
14 #define BCM6358_CPU_ID 0x6358
16 void __init
bcm63xx_cpu_init(void);
17 u16
__bcm63xx_get_cpu_id(void);
18 u16
bcm63xx_get_cpu_rev(void);
19 unsigned int bcm63xx_get_cpu_freq(void);
21 #ifdef CONFIG_BCM63XX_CPU_6338
22 # ifdef bcm63xx_get_cpu_id
23 # undef bcm63xx_get_cpu_id
24 # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
25 # define BCMCPU_RUNTIME_DETECT
27 # define bcm63xx_get_cpu_id() BCM6338_CPU_ID
29 # define BCMCPU_IS_6338() (bcm63xx_get_cpu_id() == BCM6338_CPU_ID)
31 # define BCMCPU_IS_6338() (0)
34 #ifdef CONFIG_BCM63XX_CPU_6348
35 # ifdef bcm63xx_get_cpu_id
36 # undef bcm63xx_get_cpu_id
37 # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
38 # define BCMCPU_RUNTIME_DETECT
40 # define bcm63xx_get_cpu_id() BCM6348_CPU_ID
42 # define BCMCPU_IS_6348() (bcm63xx_get_cpu_id() == BCM6348_CPU_ID)
44 # define BCMCPU_IS_6348() (0)
47 #ifdef CONFIG_BCM63XX_CPU_6358
48 # ifdef bcm63xx_get_cpu_id
49 # undef bcm63xx_get_cpu_id
50 # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
51 # define BCMCPU_RUNTIME_DETECT
53 # define bcm63xx_get_cpu_id() BCM6358_CPU_ID
55 # define BCMCPU_IS_6358() (bcm63xx_get_cpu_id() == BCM6358_CPU_ID)
57 # define BCMCPU_IS_6358() (0)
60 #ifndef bcm63xx_get_cpu_id
61 #error "No CPU support configured"
65 * While registers sets are (mostly) the same across 63xx CPU, base
66 * address of these sets do change.
68 enum bcm63xx_regs_set
{
92 #define RSET_DSL_LMEM_SIZE (64 * 1024 * 4)
93 #define RSET_DSL_SIZE 4096
94 #define RSET_WDT_SIZE 12
95 #define RSET_ENET_SIZE 2048
96 #define RSET_ENETDMA_SIZE 2048
97 #define RSET_UART_SIZE 24
98 #define RSET_SPI_SIZE 256
99 #define RSET_UDC_SIZE 256
100 #define RSET_OHCI_SIZE 256
101 #define RSET_EHCI_SIZE 256
102 #define RSET_PCMCIA_SIZE 12
105 * 6338 register sets base address
108 #define BCM_6338_PERF_BASE (0xfffe0000)
109 #define BCM_6338_TIMER_BASE (0xfffe0000)
110 #define BCM_6338_WDT_BASE (0xfffe001c)
111 #define BCM_6338_UART0_BASE (0xfffe0300)
112 #define BCM_6338_GPIO_BASE (0xfffe0400)
113 #define BCM_6338_SPI_BASE (0xfffe0c00)
114 #define BCM_6338_SAR_BASE (0xfffe2000)
115 #define BCM_6338_MEMC_BASE (0xfffe3100)
118 * 6348 register sets base address
120 #define BCM_6348_DSL_LMEM_BASE (0xfff00000)
121 #define BCM_6348_PERF_BASE (0xfffe0000)
122 #define BCM_6348_TIMER_BASE (0xfffe0200)
123 #define BCM_6348_WDT_BASE (0xfffe021c)
124 #define BCM_6348_UART0_BASE (0xfffe0300)
125 #define BCM_6348_GPIO_BASE (0xfffe0400)
126 #define BCM_6348_SPI_BASE (0xfffe0c00)
127 #define BCM_6348_UDC0_BASE (0xfffe1000)
128 #define BCM_6348_OHCI0_BASE (0xfffe1b00)
129 #define BCM_6348_OHCI_PRIV_BASE (0xfffe1c00)
130 #define BCM_6348_USBH_PRIV_BASE (0xdeadbeef)
131 #define BCM_6348_MPI_BASE (0xfffe2000)
132 #define BCM_6348_PCMCIA_BASE (0xfffe2054)
133 #define BCM_6348_SDRAM_REGS_BASE (0xfffe2300)
134 #define BCM_6348_DSL_BASE (0xfffe3000)
135 #define BCM_6348_ENET0_BASE (0xfffe6000)
136 #define BCM_6348_ENET1_BASE (0xfffe6800)
137 #define BCM_6348_ENETDMA_BASE (0xfffe7000)
138 #define BCM_6348_EHCI0_BASE (0xdeadbeef)
139 #define BCM_6348_SDRAM_BASE (0xfffe2300)
140 #define BCM_6348_MEMC_BASE (0xdeadbeef)
141 #define BCM_6348_DDR_BASE (0xdeadbeef)
144 * 6358 register sets base address
146 #define BCM_6358_DSL_LMEM_BASE (0xfff00000)
147 #define BCM_6358_PERF_BASE (0xfffe0000)
148 #define BCM_6358_TIMER_BASE (0xfffe0040)
149 #define BCM_6358_WDT_BASE (0xfffe005c)
150 #define BCM_6358_GPIO_BASE (0xfffe0080)
151 #define BCM_6358_UART0_BASE (0xfffe0100)
152 #define BCM_6358_UDC0_BASE (0xfffe0400)
153 #define BCM_6358_SPI_BASE (0xfffe0800)
154 #define BCM_6358_MPI_BASE (0xfffe1000)
155 #define BCM_6358_PCMCIA_BASE (0xfffe1054)
156 #define BCM_6358_OHCI0_BASE (0xfffe1400)
157 #define BCM_6358_OHCI_PRIV_BASE (0xdeadbeef)
158 #define BCM_6358_USBH_PRIV_BASE (0xfffe1500)
159 #define BCM_6358_SDRAM_REGS_BASE (0xfffe2300)
160 #define BCM_6358_DSL_BASE (0xfffe3000)
161 #define BCM_6358_ENET0_BASE (0xfffe4000)
162 #define BCM_6358_ENET1_BASE (0xfffe4800)
163 #define BCM_6358_ENETDMA_BASE (0xfffe5000)
164 #define BCM_6358_EHCI0_BASE (0xfffe1300)
165 #define BCM_6358_SDRAM_BASE (0xdeadbeef)
166 #define BCM_6358_MEMC_BASE (0xfffe1200)
167 #define BCM_6358_DDR_BASE (0xfffe12a0)
170 extern const unsigned long *bcm63xx_regs_base
;
172 static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set
)
174 #ifdef BCMCPU_RUNTIME_DETECT
175 return bcm63xx_regs_base
[set
];
177 #ifdef CONFIG_BCM63XX_CPU_6338
180 return BCM_6338_PERF_BASE
;
182 return BCM_6338_TIMER_BASE
;
184 return BCM_6338_WDT_BASE
;
186 return BCM_6338_UART0_BASE
;
188 return BCM_6338_GPIO_BASE
;
190 return BCM_6338_SPI_BASE
;
192 return BCM_6338_MEMC_BASE
;
195 #ifdef CONFIG_BCM63XX_CPU_6348
198 return BCM_6348_DSL_LMEM_BASE
;
200 return BCM_6348_PERF_BASE
;
202 return BCM_6348_TIMER_BASE
;
204 return BCM_6348_WDT_BASE
;
206 return BCM_6348_UART0_BASE
;
208 return BCM_6348_GPIO_BASE
;
210 return BCM_6348_SPI_BASE
;
212 return BCM_6348_UDC0_BASE
;
214 return BCM_6348_OHCI0_BASE
;
216 return BCM_6348_OHCI_PRIV_BASE
;
218 return BCM_6348_USBH_PRIV_BASE
;
220 return BCM_6348_MPI_BASE
;
222 return BCM_6348_PCMCIA_BASE
;
224 return BCM_6348_DSL_BASE
;
226 return BCM_6348_ENET0_BASE
;
228 return BCM_6348_ENET1_BASE
;
230 return BCM_6348_ENETDMA_BASE
;
232 return BCM_6348_EHCI0_BASE
;
234 return BCM_6348_SDRAM_BASE
;
236 return BCM_6348_MEMC_BASE
;
238 return BCM_6348_DDR_BASE
;
241 #ifdef CONFIG_BCM63XX_CPU_6358
244 return BCM_6358_DSL_LMEM_BASE
;
246 return BCM_6358_PERF_BASE
;
248 return BCM_6358_TIMER_BASE
;
250 return BCM_6358_WDT_BASE
;
252 return BCM_6358_UART0_BASE
;
254 return BCM_6358_GPIO_BASE
;
256 return BCM_6358_SPI_BASE
;
258 return BCM_6358_UDC0_BASE
;
260 return BCM_6358_OHCI0_BASE
;
262 return BCM_6358_OHCI_PRIV_BASE
;
264 return BCM_6358_USBH_PRIV_BASE
;
266 return BCM_6358_MPI_BASE
;
268 return BCM_6358_PCMCIA_BASE
;
270 return BCM_6358_ENET0_BASE
;
272 return BCM_6358_ENET1_BASE
;
274 return BCM_6358_ENETDMA_BASE
;
276 return BCM_6358_DSL_BASE
;
278 return BCM_6358_EHCI0_BASE
;
280 return BCM_6358_SDRAM_BASE
;
282 return BCM_6358_MEMC_BASE
;
284 return BCM_6358_DDR_BASE
;
293 * SPI register layout is not compatible
294 * accross CPU versions but it is software
298 enum bcm63xx_regs_spi
{
313 extern const unsigned long *bcm63xx_regs_spi
;
315 static inline unsigned long bcm63xx_spireg(enum bcm63xx_regs_spi reg
)
317 #ifdef BCMCPU_RUNTIME_DETECT
318 return bcm63xx_regs_spi
[reg
];
320 #ifdef CONFIG_BCM63XX_CPU_6338
323 return SPI_BCM_6338_SPI_CMD
;
325 return SPI_BCM_6338_SPI_INT_STATUS
;
326 case SPI_INT_MASK_ST
:
327 return SPI_BCM_6338_SPI_MASK_INT_ST
;
329 return SPI_BCM_6338_SPI_INT_MASK
;
331 return SPI_BCM_6338_SPI_ST
;
333 return SPI_BCM_6338_SPI_CLK_CFG
;
335 return SPI_BCM_6338_SPI_FILL_BYTE
;
337 return SPI_BCM_6338_SPI_MSG_TAIL
;
339 return SPI_BCM_6338_SPI_RX_TAIL
;
341 return SPI_BCM_6338_SPI_MSG_CTL
;
343 return SPI_BCM_6338_SPI_MSG_DATA
;
345 return SPI_BCM_6338_SPI_RX_DATA
;
348 #ifdef CONFIG_BCM63XX_CPU_6348
351 return SPI_BCM_6348_SPI_CMD
;
352 case SPI_INT_MASK_ST
:
353 return SPI_BCM_6348_SPI_MASK_INT_ST
;
355 return SPI_BCM_6348_SPI_INT_STATUS
;
357 return SPI_BCM_6348_SPI_ST
;
359 return SPI_BCM_6348_SPI_CLK_CFG
;
361 return SPI_BCM_6348_SPI_FILL_BYTE
;
363 return SPI_BCM_6348_SPI_MSG_TAIL
;
365 return SPI_BCM_6348_SPI_RX_TAIL
;
367 return SPI_BCM_6348_SPI_MSG_CTL
;
369 return SPI_BCM_6348_SPI_MSG_DATA
;
370 case SPI_BCM_6348_SPI_RX_DATA
:
371 return SPI_BCM_6348_SPI_RX_DATA
;
374 #ifdef CONFIG_BCM63XX_CPU_6358
377 return SPI_BCM_6358_SPI_CMD
;
379 return SPI_BCM_6358_SPI_INT_STATUS
;
380 case SPI_INT_MASK_ST
:
381 return SPI_BCM_6358_SPI_MASK_INT_ST
;
383 return SPI_BCM_6358_SPI_INT_MASK
;
385 return SPI_BCM_6358_SPI_STATUS
;
387 return SPI_BCM_6358_SPI_CLK_CFG
;
389 return SPI_BCM_6358_SPI_FILL_BYTE
;
391 return SPI_BCM_6358_SPI_MSG_TAIL
;
393 return SPI_BCM_6358_SPI_RX_TAIL
;
395 return SPI_BCM_6358_MSG_CTL
;
397 return SPI_BCM_6358_SPI_MSG_DATA
;
399 return SPI_BCM_6358_SPI_RX_DATA
;
407 * IRQ number changes across CPU too
431 #define BCM_6338_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
432 #define BCM_6338_SPI_IRQ (IRQ_INTERNAL_BASE + 1)
433 #define BCM_6338_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
434 #define BCM_6338_DG_IRQ (IRQ_INTERNAL_BASE + 4)
435 #define BCM_6338_DSL_IRQ (IRQ_INTERNAL_BASE + 5)
436 #define BCM_6338_ATM_IRQ (IRQ_INTERNAL_BASE + 6)
437 #define BCM_6338_USBS_IRQ (IRQ_INTERNAL_BASE + 7)
438 #define BCM_6338_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
439 #define BCM_6338_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
440 #define BCM_6338_SDRAM_IRQ (IRQ_INTERNAL_BASE + 10)
441 #define BCM_6338_USB_CNTL_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 11)
442 #define BCM_6338_USB_CNTL_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 12)
443 #define BCM_6338_USB_BULK_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 13)
444 #define BCM_6338_USB_BULK_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 14)
445 #define BCM_6338_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 15)
446 #define BCM_6338_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 16)
447 #define BCM_6338_SDIO_IRQ (IRQ_INTERNAL_BASE + 17)
452 #define BCM_6348_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
453 #define BCM_6348_SPI_IRQ (IRQ_INTERNAL_BASE + 1)
454 #define BCM_6348_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
455 #define BCM_6348_DSL_IRQ (IRQ_INTERNAL_BASE + 4)
456 #define BCM_6348_ENET1_IRQ (IRQ_INTERNAL_BASE + 7)
457 #define BCM_6348_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
458 #define BCM_6348_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
459 #define BCM_6348_OHCI0_IRQ (IRQ_INTERNAL_BASE + 12)
460 #define BCM_6348_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 20)
461 #define BCM_6348_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 21)
462 #define BCM_6348_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 22)
463 #define BCM_6348_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 23)
464 #define BCM_6348_PCMCIA_IRQ (IRQ_INTERNAL_BASE + 24)
465 #define BCM_6348_PCI_IRQ (IRQ_INTERNAL_BASE + 24)
470 #define BCM_6358_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
471 #define BCM_6358_SPI_IRQ (IRQ_INTERNAL_BASE + 1)
472 #define BCM_6358_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
473 #define BCM_6358_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)
474 #define BCM_6358_ENET1_IRQ (IRQ_INTERNAL_BASE + 6)
475 #define BCM_6358_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
476 #define BCM_6358_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
477 #define BCM_6358_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10)
478 #define BCM_6358_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 15)
479 #define BCM_6358_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 16)
480 #define BCM_6358_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 17)
481 #define BCM_6358_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 18)
482 #define BCM_6358_DSL_IRQ (IRQ_INTERNAL_BASE + 29)
483 #define BCM_6358_PCI_IRQ (IRQ_INTERNAL_BASE + 31)
484 #define BCM_6358_PCMCIA_IRQ (IRQ_INTERNAL_BASE + 24)
486 extern const int *bcm63xx_irqs
;
488 static inline int bcm63xx_get_irq_number(enum bcm63xx_irq irq
)
490 return bcm63xx_irqs
[irq
];
494 * return installed memory size
496 unsigned int bcm63xx_get_memory_size(void);
498 #endif /* !BCM63XX_CPU_H_ */