diff options
| author | Kevin Cernekee <cernekee@gmail.com> | 2014-10-21 00:28:05 -0400 |
|---|---|---|
| committer | Ralf Baechle <ralf@linux-mips.org> | 2014-11-24 01:45:13 -0500 |
| commit | d666cd0246f78bda9fbf92a7ded20d1932078652 (patch) | |
| tree | 1da1dc83ed312922062c301e7681f1669904e184 /arch | |
| parent | ab81ce62178c14e883b8cfa9773b289f22e99489 (diff) | |
MIPS: bcm3384: Initial commit of bcm3384 platform support
This supports SMP Linux running on the BCM3384 Zephyr (BMIPS5000)
application processor, with fully functional UART and USB 1.1/2.0.
Device Tree is used to configure the following items:
- All peripherals
- Early console base address
- SMP or UP mode
- MIPS counter frequency
- Memory size / regions
- DMA offset
- Kernel command line
The DT-enabled bootloader and build instructions are posted at
https://github.com/Broadcom/aeolus
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Cc: f.fainelli@gmail.com
Cc: mbizon@freebox.fr
Cc: jogo@openwrt.org
Cc: jfraser@broadcom.com
Cc: linux-mips@linux-mips.org
Cc: devicetree@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/8170/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/mips/Kbuild.platforms | 1 | ||||
| -rw-r--r-- | arch/mips/Kconfig | 26 | ||||
| -rw-r--r-- | arch/mips/bcm3384/Makefile | 1 | ||||
| -rw-r--r-- | arch/mips/bcm3384/Platform | 7 | ||||
| -rw-r--r-- | arch/mips/bcm3384/dma.c | 81 | ||||
| -rw-r--r-- | arch/mips/bcm3384/irq.c | 193 | ||||
| -rw-r--r-- | arch/mips/bcm3384/setup.c | 97 | ||||
| -rw-r--r-- | arch/mips/boot/dts/Makefile | 1 | ||||
| -rw-r--r-- | arch/mips/boot/dts/bcm3384.dtsi | 109 | ||||
| -rw-r--r-- | arch/mips/boot/dts/bcm93384wvg.dts | 32 | ||||
| -rw-r--r-- | arch/mips/configs/bcm3384_defconfig | 78 | ||||
| -rw-r--r-- | arch/mips/include/asm/mach-bcm3384/dma-coherence.h | 48 | ||||
| -rw-r--r-- | arch/mips/include/asm/mach-bcm3384/war.h | 24 |
13 files changed, 698 insertions, 0 deletions
diff --git a/arch/mips/Kbuild.platforms b/arch/mips/Kbuild.platforms index f5e18bf3275e..7c507212025a 100644 --- a/arch/mips/Kbuild.platforms +++ b/arch/mips/Kbuild.platforms | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | platforms += alchemy | 3 | platforms += alchemy |
| 4 | platforms += ar7 | 4 | platforms += ar7 |
| 5 | platforms += ath79 | 5 | platforms += ath79 |
| 6 | platforms += bcm3384 | ||
| 6 | platforms += bcm47xx | 7 | platforms += bcm47xx |
| 7 | platforms += bcm63xx | 8 | platforms += bcm63xx |
| 8 | platforms += cavium-octeon | 9 | platforms += cavium-octeon |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 002cf4c56ebf..3afb795c0125 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
| @@ -116,6 +116,32 @@ config ATH79 | |||
| 116 | help | 116 | help |
| 117 | Support for the Atheros AR71XX/AR724X/AR913X SoCs. | 117 | Support for the Atheros AR71XX/AR724X/AR913X SoCs. |
| 118 | 118 | ||
| 119 | config BCM3384 | ||
| 120 | bool "Broadcom BCM3384 based boards" | ||
| 121 | select BOOT_RAW | ||
| 122 | select NO_EXCEPT_FILL | ||
| 123 | select USE_OF | ||
| 124 | select CEVT_R4K | ||
| 125 | select CSRC_R4K | ||
| 126 | select SYNC_R4K | ||
| 127 | select COMMON_CLK | ||
| 128 | select DMA_NONCOHERENT | ||
| 129 | select IRQ_CPU | ||
| 130 | select SYS_SUPPORTS_32BIT_KERNEL | ||
| 131 | select SYS_SUPPORTS_BIG_ENDIAN | ||
| 132 | select SYS_SUPPORTS_HIGHMEM | ||
| 133 | select SYS_HAS_CPU_BMIPS5000 | ||
| 134 | select SWAP_IO_SPACE | ||
| 135 | select USB_EHCI_BIG_ENDIAN_DESC | ||
| 136 | select USB_EHCI_BIG_ENDIAN_MMIO | ||
| 137 | select USB_OHCI_BIG_ENDIAN_DESC | ||
| 138 | select USB_OHCI_BIG_ENDIAN_MMIO | ||
| 139 | help | ||
| 140 | Support for BCM3384 based boards. BCM3384/BCM33843 is a cable modem | ||
| 141 | chipset with a Linux application processor that is often used to | ||
| 142 | provide Samba services, a CUPS print server, and/or advanced routing | ||
| 143 | features. | ||
| 144 | |||
| 119 | config BCM47XX | 145 | config BCM47XX |
| 120 | bool "Broadcom BCM47XX based boards" | 146 | bool "Broadcom BCM47XX based boards" |
| 121 | select ARCH_WANT_OPTIONAL_GPIOLIB | 147 | select ARCH_WANT_OPTIONAL_GPIOLIB |
diff --git a/arch/mips/bcm3384/Makefile b/arch/mips/bcm3384/Makefile new file mode 100644 index 000000000000..a393955cba08 --- /dev/null +++ b/arch/mips/bcm3384/Makefile | |||
| @@ -0,0 +1 @@ | |||
| obj-y += setup.o irq.o dma.o | |||
diff --git a/arch/mips/bcm3384/Platform b/arch/mips/bcm3384/Platform new file mode 100644 index 000000000000..8e1ca0819e1b --- /dev/null +++ b/arch/mips/bcm3384/Platform | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # | ||
| 2 | # Broadcom BCM3384 boards | ||
| 3 | # | ||
| 4 | platform-$(CONFIG_BCM3384) += bcm3384/ | ||
| 5 | cflags-$(CONFIG_BCM3384) += \ | ||
| 6 | -I$(srctree)/arch/mips/include/asm/mach-bcm3384/ | ||
| 7 | load-$(CONFIG_BCM3384) := 0xffffffff80010000 | ||
diff --git a/arch/mips/bcm3384/dma.c b/arch/mips/bcm3384/dma.c new file mode 100644 index 000000000000..ea42012fd4f5 --- /dev/null +++ b/arch/mips/bcm3384/dma.c | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 3 | * License. See the file "COPYING" in the main directory of this archive | ||
| 4 | * for more details. | ||
| 5 | * | ||
| 6 | * Copyright (C) 2014 Kevin Cernekee <cernekee@gmail.com> | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <linux/device.h> | ||
| 10 | #include <linux/dma-direction.h> | ||
| 11 | #include <linux/dma-mapping.h> | ||
| 12 | #include <linux/init.h> | ||
| 13 | #include <linux/mm.h> | ||
| 14 | #include <linux/of.h> | ||
| 15 | #include <linux/pci.h> | ||
| 16 | #include <linux/types.h> | ||
| 17 | #include <dma-coherence.h> | ||
| 18 | |||
| 19 | /* | ||
| 20 | * BCM3384 has configurable address translation windows which allow the | ||
| 21 | * peripherals' DMA addresses to be different from the Zephyr-visible | ||
| 22 | * physical addresses. e.g. usb_dma_addr = zephyr_pa ^ 0x08000000 | ||
| 23 | * | ||
| 24 | * If our DT "memory" node has a "dma-xor-mask" property we will enable this | ||
| 25 | * translation using the provided offset. | ||
| 26 | */ | ||
| 27 | static u32 bcm3384_dma_xor_mask; | ||
| 28 | static u32 bcm3384_dma_xor_limit = 0xffffffff; | ||
| 29 | |||
| 30 | /* | ||
| 31 | * PCI collapses the memory hole at 0x10000000 - 0x1fffffff. | ||
| 32 | * On systems with a dma-xor-mask, this range is guaranteed to live above | ||
| 33 | * the dma-xor-limit. | ||
| 34 | */ | ||
| 35 | #define BCM3384_MEM_HOLE_PA 0x10000000 | ||
| 36 | #define BCM3384_MEM_HOLE_SIZE 0x10000000 | ||
| 37 | |||
| 38 | static dma_addr_t bcm3384_phys_to_dma(struct device *dev, phys_addr_t pa) | ||
| 39 | { | ||
| 40 | if (dev && dev_is_pci(dev) && | ||
| 41 | pa >= (BCM3384_MEM_HOLE_PA + BCM3384_MEM_HOLE_SIZE)) | ||
| 42 | return pa - BCM3384_MEM_HOLE_SIZE; | ||
| 43 | if (pa <= bcm3384_dma_xor_limit) | ||
| 44 | return pa ^ bcm3384_dma_xor_mask; | ||
| 45 | return pa; | ||
| 46 | } | ||
| 47 | |||
| 48 | dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) | ||
| 49 | { | ||
| 50 | return bcm3384_phys_to_dma(dev, virt_to_phys(addr)); | ||
| 51 | } | ||
| 52 | |||
| 53 | dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page) | ||
| 54 | { | ||
| 55 | return bcm3384_phys_to_dma(dev, page_to_phys(page)); | ||
| 56 | } | ||
| 57 | |||
| 58 | unsigned long plat_dma_addr_to_phys(struct device *dev, dma_addr_t dma_addr) | ||
| 59 | { | ||
| 60 | if (dev && dev_is_pci(dev) && | ||
| 61 | dma_addr >= BCM3384_MEM_HOLE_PA) | ||
| 62 | return dma_addr + BCM3384_MEM_HOLE_SIZE; | ||
| 63 | if ((dma_addr ^ bcm3384_dma_xor_mask) <= bcm3384_dma_xor_limit) | ||
| 64 | return dma_addr ^ bcm3384_dma_xor_mask; | ||
| 65 | return dma_addr; | ||
| 66 | } | ||
| 67 | |||
| 68 | static int __init bcm3384_init_dma_xor(void) | ||
| 69 | { | ||
| 70 | struct device_node *np = of_find_node_by_type(NULL, "memory"); | ||
| 71 | |||
| 72 | if (!np) | ||
| 73 | return 0; | ||
| 74 | |||
| 75 | of_property_read_u32(np, "dma-xor-mask", &bcm3384_dma_xor_mask); | ||
| 76 | of_property_read_u32(np, "dma-xor-limit", &bcm3384_dma_xor_limit); | ||
| 77 | |||
| 78 | of_node_put(np); | ||
| 79 | return 0; | ||
| 80 | } | ||
| 81 | arch_initcall(bcm3384_init_dma_xor); | ||
diff --git a/arch/mips/bcm3384/irq.c b/arch/mips/bcm3384/irq.c new file mode 100644 index 000000000000..0fb5134fb832 --- /dev/null +++ b/arch/mips/bcm3384/irq.c | |||
| @@ -0,0 +1,193 @@ | |||
| 1 | /* | ||
| 2 | * This program is free software; you can redistribute it and/or modify it | ||
| 3 | * under the terms of the GNU General Public License version 2 as published | ||
| 4 | * by the Free Software Foundation. | ||
| 5 | * | ||
| 6 | * Partially based on arch/mips/ralink/irq.c | ||
| 7 | * | ||
| 8 | * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org> | ||
| 9 | * Copyright (C) 2013 John Crispin <blogic@openwrt.org> | ||
| 10 | * Copyright (C) 2014 Kevin Cernekee <cernekee@gmail.com> | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <linux/io.h> | ||
| 14 | #include <linux/bitops.h> | ||
| 15 | #include <linux/of_platform.h> | ||
| 16 | #include <linux/of_address.h> | ||
| 17 | #include <linux/of_irq.h> | ||
| 18 | #include <linux/irqdomain.h> | ||
| 19 | #include <linux/interrupt.h> | ||
| 20 | #include <linux/slab.h> | ||
| 21 | #include <linux/spinlock.h> | ||
| 22 | |||
| 23 | #include <asm/bmips.h> | ||
| 24 | #include <asm/irq_cpu.h> | ||
| 25 | #include <asm/mipsregs.h> | ||
| 26 | |||
| 27 | /* INTC register offsets */ | ||
| 28 | #define INTC_REG_ENABLE 0x00 | ||
| 29 | #define INTC_REG_STATUS 0x04 | ||
| 30 | |||
| 31 | #define MAX_WORDS 2 | ||
| 32 | #define IRQS_PER_WORD 32 | ||
| 33 | |||
| 34 | struct bcm3384_intc { | ||
| 35 | int n_words; | ||
| 36 | void __iomem *reg[MAX_WORDS]; | ||
| 37 | u32 enable[MAX_WORDS]; | ||
| 38 | spinlock_t lock; | ||
| 39 | }; | ||
| 40 | |||
| 41 | static void bcm3384_intc_irq_unmask(struct irq_data *d) | ||
| 42 | { | ||
| 43 | struct bcm3384_intc *priv = d->domain->host_data; | ||
| 44 | unsigned long flags; | ||
| 45 | int idx = d->hwirq / IRQS_PER_WORD; | ||
| 46 | int bit = d->hwirq % IRQS_PER_WORD; | ||
| 47 | |||
| 48 | spin_lock_irqsave(&priv->lock, flags); | ||
| 49 | priv->enable[idx] |= BIT(bit); | ||
| 50 | __raw_writel(priv->enable[idx], priv->reg[idx] + INTC_REG_ENABLE); | ||
| 51 | spin_unlock_irqrestore(&priv->lock, flags); | ||
| 52 | } | ||
| 53 | |||
| 54 | static void bcm3384_intc_irq_mask(struct irq_data *d) | ||
| 55 | { | ||
| 56 | struct bcm3384_intc *priv = d->domain->host_data; | ||
| 57 | unsigned long flags; | ||
| 58 | int idx = d->hwirq / IRQS_PER_WORD; | ||
| 59 | int bit = d->hwirq % IRQS_PER_WORD; | ||
| 60 | |||
| 61 | spin_lock_irqsave(&priv->lock, flags); | ||
| 62 | priv->enable[idx] &= ~BIT(bit); | ||
| 63 | __raw_writel(priv->enable[idx], priv->reg[idx] + INTC_REG_ENABLE); | ||
| 64 | spin_unlock_irqrestore(&priv->lock, flags); | ||
| 65 | } | ||
| 66 | |||
| 67 | static struct irq_chip bcm3384_intc_irq_chip = { | ||
| 68 | .name = "INTC", | ||
| 69 | .irq_unmask = bcm3384_intc_irq_unmask, | ||
| 70 | .irq_mask = bcm3384_intc_irq_mask, | ||
| 71 | .irq_mask_ack = bcm3384_intc_irq_mask, | ||
| 72 | }; | ||
| 73 | |||
| 74 | unsigned int get_c0_compare_int(void) | ||
| 75 | { | ||
| 76 | return CP0_LEGACY_COMPARE_IRQ; | ||
| 77 | } | ||
| 78 | |||
| 79 | static void bcm3384_intc_irq_handler(unsigned int irq, struct irq_desc *desc) | ||
| 80 | { | ||
| 81 | struct irq_domain *domain = irq_get_handler_data(irq); | ||
| 82 | struct bcm3384_intc *priv = domain->host_data; | ||
| 83 | unsigned long flags; | ||
| 84 | unsigned int idx; | ||
| 85 | |||
| 86 | for (idx = 0; idx < priv->n_words; idx++) { | ||
| 87 | unsigned long pending; | ||
| 88 | int hwirq; | ||
| 89 | |||
| 90 | spin_lock_irqsave(&priv->lock, flags); | ||
| 91 | pending = __raw_readl(priv->reg[idx] + INTC_REG_STATUS) & | ||
| 92 | priv->enable[idx]; | ||
| 93 | spin_unlock_irqrestore(&priv->lock, flags); | ||
| 94 | |||
| 95 | for_each_set_bit(hwirq, &pending, IRQS_PER_WORD) { | ||
| 96 | generic_handle_irq(irq_find_mapping(domain, | ||
| 97 | hwirq + idx * IRQS_PER_WORD)); | ||
| 98 | } | ||
| 99 | } | ||
| 100 | } | ||
| 101 | |||
| 102 | asmlinkage void plat_irq_dispatch(void) | ||
| 103 | { | ||
| 104 | unsigned long pending = | ||
| 105 | (read_c0_status() & read_c0_cause() & ST0_IM) >> STATUSB_IP0; | ||
| 106 | int bit; | ||
| 107 | |||
| 108 | for_each_set_bit(bit, &pending, 8) | ||
| 109 | do_IRQ(MIPS_CPU_IRQ_BASE + bit); | ||
| 110 | } | ||
| 111 | |||
| 112 | static int intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) | ||
| 113 | { | ||
| 114 | irq_set_chip_and_handler(irq, &bcm3384_intc_irq_chip, handle_level_irq); | ||
| 115 | return 0; | ||
| 116 | } | ||
| 117 | |||
| 118 | static const struct irq_domain_ops irq_domain_ops = { | ||
| 119 | .xlate = irq_domain_xlate_onecell, | ||
| 120 | .map = intc_map, | ||
| 121 | }; | ||
| 122 | |||
| 123 | static int __init ioremap_one_pair(struct bcm3384_intc *priv, | ||
| 124 | struct device_node *node, | ||
| 125 | int idx) | ||
| 126 | { | ||
| 127 | struct resource res; | ||
| 128 | |||
| 129 | if (of_address_to_resource(node, idx, &res)) | ||
| 130 | return 0; | ||
| 131 | |||
| 132 | if (request_mem_region(res.start, resource_size(&res), | ||
| 133 | res.name) < 0) | ||
| 134 | pr_err("Failed to request INTC register region\n"); | ||
| 135 | |||
| 136 | priv->reg[idx] = ioremap_nocache(res.start, resource_size(&res)); | ||
| 137 | if (!priv->reg[idx]) | ||
| 138 | panic("Failed to ioremap INTC register range"); | ||
| 139 | |||
| 140 | /* start up with everything masked before we hook the parent IRQ */ | ||
| 141 | __raw_writel(0, priv->reg[idx] + INTC_REG_ENABLE); | ||
| 142 | priv->enable[idx] = 0; | ||
| 143 | |||
| 144 | return IRQS_PER_WORD; | ||
| 145 | } | ||
| 146 | |||
| 147 | static int __init intc_of_init(struct device_node *node, | ||
| 148 | struct device_node *parent) | ||
| 149 | { | ||
| 150 | struct irq_domain *domain; | ||
| 151 | unsigned int parent_irq, n_irqs = 0; | ||
| 152 | struct bcm3384_intc *priv; | ||
| 153 | |||
| 154 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
| 155 | if (!priv) | ||
| 156 | panic("Failed to allocate bcm3384_intc struct"); | ||
| 157 | |||
| 158 | spin_lock_init(&priv->lock); | ||
| 159 | |||
| 160 | parent_irq = irq_of_parse_and_map(node, 0); | ||
| 161 | if (!parent_irq) | ||
| 162 | panic("Failed to get INTC IRQ"); | ||
| 163 | |||
| 164 | n_irqs += ioremap_one_pair(priv, node, 0); | ||
| 165 | n_irqs += ioremap_one_pair(priv, node, 1); | ||
| 166 | |||
| 167 | if (!n_irqs) | ||
| 168 | panic("Failed to map INTC registers"); | ||
| 169 | |||
| 170 | priv->n_words = n_irqs / IRQS_PER_WORD; | ||
| 171 | domain = irq_domain_add_linear(node, n_irqs, &irq_domain_ops, priv); | ||
| 172 | if (!domain) | ||
| 173 | panic("Failed to add irqdomain"); | ||
| 174 | |||
| 175 | irq_set_chained_handler(parent_irq, bcm3384_intc_irq_handler); | ||
| 176 | irq_set_handler_data(parent_irq, domain); | ||
| 177 | |||
| 178 | return 0; | ||
| 179 | } | ||
| 180 | |||
| 181 | static struct of_device_id of_irq_ids[] __initdata = { | ||
| 182 | { .compatible = "mti,cpu-interrupt-controller", | ||
| 183 | .data = mips_cpu_intc_init }, | ||
| 184 | { .compatible = "brcm,bcm3384-intc", | ||
| 185 | .data = intc_of_init }, | ||
| 186 | {}, | ||
| 187 | }; | ||
| 188 | |||
| 189 | void __init arch_init_irq(void) | ||
| 190 | { | ||
| 191 | bmips_tp1_irqs = 0; | ||
| 192 | of_irq_init(of_irq_ids); | ||
| 193 | } | ||
diff --git a/arch/mips/bcm3384/setup.c b/arch/mips/bcm3384/setup.c new file mode 100644 index 000000000000..d84b8400b874 --- /dev/null +++ b/arch/mips/bcm3384/setup.c | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | /* | ||
| 2 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 3 | * License. See the file "COPYING" in the main directory of this archive | ||
| 4 | * for more details. | ||
| 5 | * | ||
| 6 | * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> | ||
| 7 | * Copyright (C) 2014 Kevin Cernekee <cernekee@gmail.com> | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <linux/init.h> | ||
| 11 | #include <linux/bootmem.h> | ||
| 12 | #include <linux/clk-provider.h> | ||
| 13 | #include <linux/ioport.h> | ||
| 14 | #include <linux/of.h> | ||
| 15 | #include <linux/of_fdt.h> | ||
| 16 | #include <linux/of_platform.h> | ||
| 17 | #include <linux/smp.h> | ||
| 18 | #include <asm/addrspace.h> | ||
| 19 | #include <asm/bmips.h> | ||
| 20 | #include <asm/bootinfo.h> | ||
| 21 | #include <asm/prom.h> | ||
| 22 | #include <asm/smp-ops.h> | ||
| 23 | #include <asm/time.h> | ||
| 24 | |||
| 25 | void __init prom_init(void) | ||
| 26 | { | ||
| 27 | register_bmips_smp_ops(); | ||
| 28 | } | ||
| 29 | |||
| 30 | void __init prom_free_prom_memory(void) | ||
| 31 | { | ||
| 32 | } | ||
| 33 | |||
| 34 | const char *get_system_type(void) | ||
| 35 | { | ||
| 36 | return "BCM3384"; | ||
| 37 | } | ||
| 38 | |||
| 39 | void __init plat_time_init(void) | ||
| 40 | { | ||
| 41 | struct device_node *np; | ||
| 42 | u32 freq; | ||
| 43 | |||
| 44 | np = of_find_node_by_name(NULL, "cpus"); | ||
| 45 | if (!np) | ||
| 46 | panic("missing 'cpus' DT node"); | ||
| 47 | if (of_property_read_u32(np, "mips-hpt-frequency", &freq) < 0) | ||
| 48 | panic("missing 'mips-hpt-frequency' property"); | ||
| 49 | of_node_put(np); | ||
| 50 | |||
| 51 | mips_hpt_frequency = freq; | ||
| 52 | } | ||
| 53 | |||
| 54 | void __init plat_mem_setup(void) | ||
| 55 | { | ||
| 56 | void *dtb = __dtb_start; | ||
| 57 | |||
| 58 | set_io_port_base(0); | ||
| 59 | ioport_resource.start = 0; | ||
| 60 | ioport_resource.end = ~0; | ||
| 61 | |||
| 62 | /* intended to somewhat resemble ARM; see Documentation/arm/Booting */ | ||
| 63 | if (fw_arg0 == 0 && fw_arg1 == 0xffffffff) | ||
| 64 | dtb = phys_to_virt(fw_arg2); | ||
| 65 | |||
| 66 | __dt_setup_arch(dtb); | ||
| 67 | |||
| 68 | strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); | ||
| 69 | } | ||
| 70 | |||
| 71 | void __init device_tree_init(void) | ||
| 72 | { | ||
| 73 | struct device_node *np; | ||
| 74 | |||
| 75 | unflatten_and_copy_device_tree(); | ||
| 76 | |||
| 77 | /* Disable SMP boot unless both CPUs are listed in DT and !disabled */ | ||
| 78 | np = of_find_node_by_name(NULL, "cpus"); | ||
| 79 | if (np && of_get_available_child_count(np) <= 1) | ||
| 80 | bmips_smp_enabled = 0; | ||
| 81 | of_node_put(np); | ||
| 82 | } | ||
| 83 | |||
| 84 | int __init plat_of_setup(void) | ||
| 85 | { | ||
| 86 | return __dt_register_buses("brcm,bcm3384", "simple-bus"); | ||
| 87 | } | ||
| 88 | |||
| 89 | arch_initcall(plat_of_setup); | ||
| 90 | |||
| 91 | static int __init plat_dev_init(void) | ||
| 92 | { | ||
| 93 | of_clk_init(NULL); | ||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | |||
| 97 | device_initcall(plat_dev_init); | ||
diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile index ca9c90e2cabf..4f49fa477f14 100644 --- a/arch/mips/boot/dts/Makefile +++ b/arch/mips/boot/dts/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | dtb-$(CONFIG_BCM3384) += bcm93384wvg.dtb | ||
| 1 | dtb-$(CONFIG_CAVIUM_OCTEON_SOC) += octeon_3xxx.dtb octeon_68xx.dtb | 2 | dtb-$(CONFIG_CAVIUM_OCTEON_SOC) += octeon_3xxx.dtb octeon_68xx.dtb |
| 2 | dtb-$(CONFIG_DT_EASY50712) += easy50712.dtb | 3 | dtb-$(CONFIG_DT_EASY50712) += easy50712.dtb |
| 3 | dtb-$(CONFIG_DT_XLP_EVP) += xlp_evp.dtb | 4 | dtb-$(CONFIG_DT_XLP_EVP) += xlp_evp.dtb |
diff --git a/arch/mips/boot/dts/bcm3384.dtsi b/arch/mips/boot/dts/bcm3384.dtsi new file mode 100644 index 000000000000..21b074a99c94 --- /dev/null +++ b/arch/mips/boot/dts/bcm3384.dtsi | |||
| @@ -0,0 +1,109 @@ | |||
| 1 | / { | ||
| 2 | #address-cells = <1>; | ||
| 3 | #size-cells = <1>; | ||
| 4 | compatible = "brcm,bcm3384", "brcm,bcm33843"; | ||
| 5 | |||
| 6 | cpus { | ||
| 7 | #address-cells = <1>; | ||
| 8 | #size-cells = <0>; | ||
| 9 | |||
| 10 | /* On BMIPS5000 this is 1/8th of the CPU core clock */ | ||
| 11 | mips-hpt-frequency = <100000000>; | ||
| 12 | |||
| 13 | cpu@0 { | ||
| 14 | compatible = "brcm,bmips5000"; | ||
| 15 | device_type = "cpu"; | ||
| 16 | reg = <0>; | ||
| 17 | }; | ||
| 18 | |||
| 19 | cpu@1 { | ||
| 20 | compatible = "brcm,bmips5000"; | ||
| 21 | device_type = "cpu"; | ||
| 22 | reg = <1>; | ||
| 23 | }; | ||
| 24 | }; | ||
| 25 | |||
| 26 | clocks { | ||
| 27 | #address-cells = <1>; | ||
| 28 | #size-cells = <0>; | ||
| 29 | |||
| 30 | periph_clk: periph_clk@0 { | ||
| 31 | compatible = "fixed-clock"; | ||
| 32 | #clock-cells = <0>; | ||
| 33 | clock-frequency = <54000000>; | ||
| 34 | }; | ||
| 35 | }; | ||
| 36 | |||
| 37 | aliases { | ||
| 38 | uart0 = &uart0; | ||
| 39 | }; | ||
| 40 | |||
| 41 | cpu_intc: cpu_intc@0 { | ||
| 42 | #address-cells = <0>; | ||
| 43 | compatible = "mti,cpu-interrupt-controller"; | ||
| 44 | |||
| 45 | interrupt-controller; | ||
| 46 | #interrupt-cells = <1>; | ||
| 47 | }; | ||
| 48 | |||
| 49 | periph_intc: periph_intc@14e00038 { | ||
| 50 | compatible = "brcm,bcm3384-intc"; | ||
| 51 | reg = <0x14e00038 0x8 0x14e00340 0x8>; | ||
| 52 | |||
| 53 | interrupt-controller; | ||
| 54 | #interrupt-cells = <1>; | ||
| 55 | |||
| 56 | interrupt-parent = <&cpu_intc>; | ||
| 57 | interrupts = <4>; | ||
| 58 | }; | ||
| 59 | |||
| 60 | zmips_intc: zmips_intc@104b0060 { | ||
| 61 | compatible = "brcm,bcm3384-intc"; | ||
| 62 | reg = <0x104b0060 0x8>; | ||
| 63 | |||
| 64 | interrupt-controller; | ||
| 65 | #interrupt-cells = <1>; | ||
| 66 | |||
| 67 | interrupt-parent = <&periph_intc>; | ||
| 68 | interrupts = <29>; | ||
| 69 | }; | ||
| 70 | |||
| 71 | iop_intc: iop_intc@14e00058 { | ||
| 72 | compatible = "brcm,bcm3384-intc"; | ||
| 73 | reg = <0x14e00058 0x8>; | ||
| 74 | |||
| 75 | interrupt-controller; | ||
| 76 | #interrupt-cells = <1>; | ||
| 77 | |||
| 78 | interrupt-parent = <&cpu_intc>; | ||
| 79 | interrupts = <6>; | ||
| 80 | }; | ||
| 81 | |||
| 82 | uart0: serial@14e00520 { | ||
| 83 | compatible = "brcm,bcm6345-uart"; | ||
| 84 | reg = <0x14e00520 0x18>; | ||
| 85 | interrupt-parent = <&periph_intc>; | ||
| 86 | interrupts = <2>; | ||
| 87 | clocks = <&periph_clk>; | ||
| 88 | status = "disabled"; | ||
| 89 | }; | ||
| 90 | |||
| 91 | ehci0: usb@15400300 { | ||
| 92 | compatible = "brcm,bcm3384-ehci", "generic-ehci"; | ||
| 93 | reg = <0x15400300 0x100>; | ||
| 94 | big-endian; | ||
| 95 | interrupt-parent = <&periph_intc>; | ||
| 96 | interrupts = <41>; | ||
| 97 | status = "disabled"; | ||
| 98 | }; | ||
| 99 | |||
| 100 | ohci0: usb@15400400 { | ||
| 101 | compatible = "brcm,bcm3384-ohci", "generic-ohci"; | ||
| 102 | reg = <0x15400400 0x100>; | ||
| 103 | big-endian; | ||
| 104 | no-big-frame-no; | ||
| 105 | interrupt-parent = <&periph_intc>; | ||
| 106 | interrupts = <40>; | ||
| 107 | status = "disabled"; | ||
| 108 | }; | ||
| 109 | }; | ||
diff --git a/arch/mips/boot/dts/bcm93384wvg.dts b/arch/mips/boot/dts/bcm93384wvg.dts new file mode 100644 index 000000000000..831741179212 --- /dev/null +++ b/arch/mips/boot/dts/bcm93384wvg.dts | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | /dts-v1/; | ||
| 2 | |||
| 3 | /include/ "bcm3384.dtsi" | ||
| 4 | |||
| 5 | / { | ||
| 6 | compatible = "brcm,bcm93384wvg", "brcm,bcm3384"; | ||
| 7 | model = "Broadcom BCM93384WVG"; | ||
| 8 | |||
| 9 | chosen { | ||
| 10 | bootargs = "console=ttyS0,115200"; | ||
| 11 | stdout-path = &uart0; | ||
| 12 | }; | ||
| 13 | |||
| 14 | memory@0 { | ||
| 15 | device_type = "memory"; | ||
| 16 | reg = <0x0 0x04000000>; | ||
| 17 | dma-xor-mask = <0x08000000>; | ||
| 18 | dma-xor-limit = <0x0fffffff>; | ||
| 19 | }; | ||
| 20 | }; | ||
| 21 | |||
| 22 | &uart0 { | ||
| 23 | status = "okay"; | ||
| 24 | }; | ||
| 25 | |||
| 26 | &ehci0 { | ||
| 27 | status = "okay"; | ||
| 28 | }; | ||
| 29 | |||
| 30 | &ohci0 { | ||
| 31 | status = "okay"; | ||
| 32 | }; | ||
diff --git a/arch/mips/configs/bcm3384_defconfig b/arch/mips/configs/bcm3384_defconfig new file mode 100644 index 000000000000..88711c28ff32 --- /dev/null +++ b/arch/mips/configs/bcm3384_defconfig | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | CONFIG_BCM3384=y | ||
| 2 | CONFIG_HIGHMEM=y | ||
| 3 | CONFIG_SMP=y | ||
| 4 | CONFIG_NR_CPUS=4 | ||
| 5 | # CONFIG_SECCOMP is not set | ||
| 6 | CONFIG_MIPS_O32_FP64_SUPPORT=y | ||
| 7 | # CONFIG_LOCALVERSION_AUTO is not set | ||
| 8 | # CONFIG_SWAP is not set | ||
| 9 | CONFIG_NO_HZ=y | ||
| 10 | CONFIG_BLK_DEV_INITRD=y | ||
| 11 | # CONFIG_RD_GZIP is not set | ||
| 12 | CONFIG_EXPERT=y | ||
| 13 | # CONFIG_VM_EVENT_COUNTERS is not set | ||
| 14 | # CONFIG_SLUB_DEBUG is not set | ||
| 15 | # CONFIG_BLK_DEV_BSG is not set | ||
| 16 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 17 | # CONFIG_IOSCHED_CFQ is not set | ||
| 18 | CONFIG_NET=y | ||
| 19 | CONFIG_PACKET=y | ||
| 20 | CONFIG_PACKET_DIAG=y | ||
| 21 | CONFIG_UNIX=y | ||
| 22 | CONFIG_INET=y | ||
| 23 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | ||
| 24 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | ||
| 25 | # CONFIG_INET_XFRM_MODE_BEET is not set | ||
| 26 | # CONFIG_INET_LRO is not set | ||
| 27 | # CONFIG_INET_DIAG is not set | ||
| 28 | CONFIG_CFG80211=y | ||
| 29 | CONFIG_NL80211_TESTMODE=y | ||
| 30 | CONFIG_MAC80211=y | ||
| 31 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
| 32 | CONFIG_DEVTMPFS=y | ||
| 33 | CONFIG_DEVTMPFS_MOUNT=y | ||
| 34 | # CONFIG_STANDALONE is not set | ||
| 35 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | ||
| 36 | CONFIG_MTD=y | ||
| 37 | CONFIG_MTD_CFI=y | ||
| 38 | CONFIG_MTD_CFI_INTELEXT=y | ||
| 39 | CONFIG_MTD_CFI_AMDSTD=y | ||
| 40 | CONFIG_MTD_PHYSMAP=y | ||
| 41 | # CONFIG_BLK_DEV is not set | ||
| 42 | CONFIG_SCSI=y | ||
| 43 | CONFIG_BLK_DEV_SD=y | ||
| 44 | # CONFIG_SCSI_LOWLEVEL is not set | ||
| 45 | CONFIG_NETDEVICES=y | ||
| 46 | CONFIG_USB_USBNET=y | ||
| 47 | # CONFIG_INPUT is not set | ||
| 48 | # CONFIG_SERIO is not set | ||
| 49 | # CONFIG_VT is not set | ||
| 50 | # CONFIG_DEVKMEM is not set | ||
| 51 | CONFIG_SERIAL_EARLYCON_FORCE=y | ||
| 52 | CONFIG_SERIAL_BCM63XX=y | ||
| 53 | CONFIG_SERIAL_BCM63XX_CONSOLE=y | ||
| 54 | # CONFIG_HW_RANDOM is not set | ||
| 55 | # CONFIG_HWMON is not set | ||
| 56 | CONFIG_USB=y | ||
| 57 | CONFIG_USB_EHCI_HCD=y | ||
| 58 | # CONFIG_USB_EHCI_TT_NEWSCHED is not set | ||
| 59 | CONFIG_USB_EHCI_HCD_PLATFORM=y | ||
| 60 | CONFIG_USB_OHCI_HCD=y | ||
| 61 | CONFIG_USB_OHCI_HCD_PLATFORM=y | ||
| 62 | CONFIG_USB_STORAGE=y | ||
| 63 | CONFIG_EXT4_FS=y | ||
| 64 | CONFIG_EXT4_FS_POSIX_ACL=y | ||
| 65 | CONFIG_EXT4_FS_SECURITY=y | ||
| 66 | # CONFIG_DNOTIFY is not set | ||
| 67 | CONFIG_FUSE_FS=y | ||
| 68 | CONFIG_VFAT_FS=y | ||
| 69 | CONFIG_PROC_KCORE=y | ||
| 70 | CONFIG_TMPFS=y | ||
| 71 | CONFIG_NFS_FS=y | ||
| 72 | CONFIG_CIFS=y | ||
| 73 | CONFIG_NLS_CODEPAGE_437=y | ||
| 74 | CONFIG_NLS_ASCII=y | ||
| 75 | CONFIG_NLS_ISO8859_1=y | ||
| 76 | CONFIG_DEBUG_FS=y | ||
| 77 | CONFIG_MAGIC_SYSRQ=y | ||
| 78 | # CONFIG_CRYPTO_HW is not set | ||
diff --git a/arch/mips/include/asm/mach-bcm3384/dma-coherence.h b/arch/mips/include/asm/mach-bcm3384/dma-coherence.h new file mode 100644 index 000000000000..a3be8e50e1f0 --- /dev/null +++ b/arch/mips/include/asm/mach-bcm3384/dma-coherence.h | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org> | ||
| 3 | * Copyright (C) 2009 Broadcom Corporation | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __ASM_MACH_BCM3384_DMA_COHERENCE_H | ||
| 16 | #define __ASM_MACH_BCM3384_DMA_COHERENCE_H | ||
| 17 | |||
| 18 | struct device; | ||
| 19 | |||
| 20 | extern dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size); | ||
| 21 | extern dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page); | ||
| 22 | extern unsigned long plat_dma_addr_to_phys(struct device *dev, | ||
| 23 | dma_addr_t dma_addr); | ||
| 24 | |||
| 25 | static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr, | ||
| 26 | size_t size, enum dma_data_direction direction) | ||
| 27 | { | ||
| 28 | } | ||
| 29 | |||
| 30 | static inline int plat_dma_supported(struct device *dev, u64 mask) | ||
| 31 | { | ||
| 32 | /* | ||
| 33 | * we fall back to GFP_DMA when the mask isn't all 1s, | ||
| 34 | * so we can't guarantee allocations that must be | ||
| 35 | * within a tighter range than GFP_DMA.. | ||
| 36 | */ | ||
| 37 | if (mask < DMA_BIT_MASK(24)) | ||
| 38 | return 0; | ||
| 39 | |||
| 40 | return 1; | ||
| 41 | } | ||
| 42 | |||
| 43 | static inline int plat_device_is_coherent(struct device *dev) | ||
| 44 | { | ||
| 45 | return 0; | ||
| 46 | } | ||
| 47 | |||
| 48 | #endif /* __ASM_MACH_BCM3384_DMA_COHERENCE_H */ | ||
diff --git a/arch/mips/include/asm/mach-bcm3384/war.h b/arch/mips/include/asm/mach-bcm3384/war.h new file mode 100644 index 000000000000..59d7599059b0 --- /dev/null +++ b/arch/mips/include/asm/mach-bcm3384/war.h | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | /* | ||
| 2 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 3 | * License. See the file "COPYING" in the main directory of this archive | ||
| 4 | * for more details. | ||
| 5 | * | ||
| 6 | * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org> | ||
| 7 | */ | ||
| 8 | #ifndef __ASM_MIPS_MACH_BCM3384_WAR_H | ||
| 9 | #define __ASM_MIPS_MACH_BCM3384_WAR_H | ||
| 10 | |||
| 11 | #define R4600_V1_INDEX_ICACHEOP_WAR 0 | ||
| 12 | #define R4600_V1_HIT_CACHEOP_WAR 0 | ||
| 13 | #define R4600_V2_HIT_CACHEOP_WAR 0 | ||
| 14 | #define R5432_CP0_INTERRUPT_WAR 0 | ||
| 15 | #define BCM1250_M3_WAR 0 | ||
| 16 | #define SIBYTE_1956_WAR 0 | ||
| 17 | #define MIPS4K_ICACHE_REFILL_WAR 0 | ||
| 18 | #define MIPS_CACHE_SYNC_WAR 0 | ||
| 19 | #define TX49XX_ICACHE_INDEX_INV_WAR 0 | ||
| 20 | #define ICACHE_REFILLS_WORKAROUND_WAR 0 | ||
| 21 | #define R10000_LLSC_WAR 0 | ||
| 22 | #define MIPS34K_MISSED_ITLB_WAR 0 | ||
| 23 | |||
| 24 | #endif /* __ASM_MIPS_MACH_BCM3384_WAR_H */ | ||
