Skip to contentSkip to conversation

ARM: add support for BCM2708/BCM2835 and Raspberry Pi

PATCH Superseded Stephen Warren 4 participants 5 messages Sep 8, 2012

Subsystems (5)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: add support for BCM2708/BCM2835 and Raspberry Pi

The BCM2708 is an ARM SoC from Broadcom. It is the primary SoC in a series which contains the BCM2835 amongst other variants. This patch adds very basic support for this series of SoCs, under the BCM2708 name.

http://www.broadcom.com/products/BCM2835
http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pd

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.

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.

http://www.raspberrypi.org/.

This series was extracted from git://github.com/lp0/linux.git branch rpi-split from 3-4 months ago, and significantly stripped down and modified since. The work in that branch was signed-off-by:

Chris Boot <[email protected]>
Simon Arlott <sa.me.uk> [sic]

---
v2:
* Rename *_BASE to *_PHYS to match Simon's rpi-split branch.
* Remove #define UART_BAUD since it isn't used.
* Don't select WATCHDOG from ARCH_BCM2708
* Remove 8250 and PL010 serial ports from bcm2708_defconfig
* Remove <mach/hardware.h>
* Rename common.c back to bcm2708.c; matches downstream and is preferred naming style.

---
 arch/arm/Kconfig                                 |   18 +++++
 arch/arm/Makefile                                |    1 +
 arch/arm/boot/dts/bcm2835-rpi-b.dts              |   12 +++
 arch/arm/boot/dts/bcm2835.dtsi                   |   10 +++
 arch/arm/configs/bcm2708_defconfig               |   93 ++++++++++++++++++++++
 arch/arm/mach-bcm2708/Makefile                   |    1 +
 arch/arm/mach-bcm2708/Makefile.boot              |    5 ++
 arch/arm/mach-bcm2708/bcm2708.c                  |   80 +++++++++++++++++++
 arch/arm/mach-bcm2708/include/mach/bcm2708_soc.h |   29 +++++++
 arch/arm/mach-bcm2708/include/mach/debug-macro.S |   24 ++++++
 arch/arm/mach-bcm2708/include/mach/timex.h       |   26 ++++++
 arch/arm/mach-bcm2708/include/mach/uncompress.h  |   48 +++++++++++
 12 files changed, 347 insertions(+)
 create mode 100644 arch/arm/boot/dts/bcm2835-rpi-b.dts
 create mode 100644 arch/arm/boot/dts/bcm2835.dtsi
 create mode 100644 arch/arm/configs/bcm2708_defconfig
 create mode 100644 arch/arm/mach-bcm2708/Makefile
 create mode 100644 arch/arm/mach-bcm2708/Makefile.boot
 create mode 100644 arch/arm/mach-bcm2708/bcm2708.c
 create mode 100644 arch/arm/mach-bcm2708/include/mach/bcm2708_soc.h
 create mode 100644 arch/arm/mach-bcm2708/include/mach/debug-macro.S
 create mode 100644 arch/arm/mach-bcm2708/include/mach/timex.h
 create mode 100644 arch/arm/mach-bcm2708/include/mach/uncompress.h
arch/arm/Kconfig +18 -0
index d0021fe..4dcd0cd 100644
@@ -349,6 +349,24 @@ config ARCH_AT91
 	  This enables support for systems based on Atmel
 	  AT91RM9200 and AT91SAM9* processors.
 
+config ARCH_BCM2708
+	bool "Broadcom BCM2708 family"
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARM_AMBA
+	select ARM_ERRATA_411920
+	select ARM_TIMER_SP804
+	select CLKDEV_LOOKUP
+	select COMMON_CLK
+	select CPU_V6
+	select GENERIC_CLOCKEVENTS
+	select MULTI_IRQ_HANDLER
+	select SPARSE_IRQ
+	select USE_OF
+	help
+	  This enables support for the Broadcom BCM2708 SoC series. The
+	  BCM2835 is one such SoC in this series. The Raspberry Pi uses
+	  the BCM2835.
+
 config ARCH_BCMRING
 	bool "Broadcom BCMRING"
 	depends on MMU
arch/arm/Makefile +1 -0
index a812d12..3c4f0b3 100644
@@ -136,6 +136,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 # Machine directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
 machine-$(CONFIG_ARCH_AT91)		:= at91
