1 From 0713aadd2a4e543b69022aa40bdec3e1dc5bc1e5 Mon Sep 17 00:00:00 2001
2 From: Maxime Bizon <mbizon@freebox.fr>
3 Date: Mon, 18 Aug 2008 13:56:57 +0200
4 Subject: [PATCH] [MIPS] BCM63XX: Add support for Broadcom 63xx CPUs.
6 Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
8 arch/mips/Kconfig | 16 +
9 arch/mips/Makefile | 7 +
10 arch/mips/bcm63xx/Kconfig | 9 +
11 arch/mips/bcm63xx/Makefile | 2 +
12 arch/mips/bcm63xx/clk.c | 220 ++++++
13 arch/mips/bcm63xx/cpu.c | 245 +++++++
14 arch/mips/bcm63xx/cs.c | 144 ++++
15 arch/mips/bcm63xx/early_printk.c | 30 +
16 arch/mips/bcm63xx/gpio.c | 98 +++
17 arch/mips/bcm63xx/irq.c | 253 +++++++
18 arch/mips/bcm63xx/prom.c | 43 ++
19 arch/mips/bcm63xx/setup.c | 108 +++
20 arch/mips/bcm63xx/timer.c | 205 ++++++
21 include/asm-mips/fixmap.h | 4 +
22 include/asm-mips/mach-bcm63xx/bcm63xx_clk.h | 11 +
23 include/asm-mips/mach-bcm63xx/bcm63xx_cpu.h | 314 +++++++++
24 include/asm-mips/mach-bcm63xx/bcm63xx_cs.h | 10 +
25 include/asm-mips/mach-bcm63xx/bcm63xx_gpio.h | 14 +
26 include/asm-mips/mach-bcm63xx/bcm63xx_io.h | 93 +++
27 include/asm-mips/mach-bcm63xx/bcm63xx_irq.h | 15 +
28 include/asm-mips/mach-bcm63xx/bcm63xx_regs.h | 728 ++++++++++++++++++++
29 include/asm-mips/mach-bcm63xx/bcm63xx_timer.h | 11 +
30 .../asm-mips/mach-bcm63xx/cpu-feature-overrides.h | 51 ++
31 include/asm-mips/mach-bcm63xx/gpio.h | 52 ++
32 include/asm-mips/mach-bcm63xx/war.h | 25 +
33 25 files changed, 2708 insertions(+), 0 deletions(-)
34 create mode 100644 arch/mips/bcm63xx/Kconfig
35 create mode 100644 arch/mips/bcm63xx/Makefile
36 create mode 100644 arch/mips/bcm63xx/clk.c
37 create mode 100644 arch/mips/bcm63xx/cpu.c
38 create mode 100644 arch/mips/bcm63xx/cs.c
39 create mode 100644 arch/mips/bcm63xx/early_printk.c
40 create mode 100644 arch/mips/bcm63xx/gpio.c
41 create mode 100644 arch/mips/bcm63xx/irq.c
42 create mode 100644 arch/mips/bcm63xx/prom.c
43 create mode 100644 arch/mips/bcm63xx/setup.c
44 create mode 100644 arch/mips/bcm63xx/timer.c
45 create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_clk.h
46 create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_cpu.h
47 create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_cs.h
48 create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_gpio.h
49 create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_io.h
50 create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_irq.h
51 create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_regs.h
52 create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_timer.h
53 create mode 100644 include/asm-mips/mach-bcm63xx/cpu-feature-overrides.h
54 create mode 100644 include/asm-mips/mach-bcm63xx/gpio.h
55 create mode 100644 include/asm-mips/mach-bcm63xx/war.h
57 diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
58 index 1e06d23..88dfe21 100644
59 --- a/arch/mips/Kconfig
60 +++ b/arch/mips/Kconfig
61 @@ -59,6 +59,21 @@ config BCM47XX
63 Support for BCM47XX based boards
66 + bool "Broadcom 63xx based boards"
69 + select DMA_NONCOHERENT
71 + select SYS_HAS_CPU_MIPS32_R1
72 + select SYS_SUPPORTS_32BIT_KERNEL
73 + select SYS_SUPPORTS_BIG_ENDIAN
74 + select SYS_HAS_EARLY_PRINTK
75 + select SWAP_IO_SPACE
78 + Support for BCM63XX based boards
83 @@ -600,6 +615,7 @@ endchoice
85 source "arch/mips/au1000/Kconfig"
86 source "arch/mips/basler/excite/Kconfig"
87 +source "arch/mips/bcm63xx/Kconfig"
88 source "arch/mips/jazz/Kconfig"
89 source "arch/mips/lasat/Kconfig"
90 source "arch/mips/pmc-sierra/Kconfig"
91 diff --git a/arch/mips/Makefile b/arch/mips/Makefile
92 index 9aab51c..a45652e 100644
93 --- a/arch/mips/Makefile
94 +++ b/arch/mips/Makefile
95 @@ -533,6 +533,13 @@ cflags-$(CONFIG_BCM47XX) += -Iinclude/asm-mips/mach-bcm47xx
96 load-$(CONFIG_BCM47XX) := 0xffffffff80001000
99 +# Broadcom BCM63XX boards
101 +core-$(CONFIG_BCM63XX) += arch/mips/bcm63xx/
102 +cflags-$(CONFIG_BCM63XX) += -Iinclude/asm-mips/mach-bcm63xx/
103 +load-$(CONFIG_BCM63XX) := 0xffffffff80010000
108 core-$(CONFIG_SNI_RM) += arch/mips/sni/
109 diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
111 index 0000000..e6d2699
113 +++ b/arch/mips/bcm63xx/Kconfig
118 +config BCM63XX_CPU_6348
119 + bool "support 6348 CPU"
121 +config BCM63XX_CPU_6358
122 + bool "support 6358 CPU"
124 diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
126 index 0000000..4fc0a1c
128 +++ b/arch/mips/bcm63xx/Makefile
130 +obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o
131 +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
132 diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
134 index 0000000..ae1f41f
136 +++ b/arch/mips/bcm63xx/clk.c
139 + * This file is subject to the terms and conditions of the GNU General Public
140 + * License. See the file "COPYING" in the main directory of this archive
141 + * for more details.
143 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
146 +#include <linux/module.h>
147 +#include <linux/mutex.h>
148 +#include <linux/err.h>
149 +#include <linux/clk.h>
150 +#include <bcm63xx_cpu.h>
151 +#include <bcm63xx_io.h>
152 +#include <bcm63xx_regs.h>
153 +#include <bcm63xx_clk.h>
155 +DEFINE_MUTEX(clocks_mutex);
158 +static void clk_enable_unlocked(struct clk *clk)
160 + if (clk->set && (clk->usage++) == 0)
164 +static void clk_disable_unlocked(struct clk *clk)
166 + if (clk->set && (--clk->usage) == 0)
170 +static void bcm_hwclock_set(u32 mask, int enable)
174 + reg = bcm_perf_readl(PERF_CKCTL_REG);
179 + bcm_perf_writel(reg, PERF_CKCTL_REG);
183 + * Ethernet MAC "misc" clock: dma clocks and main clock on 6348
185 +static void enet_misc_set(struct clk *clk, int enable)
189 + if (BCMCPU_IS_6348())
190 + mask = CKCTL_6348_ENET_EN;
192 + /* BCMCPU_IS_6358 */
193 + mask = CKCTL_6358_EMUSB_EN;
194 + bcm_hwclock_set(mask, enable);
197 +static struct clk clk_enet_misc = {
198 + .set = enet_misc_set,
202 + * Ethernet MAC clocks: only revelant on 6358, silently enable misc
205 +static void enetx_set(struct clk *clk, int enable)
208 + clk_enable_unlocked(&clk_enet_misc);
210 + clk_disable_unlocked(&clk_enet_misc);
212 + if (BCMCPU_IS_6358()) {
216 + mask = CKCTL_6358_ENET0_EN;
218 + mask = CKCTL_6358_ENET1_EN;
219 + bcm_hwclock_set(mask, enable);
223 +static struct clk clk_enet0 = {
228 +static struct clk clk_enet1 = {
234 + * Ethernet PHY clock
236 +static void ephy_set(struct clk *clk, int enable)
238 + if (!BCMCPU_IS_6358())
240 + bcm_hwclock_set(CKCTL_6358_EPHY_EN, enable);
244 +static struct clk clk_ephy = {
251 +static void pcm_set(struct clk *clk, int enable)
253 + if (!BCMCPU_IS_6358())
255 + bcm_hwclock_set(CKCTL_6358_PCM_EN, enable);
258 +static struct clk clk_pcm = {
265 +static void usbh_set(struct clk *clk, int enable)
267 + if (!BCMCPU_IS_6348())
269 + bcm_hwclock_set(CKCTL_6348_USBH_EN, enable);
272 +static struct clk clk_usbh = {
279 +static void spi_set(struct clk *clk, int enable)
283 + if (BCMCPU_IS_6348())
284 + mask = CKCTL_6348_SPI_EN;
286 + /* BCMCPU_IS_6358 */
287 + mask = CKCTL_6358_SPI_EN;
288 + bcm_hwclock_set(mask, enable);
291 +static struct clk clk_spi = {
296 + * Internal peripheral clock
298 +static struct clk clk_periph = {
299 + .rate = (50 * 1000 * 1000),
304 + * Linux clock API implementation
306 +int clk_enable(struct clk *clk)
308 + mutex_lock(&clocks_mutex);
309 + clk_enable_unlocked(clk);
310 + mutex_unlock(&clocks_mutex);
314 +EXPORT_SYMBOL(clk_enable);
316 +void clk_disable(struct clk *clk)
318 + mutex_lock(&clocks_mutex);
319 + clk_disable_unlocked(clk);
320 + mutex_unlock(&clocks_mutex);
323 +EXPORT_SYMBOL(clk_disable);
325 +unsigned long clk_get_rate(struct clk *clk)
330 +EXPORT_SYMBOL(clk_get_rate);
332 +struct clk *clk_get(struct device *dev, const char *id)
334 + if (!strcmp(id, "enet0"))
336 + if (!strcmp(id, "enet1"))
338 + if (!strcmp(id, "ephy"))
340 + if (!strcmp(id, "usbh"))
342 + if (!strcmp(id, "spi"))
344 + if (!strcmp(id, "periph"))
345 + return &clk_periph;
346 + if (BCMCPU_IS_6358() && !strcmp(id, "pcm"))
348 + return ERR_PTR(-ENOENT);
351 +EXPORT_SYMBOL(clk_get);
353 +void clk_put(struct clk *clk)
357 +EXPORT_SYMBOL(clk_put);
358 diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
360 index 0000000..0a403dd
362 +++ b/arch/mips/bcm63xx/cpu.c
365 + * This file is subject to the terms and conditions of the GNU General Public
366 + * License. See the file "COPYING" in the main directory of this archive
367 + * for more details.
369 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
372 +#include <linux/kernel.h>
373 +#include <linux/module.h>
374 +#include <linux/cpu.h>
375 +#include <bcm63xx_cpu.h>
376 +#include <bcm63xx_regs.h>
377 +#include <bcm63xx_io.h>
378 +#include <bcm63xx_irq.h>
380 +const unsigned long *bcm63xx_regs_base;
381 +EXPORT_SYMBOL(bcm63xx_regs_base);
383 +const int *bcm63xx_irqs;
384 +EXPORT_SYMBOL(bcm63xx_irqs);
386 +static u16 bcm63xx_cpu_id;
387 +static u16 bcm63xx_cpu_rev;
388 +static unsigned int bcm63xx_cpu_freq;
389 +static unsigned int bcm63xx_memory_size;
392 + * 6348 register sets and irqs
394 +static const unsigned long bcm96348_regs_base[] = {
395 + [RSET_DSL_LMEM] = BCM_6348_DSL_LMEM_BASE,
396 + [RSET_PERF] = BCM_6348_PERF_BASE,
397 + [RSET_TIMER] = BCM_6348_TIMER_BASE,
398 + [RSET_WDT] = BCM_6348_WDT_BASE,
399 + [RSET_UART0] = BCM_6348_UART0_BASE,
400 + [RSET_GPIO] = BCM_6348_GPIO_BASE,
401 + [RSET_SPI] = BCM_6348_SPI_BASE,
402 + [RSET_OHCI0] = BCM_6348_OHCI0_BASE,
403 + [RSET_OHCI_PRIV] = BCM_6348_OHCI_PRIV_BASE,
404 + [RSET_USBH_PRIV] = BCM_6348_USBH_PRIV_BASE,
405 + [RSET_MPI] = BCM_6348_MPI_BASE,
406 + [RSET_PCMCIA] = BCM_6348_PCMCIA_BASE,
407 + [RSET_SDRAM] = BCM_6348_SDRAM_BASE,
408 + [RSET_DSL] = BCM_6348_DSL_BASE,
409 + [RSET_ENET0] = BCM_6348_ENET0_BASE,
410 + [RSET_ENET1] = BCM_6348_ENET1_BASE,
411 + [RSET_ENETDMA] = BCM_6348_ENETDMA_BASE,
412 + [RSET_MEMC] = BCM_6348_MEMC_BASE,
413 + [RSET_DDR] = BCM_6348_DDR_BASE,
416 +static const int bcm96348_irqs[] = {
417 + [IRQ_TIMER] = BCM_6348_TIMER_IRQ,
418 + [IRQ_UART0] = BCM_6348_UART0_IRQ,
419 + [IRQ_DSL] = BCM_6348_DSL_IRQ,
420 + [IRQ_ENET0] = BCM_6348_ENET0_IRQ,
421 + [IRQ_ENET1] = BCM_6348_ENET1_IRQ,
422 + [IRQ_ENET_PHY] = BCM_6348_ENET_PHY_IRQ,
423 + [IRQ_OHCI0] = BCM_6348_OHCI0_IRQ,
424 + [IRQ_PCMCIA] = BCM_6348_PCMCIA_IRQ,
425 + [IRQ_ENET0_RXDMA] = BCM_6348_ENET0_RXDMA_IRQ,
426 + [IRQ_ENET0_TXDMA] = BCM_6348_ENET0_TXDMA_IRQ,
427 + [IRQ_ENET1_RXDMA] = BCM_6348_ENET1_RXDMA_IRQ,
428 + [IRQ_ENET1_TXDMA] = BCM_6348_ENET1_TXDMA_IRQ,
429 + [IRQ_PCI] = BCM_6348_PCI_IRQ,
433 + * 6358 register sets and irqs
435 +static const unsigned long bcm96358_regs_base[] = {
436 + [RSET_DSL_LMEM] = BCM_6358_DSL_LMEM_BASE,
437 + [RSET_PERF] = BCM_6358_PERF_BASE,
438 + [RSET_TIMER] = BCM_6358_TIMER_BASE,
439 + [RSET_WDT] = BCM_6358_WDT_BASE,
440 + [RSET_UART0] = BCM_6358_UART0_BASE,
441 + [RSET_GPIO] = BCM_6358_GPIO_BASE,
442 + [RSET_SPI] = BCM_6358_SPI_BASE,
443 + [RSET_OHCI0] = BCM_6358_OHCI0_BASE,
444 + [RSET_EHCI0] = BCM_6358_EHCI0_BASE,
445 + [RSET_OHCI_PRIV] = BCM_6358_OHCI_PRIV_BASE,
446 + [RSET_USBH_PRIV] = BCM_6358_USBH_PRIV_BASE,
447 + [RSET_MPI] = BCM_6358_MPI_BASE,
448 + [RSET_PCMCIA] = BCM_6358_PCMCIA_BASE,
449 + [RSET_SDRAM] = BCM_6358_SDRAM_BASE,
450 + [RSET_DSL] = BCM_6358_DSL_BASE,
451 + [RSET_ENET0] = BCM_6358_ENET0_BASE,
452 + [RSET_ENET1] = BCM_6358_ENET1_BASE,
453 + [RSET_ENETDMA] = BCM_6358_ENETDMA_BASE,
454 + [RSET_MEMC] = BCM_6358_MEMC_BASE,
455 + [RSET_DDR] = BCM_6358_DDR_BASE,
458 +static const int bcm96358_irqs[] = {
459 + [IRQ_TIMER] = BCM_6358_TIMER_IRQ,
460 + [IRQ_UART0] = BCM_6358_UART0_IRQ,
461 + [IRQ_DSL] = BCM_6358_DSL_IRQ,
462 + [IRQ_ENET0] = BCM_6358_ENET0_IRQ,
463 + [IRQ_ENET1] = BCM_6358_ENET1_IRQ,
464 + [IRQ_ENET_PHY] = BCM_6358_ENET_PHY_IRQ,
465 + [IRQ_OHCI0] = BCM_6358_OHCI0_IRQ,
466 + [IRQ_EHCI0] = BCM_6358_EHCI0_IRQ,
467 + [IRQ_PCMCIA] = BCM_6358_PCMCIA_IRQ,
468 + [IRQ_ENET0_RXDMA] = BCM_6358_ENET0_RXDMA_IRQ,
469 + [IRQ_ENET0_TXDMA] = BCM_6358_ENET0_TXDMA_IRQ,
470 + [IRQ_ENET1_RXDMA] = BCM_6358_ENET1_RXDMA_IRQ,
471 + [IRQ_ENET1_TXDMA] = BCM_6358_ENET1_TXDMA_IRQ,
472 + [IRQ_PCI] = BCM_6358_PCI_IRQ,
475 +u16 __bcm63xx_get_cpu_id(void)
477 + return bcm63xx_cpu_id;
480 +EXPORT_SYMBOL(__bcm63xx_get_cpu_id);
482 +u16 bcm63xx_get_cpu_rev(void)
484 + return bcm63xx_cpu_rev;
487 +EXPORT_SYMBOL(bcm63xx_get_cpu_rev);
489 +unsigned int bcm63xx_get_cpu_freq(void)
491 + return bcm63xx_cpu_freq;
494 +unsigned int bcm63xx_get_memory_size(void)
496 + return bcm63xx_memory_size;
499 +static unsigned int detect_cpu_clock(void)
501 + unsigned int tmp, n1 = 0, n2 = 0, m1 = 0;
504 + * frequency depends on PLL configuration:
506 + if (BCMCPU_IS_6348()) {
507 + /* 16MHz * (N1 + 1) * (N2 + 2) / (M1_CPU + 1) */
508 + tmp = bcm_perf_readl(PERF_MIPSPLLCTL_REG);
509 + n1 = (tmp & MIPSPLLCTL_N1_MASK) >> MIPSPLLCTL_N1_SHIFT;
510 + n2 = (tmp & MIPSPLLCTL_N2_MASK) >> MIPSPLLCTL_N2_SHIFT;
511 + m1 = (tmp & MIPSPLLCTL_M1CPU_MASK) >> MIPSPLLCTL_M1CPU_SHIFT;
517 + if (BCMCPU_IS_6358()) {
518 + /* 16MHz * N1 * N2 / M1_CPU */
519 + tmp = bcm_ddr_readl(DDR_DMIPSPLLCFG_REG);
520 + n1 = (tmp & DMIPSPLLCFG_N1_MASK) >> DMIPSPLLCFG_N1_SHIFT;
521 + n2 = (tmp & DMIPSPLLCFG_N2_MASK) >> DMIPSPLLCFG_N2_SHIFT;
522 + m1 = (tmp & DMIPSPLLCFG_M1_MASK) >> DMIPSPLLCFG_M1_SHIFT;
525 + return (16 * 1000000 * n1 * n2) / m1;
529 + * attempt to detect the amount of memory installed
531 +static unsigned int detect_memory_size(void)
533 + unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
536 + if (BCMCPU_IS_6348()) {
537 + val = bcm_sdram_readl(SDRAM_CFG_REG);
538 + rows = (val & SDRAM_CFG_ROW_MASK) >> SDRAM_CFG_ROW_SHIFT;
539 + cols = (val & SDRAM_CFG_COL_MASK) >> SDRAM_CFG_COL_SHIFT;
540 + is_32bits = (val & SDRAM_CFG_32B_MASK) ? 1 : 0;
541 + banks = (val & SDRAM_CFG_BANK_MASK) ? 2 : 1;
544 + if (BCMCPU_IS_6358()) {
545 + val = bcm_memc_readl(MEMC_CFG_REG);
546 + rows = (val & MEMC_CFG_ROW_MASK) >> MEMC_CFG_ROW_SHIFT;
547 + cols = (val & MEMC_CFG_COL_MASK) >> MEMC_CFG_COL_SHIFT;
548 + is_32bits = (val & MEMC_CFG_32B_MASK) ? 0 : 1;
552 + /* 0 => 11 address bits ... 2 => 13 address bits */
555 + /* 0 => 8 address bits ... 2 => 10 address bits */
558 + return 1 << (cols + rows + (is_32bits + 1) + banks);
561 +void __init bcm63xx_cpu_init(void)
563 + unsigned int tmp, expected_cpu_id;
564 + struct cpuinfo_mips *c = ¤t_cpu_data;
566 + /* soc registers location depends on cpu type */
567 + expected_cpu_id = 0;
569 + switch (c->cputype) {
571 + expected_cpu_id = BCM6348_CPU_ID;
572 + bcm63xx_regs_base = bcm96348_regs_base;
573 + bcm63xx_irqs = bcm96348_irqs;
576 + expected_cpu_id = BCM6358_CPU_ID;
577 + bcm63xx_regs_base = bcm96358_regs_base;
578 + bcm63xx_irqs = bcm96358_irqs;
582 + /* really early to panic, but delaying panic would not help
583 + * since we will never get any working console */
584 + if (!expected_cpu_id)
585 + panic("unsupported Broadcom CPU");
588 + * bcm63xx_regs_base is set, we can access soc registers
591 + /* double check CPU type */
592 + tmp = bcm_perf_readl(PERF_REV_REG);
593 + bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT;
594 + bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT;
596 + if (bcm63xx_cpu_id != expected_cpu_id)
597 + panic("bcm63xx CPU id mismatch");
599 + bcm63xx_cpu_freq = detect_cpu_clock();
600 + bcm63xx_memory_size = detect_memory_size();
602 + printk(KERN_INFO "Detected Broadcom 0x%04x CPU revision %02x\n",
603 + bcm63xx_cpu_id, bcm63xx_cpu_rev);
604 + printk(KERN_INFO "CPU frequency is %u MHz\n",
606 + printk(KERN_INFO "%uMB of RAM installed\n",
607 + bcm63xx_memory_size >> 20);
609 diff --git a/arch/mips/bcm63xx/cs.c b/arch/mips/bcm63xx/cs.c
611 index 0000000..50d8190
613 +++ b/arch/mips/bcm63xx/cs.c
616 + * This file is subject to the terms and conditions of the GNU General Public
617 + * License. See the file "COPYING" in the main directory of this archive
618 + * for more details.
620 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
623 +#include <linux/kernel.h>
624 +#include <linux/module.h>
625 +#include <linux/spinlock.h>
626 +#include <linux/log2.h>
627 +#include <bcm63xx_cpu.h>
628 +#include <bcm63xx_io.h>
629 +#include <bcm63xx_regs.h>
630 +#include <bcm63xx_cs.h>
632 +static DEFINE_SPINLOCK(bcm63xx_cs_lock);
635 + * check if given chip select exists
637 +static int is_valid_cs(unsigned int cs)
645 + * Configure chipselect base address and size (bytes).
646 + * Size must be a power of two between 8k and 256M.
648 +int bcm63xx_set_cs_base(unsigned int cs, u32 base, unsigned int size)
650 + unsigned long flags;
653 + if (!is_valid_cs(cs))
656 + /* sanity check on size */
657 + if (size != roundup_pow_of_two(size))
660 + if (size < 8 * 1024 || size > 256 * 1024 * 1024)
663 + val = (base & MPI_CSBASE_BASE_MASK);
664 + /* 8k => 0 - 256M => 15 */
665 + val |= (ilog2(size) - ilog2(8 * 1024)) << MPI_CSBASE_SIZE_SHIFT;
667 + spin_lock_irqsave(&bcm63xx_cs_lock, flags);
668 + bcm_mpi_writel(val, MPI_CSBASE_REG(cs));
669 + spin_unlock_irqrestore(&bcm63xx_cs_lock, flags);
674 +EXPORT_SYMBOL(bcm63xx_set_cs_base);
677 + * configure chipselect timing (ns)
679 +int bcm63xx_set_cs_timing(unsigned int cs, unsigned int wait,
680 + unsigned int setup, unsigned int hold)
682 + unsigned long flags;
685 + if (!is_valid_cs(cs))
688 + spin_lock_irqsave(&bcm63xx_cs_lock, flags);
689 + val = bcm_mpi_readl(MPI_CSCTL_REG(cs));
690 + val &= ~(MPI_CSCTL_WAIT_MASK);
691 + val &= ~(MPI_CSCTL_SETUP_MASK);
692 + val &= ~(MPI_CSCTL_HOLD_MASK);
693 + val |= wait << MPI_CSCTL_WAIT_SHIFT;
694 + val |= setup << MPI_CSCTL_SETUP_SHIFT;
695 + val |= hold << MPI_CSCTL_HOLD_SHIFT;
696 + bcm_mpi_writel(val, MPI_CSCTL_REG(cs));
697 + spin_unlock_irqrestore(&bcm63xx_cs_lock, flags);
702 +EXPORT_SYMBOL(bcm63xx_set_cs_timing);
705 + * configure other chipselect parameter (data bus size, ...)
707 +int bcm63xx_set_cs_param(unsigned int cs, u32 params)
709 + unsigned long flags;
712 + if (!is_valid_cs(cs))
715 + /* none of this fields apply to pcmcia */
716 + if (cs == MPI_CS_PCMCIA_COMMON ||
717 + cs == MPI_CS_PCMCIA_ATTR ||
718 + cs == MPI_CS_PCMCIA_IO)
721 + spin_lock_irqsave(&bcm63xx_cs_lock, flags);
722 + val = bcm_mpi_readl(MPI_CSCTL_REG(cs));
723 + val &= ~(MPI_CSCTL_DATA16_MASK);
724 + val &= ~(MPI_CSCTL_SYNCMODE_MASK);
725 + val &= ~(MPI_CSCTL_TSIZE_MASK);
726 + val &= ~(MPI_CSCTL_ENDIANSWAP_MASK);
728 + bcm_mpi_writel(val, MPI_CSCTL_REG(cs));
729 + spin_unlock_irqrestore(&bcm63xx_cs_lock, flags);
734 +EXPORT_SYMBOL(bcm63xx_set_cs_param);
737 + * set cs status (enable/disable)
739 +int bcm63xx_set_cs_status(unsigned int cs, int enable)
741 + unsigned long flags;
744 + if (!is_valid_cs(cs))
747 + spin_lock_irqsave(&bcm63xx_cs_lock, flags);
748 + val = bcm_mpi_readl(MPI_CSCTL_REG(cs));
750 + val |= MPI_CSCTL_ENABLE_MASK;
752 + val &= ~MPI_CSCTL_ENABLE_MASK;
753 + bcm_mpi_writel(val, MPI_CSCTL_REG(cs));
754 + spin_unlock_irqrestore(&bcm63xx_cs_lock, flags);
758 +EXPORT_SYMBOL(bcm63xx_set_cs_status);
759 diff --git a/arch/mips/bcm63xx/early_printk.c b/arch/mips/bcm63xx/early_printk.c
761 index 0000000..bf353c9
763 +++ b/arch/mips/bcm63xx/early_printk.c
766 + * This file is subject to the terms and conditions of the GNU General Public
767 + * License. See the file "COPYING" in the main directory of this archive
768 + * for more details.
770 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
773 +#include <linux/init.h>
774 +#include <bcm63xx_io.h>
775 +#include <bcm63xx_regs.h>
777 +static void __init wait_xfered(void)
781 + /* wait for any previous char to be transmitted */
783 + val = bcm_uart0_readl(UART_IR_REG);
784 + if (val & UART_IR_STAT(UART_IR_TXEMPTY))
789 +void __init prom_putchar(char c)
792 + bcm_uart0_writel(c, UART_FIFO_REG);
795 diff --git a/arch/mips/bcm63xx/gpio.c b/arch/mips/bcm63xx/gpio.c
797 index 0000000..2c203a6
799 +++ b/arch/mips/bcm63xx/gpio.c
802 + * This file is subject to the terms and conditions of the GNU General Public
803 + * License. See the file "COPYING" in the main directory of this archive
804 + * for more details.
806 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
809 +#include <linux/kernel.h>
810 +#include <linux/module.h>
811 +#include <linux/spinlock.h>
812 +#include <bcm63xx_cpu.h>
813 +#include <bcm63xx_gpio.h>
814 +#include <bcm63xx_io.h>
815 +#include <bcm63xx_regs.h>
817 +static DEFINE_SPINLOCK(bcm63xx_gpio_lock);
819 +void bcm63xx_gpio_set_dataout(int gpio, int val)
824 + unsigned long flags;
826 + if (gpio >= BCM63XX_GPIO_COUNT)
830 + reg = GPIO_DATA_LO_REG;
833 + reg = GPIO_DATA_HI_REG;
834 + mask = 1 << (gpio - 32);
837 + spin_lock_irqsave(&bcm63xx_gpio_lock, flags);
838 + tmp = bcm_gpio_readl(reg);
843 + bcm_gpio_writel(tmp, reg);
844 + spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags);
847 +EXPORT_SYMBOL(bcm63xx_gpio_set_dataout);
849 +int bcm63xx_gpio_get_datain(int gpio)
854 + if (gpio >= BCM63XX_GPIO_COUNT)
858 + reg = GPIO_DATA_LO_REG;
861 + reg = GPIO_DATA_HI_REG;
862 + mask = 1 << (gpio - 32);
865 + return !!(bcm_gpio_readl(reg) & mask);
868 +EXPORT_SYMBOL(bcm63xx_gpio_get_datain);
870 +void bcm63xx_gpio_set_direction(int gpio, int dir)
875 + unsigned long flags;
877 + if (gpio >= BCM63XX_GPIO_COUNT)
881 + reg = GPIO_CTL_LO_REG;
884 + reg = GPIO_CTL_HI_REG;
885 + mask = 1 << (gpio - 32);
888 + spin_lock_irqsave(&bcm63xx_gpio_lock, flags);
889 + tmp = bcm_gpio_readl(reg);
890 + if (dir == GPIO_DIR_IN)
894 + bcm_gpio_writel(tmp, reg);
895 + spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags);
898 +EXPORT_SYMBOL(bcm63xx_gpio_set_direction);
899 diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c
901 index 0000000..a0c5cd1
903 +++ b/arch/mips/bcm63xx/irq.c
906 + * This file is subject to the terms and conditions of the GNU General Public
907 + * License. See the file "COPYING" in the main directory of this archive
908 + * for more details.
910 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
911 + * Copyright (C) 2008 Nicolas Schichan <nschichan@freebox.fr>
914 +#include <linux/kernel.h>
915 +#include <linux/init.h>
916 +#include <linux/interrupt.h>
917 +#include <linux/module.h>
918 +#include <asm/irq_cpu.h>
919 +#include <asm/mipsregs.h>
920 +#include <bcm63xx_cpu.h>
921 +#include <bcm63xx_regs.h>
922 +#include <bcm63xx_io.h>
923 +#include <bcm63xx_irq.h>
926 + * dispatch internal devices IRQ (uart, enet, watchdog, ...). do not
927 + * prioritize any interrupt relatively to another. the static counter
928 + * will resume the loop where it ended the last time we left this
931 +static void bcm63xx_irq_dispatch_internal(void)
936 + pending = bcm_perf_readl(PERF_IRQMASK_REG) &
937 + bcm_perf_readl(PERF_IRQSTAT_REG);
945 + i = (i + 1) & 0x1f;
946 + if (pending & (1 << to_call)) {
947 + do_IRQ(to_call + IRQ_INTERNAL_BASE);
953 +asmlinkage void plat_irq_dispatch(void)
958 + cause = read_c0_cause() & read_c0_status() & ST0_IM;
963 + if (cause & CAUSEF_IP7)
965 + if (cause & CAUSEF_IP2)
966 + bcm63xx_irq_dispatch_internal();
967 + if (cause & CAUSEF_IP3)
969 + if (cause & CAUSEF_IP4)
971 + if (cause & CAUSEF_IP5)
973 + if (cause & CAUSEF_IP6)
979 + * internal IRQs operations: only mask/unmask on PERF irq mask
982 +static inline void bcm63xx_internal_irq_mask(unsigned int irq)
986 + irq -= IRQ_INTERNAL_BASE;
987 + mask = bcm_perf_readl(PERF_IRQMASK_REG);
988 + mask &= ~(1 << irq);
989 + bcm_perf_writel(mask, PERF_IRQMASK_REG);
992 +static void bcm63xx_internal_irq_unmask(unsigned int irq)
996 + irq -= IRQ_INTERNAL_BASE;
997 + mask = bcm_perf_readl(PERF_IRQMASK_REG);
998 + mask |= (1 << irq);
999 + bcm_perf_writel(mask, PERF_IRQMASK_REG);
1002 +static unsigned int bcm63xx_internal_irq_startup(unsigned int irq)
1004 + bcm63xx_internal_irq_unmask(irq);
1009 + * external IRQs operations: mask/unmask and clear on PERF external
1010 + * irq control register.
1012 +static void bcm63xx_external_irq_mask(unsigned int irq)
1016 + irq -= IRQ_EXT_BASE;
1017 + reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG);
1018 + reg &= ~EXTIRQ_CFG_MASK(irq);
1019 + bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG);
1022 +static void bcm63xx_external_irq_unmask(unsigned int irq)
1026 + irq -= IRQ_EXT_BASE;
1027 + reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG);
1028 + reg |= EXTIRQ_CFG_MASK(irq);
1029 + bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG);
1032 +static void bcm63xx_external_irq_clear(unsigned int irq)
1036 + irq -= IRQ_EXT_BASE;
1037 + reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG);
1038 + reg |= EXTIRQ_CFG_CLEAR(irq);
1039 + bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG);
1042 +static unsigned int bcm63xx_external_irq_startup(unsigned int irq)
1044 + set_c0_status(0x100 << (irq - IRQ_MIPS_BASE));
1045 + irq_enable_hazard();
1046 + bcm63xx_external_irq_unmask(irq);
1050 +static void bcm63xx_external_irq_shutdown(unsigned int irq)
1052 + bcm63xx_external_irq_mask(irq);
1053 + clear_c0_status(0x100 << (irq - IRQ_MIPS_BASE));
1054 + irq_disable_hazard();
1057 +static int bcm63xx_external_irq_set_type(unsigned int irq,
1058 + unsigned int flow_type)
1061 + struct irq_desc *desc = irq_desc + irq;
1063 + irq -= IRQ_EXT_BASE;
1065 + flow_type &= IRQ_TYPE_SENSE_MASK;
1067 + if (flow_type == IRQ_TYPE_NONE)
1068 + flow_type = IRQ_TYPE_LEVEL_LOW;
1070 + reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG);
1071 + switch (flow_type) {
1072 + case IRQ_TYPE_EDGE_BOTH:
1073 + reg &= ~EXTIRQ_CFG_LEVELSENSE(irq);
1074 + reg |= EXTIRQ_CFG_BOTHEDGE(irq);
1077 + case IRQ_TYPE_EDGE_RISING:
1078 + reg &= ~EXTIRQ_CFG_LEVELSENSE(irq);
1079 + reg |= EXTIRQ_CFG_SENSE(irq);
1080 + reg &= ~EXTIRQ_CFG_BOTHEDGE(irq);
1083 + case IRQ_TYPE_EDGE_FALLING:
1084 + reg &= ~EXTIRQ_CFG_LEVELSENSE(irq);
1085 + reg &= ~EXTIRQ_CFG_SENSE(irq);
1086 + reg &= ~EXTIRQ_CFG_BOTHEDGE(irq);
1089 + case IRQ_TYPE_LEVEL_HIGH:
1090 + reg |= EXTIRQ_CFG_LEVELSENSE(irq);
1091 + reg |= EXTIRQ_CFG_SENSE(irq);
1094 + case IRQ_TYPE_LEVEL_LOW:
1095 + reg |= EXTIRQ_CFG_LEVELSENSE(irq);
1096 + reg &= ~EXTIRQ_CFG_SENSE(irq);
1100 + printk(KERN_ERR "bogus flow type combination given !\n");
1103 + bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG);
1105 + if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) {
1106 + desc->status |= IRQ_LEVEL;
1107 + desc->handle_irq = handle_level_irq;
1109 + desc->handle_irq = handle_edge_irq;
1115 +static struct irq_chip bcm63xx_internal_irq_chip = {
1116 + .name = "bcm63xx_ipic",
1117 + .startup = bcm63xx_internal_irq_startup,
1118 + .shutdown = bcm63xx_internal_irq_mask,
1120 + .mask = bcm63xx_internal_irq_mask,
1121 + .mask_ack = bcm63xx_internal_irq_mask,
1122 + .unmask = bcm63xx_internal_irq_unmask,
1125 +static struct irq_chip bcm63xx_external_irq_chip = {
1126 + .name = "bcm63xx_epic",
1127 + .startup = bcm63xx_external_irq_startup,
1128 + .shutdown = bcm63xx_external_irq_shutdown,
1130 + .ack = bcm63xx_external_irq_clear,
1132 + .mask = bcm63xx_external_irq_mask,
1133 + .unmask = bcm63xx_external_irq_unmask,
1135 + .set_type = bcm63xx_external_irq_set_type,
1138 +static struct irqaction cpu_ip2_cascade_action = {
1139 + .handler = no_action,
1140 + .name = "cascade_ip2",
1143 +void __init arch_init_irq(void)
1147 + mips_cpu_irq_init();
1148 + for (i = IRQ_INTERNAL_BASE; i < NR_IRQS; ++i)
1149 + set_irq_chip_and_handler(i, &bcm63xx_internal_irq_chip,
1150 + handle_level_irq);
1152 + for (i = IRQ_EXT_BASE; i < IRQ_EXT_BASE + 4; ++i)
1153 + set_irq_chip_and_handler(i, &bcm63xx_external_irq_chip,
1156 + setup_irq(IRQ_MIPS_BASE + 2, &cpu_ip2_cascade_action);
1158 diff --git a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c
1159 new file mode 100644
1160 index 0000000..f0b49e8
1162 +++ b/arch/mips/bcm63xx/prom.c
1165 + * This file is subject to the terms and conditions of the GNU General Public
1166 + * License. See the file "COPYING" in the main directory of this archive
1167 + * for more details.
1169 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
1172 +#include <linux/init.h>
1173 +#include <linux/bootmem.h>
1174 +#include <asm/bootinfo.h>
1175 +#include <bcm63xx_cpu.h>
1176 +#include <bcm63xx_io.h>
1177 +#include <bcm63xx_regs.h>
1179 +void __init prom_init(void)
1183 + bcm63xx_cpu_init();
1185 + /* stop any running watchdog */
1186 + bcm_wdt_writel(WDT_STOP_1, WDT_CTL_REG);
1187 + bcm_wdt_writel(WDT_STOP_2, WDT_CTL_REG);
1189 + /* disable all hardware blocks clock for now */
1190 + if (BCMCPU_IS_6348())
1191 + mask = CKCTL_6348_ALL_SAFE_EN;
1193 + /* BCMCPU_IS_6358() */
1194 + mask = CKCTL_6358_ALL_SAFE_EN;
1196 + reg = bcm_perf_readl(PERF_CKCTL_REG);
1198 + bcm_perf_writel(reg, PERF_CKCTL_REG);
1200 + /* assign command line from kernel config */
1201 + strcpy(arcs_cmdline, CONFIG_CMDLINE);
1204 +void __init prom_free_prom_memory(void)
1207 diff --git a/arch/mips/bcm63xx/setup.c b/arch/mips/bcm63xx/setup.c
1208 new file mode 100644
1209 index 0000000..55c51a9
1211 +++ b/arch/mips/bcm63xx/setup.c
1214 + * This file is subject to the terms and conditions of the GNU General Public
1215 + * License. See the file "COPYING" in the main directory of this archive
1216 + * for more details.
1218 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
1221 +#include <linux/init.h>
1222 +#include <linux/kernel.h>
1223 +#include <linux/delay.h>
1224 +#include <linux/bootmem.h>
1225 +#include <linux/ioport.h>
1226 +#include <linux/pm.h>
1227 +#include <asm/bootinfo.h>
1228 +#include <asm/time.h>
1229 +#include <asm/reboot.h>
1230 +#include <asm/cacheflush.h>
1231 +#include <bcm63xx_cpu.h>
1232 +#include <bcm63xx_regs.h>
1233 +#include <bcm63xx_io.h>
1235 +void bcm63xx_machine_halt(void)
1237 + printk(KERN_INFO "System halted\n");
1241 +static void bcm6348_a1_reboot(void)
1245 + /* soft reset all blocks */
1246 + printk(KERN_INFO "soft-reseting all blocks ...\n");
1247 + reg = bcm_perf_readl(PERF_SOFTRESET_REG);
1248 + reg &= ~SOFTRESET_6348_ALL;
1249 + bcm_perf_writel(reg, PERF_SOFTRESET_REG);
1252 + reg = bcm_perf_readl(PERF_SOFTRESET_REG);
1253 + reg |= SOFTRESET_6348_ALL;
1254 + bcm_perf_writel(reg, PERF_SOFTRESET_REG);
1257 + /* Jump to the power on address. */
1258 + printk(KERN_INFO "jumping to reset vector.\n");
1259 + /* set high vectors (base at 0xbfc00000 */
1260 + set_c0_status(ST0_BEV | ST0_ERL);
1261 + /* run uncached in kseg0 */
1262 + change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
1263 + __flush_cache_all();
1264 + /* remove all wired TLB entries */
1265 + write_c0_wired(0);
1266 + __asm__ __volatile__(
1269 + : "r" (0xbfc00000));
1273 +void bcm63xx_machine_reboot(void)
1277 + /* mask and clear all external irq */
1278 + reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG);
1279 + reg &= ~EXTIRQ_CFG_MASK_ALL;
1280 + reg |= EXTIRQ_CFG_CLEAR_ALL;
1281 + bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG);
1283 + if (BCMCPU_IS_6348() && (bcm63xx_get_cpu_rev() == 0xa1))
1284 + bcm6348_a1_reboot();
1286 + printk(KERN_INFO "triggering watchdog soft-reset...\n");
1287 + bcm_perf_writel(SYS_PLL_SOFT_RESET, PERF_SYS_PLL_CTL_REG);
1291 +static void __bcm63xx_machine_reboot(char *p)
1293 + bcm63xx_machine_reboot();
1297 + * return system type in /proc/cpuinfo
1299 +const char *get_system_type(void)
1301 + static char buf[128];
1302 + sprintf(buf, "bcm963xx (0x%04x/0x%04X)",
1303 + bcm63xx_get_cpu_id(), bcm63xx_get_cpu_rev());
1307 +void __init plat_time_init(void)
1309 + mips_hpt_frequency = bcm63xx_get_cpu_freq() / 2;
1311 +void __init plat_mem_setup(void)
1313 + add_memory_region(0, bcm63xx_get_memory_size(), BOOT_MEM_RAM);
1315 + _machine_halt = bcm63xx_machine_halt;
1316 + _machine_restart = __bcm63xx_machine_reboot;
1317 + pm_power_off = bcm63xx_machine_halt;
1319 + set_io_port_base(0);
1321 diff --git a/arch/mips/bcm63xx/timer.c b/arch/mips/bcm63xx/timer.c
1322 new file mode 100644
1323 index 0000000..ba522bd
1325 +++ b/arch/mips/bcm63xx/timer.c
1328 + * This file is subject to the terms and conditions of the GNU General Public
1329 + * License. See the file "COPYING" in the main directory of this archive
1330 + * for more details.
1332 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
1335 +#include <linux/kernel.h>
1336 +#include <linux/err.h>
1337 +#include <linux/module.h>
1338 +#include <linux/spinlock.h>
1339 +#include <linux/interrupt.h>
1340 +#include <linux/clk.h>
1341 +#include <bcm63xx_cpu.h>
1342 +#include <bcm63xx_io.h>
1343 +#include <bcm63xx_timer.h>
1344 +#include <bcm63xx_regs.h>
1346 +static DEFINE_SPINLOCK(timer_reg_lock);
1347 +static DEFINE_SPINLOCK(timer_data_lock);
1348 +static struct clk *periph_clk;
1350 +static struct timer_data {
1351 + void (*cb)(void *);
1353 +} timer_data[BCM63XX_TIMER_COUNT];
1355 +static irqreturn_t timer_interrupt(int irq, void *dev_id)
1360 + spin_lock(&timer_reg_lock);
1361 + stat = bcm_timer_readl(TIMER_IRQSTAT_REG);
1362 + bcm_timer_writel(stat, TIMER_IRQSTAT_REG);
1363 + spin_unlock(&timer_reg_lock);
1365 + for (i = 0; i < BCM63XX_TIMER_COUNT; i++) {
1366 + if (!(stat & TIMER_IRQSTAT_TIMER_CAUSE(i)))
1369 + spin_lock(&timer_data_lock);
1370 + if (!timer_data[i].cb) {
1371 + spin_unlock(&timer_data_lock);
1375 + timer_data[i].cb(timer_data[i].data);
1376 + spin_unlock(&timer_data_lock);
1379 + return IRQ_HANDLED;
1382 +int bcm63xx_timer_enable(int id)
1385 + unsigned long flags;
1387 + if (id >= BCM63XX_TIMER_COUNT)
1390 + spin_lock_irqsave(&timer_reg_lock, flags);
1392 + reg = bcm_timer_readl(TIMER_CTLx_REG(id));
1393 + reg |= TIMER_CTL_ENABLE_MASK;
1394 + bcm_timer_writel(reg, TIMER_CTLx_REG(id));
1396 + reg = bcm_timer_readl(TIMER_IRQSTAT_REG);
1397 + reg |= TIMER_IRQSTAT_TIMER_IR_EN(id);
1398 + bcm_timer_writel(reg, TIMER_IRQSTAT_REG);
1400 + spin_unlock_irqrestore(&timer_reg_lock, flags);
1404 +EXPORT_SYMBOL(bcm63xx_timer_enable);
1406 +int bcm63xx_timer_disable(int id)
1409 + unsigned long flags;
1411 + if (id >= BCM63XX_TIMER_COUNT)
1414 + spin_lock_irqsave(&timer_reg_lock, flags);
1416 + reg = bcm_timer_readl(TIMER_CTLx_REG(id));
1417 + reg &= ~TIMER_CTL_ENABLE_MASK;
1418 + bcm_timer_writel(reg, TIMER_CTLx_REG(id));
1420 + reg = bcm_timer_readl(TIMER_IRQSTAT_REG);
1421 + reg &= ~TIMER_IRQSTAT_TIMER_IR_EN(id);
1422 + bcm_timer_writel(reg, TIMER_IRQSTAT_REG);
1424 + spin_unlock_irqrestore(&timer_reg_lock, flags);
1428 +EXPORT_SYMBOL(bcm63xx_timer_disable);
1430 +int bcm63xx_timer_register(int id, void (*callback)(void *data), void *data)
1432 + unsigned long flags;
1435 + if (id >= BCM63XX_TIMER_COUNT || !callback)
1439 + spin_lock_irqsave(&timer_data_lock, flags);
1440 + if (timer_data[id].cb) {
1445 + timer_data[id].cb = callback;
1446 + timer_data[id].data = data;
1449 + spin_unlock_irqrestore(&timer_data_lock, flags);
1453 +EXPORT_SYMBOL(bcm63xx_timer_register);
1455 +void bcm63xx_timer_unregister(int id)
1457 + unsigned long flags;
1459 + if (id >= BCM63XX_TIMER_COUNT)
1462 + spin_lock_irqsave(&timer_data_lock, flags);
1463 + timer_data[id].cb = NULL;
1464 + spin_unlock_irqrestore(&timer_data_lock, flags);
1467 +EXPORT_SYMBOL(bcm63xx_timer_unregister);
1469 +unsigned int bcm63xx_timer_countdown(unsigned int countdown_us)
1471 + return (clk_get_rate(periph_clk) / (1000 * 1000)) * countdown_us;
1474 +EXPORT_SYMBOL(bcm63xx_timer_countdown);
1476 +int bcm63xx_timer_set(int id, int monotonic, unsigned int countdown_us)
1478 + u32 reg, countdown;
1479 + unsigned long flags;
1481 + if (id >= BCM63XX_TIMER_COUNT)
1484 + countdown = bcm63xx_timer_countdown(countdown_us);
1485 + if (countdown & ~TIMER_CTL_COUNTDOWN_MASK)
1488 + spin_lock_irqsave(&timer_reg_lock, flags);
1489 + reg = bcm_timer_readl(TIMER_CTLx_REG(id));
1492 + reg &= ~TIMER_CTL_MONOTONIC_MASK;
1494 + reg |= TIMER_CTL_MONOTONIC_MASK;
1496 + reg &= ~TIMER_CTL_COUNTDOWN_MASK;
1498 + bcm_timer_writel(reg, TIMER_CTLx_REG(id));
1500 + spin_unlock_irqrestore(&timer_reg_lock, flags);
1504 +EXPORT_SYMBOL(bcm63xx_timer_set);
1506 +int bcm63xx_timer_init(void)
1511 + reg = bcm_timer_readl(TIMER_IRQSTAT_REG);
1512 + reg &= ~TIMER_IRQSTAT_TIMER0_IR_EN;
1513 + reg &= ~TIMER_IRQSTAT_TIMER1_IR_EN;
1514 + reg &= ~TIMER_IRQSTAT_TIMER2_IR_EN;
1515 + bcm_timer_writel(reg, TIMER_IRQSTAT_REG);
1517 + periph_clk = clk_get(NULL, "periph");
1518 + if (IS_ERR(periph_clk))
1521 + irq = bcm63xx_get_irq_number(IRQ_TIMER);
1522 + ret = request_irq(irq, timer_interrupt, 0, "bcm63xx_timer", NULL);
1524 + printk(KERN_ERR "bcm63xx_timer: failed to register irq\n");
1531 +arch_initcall(bcm63xx_timer_init);
1532 diff --git a/include/asm-mips/fixmap.h b/include/asm-mips/fixmap.h
1533 index 9cc8522..884c7a9 100644
1534 --- a/include/asm-mips/fixmap.h
1535 +++ b/include/asm-mips/fixmap.h
1536 @@ -67,11 +67,15 @@ enum fixed_addresses {
1537 * the start of the fixmap, and leave one page empty
1538 * at the top of mem..
1540 +#ifdef CONFIG_BCM63XX
1541 +#define FIXADDR_TOP ((unsigned long)(long)(int)0xff000000)
1543 #if defined(CONFIG_CPU_TX39XX) || defined(CONFIG_CPU_TX49XX)
1544 #define FIXADDR_TOP ((unsigned long)(long)(int)(0xff000000 - 0x20000))
1546 #define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000)
1549 #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
1550 #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
1552 diff --git a/include/asm-mips/mach-bcm63xx/bcm63xx_clk.h b/include/asm-mips/mach-bcm63xx/bcm63xx_clk.h
1553 new file mode 100644
1554 index 0000000..8fcf8df
1556 +++ b/include/asm-mips/mach-bcm63xx/bcm63xx_clk.h
1558 +#ifndef BCM63XX_CLK_H_
1559 +#define BCM63XX_CLK_H_
1562 + void (*set)(struct clk *, int);
1563 + unsigned int rate;
1564 + unsigned int usage;
1568 +#endif /* ! BCM63XX_CLK_H_ */
1569 diff --git a/include/asm-mips/mach-bcm63xx/bcm63xx_cpu.h b/include/asm-mips/mach-bcm63xx/bcm63xx_cpu.h
1570 new file mode 100644
1571 index 0000000..29b61fd
1573 +++ b/include/asm-mips/mach-bcm63xx/bcm63xx_cpu.h
1575 +#ifndef BCM63XX_CPU_H_
1576 +#define BCM63XX_CPU_H_
1578 +#include <linux/types.h>
1579 +#include <linux/init.h>
1582 + * Macro to fetch bcm63xx cpu id and revision, should be optimized at
1583 + * compile time if only one CPU support is enabled (idea stolen from
1586 +#define BCM6348_CPU_ID 0x6348
1587 +#define BCM6358_CPU_ID 0x6358
1589 +void __init bcm63xx_cpu_init(void);
1590 +u16 __bcm63xx_get_cpu_id(void);
1591 +u16 bcm63xx_get_cpu_rev(void);
1592 +unsigned int bcm63xx_get_cpu_freq(void);
1594 +#ifdef CONFIG_BCM63XX_CPU_6348
1595 +# ifdef bcm63xx_get_cpu_id
1596 +# undef bcm63xx_get_cpu_id
1597 +# define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
1598 +# define BCMCPU_RUNTIME_DETECT
1600 +# define bcm63xx_get_cpu_id() BCM6348_CPU_ID
1602 +# define BCMCPU_IS_6348() (bcm63xx_get_cpu_id() == BCM6348_CPU_ID)
1604 +# define BCMCPU_IS_6348() (0)
1607 +#ifdef CONFIG_BCM63XX_CPU_6358
1608 +# ifdef bcm63xx_get_cpu_id
1609 +# undef bcm63xx_get_cpu_id
1610 +# define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
1611 +# define BCMCPU_RUNTIME_DETECT
1613 +# define bcm63xx_get_cpu_id() BCM6358_CPU_ID
1615 +# define BCMCPU_IS_6358() (bcm63xx_get_cpu_id() == BCM6358_CPU_ID)
1617 +# define BCMCPU_IS_6358() (0)
1620 +#ifndef bcm63xx_get_cpu_id
1621 +#error "No CPU support configured"
1625 + * While registers sets are (mostly) the same across 63xx CPU, base
1626 + * address of these sets do change.
1628 +enum bcm63xx_regs_set {
1629 + RSET_DSL_LMEM = 0,
1652 +#define RSET_DSL_LMEM_SIZE (64 * 1024 * 4)
1653 +#define RSET_DSL_SIZE 4096
1654 +#define RSET_WDT_SIZE 12
1655 +#define RSET_ENET_SIZE 2048
1656 +#define RSET_ENETDMA_SIZE 2048
1657 +#define RSET_UART_SIZE 24
1658 +#define RSET_UDC_SIZE 256
1659 +#define RSET_OHCI_SIZE 256
1660 +#define RSET_EHCI_SIZE 256
1661 +#define RSET_PCMCIA_SIZE 12
1664 + * 6348 register sets base address
1666 +#define BCM_6348_DSL_LMEM_BASE (0xfff00000)
1667 +#define BCM_6348_PERF_BASE (0xfffe0000)
1668 +#define BCM_6348_TIMER_BASE (0xfffe0200)
1669 +#define BCM_6348_WDT_BASE (0xfffe021c)
1670 +#define BCM_6348_UART0_BASE (0xfffe0300)
1671 +#define BCM_6348_GPIO_BASE (0xfffe0400)
1672 +#define BCM_6348_SPI_BASE (0xfffe0c00)
1673 +#define BCM_6348_UDC0_BASE (0xfffe1000)
1674 +#define BCM_6348_OHCI0_BASE (0xfffe1b00)
1675 +#define BCM_6348_OHCI_PRIV_BASE (0xfffe1c00)
1676 +#define BCM_6348_USBH_PRIV_BASE (0xdeadbeef)
1677 +#define BCM_6348_MPI_BASE (0xfffe2000)
1678 +#define BCM_6348_PCMCIA_BASE (0xfffe2054)
1679 +#define BCM_6348_SDRAM_REGS_BASE (0xfffe2300)
1680 +#define BCM_6348_DSL_BASE (0xfffe3000)
1681 +#define BCM_6348_ENET0_BASE (0xfffe6000)
1682 +#define BCM_6348_ENET1_BASE (0xfffe6800)
1683 +#define BCM_6348_ENETDMA_BASE (0xfffe7000)
1684 +#define BCM_6348_EHCI0_BASE (0xdeadbeef)
1685 +#define BCM_6348_SDRAM_BASE (0xfffe2300)
1686 +#define BCM_6348_MEMC_BASE (0xdeadbeef)
1687 +#define BCM_6348_DDR_BASE (0xdeadbeef)
1690 + * 6358 register sets base address
1692 +#define BCM_6358_DSL_LMEM_BASE (0xfff00000)
1693 +#define BCM_6358_PERF_BASE (0xfffe0000)
1694 +#define BCM_6358_TIMER_BASE (0xfffe0040)
1695 +#define BCM_6358_WDT_BASE (0xfffe005c)
1696 +#define BCM_6358_UART0_BASE (0xfffe0100)
1697 +#define BCM_6358_GPIO_BASE (0xfffe0080)
1698 +#define BCM_6358_SPI_BASE (0xdeadbeef)
1699 +#define BCM_6358_UDC0_BASE (0xfffe0800)
1700 +#define BCM_6358_OHCI0_BASE (0xfffe1400)
1701 +#define BCM_6358_OHCI_PRIV_BASE (0xdeadbeef)
1702 +#define BCM_6358_USBH_PRIV_BASE (0xfffe1500)
1703 +#define BCM_6358_MPI_BASE (0xfffe1000)
1704 +#define BCM_6358_PCMCIA_BASE (0xfffe1054)
1705 +#define BCM_6358_SDRAM_REGS_BASE (0xfffe2300)
1706 +#define BCM_6358_DSL_BASE (0xfffe3000)
1707 +#define BCM_6358_ENET0_BASE (0xfffe4000)
1708 +#define BCM_6358_ENET1_BASE (0xfffe4800)
1709 +#define BCM_6358_ENETDMA_BASE (0xfffe5000)
1710 +#define BCM_6358_EHCI0_BASE (0xfffe1300)
1711 +#define BCM_6358_SDRAM_BASE (0xdeadbeef)
1712 +#define BCM_6358_MEMC_BASE (0xfffe1200)
1713 +#define BCM_6358_DDR_BASE (0xfffe12a0)
1716 +extern const unsigned long *bcm63xx_regs_base;
1718 +static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set)
1720 +#ifdef BCMCPU_RUNTIME_DETECT
1721 + return bcm63xx_regs_base[set];
1723 +#ifdef CONFIG_BCM63XX_CPU_6348
1725 + case RSET_DSL_LMEM:
1726 + return BCM_6348_DSL_LMEM_BASE;
1728 + return BCM_6348_PERF_BASE;
1730 + return BCM_6348_TIMER_BASE;
1732 + return BCM_6348_WDT_BASE;
1734 + return BCM_6348_UART0_BASE;
1736 + return BCM_6348_GPIO_BASE;
1738 + return BCM_6348_SPI_BASE;
1740 + return BCM_6348_UDC0_BASE;
1742 + return BCM_6348_OHCI0_BASE;
1743 + case RSET_OHCI_PRIV:
1744 + return BCM_6348_OHCI_PRIV_BASE;
1745 + case RSET_USBH_PRIV:
1746 + return BCM_6348_USBH_PRIV_BASE;
1748 + return BCM_6348_MPI_BASE;
1750 + return BCM_6348_PCMCIA_BASE;
1752 + return BCM_6348_DSL_BASE;
1754 + return BCM_6348_ENET0_BASE;
1756 + return BCM_6348_ENET1_BASE;
1757 + case RSET_ENETDMA:
1758 + return BCM_6348_ENETDMA_BASE;
1760 + return BCM_6348_EHCI0_BASE;
1762 + return BCM_6348_SDRAM_BASE;
1764 + return BCM_6348_MEMC_BASE;
1766 + return BCM_6348_DDR_BASE;
1769 +#ifdef CONFIG_BCM63XX_CPU_6358
1771 + case RSET_DSL_LMEM:
1772 + return BCM_6358_DSL_LMEM_BASE;
1774 + return BCM_6358_PERF_BASE;
1776 + return BCM_6358_TIMER_BASE;
1778 + return BCM_6358_WDT_BASE;
1780 + return BCM_6358_UART0_BASE;
1782 + return BCM_6358_GPIO_BASE;
1784 + return BCM_6358_SPI_BASE;
1786 + return BCM_6358_UDC0_BASE;
1788 + return BCM_6358_OHCI0_BASE;
1789 + case RSET_OHCI_PRIV:
1790 + return BCM_6358_OHCI_PRIV_BASE;
1791 + case RSET_USBH_PRIV:
1792 + return BCM_6358_USBH_PRIV_BASE;
1794 + return BCM_6358_MPI_BASE;
1796 + return BCM_6358_PCMCIA_BASE;
1798 + return BCM_6358_ENET0_BASE;
1800 + return BCM_6358_ENET1_BASE;
1801 + case RSET_ENETDMA:
1802 + return BCM_6358_ENETDMA_BASE;
1804 + return BCM_6358_DSL_BASE;
1806 + return BCM_6358_EHCI0_BASE;
1808 + return BCM_6358_SDRAM_BASE;
1810 + return BCM_6358_MEMC_BASE;
1812 + return BCM_6358_DDR_BASE;
1821 + * IRQ number changes across CPU too
1844 +#define BCM_6348_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
1845 +#define BCM_6348_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
1846 +#define BCM_6348_DSL_IRQ (IRQ_INTERNAL_BASE + 4)
1847 +#define BCM_6348_ENET1_IRQ (IRQ_INTERNAL_BASE + 7)
1848 +#define BCM_6348_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
1849 +#define BCM_6348_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
1850 +#define BCM_6348_OHCI0_IRQ (IRQ_INTERNAL_BASE + 12)
1851 +#define BCM_6348_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 20)
1852 +#define BCM_6348_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 21)
1853 +#define BCM_6348_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 22)
1854 +#define BCM_6348_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 23)
1855 +#define BCM_6348_PCMCIA_IRQ (IRQ_INTERNAL_BASE + 24)
1856 +#define BCM_6348_PCI_IRQ (IRQ_INTERNAL_BASE + 24)
1861 +#define BCM_6358_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
1862 +#define BCM_6358_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
1863 +#define BCM_6358_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)
1864 +#define BCM_6358_ENET1_IRQ (IRQ_INTERNAL_BASE + 6)
1865 +#define BCM_6358_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
1866 +#define BCM_6358_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
1867 +#define BCM_6358_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10)
1868 +#define BCM_6358_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 15)
1869 +#define BCM_6358_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 16)
1870 +#define BCM_6358_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 17)
1871 +#define BCM_6358_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 18)
1872 +#define BCM_6358_DSL_IRQ (IRQ_INTERNAL_BASE + 29)
1873 +#define BCM_6358_PCI_IRQ (IRQ_INTERNAL_BASE + 31)
1874 +#define BCM_6358_PCMCIA_IRQ (IRQ_INTERNAL_BASE + 24)
1876 +extern const int *bcm63xx_irqs;
1878 +static inline int bcm63xx_get_irq_number(enum bcm63xx_irq irq)
1880 + return bcm63xx_irqs[irq];
1884 + * return installed memory size
1886 +unsigned int bcm63xx_get_memory_size(void);
1888 +#endif /* !BCM63XX_CPU_H_ */
1889 diff --git a/include/asm-mips/mach-bcm63xx/bcm63xx_cs.h b/include/asm-mips/mach-bcm63xx/bcm63xx_cs.h
1890 new file mode 100644
1891 index 0000000..b1821c8
1893 +++ b/include/asm-mips/mach-bcm63xx/bcm63xx_cs.h
1895 +#ifndef BCM63XX_CS_H
1896 +#define BCM63XX_CS_H
1898 +int bcm63xx_set_cs_base(unsigned int cs, u32 base, unsigned int size);
1899 +int bcm63xx_set_cs_timing(unsigned int cs, unsigned int wait,
1900 + unsigned int setup, unsigned int hold);
1901 +int bcm63xx_set_cs_param(unsigned int cs, u32 flags);
1902 +int bcm63xx_set_cs_status(unsigned int cs, int enable);
1904 +#endif /* !BCM63XX_CS_H */
1905 diff --git a/include/asm-mips/mach-bcm63xx/bcm63xx_gpio.h b/include/asm-mips/mach-bcm63xx/bcm63xx_gpio.h
1906 new file mode 100644
1907 index 0000000..31145df
1909 +++ b/include/asm-mips/mach-bcm63xx/bcm63xx_gpio.h
1911 +#ifndef BCM63XX_GPIO_H
1912 +#define BCM63XX_GPIO_H
1914 +/* all helpers will BUG() if gpio count is >= 37. */
1915 +#define BCM63XX_GPIO_COUNT 37
1917 +void bcm63xx_gpio_set_dataout(int gpio, int val);
1918 +int bcm63xx_gpio_get_datain(int gpio);
1919 +void bcm63xx_gpio_set_direction(int gpio, int dir);
1921 +#define GPIO_DIR_OUT 0x0
1922 +#define GPIO_DIR_IN 0x1
1924 +#endif /* !BCM63XX_GPIO_H */
1925 diff --git a/include/asm-mips/mach-bcm63xx/bcm63xx_io.h b/include/asm-mips/mach-bcm63xx/bcm63xx_io.h
1926 new file mode 100644
1927 index 0000000..1aef06f
1929 +++ b/include/asm-mips/mach-bcm63xx/bcm63xx_io.h
1931 +#ifndef BCM63XX_IO_H_
1932 +#define BCM63XX_IO_H_
1934 +#include "bcm63xx_cpu.h"
1937 + * Physical memory map, RAM is mapped at 0x0.
1939 + * Note that size MUST be a power of two.
1941 +#define BCM_PCMCIA_COMMON_BASE_PA (0x20000000)
1942 +#define BCM_PCMCIA_COMMON_SIZE (16 * 1024 * 1024)
1943 +#define BCM_PCMCIA_COMMON_END_PA (BCM_PCMCIA_COMMON_BASE_PA + \
1944 + BCM_PCMCIA_COMMON_SIZE - 1)
1946 +#define BCM_PCMCIA_ATTR_BASE_PA (0x21000000)
1947 +#define BCM_PCMCIA_ATTR_SIZE (16 * 1024 * 1024)
1948 +#define BCM_PCMCIA_ATTR_END_PA (BCM_PCMCIA_ATTR_BASE_PA + \
1949 + BCM_PCMCIA_ATTR_SIZE - 1)
1951 +#define BCM_PCMCIA_IO_BASE_PA (0x22000000)
1952 +#define BCM_PCMCIA_IO_SIZE (64 * 1024)
1953 +#define BCM_PCMCIA_IO_END_PA (BCM_PCMCIA_IO_BASE_PA + \
1954 + BCM_PCMCIA_IO_SIZE - 1)
1956 +#define BCM_PCI_MEM_BASE_PA (0x30000000)
1957 +#define BCM_PCI_MEM_SIZE (128 * 1024 * 1024)
1958 +#define BCM_PCI_MEM_END_PA (BCM_PCI_MEM_BASE_PA + \
1959 + BCM_PCI_MEM_SIZE - 1)
1961 +#define BCM_PCI_IO_BASE_PA (0x08000000)
1962 +#define BCM_PCI_IO_SIZE (64 * 1024)
1963 +#define BCM_PCI_IO_END_PA (BCM_PCI_IO_BASE_PA + \
1964 + BCM_PCI_IO_SIZE - 1)
1965 +#define BCM_PCI_IO_HALF_PA (BCM_PCI_IO_BASE_PA + \
1966 + (BCM_PCI_IO_SIZE / 2) - 1)
1968 +#define BCM_CB_MEM_BASE_PA (0x38000000)
1969 +#define BCM_CB_MEM_SIZE (128 * 1024 * 1024)
1970 +#define BCM_CB_MEM_END_PA (BCM_CB_MEM_BASE_PA + \
1971 + BCM_CB_MEM_SIZE - 1)
1975 + * Internal registers are accessed through KSEG3
1977 +#define BCM_REGS_VA(x) ((void __iomem *)(x))
1979 +#define bcm_readb(a) (*(volatile unsigned char *) BCM_REGS_VA(a))
1980 +#define bcm_readw(a) (*(volatile unsigned short *) BCM_REGS_VA(a))
1981 +#define bcm_readl(a) (*(volatile unsigned int *) BCM_REGS_VA(a))
1982 +#define bcm_writeb(v,a) (*(volatile unsigned char *) BCM_REGS_VA((a)) = (v))
1983 +#define bcm_writew(v,a) (*(volatile unsigned short *) BCM_REGS_VA((a)) = (v))
1984 +#define bcm_writel(v,a) (*(volatile unsigned int *) BCM_REGS_VA((a)) = (v))
1987 + * IO helpers to access register set for current CPU
1989 +#define bcm_rset_readb(s,o) bcm_readb(bcm63xx_regset_address(s) + (o))
1990 +#define bcm_rset_readw(s,o) bcm_readw(bcm63xx_regset_address(s) + (o))
1991 +#define bcm_rset_readl(s,o) bcm_readl(bcm63xx_regset_address(s) + (o))
1992 +#define bcm_rset_writeb(s,v,o) bcm_writeb((v), \
1993 + bcm63xx_regset_address(s) + (o))
1994 +#define bcm_rset_writew(s,v,o) bcm_writew((v), \
1995 + bcm63xx_regset_address(s) + (o))
1996 +#define bcm_rset_writel(s,v,o) bcm_writel((v), \
1997 + bcm63xx_regset_address(s) + (o))
2000 + * helpers for frequently used register sets
2002 +#define bcm_perf_readl(o) bcm_rset_readl(RSET_PERF, (o))
2003 +#define bcm_perf_writel(v,o) bcm_rset_writel(RSET_PERF, (v), (o))
2004 +#define bcm_timer_readl(o) bcm_rset_readl(RSET_TIMER, (o))
2005 +#define bcm_timer_writel(v,o) bcm_rset_writel(RSET_TIMER, (v), (o))
2006 +#define bcm_wdt_readl(o) bcm_rset_readl(RSET_WDT, (o))
2007 +#define bcm_wdt_writel(v,o) bcm_rset_writel(RSET_WDT, (v), (o))
2008 +#define bcm_gpio_readl(o) bcm_rset_readl(RSET_GPIO, (o))
2009 +#define bcm_gpio_writel(v,o) bcm_rset_writel(RSET_GPIO, (v), (o))
2010 +#define bcm_uart0_readl(o) bcm_rset_readl(RSET_UART0, (o))
2011 +#define bcm_uart0_writel(v,o) bcm_rset_writel(RSET_UART0, (v), (o))
2012 +#define bcm_mpi_readl(o) bcm_rset_readl(RSET_MPI, (o))
2013 +#define bcm_mpi_writel(v,o) bcm_rset_writel(RSET_MPI, (v), (o))
2014 +#define bcm_pcmcia_readl(o) bcm_rset_readl(RSET_PCMCIA, (o))
2015 +#define bcm_pcmcia_writel(v,o) bcm_rset_writel(RSET_PCMCIA, (v), (o))
2016 +#define bcm_sdram_readl(o) bcm_rset_readl(RSET_SDRAM, (o))
2017 +#define bcm_sdram_writel(v,o) bcm_rset_writel(RSET_SDRAM, (v), (o))
2018 +#define bcm_memc_readl(o) bcm_rset_readl(RSET_MEMC, (o))
2019 +#define bcm_memc_writel(v,o) bcm_rset_writel(RSET_MEMC, (v), (o))
2020 +#define bcm_ddr_readl(o) bcm_rset_readl(RSET_DDR, (o))
2021 +#define bcm_ddr_writel(v,o) bcm_rset_writel(RSET_DDR, (v), (o))
2023 +#endif /* ! BCM63XX_IO_H_ */
2024 diff --git a/include/asm-mips/mach-bcm63xx/bcm63xx_irq.h b/include/asm-mips/mach-bcm63xx/bcm63xx_irq.h
2025 new file mode 100644
2026 index 0000000..5f95577
2028 +++ b/include/asm-mips/mach-bcm63xx/bcm63xx_irq.h
2030 +#ifndef BCM63XX_IRQ_H_
2031 +#define BCM63XX_IRQ_H_
2033 +#include <bcm63xx_cpu.h>
2035 +#define IRQ_MIPS_BASE 0
2036 +#define IRQ_INTERNAL_BASE 8
2038 +#define IRQ_EXT_BASE (IRQ_MIPS_BASE + 3)
2039 +#define IRQ_EXT_0 (IRQ_EXT_BASE + 0)
2040 +#define IRQ_EXT_1 (IRQ_EXT_BASE + 1)
2041 +#define IRQ_EXT_2 (IRQ_EXT_BASE + 2)
2042 +#define IRQ_EXT_3 (IRQ_EXT_BASE + 3)
2044 +#endif /* ! BCM63XX_IRQ_H_ */
2045 diff --git a/include/asm-mips/mach-bcm63xx/bcm63xx_regs.h b/include/asm-mips/mach-bcm63xx/bcm63xx_regs.h
2046 new file mode 100644
2047 index 0000000..b5562b1
2049 +++ b/include/asm-mips/mach-bcm63xx/bcm63xx_regs.h
2051 +#ifndef BCM63XX_REGS_H_
2052 +#define BCM63XX_REGS_H_
2054 +/*************************************************************************
2055 + * _REG relative to RSET_PERF
2056 + *************************************************************************/
2058 +/* Chip Identifier / Revision register */
2059 +#define PERF_REV_REG 0x0
2060 +#define REV_CHIPID_SHIFT 16
2061 +#define REV_CHIPID_MASK (0xffff << REV_CHIPID_SHIFT)
2062 +#define REV_REVID_SHIFT 0
2063 +#define REV_REVID_MASK (0xffff << REV_REVID_SHIFT)
2065 +/* Clock Control register */
2066 +#define PERF_CKCTL_REG 0x4
2068 +#define CKCTL_6348_ADSLPHY_EN (1 << 0)
2069 +#define CKCTL_6348_MPI_EN (1 << 1)
2070 +#define CKCTL_6348_SDRAM_EN (1 << 2)
2071 +#define CKCTL_6348_M2M_EN (1 << 3)
2072 +#define CKCTL_6348_ENET_EN (1 << 4)
2073 +#define CKCTL_6348_SAR_EN (1 << 5)
2074 +#define CKCTL_6348_USBS_EN (1 << 6)
2075 +#define CKCTL_6348_USBH_EN (1 << 8)
2076 +#define CKCTL_6348_SPI_EN (1 << 9)
2078 +#define CKCTL_6348_ALL_SAFE_EN (CKCTL_6348_ADSLPHY_EN | \
2079 + CKCTL_6348_M2M_EN | \
2080 + CKCTL_6348_ENET_EN | \
2081 + CKCTL_6348_SAR_EN | \
2082 + CKCTL_6348_USBS_EN | \
2083 + CKCTL_6348_USBH_EN | \
2084 + CKCTL_6348_SPI_EN)
2086 +#define CKCTL_6358_ENET_EN (1 << 4)
2087 +#define CKCTL_6358_ADSLPHY_EN (1 << 5)
2088 +#define CKCTL_6358_PCM_EN (1 << 8)
2089 +#define CKCTL_6358_SPI_EN (1 << 9)
2090 +#define CKCTL_6358_USBS_EN (1 << 10)
2091 +#define CKCTL_6358_SAR_EN (1 << 11)
2092 +#define CKCTL_6358_EMUSB_EN (1 << 17)
2093 +#define CKCTL_6358_ENET0_EN (1 << 18)
2094 +#define CKCTL_6358_ENET1_EN (1 << 19)
2095 +#define CKCTL_6358_USBSU_EN (1 << 20)
2096 +#define CKCTL_6358_EPHY_EN (1 << 21)
2098 +#define CKCTL_6358_ALL_SAFE_EN (CKCTL_6358_ENET_EN | \
2099 + CKCTL_6358_ADSLPHY_EN | \
2100 + CKCTL_6358_PCM_EN | \
2101 + CKCTL_6358_SPI_EN | \
2102 + CKCTL_6358_USBS_EN | \
2103 + CKCTL_6358_SAR_EN | \
2104 + CKCTL_6358_EMUSB_EN | \
2105 + CKCTL_6358_ENET0_EN | \
2106 + CKCTL_6358_ENET1_EN | \
2107 + CKCTL_6358_USBSU_EN | \
2108 + CKCTL_6358_EPHY_EN)
2110 +/* System PLL Control register */
2111 +#define PERF_SYS_PLL_CTL_REG 0x8
2112 +#define SYS_PLL_SOFT_RESET 0x1
2114 +/* Interrupt Mask register */
2115 +#define PERF_IRQMASK_REG 0xc
2116 +#define PERF_IRQSTAT_REG 0x10
2118 +/* Interrupt Status register */
2119 +#define PERF_IRQSTAT_REG 0x10
2121 +/* External Interrupt Configuration register */
2122 +#define PERF_EXTIRQ_CFG_REG 0x14
2123 +#define EXTIRQ_CFG_SENSE(x) (1 << (x))
2124 +#define EXTIRQ_CFG_STAT(x) (1 << (x + 5))
2125 +#define EXTIRQ_CFG_CLEAR(x) (1 << (x + 10))
2126 +#define EXTIRQ_CFG_MASK(x) (1 << (x + 15))
2127 +#define EXTIRQ_CFG_BOTHEDGE(x) (1 << (x + 20))
2128 +#define EXTIRQ_CFG_LEVELSENSE(x) (1 << (x + 25))
2130 +#define EXTIRQ_CFG_CLEAR_ALL (0xf << 10)
2131 +#define EXTIRQ_CFG_MASK_ALL (0xf << 15)
2133 +/* Soft Reset register */
2134 +#define PERF_SOFTRESET_REG 0x28
2136 +#define SOFTRESET_6348_SPI_MASK (1 << 0)
2137 +#define SOFTRESET_6348_ENET_MASK (1 << 2)
2138 +#define SOFTRESET_6348_USBH_MASK (1 << 3)
2139 +#define SOFTRESET_6348_USBS_MASK (1 << 4)
2140 +#define SOFTRESET_6348_ADSL_MASK (1 << 5)
2141 +#define SOFTRESET_6348_DMAMEM_MASK (1 << 6)
2142 +#define SOFTRESET_6348_SAR_MASK (1 << 7)
2143 +#define SOFTRESET_6348_ACLC_MASK (1 << 8)
2144 +#define SOFTRESET_6348_ADSLMIPSPLL_MASK (1 << 10)
2146 +#define SOFTRESET_6348_ALL (SOFTRESET_6348_SPI_MASK | \
2147 + SOFTRESET_6348_ENET_MASK | \
2148 + SOFTRESET_6348_USBH_MASK | \
2149 + SOFTRESET_6348_USBS_MASK | \
2150 + SOFTRESET_6348_ADSL_MASK | \
2151 + SOFTRESET_6348_DMAMEM_MASK | \
2152 + SOFTRESET_6348_SAR_MASK | \
2153 + SOFTRESET_6348_ACLC_MASK | \
2154 + SOFTRESET_6348_ADSLMIPSPLL_MASK)
2156 +/* MIPS PLL control register */
2157 +#define PERF_MIPSPLLCTL_REG 0x34
2158 +#define MIPSPLLCTL_N1_SHIFT 20
2159 +#define MIPSPLLCTL_N1_MASK (0x7 << MIPSPLLCTL_N1_SHIFT)
2160 +#define MIPSPLLCTL_N2_SHIFT 15
2161 +#define MIPSPLLCTL_N2_MASK (0x1f << MIPSPLLCTL_N2_SHIFT)
2162 +#define MIPSPLLCTL_M1REF_SHIFT 12
2163 +#define MIPSPLLCTL_M1REF_MASK (0x7 << MIPSPLLCTL_M1REF_SHIFT)
2164 +#define MIPSPLLCTL_M2REF_SHIFT 9
2165 +#define MIPSPLLCTL_M2REF_MASK (0x7 << MIPSPLLCTL_M2REF_SHIFT)
2166 +#define MIPSPLLCTL_M1CPU_SHIFT 6
2167 +#define MIPSPLLCTL_M1CPU_MASK (0x7 << MIPSPLLCTL_M1CPU_SHIFT)
2168 +#define MIPSPLLCTL_M1BUS_SHIFT 3
2169 +#define MIPSPLLCTL_M1BUS_MASK (0x7 << MIPSPLLCTL_M1BUS_SHIFT)
2170 +#define MIPSPLLCTL_M2BUS_SHIFT 0
2171 +#define MIPSPLLCTL_M2BUS_MASK (0x7 << MIPSPLLCTL_M2BUS_SHIFT)
2173 +/* ADSL PHY PLL Control register */
2174 +#define PERF_ADSLPLLCTL_REG 0x38
2175 +#define ADSLPLLCTL_N1_SHIFT 20
2176 +#define ADSLPLLCTL_N1_MASK (0x7 << ADSLPLLCTL_N1_SHIFT)
2177 +#define ADSLPLLCTL_N2_SHIFT 15
2178 +#define ADSLPLLCTL_N2_MASK (0x1f << ADSLPLLCTL_N2_SHIFT)
2179 +#define ADSLPLLCTL_M1REF_SHIFT 12
2180 +#define ADSLPLLCTL_M1REF_MASK (0x7 << ADSLPLLCTL_M1REF_SHIFT)
2181 +#define ADSLPLLCTL_M2REF_SHIFT 9
2182 +#define ADSLPLLCTL_M2REF_MASK (0x7 << ADSLPLLCTL_M2REF_SHIFT)
2183 +#define ADSLPLLCTL_M1CPU_SHIFT 6
2184 +#define ADSLPLLCTL_M1CPU_MASK (0x7 << ADSLPLLCTL_M1CPU_SHIFT)
2185 +#define ADSLPLLCTL_M1BUS_SHIFT 3
2186 +#define ADSLPLLCTL_M1BUS_MASK (0x7 << ADSLPLLCTL_M1BUS_SHIFT)
2187 +#define ADSLPLLCTL_M2BUS_SHIFT 0
2188 +#define ADSLPLLCTL_M2BUS_MASK (0x7 << ADSLPLLCTL_M2BUS_SHIFT)
2190 +#define ADSLPLLCTL_VAL(n1,n2,m1ref,m2ref,m1cpu,m1bus,m2bus) \
2191 + (((n1) << ADSLPLLCTL_N1_SHIFT) | \
2192 + ((n2) << ADSLPLLCTL_N2_SHIFT) | \
2193 + ((m1ref) << ADSLPLLCTL_M1REF_SHIFT) | \
2194 + ((m2ref) << ADSLPLLCTL_M2REF_SHIFT) | \
2195 + ((m1cpu) << ADSLPLLCTL_M1CPU_SHIFT) | \
2196 + ((m1bus) << ADSLPLLCTL_M1BUS_SHIFT) | \
2197 + ((m2bus) << ADSLPLLCTL_M2BUS_SHIFT))
2200 +/*************************************************************************
2201 + * _REG relative to RSET_TIMER
2202 + *************************************************************************/
2204 +#define BCM63XX_TIMER_COUNT 4
2205 +#define TIMER_T0_ID 0
2206 +#define TIMER_T1_ID 1
2207 +#define TIMER_T2_ID 2
2208 +#define TIMER_WDT_ID 3
2210 +/* Timer irqstat register */
2211 +#define TIMER_IRQSTAT_REG 0
2212 +#define TIMER_IRQSTAT_TIMER_CAUSE(x) (1 << (x))
2213 +#define TIMER_IRQSTAT_TIMER0_CAUSE (1 << 0)
2214 +#define TIMER_IRQSTAT_TIMER1_CAUSE (1 << 1)
2215 +#define TIMER_IRQSTAT_TIMER2_CAUSE (1 << 2)
2216 +#define TIMER_IRQSTAT_WDT_CAUSE (1 << 3)
2217 +#define TIMER_IRQSTAT_TIMER_IR_EN(x) (1 << ((x) + 8))
2218 +#define TIMER_IRQSTAT_TIMER0_IR_EN (1 << 8)
2219 +#define TIMER_IRQSTAT_TIMER1_IR_EN (1 << 9)
2220 +#define TIMER_IRQSTAT_TIMER2_IR_EN (1 << 10)
2222 +/* Timer control register */
2223 +#define TIMER_CTLx_REG(x) (0x4 + (x * 4))
2224 +#define TIMER_CTL0_REG 0x4
2225 +#define TIMER_CTL1_REG 0x8
2226 +#define TIMER_CTL2_REG 0xC
2227 +#define TIMER_CTL_COUNTDOWN_MASK (0x3fffffff)
2228 +#define TIMER_CTL_MONOTONIC_MASK (1 << 30)
2229 +#define TIMER_CTL_ENABLE_MASK (1 << 31)
2232 +/*************************************************************************
2233 + * _REG relative to RSET_WDT
2234 + *************************************************************************/
2236 +/* Watchdog default count register */
2237 +#define WDT_DEFVAL_REG 0x0
2239 +/* Watchdog control register */
2240 +#define WDT_CTL_REG 0x4
2242 +/* Watchdog control register constants */
2243 +#define WDT_START_1 (0xff00)
2244 +#define WDT_START_2 (0x00ff)
2245 +#define WDT_STOP_1 (0xee00)
2246 +#define WDT_STOP_2 (0x00ee)
2248 +/* Watchdog reset length register */
2249 +#define WDT_RSTLEN_REG 0x8
2252 +/*************************************************************************
2253 + * _REG relative to RSET_UARTx
2254 + *************************************************************************/
2256 +/* UART Control Register */
2257 +#define UART_CTL_REG 0x0
2258 +#define UART_CTL_RXTMOUTCNT_SHIFT 0
2259 +#define UART_CTL_RXTMOUTCNT_MASK (0x1f << UART_CTL_RXTMOUTCNT_SHIFT)
2260 +#define UART_CTL_RSTTXDN_SHIFT 5
2261 +#define UART_CTL_RSTTXDN_MASK (1 << UART_CTL_RSTTXDN_SHIFT)
2262 +#define UART_CTL_RSTRXFIFO_SHIFT 6
2263 +#define UART_CTL_RSTRXFIFO_MASK (1 << UART_CTL_RSTRXFIFO_SHIFT)
2264 +#define UART_CTL_RSTTXFIFO_SHIFT 7
2265 +#define UART_CTL_RSTTXFIFO_MASK (1 << UART_CTL_RSTTXFIFO_SHIFT)
2266 +#define UART_CTL_STOPBITS_SHIFT 8
2267 +#define UART_CTL_STOPBITS_MASK (0xf << UART_CTL_STOPBITS_SHIFT)
2268 +#define UART_CTL_STOPBITS_1 (0x7 << UART_CTL_STOPBITS_SHIFT)
2269 +#define UART_CTL_STOPBITS_2 (0xf << UART_CTL_STOPBITS_SHIFT)
2270 +#define UART_CTL_BITSPERSYM_SHIFT 12
2271 +#define UART_CTL_BITSPERSYM_MASK (0x3 << UART_CTL_BITSPERSYM_SHIFT)
2272 +#define UART_CTL_XMITBRK_SHIFT 14
2273 +#define UART_CTL_XMITBRK_MASK (1 << UART_CTL_XMITBRK_SHIFT)
2274 +#define UART_CTL_RSVD_SHIFT 15
2275 +#define UART_CTL_RSVD_MASK (1 << UART_CTL_RSVD_SHIFT)
2276 +#define UART_CTL_RXPAREVEN_SHIFT 16
2277 +#define UART_CTL_RXPAREVEN_MASK (1 << UART_CTL_RXPAREVEN_SHIFT)
2278 +#define UART_CTL_RXPAREN_SHIFT 17
2279 +#define UART_CTL_RXPAREN_MASK (1 << UART_CTL_RXPAREN_SHIFT)
2280 +#define UART_CTL_TXPAREVEN_SHIFT 18
2281 +#define UART_CTL_TXPAREVEN_MASK (1 << UART_CTL_TXPAREVEN_SHIFT)
2282 +#define UART_CTL_TXPAREN_SHIFT 18
2283 +#define UART_CTL_TXPAREN_MASK (1 << UART_CTL_TXPAREN_SHIFT)
2284 +#define UART_CTL_LOOPBACK_SHIFT 20
2285 +#define UART_CTL_LOOPBACK_MASK (1 << UART_CTL_LOOPBACK_SHIFT)
2286 +#define UART_CTL_RXEN_SHIFT 21
2287 +#define UART_CTL_RXEN_MASK (1 << UART_CTL_RXEN_SHIFT)
2288 +#define UART_CTL_TXEN_SHIFT 22
2289 +#define UART_CTL_TXEN_MASK (1 << UART_CTL_TXEN_SHIFT)
2290 +#define UART_CTL_BRGEN_SHIFT 23
2291 +#define UART_CTL_BRGEN_MASK (1 << UART_CTL_BRGEN_SHIFT)
2293 +/* UART Baudword register */
2294 +#define UART_BAUD_REG 0x4
2296 +/* UART Misc Control register */
2297 +#define UART_MCTL_REG 0x8
2298 +#define UART_MCTL_DTR_SHIFT 0
2299 +#define UART_MCTL_DTR_MASK (1 << UART_MCTL_DTR_SHIFT)
2300 +#define UART_MCTL_RTS_SHIFT 1
2301 +#define UART_MCTL_RTS_MASK (1 << UART_MCTL_RTS_SHIFT)
2302 +#define UART_MCTL_RXFIFOTHRESH_SHIFT 8
2303 +#define UART_MCTL_RXFIFOTHRESH_MASK (0xf << UART_MCTL_RXFIFOTHRESH_SHIFT)
2304 +#define UART_MCTL_TXFIFOTHRESH_SHIFT 12
2305 +#define UART_MCTL_TXFIFOTHRESH_MASK (0xf << UART_MCTL_TXFIFOTHRESH_SHIFT)
2306 +#define UART_MCTL_RXFIFOFILL_SHIFT 16
2307 +#define UART_MCTL_RXFIFOFILL_MASK (0x1f << UART_MCTL_RXFIFOFILL_SHIFT)
2308 +#define UART_MCTL_TXFIFOFILL_SHIFT 24
2309 +#define UART_MCTL_TXFIFOFILL_MASK (0x1f << UART_MCTL_TXFIFOFILL_SHIFT)
2311 +/* UART External Input Configuration register */
2312 +#define UART_EXTINP_REG 0xc
2313 +#define UART_EXTINP_RI_SHIFT 0
2314 +#define UART_EXTINP_RI_MASK (1 << UART_EXTINP_RI_SHIFT)
2315 +#define UART_EXTINP_CTS_SHIFT 1
2316 +#define UART_EXTINP_CTS_MASK (1 << UART_EXTINP_CTS_SHIFT)
2317 +#define UART_EXTINP_DCD_SHIFT 2
2318 +#define UART_EXTINP_DCD_MASK (1 << UART_EXTINP_DCD_SHIFT)
2319 +#define UART_EXTINP_DSR_SHIFT 3
2320 +#define UART_EXTINP_DSR_MASK (1 << UART_EXTINP_DSR_SHIFT)
2321 +#define UART_EXTINP_IRSTAT(x) (1 << (x + 4))
2322 +#define UART_EXTINP_IRMASK(x) (1 << (x + 8))
2323 +#define UART_EXTINP_IR_RI 0
2324 +#define UART_EXTINP_IR_CTS 1
2325 +#define UART_EXTINP_IR_DCD 2
2326 +#define UART_EXTINP_IR_DSR 3
2327 +#define UART_EXTINP_RI_NOSENSE_SHIFT 16
2328 +#define UART_EXTINP_RI_NOSENSE_MASK (1 << UART_EXTINP_RI_NOSENSE_SHIFT)
2329 +#define UART_EXTINP_CTS_NOSENSE_SHIFT 17
2330 +#define UART_EXTINP_CTS_NOSENSE_MASK (1 << UART_EXTINP_CTS_NOSENSE_SHIFT)
2331 +#define UART_EXTINP_DCD_NOSENSE_SHIFT 18
2332 +#define UART_EXTINP_DCD_NOSENSE_MASK (1 << UART_EXTINP_DCD_NOSENSE_SHIFT)
2333 +#define UART_EXTINP_DSR_NOSENSE_SHIFT 19
2334 +#define UART_EXTINP_DSR_NOSENSE_MASK (1 << UART_EXTINP_DSR_NOSENSE_SHIFT)
2336 +/* UART Interrupt register */
2337 +#define UART_IR_REG 0x10
2338 +#define UART_IR_MASK(x) (1 << (x + 16))
2339 +#define UART_IR_STAT(x) (1 << (x))
2340 +#define UART_IR_EXTIP 0
2341 +#define UART_IR_TXUNDER 1
2342 +#define UART_IR_TXOVER 2
2343 +#define UART_IR_TXTRESH 3
2344 +#define UART_IR_TXRDLATCH 4
2345 +#define UART_IR_TXEMPTY 5
2346 +#define UART_IR_RXUNDER 6
2347 +#define UART_IR_RXOVER 7
2348 +#define UART_IR_RXTIMEOUT 8
2349 +#define UART_IR_RXFULL 9
2350 +#define UART_IR_RXTHRESH 10
2351 +#define UART_IR_RXNOTEMPTY 11
2352 +#define UART_IR_RXFRAMEERR 12
2353 +#define UART_IR_RXPARERR 13
2354 +#define UART_IR_RXBRK 14
2355 +#define UART_IR_TXDONE 15
2357 +/* UART Fifo register */
2358 +#define UART_FIFO_REG 0x14
2359 +#define UART_FIFO_VALID_SHIFT 0
2360 +#define UART_FIFO_VALID_MASK 0xff
2361 +#define UART_FIFO_FRAMEERR_SHIFT 8
2362 +#define UART_FIFO_FRAMEERR_MASK (1 << UART_FIFO_FRAMEERR_SHIFT)
2363 +#define UART_FIFO_PARERR_SHIFT 9
2364 +#define UART_FIFO_PARERR_MASK (1 << UART_FIFO_PARERR_SHIFT)
2365 +#define UART_FIFO_BRKDET_SHIFT 10
2366 +#define UART_FIFO_BRKDET_MASK (1 << UART_FIFO_BRKDET_SHIFT)
2367 +#define UART_FIFO_ANYERR_MASK (UART_FIFO_FRAMEERR_MASK | \
2368 + UART_FIFO_PARERR_MASK | \
2369 + UART_FIFO_BRKDET_MASK)
2372 +/*************************************************************************
2373 + * _REG relative to RSET_GPIO
2374 + *************************************************************************/
2376 +/* GPIO registers */
2377 +#define GPIO_CTL_HI_REG 0x0
2378 +#define GPIO_CTL_LO_REG 0x4
2379 +#define GPIO_DATA_HI_REG 0x8
2380 +#define GPIO_DATA_LO_REG 0xC
2382 +/* GPIO mux registers and constants */
2383 +#define GPIO_MODE_REG 0x18
2385 +#define GPIO_MODE_6348_G4_DIAG 0x00090000
2386 +#define GPIO_MODE_6348_G4_UTOPIA 0x00080000
2387 +#define GPIO_MODE_6348_G4_LEGACY_LED 0x00030000
2388 +#define GPIO_MODE_6348_G4_MII_SNOOP 0x00020000
2389 +#define GPIO_MODE_6348_G4_EXT_EPHY 0x00010000
2390 +#define GPIO_MODE_6348_G3_DIAG 0x00009000
2391 +#define GPIO_MODE_6348_G3_UTOPIA 0x00008000
2392 +#define GPIO_MODE_6348_G3_EXT_MII 0x00007000
2393 +#define GPIO_MODE_6348_G2_DIAG 0x00000900
2394 +#define GPIO_MODE_6348_G2_PCI 0x00000500
2395 +#define GPIO_MODE_6348_G1_DIAG 0x00000090
2396 +#define GPIO_MODE_6348_G1_UTOPIA 0x00000080
2397 +#define GPIO_MODE_6348_G1_SPI_UART 0x00000060
2398 +#define GPIO_MODE_6348_G1_SPI_MASTER 0x00000060
2399 +#define GPIO_MODE_6348_G1_MII_PCCARD 0x00000040
2400 +#define GPIO_MODE_6348_G1_MII_SNOOP 0x00000020
2401 +#define GPIO_MODE_6348_G1_EXT_EPHY 0x00000010
2402 +#define GPIO_MODE_6348_G0_DIAG 0x00000009
2403 +#define GPIO_MODE_6348_G0_EXT_MII 0x00000007
2405 +#define GPIO_MODE_6358_EXTRACS (1 << 5)
2406 +#define GPIO_MODE_6358_UART1 (1 << 6)
2407 +#define GPIO_MODE_6358_EXTRA_SPI_SS (1 << 7)
2408 +#define GPIO_MODE_6358_SERIAL_LED (1 << 10)
2409 +#define GPIO_MODE_6358_UTOPIA (1 << 12)
2412 +/*************************************************************************
2413 + * _REG relative to RSET_ENET
2414 + *************************************************************************/
2416 +/* Receiver Configuration register */
2417 +#define ENET_RXCFG_REG 0x0
2418 +#define ENET_RXCFG_ALLMCAST_SHIFT 1
2419 +#define ENET_RXCFG_ALLMCAST_MASK (1 << ENET_RXCFG_ALLMCAST_SHIFT)
2420 +#define ENET_RXCFG_PROMISC_SHIFT 3
2421 +#define ENET_RXCFG_PROMISC_MASK (1 << ENET_RXCFG_PROMISC_SHIFT)
2422 +#define ENET_RXCFG_LOOPBACK_SHIFT 4
2423 +#define ENET_RXCFG_LOOPBACK_MASK (1 << ENET_RXCFG_LOOPBACK_SHIFT)
2424 +#define ENET_RXCFG_ENFLOW_SHIFT 5
2425 +#define ENET_RXCFG_ENFLOW_MASK (1 << ENET_RXCFG_ENFLOW_SHIFT)
2427 +/* Receive Maximum Length register */
2428 +#define ENET_RXMAXLEN_REG 0x4
2429 +#define ENET_RXMAXLEN_SHIFT 0
2430 +#define ENET_RXMAXLEN_MASK (0x7ff << ENET_RXMAXLEN_SHIFT)
2432 +/* Transmit Maximum Length register */
2433 +#define ENET_TXMAXLEN_REG 0x8
2434 +#define ENET_TXMAXLEN_SHIFT 0
2435 +#define ENET_TXMAXLEN_MASK (0x7ff << ENET_TXMAXLEN_SHIFT)
2437 +/* MII Status/Control register */
2438 +#define ENET_MIISC_REG 0x10
2439 +#define ENET_MIISC_MDCFREQDIV_SHIFT 0
2440 +#define ENET_MIISC_MDCFREQDIV_MASK (0x7f << ENET_MIISC_MDCFREQDIV_SHIFT)
2441 +#define ENET_MIISC_PREAMBLEEN_SHIFT 7
2442 +#define ENET_MIISC_PREAMBLEEN_MASK (1 << ENET_MIISC_PREAMBLEEN_SHIFT)
2444 +/* MII Data register */
2445 +#define ENET_MIIDATA_REG 0x14
2446 +#define ENET_MIIDATA_DATA_SHIFT 0
2447 +#define ENET_MIIDATA_DATA_MASK (0xffff << ENET_MIIDATA_DATA_SHIFT)
2448 +#define ENET_MIIDATA_TA_SHIFT 16
2449 +#define ENET_MIIDATA_TA_MASK (0x3 << ENET_MIIDATA_TA_SHIFT)
2450 +#define ENET_MIIDATA_REG_SHIFT 18
2451 +#define ENET_MIIDATA_REG_MASK (0x1f << ENET_MIIDATA_REG_SHIFT)
2452 +#define ENET_MIIDATA_PHYID_SHIFT 23
2453 +#define ENET_MIIDATA_PHYID_MASK (0x1f << ENET_MIIDATA_PHYID_SHIFT)
2454 +#define ENET_MIIDATA_OP_READ_MASK (0x6 << 28)
2455 +#define ENET_MIIDATA_OP_WRITE_MASK (0x5 << 28)
2457 +/* Ethernet Interrupt Mask register */
2458 +#define ENET_IRMASK_REG 0x18
2460 +/* Ethernet Interrupt register */
2461 +#define ENET_IR_REG 0x1c
2462 +#define ENET_IR_MII (1 << 0)
2463 +#define ENET_IR_MIB (1 << 1)
2464 +#define ENET_IR_FLOWC (1 << 2)
2466 +/* Ethernet Control register */
2467 +#define ENET_CTL_REG 0x2c
2468 +#define ENET_CTL_ENABLE_SHIFT 0
2469 +#define ENET_CTL_ENABLE_MASK (1 << ENET_CTL_ENABLE_SHIFT)
2470 +#define ENET_CTL_DISABLE_SHIFT 1
2471 +#define ENET_CTL_DISABLE_MASK (1 << ENET_CTL_DISABLE_SHIFT)
2472 +#define ENET_CTL_SRESET_SHIFT 2
2473 +#define ENET_CTL_SRESET_MASK (1 << ENET_CTL_SRESET_SHIFT)
2474 +#define ENET_CTL_EPHYSEL_SHIFT 3
2475 +#define ENET_CTL_EPHYSEL_MASK (1 << ENET_CTL_EPHYSEL_SHIFT)
2477 +/* Transmit Control register */
2478 +#define ENET_TXCTL_REG 0x30
2479 +#define ENET_TXCTL_FD_SHIFT 0
2480 +#define ENET_TXCTL_FD_MASK (1 << ENET_TXCTL_FD_SHIFT)
2482 +/* Transmit Watermask register */
2483 +#define ENET_TXWMARK_REG 0x34
2484 +#define ENET_TXWMARK_WM_SHIFT 0
2485 +#define ENET_TXWMARK_WM_MASK (0x3f << ENET_TXWMARK_WM_SHIFT)
2487 +/* MIB Control register */
2488 +#define ENET_MIBCTL_REG 0x38
2489 +#define ENET_MIBCTL_RDCLEAR_SHIFT 0
2490 +#define ENET_MIBCTL_RDCLEAR_MASK (1 << ENET_MIBCTL_RDCLEAR_SHIFT)
2492 +/* Perfect Match Data Low register */
2493 +#define ENET_PML_REG(x) (0x58 + (x) * 8)
2494 +#define ENET_PMH_REG(x) (0x5c + (x) * 8)
2495 +#define ENET_PMH_DATAVALID_SHIFT 16
2496 +#define ENET_PMH_DATAVALID_MASK (1 << ENET_PMH_DATAVALID_SHIFT)
2499 +#define ENET_MIB_REG(x) (0x200 + (x) * 4)
2500 +#define ENET_MIB_REG_COUNT 55
2503 +/*************************************************************************
2504 + * _REG relative to RSET_ENETDMA
2505 + *************************************************************************/
2507 +/* Controller Configuration Register */
2508 +#define ENETDMA_CFG_REG (0x0)
2509 +#define ENETDMA_CFG_EN_SHIFT 0
2510 +#define ENETDMA_CFG_EN_MASK (1 << ENETDMA_CFG_EN_SHIFT)
2511 +#define ENETDMA_CFG_FLOWCH_MASK(x) (1 << ((x >> 1) + 1))
2513 +/* Flow Control Descriptor Low Threshold register */
2514 +#define ENETDMA_FLOWCL_REG(x) (0x4 + (x) * 6)
2516 +/* Flow Control Descriptor High Threshold register */
2517 +#define ENETDMA_FLOWCH_REG(x) (0x8 + (x) * 6)
2519 +/* Flow Control Descriptor Buffer Alloca Threshold register */
2520 +#define ENETDMA_BUFALLOC_REG(x) (0xc + (x) * 6)
2521 +#define ENETDMA_BUFALLOC_FORCE_SHIFT 31
2522 +#define ENETDMA_BUFALLOC_FORCE_MASK (1 << ENETDMA_BUFALLOC_FORCE_SHIFT)
2524 +/* Channel Configuration register */
2525 +#define ENETDMA_CHANCFG_REG(x) (0x100 + (x) * 0x10)
2526 +#define ENETDMA_CHANCFG_EN_SHIFT 0
2527 +#define ENETDMA_CHANCFG_EN_MASK (1 << ENETDMA_CHANCFG_EN_SHIFT)
2528 +#define ENETDMA_CHANCFG_PKTHALT_SHIFT 1
2529 +#define ENETDMA_CHANCFG_PKTHALT_MASK (1 << ENETDMA_CHANCFG_PKTHALT_SHIFT)
2531 +/* Interrupt Control/Status register */
2532 +#define ENETDMA_IR_REG(x) (0x104 + (x) * 0x10)
2533 +#define ENETDMA_IR_BUFDONE_MASK (1 << 0)
2534 +#define ENETDMA_IR_PKTDONE_MASK (1 << 1)
2535 +#define ENETDMA_IR_NOTOWNER_MASK (1 << 2)
2537 +/* Interrupt Mask register */
2538 +#define ENETDMA_IRMASK_REG(x) (0x108 + (x) * 0x10)
2540 +/* Maximum Burst Length */
2541 +#define ENETDMA_MAXBURST_REG(x) (0x10C + (x) * 0x10)
2543 +/* Ring Start Address register */
2544 +#define ENETDMA_RSTART_REG(x) (0x200 + (x) * 0x10)
2546 +/* State Ram Word 2 */
2547 +#define ENETDMA_SRAM2_REG(x) (0x204 + (x) * 0x10)
2549 +/* State Ram Word 3 */
2550 +#define ENETDMA_SRAM3_REG(x) (0x208 + (x) * 0x10)
2552 +/* State Ram Word 4 */
2553 +#define ENETDMA_SRAM4_REG(x) (0x20c + (x) * 0x10)
2556 +/*************************************************************************
2557 + * _REG relative to RSET_OHCI_PRIV
2558 + *************************************************************************/
2560 +#define OHCI_PRIV_REG 0x0
2561 +#define OHCI_PRIV_PORT1_HOST_SHIFT 0
2562 +#define OHCI_PRIV_PORT1_HOST_MASK (1 << OHCI_PRIV_PORT1_HOST_SHIFT)
2563 +#define OHCI_PRIV_REG_SWAP_SHIFT 3
2564 +#define OHCI_PRIV_REG_SWAP_MASK (1 << OHCI_PRIV_REG_SWAP_SHIFT)
2567 +/*************************************************************************
2568 + * _REG relative to RSET_USBH_PRIV
2569 + *************************************************************************/
2571 +#define USBH_PRIV_SWAP_REG 0x0
2572 +#define USBH_PRIV_SWAP_EHCI_ENDN_SHIFT 4
2573 +#define USBH_PRIV_SWAP_EHCI_ENDN_MASK (1 << USBH_PRIV_SWAP_EHCI_ENDN_SHIFT)
2574 +#define USBH_PRIV_SWAP_EHCI_DATA_SHIFT 3
2575 +#define USBH_PRIV_SWAP_EHCI_DATA_MASK (1 << USBH_PRIV_SWAP_EHCI_DATA_SHIFT)
2576 +#define USBH_PRIV_SWAP_OHCI_ENDN_SHIFT 1
2577 +#define USBH_PRIV_SWAP_OHCI_ENDN_MASK (1 << USBH_PRIV_SWAP_OHCI_ENDN_SHIFT)
2578 +#define USBH_PRIV_SWAP_OHCI_DATA_SHIFT 0
2579 +#define USBH_PRIV_SWAP_OHCI_DATA_MASK (1 << USBH_PRIV_SWAP_OHCI_DATA_SHIFT)
2581 +#define USBH_PRIV_TEST_REG 0x24
2584 +/*************************************************************************
2585 + * _REG relative to RSET_MPI
2586 + *************************************************************************/
2588 +/* well known (hard wired) chip select */
2589 +#define MPI_CS_PCMCIA_COMMON 4
2590 +#define MPI_CS_PCMCIA_ATTR 5
2591 +#define MPI_CS_PCMCIA_IO 6
2593 +/* Chip select base register */
2594 +#define MPI_CSBASE_REG(x) (0x0 + (x) * 8)
2595 +#define MPI_CSBASE_BASE_SHIFT 13
2596 +#define MPI_CSBASE_BASE_MASK (0x1ffff << MPI_CSBASE_BASE_SHIFT)
2597 +#define MPI_CSBASE_SIZE_SHIFT 0
2598 +#define MPI_CSBASE_SIZE_MASK (0xf << MPI_CSBASE_SIZE_SHIFT)
2600 +#define MPI_CSBASE_SIZE_8K 0
2601 +#define MPI_CSBASE_SIZE_16K 1
2602 +#define MPI_CSBASE_SIZE_32K 2
2603 +#define MPI_CSBASE_SIZE_64K 3
2604 +#define MPI_CSBASE_SIZE_128K 4
2605 +#define MPI_CSBASE_SIZE_256K 5
2606 +#define MPI_CSBASE_SIZE_512K 6
2607 +#define MPI_CSBASE_SIZE_1M 7
2608 +#define MPI_CSBASE_SIZE_2M 8
2609 +#define MPI_CSBASE_SIZE_4M 9
2610 +#define MPI_CSBASE_SIZE_8M 10
2611 +#define MPI_CSBASE_SIZE_16M 11
2612 +#define MPI_CSBASE_SIZE_32M 12
2613 +#define MPI_CSBASE_SIZE_64M 13
2614 +#define MPI_CSBASE_SIZE_128M 14
2615 +#define MPI_CSBASE_SIZE_256M 15
2617 +/* Chip select control register */
2618 +#define MPI_CSCTL_REG(x) (0x4 + (x) * 8)
2619 +#define MPI_CSCTL_ENABLE_MASK (1 << 0)
2620 +#define MPI_CSCTL_WAIT_SHIFT 1
2621 +#define MPI_CSCTL_WAIT_MASK (0x7 << MPI_CSCTL_WAIT_SHIFT)
2622 +#define MPI_CSCTL_DATA16_MASK (1 << 4)
2623 +#define MPI_CSCTL_SYNCMODE_MASK (1 << 7)
2624 +#define MPI_CSCTL_TSIZE_MASK (1 << 8)
2625 +#define MPI_CSCTL_ENDIANSWAP_MASK (1 << 10)
2626 +#define MPI_CSCTL_SETUP_SHIFT 16
2627 +#define MPI_CSCTL_SETUP_MASK (0xf << MPI_CSCTL_SETUP_SHIFT)
2628 +#define MPI_CSCTL_HOLD_SHIFT 20
2629 +#define MPI_CSCTL_HOLD_MASK (0xf << MPI_CSCTL_HOLD_SHIFT)
2631 +/* PCI registers */
2632 +#define MPI_SP0_RANGE_REG 0x100
2633 +#define MPI_SP0_REMAP_REG 0x104
2634 +#define MPI_SP0_REMAP_ENABLE_MASK (1 << 0)
2635 +#define MPI_SP1_RANGE_REG 0x10C
2636 +#define MPI_SP1_REMAP_REG 0x110
2637 +#define MPI_SP1_REMAP_ENABLE_MASK (1 << 0)
2639 +#define MPI_L2PCFG_REG 0x11C
2640 +#define MPI_L2PCFG_CFG_TYPE_SHIFT 0
2641 +#define MPI_L2PCFG_CFG_TYPE_MASK (0x3 << MPI_L2PCFG_CFG_TYPE_SHIFT)
2642 +#define MPI_L2PCFG_REG_SHIFT 2
2643 +#define MPI_L2PCFG_REG_MASK (0x3f << MPI_L2PCFG_REG_SHIFT)
2644 +#define MPI_L2PCFG_FUNC_SHIFT 8
2645 +#define MPI_L2PCFG_FUNC_MASK (0x7 << MPI_L2PCFG_FUNC_SHIFT)
2646 +#define MPI_L2PCFG_DEVNUM_SHIFT 11
2647 +#define MPI_L2PCFG_DEVNUM_MASK (0x1f << MPI_L2PCFG_DEVNUM_SHIFT)
2648 +#define MPI_L2PCFG_CFG_USEREG_MASK (1 << 30)
2649 +#define MPI_L2PCFG_CFG_SEL_MASK (1 << 31)
2651 +#define MPI_L2PMEMRANGE1_REG 0x120
2652 +#define MPI_L2PMEMBASE1_REG 0x124
2653 +#define MPI_L2PMEMREMAP1_REG 0x128
2654 +#define MPI_L2PMEMRANGE2_REG 0x12C
2655 +#define MPI_L2PMEMBASE2_REG 0x130
2656 +#define MPI_L2PMEMREMAP2_REG 0x134
2657 +#define MPI_L2PIORANGE_REG 0x138
2658 +#define MPI_L2PIOBASE_REG 0x13C
2659 +#define MPI_L2PIOREMAP_REG 0x140
2660 +#define MPI_L2P_BASE_MASK (0xffff8000)
2661 +#define MPI_L2PREMAP_ENABLED_MASK (1 << 0)
2662 +#define MPI_L2PREMAP_IS_CARDBUS_MASK (1 << 2)
2664 +#define MPI_PCIMODESEL_REG 0x144
2665 +#define MPI_PCIMODESEL_BAR1_NOSWAP_MASK (1 << 0)
2666 +#define MPI_PCIMODESEL_BAR2_NOSWAP_MASK (1 << 1)
2667 +#define MPI_PCIMODESEL_EXT_ARB_MASK (1 << 2)
2668 +#define MPI_PCIMODESEL_PREFETCH_SHIFT 4
2669 +#define MPI_PCIMODESEL_PREFETCH_MASK (0xf << MPI_PCIMODESEL_PREFETCH_SHIFT)
2671 +#define MPI_LOCBUSCTL_REG 0x14C
2672 +#define MPI_LOCBUSCTL_EN_PCI_GPIO_MASK (1 << 0)
2673 +#define MPI_LOCBUSCTL_U2P_NOSWAP_MASK (1 << 1)
2675 +#define MPI_LOCINT_REG 0x150
2676 +#define MPI_LOCINT_MASK(x) (1 << (x + 16))
2677 +#define MPI_LOCINT_STAT(x) (1 << (x))
2678 +#define MPI_LOCINT_DIR_FAILED 6
2679 +#define MPI_LOCINT_EXT_PCI_INT 7
2680 +#define MPI_LOCINT_SERR 8
2681 +#define MPI_LOCINT_CSERR 9
2683 +#define MPI_PCICFGCTL_REG 0x178
2684 +#define MPI_PCICFGCTL_CFGADDR_SHIFT 2
2685 +#define MPI_PCICFGCTL_CFGADDR_MASK (0x1f << MPI_PCICFGCTL_CFGADDR_SHIFT)
2686 +#define MPI_PCICFGCTL_WRITEEN_MASK (1 << 7)
2688 +#define MPI_PCICFGDATA_REG 0x17C
2690 +/* PCI host bridge custom register */
2691 +#define BCMPCI_REG_TIMERS 0x40
2692 +#define REG_TIMER_TRDY_SHIFT 0
2693 +#define REG_TIMER_TRDY_MASK (0xff << REG_TIMER_TRDY_SHIFT)
2694 +#define REG_TIMER_RETRY_SHIFT 8
2695 +#define REG_TIMER_RETRY_MASK (0xff << REG_TIMER_RETRY_SHIFT)
2698 +/*************************************************************************
2699 + * _REG relative to RSET_PCMCIA
2700 + *************************************************************************/
2702 +#define PCMCIA_C1_REG 0x0
2703 +#define PCMCIA_C1_CD1_MASK (1 << 0)
2704 +#define PCMCIA_C1_CD2_MASK (1 << 1)
2705 +#define PCMCIA_C1_VS1_MASK (1 << 2)
2706 +#define PCMCIA_C1_VS2_MASK (1 << 3)
2707 +#define PCMCIA_C1_VS1OE_MASK (1 << 6)
2708 +#define PCMCIA_C1_VS2OE_MASK (1 << 7)
2709 +#define PCMCIA_C1_CBIDSEL_SHIFT (8)
2710 +#define PCMCIA_C1_CBIDSEL_MASK (0x1f << PCMCIA_C1_CBIDSEL_SHIFT)
2711 +#define PCMCIA_C1_EN_PCMCIA_GPIO_MASK (1 << 13)
2712 +#define PCMCIA_C1_EN_PCMCIA_MASK (1 << 14)
2713 +#define PCMCIA_C1_EN_CARDBUS_MASK (1 << 15)
2714 +#define PCMCIA_C1_RESET_MASK (1 << 18)
2716 +#define PCMCIA_C2_REG 0x8
2717 +#define PCMCIA_C2_DATA16_MASK (1 << 0)
2718 +#define PCMCIA_C2_BYTESWAP_MASK (1 << 1)
2719 +#define PCMCIA_C2_RWCOUNT_SHIFT 2
2720 +#define PCMCIA_C2_RWCOUNT_MASK (0x3f << PCMCIA_C2_RWCOUNT_SHIFT)
2721 +#define PCMCIA_C2_INACTIVE_SHIFT 8
2722 +#define PCMCIA_C2_INACTIVE_MASK (0x3f << PCMCIA_C2_INACTIVE_SHIFT)
2723 +#define PCMCIA_C2_SETUP_SHIFT 16
2724 +#define PCMCIA_C2_SETUP_MASK (0x3f << PCMCIA_C2_SETUP_SHIFT)
2725 +#define PCMCIA_C2_HOLD_SHIFT 24
2726 +#define PCMCIA_C2_HOLD_MASK (0x3f << PCMCIA_C2_HOLD_SHIFT)
2729 +/*************************************************************************
2730 + * _REG relative to RSET_SDRAM
2731 + *************************************************************************/
2733 +#define SDRAM_CFG_REG 0x0
2734 +#define SDRAM_CFG_ROW_SHIFT 4
2735 +#define SDRAM_CFG_ROW_MASK (0x3 << SDRAM_CFG_ROW_SHIFT)
2736 +#define SDRAM_CFG_COL_SHIFT 6
2737 +#define SDRAM_CFG_COL_MASK (0x3 << SDRAM_CFG_COL_SHIFT)
2738 +#define SDRAM_CFG_32B_SHIFT 10
2739 +#define SDRAM_CFG_32B_MASK (1 << SDRAM_CFG_32B_SHIFT)
2740 +#define SDRAM_CFG_BANK_SHIFT 13
2741 +#define SDRAM_CFG_BANK_MASK (1 << SDRAM_CFG_BANK_SHIFT)
2743 +#define SDRAM_PRIO_REG 0x2C
2744 +#define SDRAM_PRIO_MIPS_SHIFT 29
2745 +#define SDRAM_PRIO_MIPS_MASK (1 << SDRAM_PRIO_MIPS_SHIFT)
2746 +#define SDRAM_PRIO_ADSL_SHIFT 30
2747 +#define SDRAM_PRIO_ADSL_MASK (1 << SDRAM_PRIO_ADSL_SHIFT)
2748 +#define SDRAM_PRIO_EN_SHIFT 31
2749 +#define SDRAM_PRIO_EN_MASK (1 << SDRAM_PRIO_EN_SHIFT)
2752 +/*************************************************************************
2753 + * _REG relative to RSET_MEMC
2754 + *************************************************************************/
2756 +#define MEMC_CFG_REG 0x4
2757 +#define MEMC_CFG_32B_SHIFT 1
2758 +#define MEMC_CFG_32B_MASK (1 << MEMC_CFG_32B_SHIFT)
2759 +#define MEMC_CFG_COL_SHIFT 3
2760 +#define MEMC_CFG_COL_MASK (0x3 << MEMC_CFG_COL_SHIFT)
2761 +#define MEMC_CFG_ROW_SHIFT 6
2762 +#define MEMC_CFG_ROW_MASK (0x3 << MEMC_CFG_ROW_SHIFT)
2765 +/*************************************************************************
2766 + * _REG relative to RSET_DDR
2767 + *************************************************************************/
2769 +#define DDR_DMIPSPLLCFG_REG 0x18
2770 +#define DMIPSPLLCFG_M1_SHIFT 0
2771 +#define DMIPSPLLCFG_M1_MASK (0xff << DMIPSPLLCFG_M1_SHIFT)
2772 +#define DMIPSPLLCFG_N1_SHIFT 23
2773 +#define DMIPSPLLCFG_N1_MASK (0x3f << DMIPSPLLCFG_N1_SHIFT)
2774 +#define DMIPSPLLCFG_N2_SHIFT 29
2775 +#define DMIPSPLLCFG_N2_MASK (0x7 << DMIPSPLLCFG_N2_SHIFT)
2777 +#endif /* BCM63XX_REGS_H_ */
2779 diff --git a/include/asm-mips/mach-bcm63xx/bcm63xx_timer.h b/include/asm-mips/mach-bcm63xx/bcm63xx_timer.h
2780 new file mode 100644
2781 index 0000000..c0fce83
2783 +++ b/include/asm-mips/mach-bcm63xx/bcm63xx_timer.h
2785 +#ifndef BCM63XX_TIMER_H_
2786 +#define BCM63XX_TIMER_H_
2788 +int bcm63xx_timer_register(int id, void (*callback)(void *data), void *data);
2789 +void bcm63xx_timer_unregister(int id);
2790 +int bcm63xx_timer_set(int id, int monotonic, unsigned int countdown_us);
2791 +int bcm63xx_timer_enable(int id);
2792 +int bcm63xx_timer_disable(int id);
2793 +unsigned int bcm63xx_timer_countdown(unsigned int countdown_us);
2795 +#endif /* !BCM63XX_TIMER_H_ */
2796 diff --git a/include/asm-mips/mach-bcm63xx/cpu-feature-overrides.h b/include/asm-mips/mach-bcm63xx/cpu-feature-overrides.h
2797 new file mode 100644
2798 index 0000000..1a5c4b1
2800 +++ b/include/asm-mips/mach-bcm63xx/cpu-feature-overrides.h
2802 +#ifndef __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H
2803 +#define __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H
2805 +#include <bcm63xx_cpu.h>
2807 +#define cpu_has_tlb 1
2808 +#define cpu_has_4kex 1
2809 +#define cpu_has_4k_cache 1
2810 +#define cpu_has_fpu 0
2811 +#define cpu_has_32fpr 0
2812 +#define cpu_has_counter 1
2813 +#define cpu_has_watch 0
2814 +#define cpu_has_divec 1
2815 +#define cpu_has_vce 0
2816 +#define cpu_has_cache_cdex_p 0
2817 +#define cpu_has_cache_cdex_s 0
2818 +#define cpu_has_prefetch 1
2819 +#define cpu_has_mcheck 1
2820 +#define cpu_has_ejtag 1
2821 +#define cpu_has_llsc 1
2822 +#define cpu_has_mips16 0
2823 +#define cpu_has_mdmx 0
2824 +#define cpu_has_mips3d 0
2825 +#define cpu_has_smartmips 0
2826 +#define cpu_has_vtag_icache 0
2828 +#if !defined(BCMCPU_RUNTIME_DETECT) && defined(CONFIG_BCMCPU_IS_6348)
2829 +#define cpu_has_dc_aliases 0
2832 +#define cpu_has_ic_fills_f_dc 0
2833 +#define cpu_has_pindexed_dcache 0
2835 +#define cpu_has_mips32r1 1
2836 +#define cpu_has_mips32r2 0
2837 +#define cpu_has_mips64r1 0
2838 +#define cpu_has_mips64r2 0
2840 +#define cpu_has_dsp 0
2841 +#define cpu_has_mipsmt 0
2842 +#define cpu_has_userlocal 0
2844 +#define cpu_has_nofpuex 0
2845 +#define cpu_has_64bits 0
2846 +#define cpu_has_64bit_zero_reg 0
2848 +#define cpu_dcache_line_size() 16
2849 +#define cpu_icache_line_size() 16
2850 +#define cpu_scache_line_size() 0
2852 +#endif /* __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H */
2853 diff --git a/include/asm-mips/mach-bcm63xx/gpio.h b/include/asm-mips/mach-bcm63xx/gpio.h
2854 new file mode 100644
2855 index 0000000..dd2c0f3
2857 +++ b/include/asm-mips/mach-bcm63xx/gpio.h
2859 +#ifndef __ASM_MIPS_MACH_BCM63XX_GPIO_H
2860 +#define __ASM_MIPS_MACH_BCM63XX_GPIO_H
2862 +#include <bcm63xx_gpio.h>
2864 +static inline int gpio_is_valid(int number)
2866 + return (number >= BCM63XX_GPIO_COUNT) ? 0 : 1;
2869 +static inline int gpio_request(unsigned gpio, const char *label)
2874 +static inline void gpio_free(unsigned gpio)
2878 +static inline int gpio_direction_input(unsigned gpio)
2880 + bcm63xx_gpio_set_direction(gpio, GPIO_DIR_IN);
2884 +static inline int gpio_direction_output(unsigned gpio, int value)
2886 + bcm63xx_gpio_set_direction(gpio, GPIO_DIR_OUT);
2890 +static inline int gpio_get_value(unsigned gpio)
2892 + return bcm63xx_gpio_get_datain(gpio);
2895 +static inline void gpio_set_value(unsigned gpio, int value)
2897 + bcm63xx_gpio_set_dataout(gpio, value);
2900 +static inline int gpio_to_irq(unsigned gpio)
2905 +static inline int irq_to_gpio(unsigned irq)
2910 +#endif /* __ASM_MIPS_MACH_BCM63XX_GPIO_H */
2911 diff --git a/include/asm-mips/mach-bcm63xx/war.h b/include/asm-mips/mach-bcm63xx/war.h
2912 new file mode 100644
2913 index 0000000..8e3f3fd
2915 +++ b/include/asm-mips/mach-bcm63xx/war.h
2918 + * This file is subject to the terms and conditions of the GNU General Public
2919 + * License. See the file "COPYING" in the main directory of this archive
2920 + * for more details.
2922 + * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
2924 +#ifndef __ASM_MIPS_MACH_BCM63XX_WAR_H
2925 +#define __ASM_MIPS_MACH_BCM63XX_WAR_H
2927 +#define R4600_V1_INDEX_ICACHEOP_WAR 0
2928 +#define R4600_V1_HIT_CACHEOP_WAR 0
2929 +#define R4600_V2_HIT_CACHEOP_WAR 0
2930 +#define R5432_CP0_INTERRUPT_WAR 0
2931 +#define BCM1250_M3_WAR 0
2932 +#define SIBYTE_1956_WAR 0
2933 +#define MIPS4K_ICACHE_REFILL_WAR 0
2934 +#define MIPS_CACHE_SYNC_WAR 0
2935 +#define TX49XX_ICACHE_INDEX_INV_WAR 0
2936 +#define RM9000_CDEX_SMP_WAR 0
2937 +#define ICACHE_REFILLS_WORKAROUND_WAR 0
2938 +#define R10000_LLSC_WAR 0
2939 +#define MIPS34K_MISSED_ITLB_WAR 0
2941 +#endif /* __ASM_MIPS_MACH_BCM63XX_WAR_H */