aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Arlott <simon@fire.lp0.eu>2012-05-26 03:04:43 -0400
committerStephen Warren <swarren@wwwdotorg.org>2012-09-19 21:08:27 -0400
commitec9653b8476bf526dde7bdefbc2be6b7aaa34db7 (patch)
tree648b35803beb4ae30ad11ae1932645fc31fe0b0b
parent55d512e245bc7699a8800e23df1a24195dd08217 (diff)
ARM: add infra-structure for BCM2835 and Raspberry Pi
The BCM2835 is an ARM SoC from Broadcom. This patch adds very basic support for this SoC. http://www.broadcom.com/products/BCM2835 http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf Note that the documentation in the latter .pdf assumes the MMU setup that's used on the "VideoCore" companion processor, and does not document physical peripheral addresses. Subtract 0x5e000000 to obtain the physical addresses. This is accounted for by the ranges property in the /soc node in the device tree. The BCM2835 SoC is used in the Raspberry Pi. This patch also adds a minimal device tree for this board; enough to see some very early kernel boot messages through earlyprintk. However, this patch does not yet provide a useful booting system. http://www.raspberrypi.org/. This patch was extracted from git://github.com/lp0/linux.git branch rpi-split from 3-4 months ago, and significantly stripped down and modified since. Signed-off-by: Chris Boot <bootc@bootc.net> Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Signed-off-by: Dom Cobley <popcornmix@gmail.com> Signed-off-by: Dom Cobley <dc4@broadcom.com> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Acked-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--Documentation/devicetree/bindings/arm/bcm2835.txt8
-rw-r--r--Documentation/devicetree/bindings/vendor-prefixes.txt1
-rw-r--r--arch/arm/Kconfig17
-rw-r--r--arch/arm/Makefile1
-rw-r--r--arch/arm/boot/dts/bcm2835-rpi-b.dts12
-rw-r--r--arch/arm/boot/dts/bcm2835.dtsi17
-rw-r--r--arch/arm/configs/bcm2835_defconfig95
-rw-r--r--arch/arm/mach-bcm2835/Makefile1
-rw-r--r--arch/arm/mach-bcm2835/Makefile.boot5
-rw-r--r--arch/arm/mach-bcm2835/bcm2835.c77
-rw-r--r--arch/arm/mach-bcm2835/include/mach/bcm2835_soc.h29
-rw-r--r--arch/arm/mach-bcm2835/include/mach/debug-macro.S21
-rw-r--r--arch/arm/mach-bcm2835/include/mach/timex.h26
-rw-r--r--arch/arm/mach-bcm2835/include/mach/uncompress.h45
14 files changed, 355 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/arm/bcm2835.txt b/Documentation/devicetree/bindings/arm/bcm2835.txt
new file mode 100644
index 000000000000..ac683480c486
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/bcm2835.txt
@@ -0,0 +1,8 @@
1Broadcom BCM2835 device tree bindings
2-------------------------------------------
3
4Boards with the BCM2835 SoC shall have the following properties:
5
6Required root node property:
7
8compatible = "brcm,bcm2835";
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index db4d3af3643c..4f293e5571f0 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -10,6 +10,7 @@ apm Applied Micro Circuits Corporation (APM)
10arm ARM Ltd. 10arm ARM Ltd.
11atmel Atmel Corporation 11atmel Atmel Corporation
12bosch Bosch Sensortec GmbH 12bosch Bosch Sensortec GmbH
13brcm Broadcom Corporation
13cavium Cavium, Inc. 14cavium Cavium, Inc.
14chrp Common Hardware Reference Platform 15chrp Common Hardware Reference Platform
15cortina Cortina Systems, Inc. 16cortina Cortina Systems, Inc.
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2f88d8d97701..6524497609fa 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -350,6 +350,23 @@ config ARCH_AT91
350 This enables support for systems based on Atmel 350 This enables support for systems based on Atmel
351 AT91RM9200 and AT91SAM9* processors. 351 AT91RM9200 and AT91SAM9* processors.
352 352
353config ARCH_BCM2835
354 bool "Broadcom BCM2835 family"
355 select ARCH_WANT_OPTIONAL_GPIOLIB
356 select ARM_AMBA
357 select ARM_ERRATA_411920
358 select ARM_TIMER_SP804
359 select CLKDEV_LOOKUP
360 select COMMON_CLK
361 select CPU_V6
362 select GENERIC_CLOCKEVENTS
363 select MULTI_IRQ_HANDLER
364 select SPARSE_IRQ
365 select USE_OF
366 help
367 This enables support for the Broadcom BCM2835 SoC. This SoC is
368 use in the Raspberry Pi, and Roku 2 devices.
369
353config ARCH_BCMRING 370config ARCH_BCMRING
354 bool "Broadcom BCMRING" 371 bool "Broadcom BCMRING"
355 depends on MMU 372 depends on MMU
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 30eae87ead6d..17b0d5fc0c84 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -136,6 +136,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
136# Machine directory name. This list is sorted alphanumerically 136# Machine directory name. This list is sorted alphanumerically
137# by CONFIG_* macro name. 137# by CONFIG_* macro name.
138machine-$(CONFIG_ARCH_AT91) := at91 138machine-$(CONFIG_ARCH_AT91) := at91
139machine-$(CONFIG_ARCH_BCM2835) := bcm2835
139machine-$(CONFIG_ARCH_BCMRING) := bcmring 140machine-$(CONFIG_ARCH_BCMRING) := bcmring
140machine-$(CONFIG_ARCH_CLPS711X) := clps711x 141machine-$(CONFIG_ARCH_CLPS711X) := clps711x
141machine-$(CONFIG_ARCH_CNS3XXX) := cns3xxx 142machine-$(CONFIG_ARCH_CNS3XXX) := cns3xxx
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
new file mode 100644
index 000000000000..7dd860f83f96
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -0,0 +1,12 @@
1/dts-v1/;
2/memreserve/ 0x0c000000 0x04000000;
3/include/ "bcm2835.dtsi"
4
5/ {
6 compatible = "raspberrypi,model-b", "brcm,bcm2835";
7 model = "Raspberry Pi Model B";
8
9 memory {
10 reg = <0 0x10000000>;
11 };
12};
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
new file mode 100644
index 000000000000..a31cb40ef684
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -0,0 +1,17 @@
1/include/ "skeleton.dtsi"
2
3/ {
4 compatible = "brcm,bcm2835";
5 model = "BCM2835";
6
7 chosen {
8 bootargs = "earlyprintk";
9 };
10
11 soc {
12 compatible = "simple-bus";
13 #address-cells = <1>;
14 #size-cells = <1>;
15 ranges = <0x7e000000 0x20000000 0x02000000>;
16 };
17};
diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig
new file mode 100644
index 000000000000..7aea70253c63
--- /dev/null
+++ b/arch/arm/configs/bcm2835_defconfig
@@ -0,0 +1,95 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y
4CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_BSD_PROCESS_ACCT_V3=y
6CONFIG_FHANDLE=y
7CONFIG_NO_HZ=y
8CONFIG_HIGH_RES_TIMERS=y
9CONFIG_LOG_BUF_SHIFT=18
10CONFIG_CGROUP_FREEZER=y
11CONFIG_CGROUP_DEVICE=y
12CONFIG_CPUSETS=y
13CONFIG_CGROUP_CPUACCT=y
14CONFIG_RESOURCE_COUNTERS=y
15CONFIG_CGROUP_PERF=y
16CONFIG_CFS_BANDWIDTH=y
17CONFIG_RT_GROUP_SCHED=y
18CONFIG_NAMESPACES=y
19CONFIG_SCHED_AUTOGROUP=y
20CONFIG_RELAY=y
21CONFIG_BLK_DEV_INITRD=y
22CONFIG_RD_BZIP2=y
23CONFIG_RD_LZMA=y
24CONFIG_RD_XZ=y
25CONFIG_RD_LZO=y
26CONFIG_CC_OPTIMIZE_FOR_SIZE=y
27CONFIG_KALLSYMS_ALL=y
28CONFIG_EMBEDDED=y
29# CONFIG_COMPAT_BRK is not set
30CONFIG_PROFILING=y
31CONFIG_OPROFILE=y
32CONFIG_JUMP_LABEL=y
33# CONFIG_BLOCK is not set
34CONFIG_ARCH_BCM2835=y
35CONFIG_PREEMPT_VOLUNTARY=y
36CONFIG_AEABI=y
37CONFIG_COMPACTION=y
38CONFIG_KSM=y
39CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
40CONFIG_CLEANCACHE=y
41CONFIG_SECCOMP=y
42CONFIG_CC_STACKPROTECTOR=y
43CONFIG_KEXEC=y
44CONFIG_CRASH_DUMP=y
45CONFIG_VFP=y
46# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
47# CONFIG_SUSPEND is not set
48CONFIG_DEVTMPFS=y
49CONFIG_DEVTMPFS_MOUNT=y
50# CONFIG_STANDALONE is not set
51# CONFIG_INPUT_MOUSEDEV is not set
52# CONFIG_INPUT_KEYBOARD is not set
53# CONFIG_INPUT_MOUSE is not set
54# CONFIG_SERIO is not set
55# CONFIG_VT is not set
56# CONFIG_UNIX98_PTYS is not set
57# CONFIG_LEGACY_PTYS is not set
58# CONFIG_DEVKMEM is not set
59CONFIG_SERIAL_AMBA_PL011=y
60CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
61CONFIG_TTY_PRINTK=y
62# CONFIG_HW_RANDOM is not set
63# CONFIG_HWMON is not set
64# CONFIG_USB_SUPPORT is not set
65# CONFIG_IOMMU_SUPPORT is not set
66# CONFIG_FILE_LOCKING is not set
67# CONFIG_DNOTIFY is not set
68# CONFIG_INOTIFY_USER is not set
69# CONFIG_PROC_FS is not set
70# CONFIG_SYSFS is not set
71# CONFIG_MISC_FILESYSTEMS is not set
72CONFIG_PRINTK_TIME=y
73# CONFIG_ENABLE_WARN_DEPRECATED is not set
74# CONFIG_ENABLE_MUST_CHECK is not set
75CONFIG_UNUSED_SYMBOLS=y
76CONFIG_LOCKUP_DETECTOR=y
77CONFIG_DEBUG_INFO=y
78CONFIG_DEBUG_MEMORY_INIT=y
79CONFIG_BOOT_PRINTK_DELAY=y
80CONFIG_SCHED_TRACER=y
81CONFIG_STACK_TRACER=y
82CONFIG_FUNCTION_PROFILER=y
83CONFIG_DYNAMIC_DEBUG=y
84CONFIG_KGDB=y
85CONFIG_KGDB_KDB=y
86CONFIG_TEST_KSTRTOX=y
87CONFIG_STRICT_DEVMEM=y
88CONFIG_DEBUG_LL=y
89CONFIG_EARLY_PRINTK=y
90# CONFIG_XZ_DEC_X86 is not set
91# CONFIG_XZ_DEC_POWERPC is not set
92# CONFIG_XZ_DEC_IA64 is not set
93# CONFIG_XZ_DEC_ARM is not set
94# CONFIG_XZ_DEC_ARMTHUMB is not set
95# CONFIG_XZ_DEC_SPARC is not set
diff --git a/arch/arm/mach-bcm2835/Makefile b/arch/arm/mach-bcm2835/Makefile
new file mode 100644
index 000000000000..4c3892fe02c3
--- /dev/null
+++ b/arch/arm/mach-bcm2835/Makefile
@@ -0,0 +1 @@
obj-y += bcm2835.o
diff --git a/arch/arm/mach-bcm2835/Makefile.boot b/arch/arm/mach-bcm2835/Makefile.boot
new file mode 100644
index 000000000000..0831fd1764e7
--- /dev/null
+++ b/arch/arm/mach-bcm2835/Makefile.boot
@@ -0,0 +1,5 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
4
5dtb-y += bcm2835-rpi-b.dtb
diff --git a/arch/arm/mach-bcm2835/bcm2835.c b/arch/arm/mach-bcm2835/bcm2835.c
new file mode 100644
index 000000000000..f6b36b4b5921
--- /dev/null
+++ b/arch/arm/mach-bcm2835/bcm2835.c
@@ -0,0 +1,77 @@
1/*
2 * Copyright (C) 2010 Broadcom
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
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#include <linux/init.h>
16#include <linux/of_platform.h>
17
18#include <asm/mach/arch.h>
19#include <asm/mach/map.h>
20#include <asm/mach/time.h>
21#include <asm/exception.h>
22
23#include <mach/bcm2835_soc.h>
24
25static struct map_desc io_map __initdata = {
26 .virtual = BCM2835_PERIPH_VIRT,
27 .pfn = __phys_to_pfn(BCM2835_PERIPH_PHYS),
28 .length = BCM2835_PERIPH_SIZE,
29 .type = MT_DEVICE
30};
31
32void __init bcm2835_map_io(void)
33{
34 iotable_init(&io_map, 1);
35}
36
37void __init bcm2835_init_irq(void)
38{
39}
40
41asmlinkage void __exception_irq_entry bcm2835_handle_irq(struct pt_regs *regs)
42{
43}
44
45void __init bcm2835_init(void)
46{
47 int ret;
48
49 ret = of_platform_populate(NULL, of_default_bus_match_table, NULL,
50 NULL);
51 if (ret) {
52 pr_err("of_platform_populate failed: %d\n", ret);
53 BUG();
54 }
55}
56
57static void __init bcm2835_timer_init(void)
58{
59}
60
61struct sys_timer bcm2835_timer = {
62 .init = bcm2835_timer_init
63};
64
65static const char * const bcm2835_compat[] = {
66 "brcm,bcm2835",
67 NULL
68};
69
70DT_MACHINE_START(BCM2835, "BCM2835")
71 .map_io = bcm2835_map_io,
72 .init_irq = bcm2835_init_irq,
73 .handle_irq = bcm2835_handle_irq,
74 .init_machine = bcm2835_init,
75 .timer = &bcm2835_timer,
76 .dt_compat = bcm2835_compat
77MACHINE_END
diff --git a/arch/arm/mach-bcm2835/include/mach/bcm2835_soc.h b/arch/arm/mach-bcm2835/include/mach/bcm2835_soc.h
new file mode 100644
index 000000000000..d4dfcf7a9cda
--- /dev/null
+++ b/arch/arm/mach-bcm2835/include/mach/bcm2835_soc.h
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2012 Stephen Warren
3 *
4 * Derived from code:
5 * Copyright (C) 2010 Broadcom
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __MACH_BCM2835_BCM2835_SOC_H__
19#define __MACH_BCM2835_BCM2835_SOC_H__
20
21#include <asm/sizes.h>
22
23#define BCM2835_PERIPH_PHYS 0x20000000
24#define BCM2835_PERIPH_VIRT 0xf0000000
25#define BCM2835_PERIPH_SIZE SZ_16M
26#define BCM2835_DEBUG_PHYS 0x20201000
27#define BCM2835_DEBUG_VIRT 0xf0201000
28
29#endif
diff --git a/arch/arm/mach-bcm2835/include/mach/debug-macro.S b/arch/arm/mach-bcm2835/include/mach/debug-macro.S
new file mode 100644
index 000000000000..8a161e44ae28
--- /dev/null
+++ b/arch/arm/mach-bcm2835/include/mach/debug-macro.S
@@ -0,0 +1,21 @@
1/*
2 * Debugging macro include header
3 *
4 * Copyright (C) 2010 Broadcom
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#include <mach/bcm2835_soc.h>
15
16 .macro addruart, rp, rv, tmp
17 ldr \rp, =BCM2835_DEBUG_PHYS
18 ldr \rv, =BCM2835_DEBUG_VIRT
19 .endm
20
21#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-bcm2835/include/mach/timex.h b/arch/arm/mach-bcm2835/include/mach/timex.h
new file mode 100644
index 000000000000..6d021e136ae3
--- /dev/null
+++ b/arch/arm/mach-bcm2835/include/mach/timex.h
@@ -0,0 +1,26 @@
1/*
2 * BCM2835 system clock frequency
3 *
4 * Copyright (C) 2010 Broadcom
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __ASM_ARCH_TIMEX_H
22#define __ASM_ARCH_TIMEX_H
23
24#define CLOCK_TICK_RATE (1000000)
25
26#endif
diff --git a/arch/arm/mach-bcm2835/include/mach/uncompress.h b/arch/arm/mach-bcm2835/include/mach/uncompress.h
new file mode 100644
index 000000000000..cc46dcc72377
--- /dev/null
+++ b/arch/arm/mach-bcm2835/include/mach/uncompress.h
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) 2010 Broadcom
3 * Copyright (C) 2003 ARM Limited
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 as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/io.h>
17#include <linux/amba/serial.h>
18#include <mach/bcm2835_soc.h>
19
20#define UART0_BASE BCM2835_DEBUG_PHYS
21
22#define BCM2835_UART_DR IOMEM(UART0_BASE + UART01x_DR)
23#define BCM2835_UART_FR IOMEM(UART0_BASE + UART01x_FR)
24#define BCM2835_UART_CR IOMEM(UART0_BASE + UART011_CR)
25
26static inline void putc(int c)
27{
28 while (__raw_readl(BCM2835_UART_FR) & UART01x_FR_TXFF)
29 barrier();
30
31 __raw_writel(c, BCM2835_UART_DR);
32}
33
34static inline void flush(void)
35{
36 int fr;
37
38 do {
39 fr = __raw_readl(BCM2835_UART_FR);
40 barrier();
41 } while ((fr & (UART011_FR_TXFE | UART01x_FR_BUSY)) != UART011_FR_TXFE);
42}
43
44#define arch_decomp_setup()
45#define arch_decomp_wdog()