+machine-$(CONFIG_ARCH_BCM2708)		:= bcm2708
 machine-$(CONFIG_ARCH_BCMRING)		:= bcmring
 machine-$(CONFIG_ARCH_CLPS711X)		:= clps711x
 machine-$(CONFIG_ARCH_CNS3XXX)		:= cns3xxx
arch/arm/boot/dts/bcm2835-rpi-b.dts new file +12 -0
new file mode 100644
index 0000000..7e43197
@@ -0,0 +1,12 @@
+/dts-v1/;
+/memreserve/ 0x0c000000 0x04000000;
+/include/ "bcm2835.dtsi"
+
+/ {
+	model = "Raspberry Pi Model B";
+	compatible = "raspberrypi,model-b", "broadcom,bcm2835", "broadcom,bcm2708";
+
+	memory {
+		reg = <0 0x10000000>;
+	};
+};
arch/arm/boot/dts/bcm2835.dtsi new file +10 -0
new file mode 100644
index 0000000..221a49a
@@ -0,0 +1,10 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "broadcom,bcm2835", "broadcom,bcm2708";
+	model = "BCM2835";
+
+	chosen {
+		bootargs = "earlyprintk";			/* Set by VideoCore */
+	};
+};
arch/arm/configs/bcm2708_defconfig new file +93 -0

93 lines not on this page · raw message

arch/arm/mach-bcm2708/Makefile new file +1 -0
new file mode 100644
index 0000000..c382763
@@ -0,0 +1 @@
+obj-y += bcm2708.o
arch/arm/mach-bcm2708/Makefile.boot new file +5 -0
new file mode 100644
index 0000000..0831fd1
@@ -0,0 +1,5 @@
+   zreladdr-y := 0x00008000
+params_phys-y := 0x00000100
+initrd_phys-y := 0x00800000
+
+dtb-y += bcm2835-rpi-b.dtb
arch/arm/mach-bcm2708/bcm2708.c new file +80 -0

80 lines not on this page · raw message

arch/arm/mach-bcm2708/include/mach/bcm2708_soc.h new file +29 -0
new file mode 100644
index 0000000..3549699
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2012 Stephen Warren
+ *
+ * Derived from code:
+ * Copyright (C) 2010 Broadcom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __MACH_BCM2708_BCM2708_SOC_H__
+#define __MACH_BCM2708_BCM2708_SOC_H__
+
+#include <asm/sizes.h>
+
+#define BCM2708_PERIPH_PHYS	0x20000000
+#define BCM2708_PERIPH_VIRT	0xf0000000
+#define BCM2708_PERIPH_SIZE	SZ_16M
+#define BCM2708_DEBUG_PHYS	0x20201000
+#define BCM2708_DEBUG_VIRT	0xf0201000
+
+#endif
arch/arm/mach-bcm2708/include/mach/debug-macro.S new file +24 -0
new file mode 100644
index 0000000..962f4d1
@@ -0,0 +1,24 @@
+/*
+ * Debugging macro include header
+ *
+ * Copyright (C) 2012 Stephen Warren
+ *
+ * Derived from code:
+ *  Copyright (C) 2010 Broadcom
+ *  Copyright (C) 1994-1999 Russell King
+ *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <mach/bcm2708_soc.h>
+
+	.macro	addruart, rp, rv, tmp
+	ldr	\rp, =BCM2708_DEBUG_PHYS
+	ldr	\rv, =BCM2708_DEBUG_VIRT
+	.endm
+
+#include <asm/hardware/debug-pl01x.S>
arch/arm/mach-bcm2708/include/mach/timex.h new file +26 -0
new file mode 100644
index 0000000..ca67219
@@ -0,0 +1,26 @@
+/*
+ *  BCM2708 system clock frequency
+ *
+ *  Copyright (C) 2010 Broadcom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __ASM_ARCH_TIMEX_H
+#define __ASM_ARCH_TIMEX_H
+
+#define CLOCK_TICK_RATE		(1000000)
+
+#endif
arch/arm/mach-bcm2708/include/mach/uncompress.h new file +48 -0

48 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/1 ARM: add support for BCM2708/BCM2835 and Raspberry Pi

Quoted 3 lines · Stephen Warren
arch/arm/mach-bcm2708/bcm2708.c new file +3 -0
+void __init bcm2708_init_irq(void)
+{
+}

...

arch/arm/mach-bcm2708/bcm2708.c line 62

Quoted 3 lines
arch/arm/mach-bcm2708/bcm2708.c new file +3 -0
+static void __init bcm2708_timer_init(void)
+{
+}

There's no timer and no interrupt handler so it won't even finish booting. It's going to stall when it tries to calculate loops per jiffy.

I don't know what you're trying to achieve. This does not add support for the BCM2708.

See https://github.com/lp0/linux/commits/rpi-split from June 21 onwards for separate patch commits that apply to specific devices.

Quoted 2 lines · Stephen Warren

v2:
* Rename *_BASE to *_PHYS to match Simon's rpi-split branch.

You've definitely used the rpi-linear branch if you're missing things. The HEAD of the two branches is identical but rpi-split has a rebased history.

Signature · 1 line
Simon Arlott
#2 lore raw

PATCH v2 1/1 ARM: add support for BCM2708/BCM2835 and Raspberry Pi

Quoted 2 lines · Simon Arlott

I don't know what you're trying to achieve. This does not add support for the BCM2708.

If you don't like this patch, could we get a patch(set) from you since you're code is the origin for this work?

I understand that there is some bootloader support missing, but surely we can get some support into mainline now, right?

I just don't want this work to rot.

Seth

#3 lore raw

PATCH v2 1/1 ARM: add support for BCM2708/BCM2835 and Raspberry Pi

In reply to Simon Arlott
Quoted 11 lines · Simon Arlott
Quoted 3 lines · Stephen Warren
arch/arm/mach-bcm2708/bcm2708.c new file +3 -0
+void __init bcm2708_init_irq(void)
+{
+}

...

arch/arm/mach-bcm2708/bcm2708.c line 62

Quoted 3 lines
arch/arm/mach-bcm2708/bcm2708.c new file +3 -0
+static void __init bcm2708_timer_init(void)
+{
+}

There's no timer and no interrupt handler so it won't even finish booting. It's going to stall when it tries to calculate loops per jiffy.

Yes, I did mention this when I posted V1. Perhaps it's worth mentioning in the commit description itself too.

Quoted 2 lines

I don't know what you're trying to achieve. This does not add support for the BCM2708.

I'm trying to get upstreaming started, a little bit at a time. Right now, all work has been done outside the regular Linux ARM community. I feel it'd be much better to start feeding the work upstream. This will provide much better exposure for the work, and put it into a place that's more obvious for users, and useful for distros.

Obviously, the next step after this patch is to upstream the interrupt controller and timer, to resolve the problem mentioned above. There's certainly still much more to do after that.

Quoted 10 lines

See https://github.com/lp0/linux/commits/rpi-split from June 21 onwards for separate patch commits that apply to specific devices.

Quoted 2 lines · Stephen Warren

v2:
* Rename *_BASE to *_PHYS to match Simon's rpi-split branch.

You've definitely used the rpi-linear branch if you're missing things. The HEAD of the two branches is identical but rpi-split has a rebased history.

No, I just took the HEAD of the branch, and manually copied minimal pieces out of it to create this patch; the interim contents of any of the patches in the branches didn't influence this patch at all.

BTW, could you possibly fix your git configuration so that your commits have a valid email address in the git author field and Signed-off-by tag? For this patch, I set the git author field to myself even though you (and others) authored the work it was derived from, since I didn't feel comfortable using the invalid values from your git repo.

Thanks for the interest in these patches!

#4 lore raw

PATCH v2 1/1 ARM: add support for BCM2708/BCM2835 and Raspberry Pi

Quoted 12 lines · On Saturday 08 September 2012 11:41:45 Stephen Warren wrote:
Quoted 4 lines · Simon Arlott

On 08/09/12 06:48, Stephen Warren wrote:

I don't know what you're trying to achieve. This does not add support for the BCM2708.

I'm trying to get upstreaming started, a little bit at a time. Right now, all work has been done outside the regular Linux ARM community. I feel it'd be much better to start feeding the work upstream. This will provide much better exposure for the work, and put it into a place that's more obvious for users, and useful for distros.

Quoted 3 lines

Obviously, the next step after this patch is to upstream the interrupt controller and timer, to resolve the problem mentioned above. There's certainly still much more to do after that.

I think it would be good to get those reviewed and submitted in time for the merge window, to have something that actually boots.

I agree that for review purposes starting out with just the minimal patch was a good idea, but when the other stuff looks reasonable, we should also try to get it in at the same time.

Arnd