Skip to contentSkip to conversation

bcm283x: add support for raspberry pi 2

PATCH Applied Alexander Aring 2 participants 9 messages Dec 19, 2015 – Jan 4, 2016

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

cover bcm283x: add support for raspberry pi 2

This patch series contains at first small cleanups which I detected by supporting/testing raspberry pi 2 and initial support for rpi2.

It introduced the mach-bcm283x which contains bcm2835 and bcm2836, because these are mostly the same. I didn't rename everything from bcm2835 to bcm283x, what I changed are the Kconfig entries only.

The complete mach-bcm283x doesn't support devicetree handling which may be the next step. Also there is still no support for dwc2 usb.

- Alex

Alexander Aring (7):
memtest: fix missing arguments in help string
led: add missing includes
arm: bcm2835: fix indentation
bcm2835: introduce mach-bcm283x
bcm283x: mbox: align to cachesize
rpi: sync revision detection with u-boot
arm: bcm283x: add rpi2 support

 arch/arm/Kconfig                                   |  23 +-
 arch/arm/Makefile                                  |   2 +-
 arch/arm/boards/Makefile                           |   2 +-
 arch/arm/boards/raspberry-pi/Makefile              |   2 +
 arch/arm/boards/raspberry-pi/rpi-common.c          | 294 +++++++++++++++++++++
 arch/arm/boards/raspberry-pi/rpi.c                 | 277 +------------------
 arch/arm/boards/raspberry-pi/rpi.h                 |  28 ++
 arch/arm/boards/raspberry-pi/rpi2.c                |  21 ++
 arch/arm/configs/rpi2_defconfig                    |  72 +++++
 arch/arm/configs/rpi_defconfig                     |  70 ++---
 arch/arm/mach-bcm2835/Kconfig                      |  15 --
 arch/arm/mach-bcm283x/Kconfig                      |  25 ++
 arch/arm/{mach-bcm2835 => mach-bcm283x}/Makefile   |   0
 arch/arm/{mach-bcm2835 => mach-bcm283x}/core.c     |   0
 .../include/mach/core.h                            |   2 +-
 .../include/mach/debug_ll.h                        |   0
 .../include/mach/mbox.h                            |   9 +-
 .../include/mach/platform.h                        |   9 +
 .../include/mach/wd.h                              |   0
 arch/arm/{mach-bcm2835 => mach-bcm283x}/mbox.c     |   0
 commands/memtest.c                                 |   2 +-
 drivers/clocksource/Kconfig                        |   4 +-
 drivers/clocksource/Makefile                       |   2 +-
 drivers/gpio/Kconfig                               |   6 +-
 drivers/gpio/Makefile                              |   2 +-
 drivers/mci/Kconfig                                |   6 +-
 drivers/mci/Makefile                               |   2 +-
 drivers/regulator/Kconfig                          |   4 +-
 drivers/regulator/Makefile                         |   2 +-
 drivers/video/Kconfig                              |   8 +-
 drivers/video/Makefile                             |   2 +-
 include/led.h                                      |   3 +
 32 files changed, 543 insertions(+), 351 deletions(-)
 create mode 100644 arch/arm/boards/raspberry-pi/rpi-common.c
 create mode 100644 arch/arm/boards/raspberry-pi/rpi.h
 create mode 100644 arch/arm/boards/raspberry-pi/rpi2.c
 create mode 100644 arch/arm/configs/rpi2_defconfig
 delete mode 100644 arch/arm/mach-bcm2835/Kconfig
 create mode 100644 arch/arm/mach-bcm283x/Kconfig
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/Makefile (100%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/core.c (100%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/include/mach/core.h (97%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/include/mach/debug_ll.h (100%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/include/mach/mbox.h (98%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/include/mach/platform.h (90%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/include/mach/wd.h (100%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/mbox.c (100%)
Signature · 7 lines
2.6.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 1/7 memtest: fix missing arguments in help string

This patch adds some missing arguments in help string of memtest.

---
 commands/memtest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
commands/memtest.c +1 -1
index d784a5c..99d4864 100644
@@ -191,7 +191,7 @@ BAREBOX_CMD_HELP_END
 BAREBOX_CMD_START(memtest)
 	.cmd		= do_memtest,
 	BAREBOX_CMD_DESC("extensive memory test")
-	BAREBOX_CMD_OPTS("[-ib]")
+	BAREBOX_CMD_OPTS("[-ibcut]")
 	BAREBOX_CMD_GROUP(CMD_GRP_MEM)
 	BAREBOX_CMD_HELP(cmd_memtest_help)
 BAREBOX_CMD_END
Signature · 7 lines
2.6.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/7 led: add missing includes

In reply to Alexander Aring

The led header use some parts which are missing when include the this header. This patch adds them.

---
 include/led.h | 3 +++
 1 file changed, 3 insertions(+)
include/led.h +3 -0
index ddf8d90..000267c 100644
@@ -1,7 +1,10 @@
 #ifndef __LED_H
 #define __LED_H
 
+#include <linux/list.h>
+
 #include <errno.h>
+#include <of.h>
 
 struct led {
 	void (*set)(struct led *, unsigned int value);
Signature · 7 lines
2.6.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 3/7 arm: bcm2835: fix indentation

In reply to Alexander Aring

This patch fix indentation in core.h of mach-bcm2835.

---
 arch/arm/mach-bcm2835/include/mach/core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-bcm2835/include/mach/core.h +1 -1
index 477ecb9..b0bed80 100644
@@ -24,7 +24,7 @@ void bcm2835_add_device_sdram(u32 size);
 static void inline bcm2835_register_mci(void)
 {
 	add_generic_device("bcm2835_mci", 0, NULL, BCM2835_EMMC_BASE, 0xFC,
-			IORESOURCE_MEM, NULL);
+			   IORESOURCE_MEM, NULL);
 }
 
 static void inline bcm2835_register_fb(void)
Signature · 7 lines
2.6.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 4/7 bcm2835: introduce mach-bcm283x

In reply to Alexander Aring

This patch changes the most part of mach-bcm2835 to mach-bcm283x. This prepares to add RPi2 support which is a bcm2836. This patch changes the Kconfig entry namens to BCM283X for drivers only. These drivers should working the same in bcm2836.

While updating defconfig I added LED support/trigger option.

---
 arch/arm/Kconfig                                   | 18 +++---
 arch/arm/Makefile                                  |  2 +-
 arch/arm/configs/rpi_defconfig                     | 70 ++++++++++++----------
 arch/arm/{mach-bcm2835 => mach-bcm283x}/Kconfig    |  5 +-
 arch/arm/{mach-bcm2835 => mach-bcm283x}/Makefile   |  0
 arch/arm/{mach-bcm2835 => mach-bcm283x}/core.c     |  0
 .../include/mach/core.h                            |  0
 .../include/mach/debug_ll.h                        |  0
 .../include/mach/mbox.h                            |  0
 .../include/mach/platform.h                        |  0
 .../include/mach/wd.h                              |  0
 arch/arm/{mach-bcm2835 => mach-bcm283x}/mbox.c     |  0
 drivers/clocksource/Kconfig                        |  4 +-
 drivers/clocksource/Makefile                       |  2 +-
 drivers/gpio/Kconfig                               |  6 +-
 drivers/gpio/Makefile                              |  2 +-
 drivers/mci/Kconfig                                |  6 +-
 drivers/mci/Makefile                               |  2 +-
 drivers/regulator/Kconfig                          |  4 +-
 drivers/regulator/Makefile                         |  2 +-
 drivers/video/Kconfig                              |  8 +--
 drivers/video/Makefile                             |  2 +-
 22 files changed, 71 insertions(+), 62 deletions(-)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/Kconfig (70%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/Makefile (100%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/core.c (100%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/include/mach/core.h (100%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/include/mach/debug_ll.h (100%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/include/mach/mbox.h (100%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/include/mach/platform.h (100%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/include/mach/wd.h (100%)
 rename arch/arm/{mach-bcm2835 => mach-bcm283x}/mbox.c (100%)
arch/arm/Kconfig +11 -7
index 9f4d8e9..4e7c1fd 100644
@@ -22,6 +22,15 @@ config ARM_USE_COMPRESSED_DTB
 	select UNCOMPRESS
 	select LZO_DECOMPRESS
 
+config ARCH_BCM283X
+	bool
+	select GPIOLIB
+	select CLKDEV_LOOKUP
+	select COMMON_CLK
+	select CLOCKSOURCE_BCM283X
+	select ARM_AMBA
+	select HAS_DEBUG_LL
+
 menu "System Type"
 
 config BUILTIN_DTB
@@ -52,13 +61,8 @@ config ARCH_AT91
 
 config ARCH_BCM2835
 	bool "Broadcom BCM2835 boards"
-	select GPIOLIB
+	select ARCH_BCM283X
 	select CPU_ARM1176
-	select CLKDEV_LOOKUP
-	select COMMON_CLK
-	select CLOCKSOURCE_BCM2835
-	select ARM_AMBA
-	select HAS_DEBUG_LL
 
 config ARCH_CLPS711X
 	bool "Cirrus Logic EP711x/EP721x/EP731x"
@@ -251,7 +255,7 @@ endchoice
 
 source arch/arm/cpu/Kconfig
 source arch/arm/mach-at91/Kconfig
-source arch/arm/mach-bcm2835/Kconfig
+source arch/arm/mach-bcm283x/Kconfig
 source arch/arm/mach-clps711x/Kconfig
 source arch/arm/mach-davinci/Kconfig
 source arch/arm/mach-digic/Kconfig
arch/arm/Makefile +1 -1
index cae05ff..9ce16b9 100644
@@ -57,7 +57,7 @@ AFLAGS   += -include asm/unified.h -msoft-float $(AFLAGS_THUMB2)
 # Machine directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
 machine-$(CONFIG_ARCH_AT91)		:= at91
-machine-$(CONFIG_ARCH_BCM2835)		:= bcm2835
+machine-$(CONFIG_ARCH_BCM283X)		:= bcm283x
 machine-$(CONFIG_ARCH_CLPS711X)		:= clps711x
 machine-$(CONFIG_ARCH_DAVINCI)		:= davinci
 machine-$(CONFIG_ARCH_DIGIC)		:= digic
arch/arm/configs/rpi_defconfig +37 -33

96 lines not on this page · raw message

arch/arm/mach-bcm283x/Kconfig renamed from arch/arm/mach-bcm2835/Kconfig +3 -2
similarity index 70%
rename from arch/arm/mach-bcm2835/Kconfig
rename to arch/arm/mach-bcm283x/Kconfig
index 134ad9b..f4a7e67 100644
@@ -1,14 +1,15 @@
-if ARCH_BCM2835
+if ARCH_BCM283X
 
 config ARCH_TEXT_BASE
 	hex
-	default 0x04000000 if MACH_RPI
+	default 0x04000000
 
 choice
 	prompt "Broadcom Board type"
 
 config MACH_RPI
 	bool "RaspberryPi (BCM2835/ARM1176JZF-S)"
+	depends on ARCH_BCM2835
 
 endchoice
 
arch/arm/mach-bcm283x/Makefile renamed from arch/arm/mach-bcm2835/Makefile +0 -0
similarity index 100%
rename from arch/arm/mach-bcm2835/Makefile
rename to arch/arm/mach-bcm283x/Makefile
arch/arm/mach-bcm283x/core.c renamed from arch/arm/mach-bcm2835/core.c +0 -0
similarity index 100%
rename from arch/arm/mach-bcm2835/core.c
rename to arch/arm/mach-bcm283x/core.c
arch/arm/mach-bcm283x/include/mach/core.h renamed from arch/arm/mach-bcm2835/include/mach/core.h +0 -0
similarity index 100%
rename from arch/arm/mach-bcm2835/include/mach/core.h
rename to arch/arm/mach-bcm283x/include/mach/core.h
arch/arm/mach-bcm283x/include/mach/debug_ll.h renamed from arch/arm/mach-bcm2835/include/mach/debug_ll.h +0 -0
similarity index 100%
rename from arch/arm/mach-bcm2835/include/mach/debug_ll.h
rename to arch/arm/mach-bcm283x/include/mach/debug_ll.h
arch/arm/mach-bcm283x/include/mach/mbox.h renamed from arch/arm/mach-bcm2835/include/mach/mbox.h +0 -0
similarity index 100%
rename from arch/arm/mach-bcm2835/include/mach/mbox.h
rename to arch/arm/mach-bcm283x/include/mach/mbox.h
arch/arm/mach-bcm283x/include/mach/platform.h renamed from arch/arm/mach-bcm2835/include/mach/platform.h +0 -0
similarity index 100%
rename from arch/arm/mach-bcm2835/include/mach/platform.h
rename to arch/arm/mach-bcm283x/include/mach/platform.h
arch/arm/mach-bcm283x/include/mach/wd.h renamed from arch/arm/mach-bcm2835/include/mach/wd.h +0 -0
similarity index 100%
rename from arch/arm/mach-bcm2835/include/mach/wd.h
rename to arch/arm/mach-bcm283x/include/mach/wd.h
arch/arm/mach-bcm283x/mbox.c renamed from arch/arm/mach-bcm2835/mbox.c +0 -0
similarity index 100%
rename from arch/arm/mach-bcm2835/mbox.c
rename to arch/arm/mach-bcm283x/mbox.c
drivers/clocksource/Kconfig +2 -2
index 598edc9..3fb09fb 100644
@@ -6,9 +6,9 @@ config ARM_SMP_TWD
 	bool
 	depends on ARM && CPU_V7
 
-config CLOCKSOURCE_BCM2835
+config CLOCKSOURCE_BCM283X
 	bool
-	depends on ARCH_BCM2835
+	depends on ARCH_BCM283X
 
 config CLOCKSOURCE_CLPS711X
 	bool
drivers/clocksource/Makefile +1 -1
index f5f5141..4eb1656 100644
@@ -1,6 +1,6 @@
 obj-$(CONFIG_AMBA_SP804) += amba-sp804.o
 obj-$(CONFIG_ARM_SMP_TWD) += arm_smp_twd.o
-obj-$(CONFIG_CLOCKSOURCE_BCM2835) += bcm2835.o
+obj-$(CONFIG_CLOCKSOURCE_BCM283X) += bcm2835.o
 obj-$(CONFIG_CLOCKSOURCE_CLPS711X) += clps711x.o
 obj-$(CONFIG_CLOCKSOURCE_DIGIC)   += digic.o
 obj-$(CONFIG_CLOCKSOURCE_MVEBU)   += mvebu.o
drivers/gpio/Kconfig +3 -3
index 9cb2261..d839d7a 100644
@@ -21,9 +21,9 @@ config GPIO_74164
 	  shift registers. This driver can be used to provide access
 	  to more gpio outputs.
 
-config GPIO_BCM2835
-	bool "GPIO support for BCM2835"
-	depends on ARCH_BCM2835
+config GPIO_BCM283X
+	bool "GPIO support for BCM283X"
+	depends on ARCH_BCM283X
 
 config GPIO_CLPS711X
 	bool "GPIO support for CLPS711X"
drivers/gpio/Makefile +1 -1
index f39e8da..8767eed 100644
@@ -2,7 +2,7 @@ obj-$(CONFIG_GPIOLIB)		+= gpiolib.o
 
 obj-$(CONFIG_GPIO_74164)	+= gpio-74164.o
 obj-$(CONFIG_MACH_MIPS_ATH79)	+= gpio-ath79.o
-obj-$(CONFIG_GPIO_BCM2835)	+= gpio-bcm2835.o
+obj-$(CONFIG_GPIO_BCM283X)	+= gpio-bcm2835.o
 obj-$(CONFIG_GPIO_DAVINCI)	+= gpio-davinci.o
 obj-$(CONFIG_GPIO_CLPS711X)	+= gpio-clps711x.o
 obj-$(CONFIG_GPIO_DIGIC)	+= gpio-digic.o
drivers/mci/Kconfig +3 -3
index ebd8da9..0f3504c 100644
@@ -62,9 +62,9 @@ config MCI_S3C
 	  Enable this entry to add support to read and write SD cards on a
 	  Samsung S3C24xx based system.
 
-config MCI_BCM2835
-	bool "MCI support for BCM2835"
-	depends on ARCH_BCM2835
+config MCI_BCM283X
+	bool "MCI support for BCM283X"
+	depends on ARCH_BCM283X
 
 config MCI_IMX
 	bool "i.MX"
drivers/mci/Makefile +1 -1
index 1e8443c..88ec456 100644
@@ -1,6 +1,6 @@
 obj-$(CONFIG_MCI)		+= mci-core.o
 obj-$(CONFIG_MCI_ATMEL)		+= atmel_mci.o
-obj-$(CONFIG_MCI_BCM2835)	+= mci-bcm2835.o
+obj-$(CONFIG_MCI_BCM283X)	+= mci-bcm2835.o
 obj-$(CONFIG_MCI_IMX)		+= imx.o
 obj-$(CONFIG_MCI_IMX_ESDHC)	+= imx-esdhc.o
 obj-$(CONFIG_MCI_MXS)		+= mxs.o
drivers/regulator/Kconfig +2 -2
index 05c3f48..4b41252 100644
@@ -11,9 +11,9 @@ config REGULATOR_FIXED
 	  This enables a simple fixed regulator. It is used for regulators
 	  which are not software controllable or controllable via gpio.
 
-config REGULATOR_BCM2835
+config REGULATOR_BCM283X
 	bool
-	depends on ARCH_BCM2835
+	depends on ARCH_BCM283X
 	default y
 
 endif
drivers/regulator/Makefile +1 -1
index d663c16..a8dd9bd 100644
@@ -1,3 +1,3 @@
 obj-$(CONFIG_REGULATOR) += core.o
 obj-$(CONFIG_REGULATOR_FIXED) += fixed.o
-obj-$(CONFIG_REGULATOR_BCM2835) += bcm2835.o
+obj-$(CONFIG_REGULATOR_BCM283X) += bcm2835.o
drivers/video/Kconfig +4 -4
index eabd246..7ff67e5 100644
@@ -82,11 +82,11 @@ config DRIVER_VIDEO_PXA
 	  Add support for the frame buffer device found on the PXA270
 	  CPU.
 
-config DRIVER_VIDEO_BCM2835
-	bool "BCM2835 framebuffer driver"
-	depends on ARCH_BCM2835
+config DRIVER_VIDEO_BCM283X
+	bool "BCM283X framebuffer driver"
+	depends on ARCH_BCM283X
 	help
-	  Add support for the BCM2835/VideoCore frame buffer device.
+	  Add support for the BCM283X/VideoCore frame buffer device.
 
 source drivers/video/imx-ipu-v3/Kconfig
 
drivers/video/Makefile +1 -1
index 57e4864..a64fc5f 100644
@@ -17,6 +17,6 @@ obj-$(CONFIG_DRIVER_VIDEO_S3C24XX) += s3c24xx.o
 obj-$(CONFIG_DRIVER_VIDEO_PXA) += pxa.o
 obj-$(CONFIG_DRIVER_VIDEO_SDL) += sdl.o
 obj-$(CONFIG_DRIVER_VIDEO_OMAP) += omap.o
-obj-$(CONFIG_DRIVER_VIDEO_BCM2835) += bcm2835.o
+obj-$(CONFIG_DRIVER_VIDEO_BCM283X) += bcm2835.o
 obj-$(CONFIG_DRIVER_VIDEO_SIMPLEFB) += simplefb.o
 obj-$(CONFIG_DRIVER_VIDEO_IMX_IPUV3) += imx-ipu-v3/
Signature · 7 lines
2.6.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH 5/7 bcm283x: mbox: align to cachesize

In reply to Alexander Aring

This patch change the align of mbox stack resource to 32. The reason is that I had some experience with bcm2836 and the mbox implementation, after setting the align to 64(on bcm2836) the issues was gone.

I found these values inside the u-boot implementation, they use 32 (bcm2835) and 64 (bcm2836).

---
 arch/arm/mach-bcm283x/include/mach/mbox.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-bcm283x/include/mach/mbox.h +3 -1
index 4c3fd77..09b31f2 100644
@@ -73,8 +73,10 @@ struct bcm2835_mbox_hdr {
 #define BCM2835_MBOX_REQ_CODE		0
 #define BCM2835_MBOX_RESP_CODE_SUCCESS	0x80000000
 
+#define BCM2835_CACHELINE_SIZE		32
+
 #define BCM2835_MBOX_STACK_ALIGN(type, name) \
-	STACK_ALIGN_ARRAY(type, name, 1, BCM2835_CHAN_MASK + 1)
+	STACK_ALIGN_ARRAY(type, name, 1, BCM2835_CACHELINE_SIZE)
 
 #define BCM2835_MBOX_INIT_HDR(_m_) { \
 		memset((_m_), 0, sizeof(*(_m_))); \
Signature · 7 lines
2.6.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH 6/7 rpi: sync revision detection with u-boot

In reply to Alexander Aring

This patch adds parts from u-boot code for doing RPi revision detection and take care about the "warranty bit". I got this bit on my RPi2.

---
 arch/arm/boards/raspberry-pi/rpi.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boards/raspberry-pi/rpi.c +15 -0
index f9406d4..faf48a5 100644
@@ -203,7 +203,22 @@ static void rpi_get_board_rev(void)
 		return;
 	}
 
+	/* Comments from u-boot:
+	 * For details of old-vs-new scheme, see:
+	 * https://github.com/pimoroni/RPi.version/blob/master/RPi/version.py
+	 * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=99293&p=690282
+	 * (a few posts down)
+	 *
+	 * For the RPi 1, bit 24 is the "warranty bit", so we mask off just the
+	 * lower byte to use as the board rev:
+	 * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=98367&start=250
+	 * http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=20594
+	 */
 	rpi_board_rev = msg->get_board_rev.body.resp.rev;
+	if (rpi_board_rev & 0x800000)
+		rpi_board_rev = (rpi_board_rev >> 4) & 0xff;
+	else
+		rpi_board_rev &= 0xff;
 	if (rpi_board_rev >= ARRAY_SIZE(models)) {
 		printf("RPI: Board rev %u outside known range\n",
 		       rpi_board_rev);
Signature · 7 lines
2.6.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH 7/7 arm: bcm283x: add rpi2 support

In reply to Alexander Aring

This patch adds Raspberry Pi 2 support in barebox. The features should be the same like the current RPi status in barebox.

---
 arch/arm/Kconfig                              |   5 +
 arch/arm/boards/Makefile                      |   2 +-
 arch/arm/boards/raspberry-pi/Makefile         |   2 +
 arch/arm/boards/raspberry-pi/rpi-common.c     | 294 ++++++++++++++++++++++++++
 arch/arm/boards/raspberry-pi/rpi.c            | 292 +------------------------
 arch/arm/boards/raspberry-pi/rpi.h            |  28 +++
 arch/arm/boards/raspberry-pi/rpi2.c           |  21 ++
 arch/arm/configs/rpi2_defconfig               |  72 +++++++
 arch/arm/mach-bcm283x/Kconfig                 |   9 +
 arch/arm/mach-bcm283x/include/mach/mbox.h     |   9 +-
 arch/arm/mach-bcm283x/include/mach/platform.h |   9 +
 11 files changed, 453 insertions(+), 290 deletions(-)
 create mode 100644 arch/arm/boards/raspberry-pi/rpi-common.c
 create mode 100644 arch/arm/boards/raspberry-pi/rpi.h
 create mode 100644 arch/arm/boards/raspberry-pi/rpi2.c
 create mode 100644 arch/arm/configs/rpi2_defconfig
arch/arm/Kconfig +5 -0
index 4e7c1fd..71d4336 100644
@@ -64,6 +64,11 @@ config ARCH_BCM2835
 	select ARCH_BCM283X
 	select CPU_ARM1176
 
+config ARCH_BCM2836
+	bool "Broadcom BCM2836 boards"
+	select ARCH_BCM283X
+	select CPU_V7
+
 config ARCH_CLPS711X
 	bool "Cirrus Logic EP711x/EP721x/EP731x"
 	select CLKDEV_LOOKUP
arch/arm/boards/Makefile +1 -1
index 2e58f15..1029e8f 100644
@@ -95,7 +95,7 @@ obj-$(CONFIG_MACH_QIL_A9260)			+= qil-a926x/
 obj-$(CONFIG_MACH_QIL_A9G20)			+= qil-a926x/
 obj-$(CONFIG_MACH_RADXA_ROCK)			+= radxa-rock/
 obj-$(CONFIG_MACH_REALQ7)			+= datamodul-edm-qmx6/
-obj-$(CONFIG_MACH_RPI)				+= raspberry-pi/
+obj-$(CONFIG_MACH_RPI_COMMON)			+= raspberry-pi/
 obj-$(CONFIG_MACH_SABRELITE)			+= freescale-mx6-sabrelite/
 obj-$(CONFIG_MACH_SABRESD)			+= freescale-mx6-sabresd/
 obj-$(CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB)	+= freescale-mx6sx-sabresdb/
arch/arm/boards/raspberry-pi/Makefile +2 -0
index 978383a..7a3d7de 100644
@@ -1,2 +1,4 @@
+obj-$(CONFIG_MACH_RPI_COMMON) += rpi-common.o
 obj-$(CONFIG_MACH_RPI) += rpi.o
+obj-$(CONFIG_MACH_RPI2) += rpi2.o
 lwl-y += lowlevel.o
arch/arm/boards/raspberry-pi/rpi-common.c new file +294 -0

294 lines not on this page · raw message

arch/arm/boards/raspberry-pi/rpi.c +6 -286

308 lines not on this page · raw message

arch/arm/boards/raspberry-pi/rpi.h new file +28 -0
new file mode 100644
index 0000000..739cdee
@@ -0,0 +1,28 @@
+#ifndef __ARCH_ARM_BOARDS_RPI_H__
+#define __ARCH_ARM_BOARDS_RPI_H__
+
+#include <types.h>
+#include <led.h>
+
+#include <mach/mbox.h>
+
+#define RPI_MODEL(_id, _name, _init)	\
+	[_id] = {				\
+		.name			= _name,\
+		.init			= _init,\
+	}
+
+struct rpi_model {
+	const char *name;
+	void (*init)(void);
+};
+
+extern const struct rpi_model rpi_models[];
+extern const size_t rpi_models_size;
+extern const char *rpi_model_string;
+extern struct gpio_led rpi_leds[];
+
+void rpi_b_plus_init(void);
+void rpi_set_usbethaddr(void);
+
+#endif /* __ARCH_ARM_BOARDS_RPI_H__ */
arch/arm/boards/raspberry-pi/rpi2.c new file +21 -0
new file mode 100644
index 0000000..2cfc06f
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ *
+ */
+
+#include "rpi.h"
+
+const struct rpi_model rpi_models[] = {
+	RPI_MODEL(0, "Unknown model", NULL),
+	RPI_MODEL(BCM2836_BOARD_REV_2_B, "2 Model B", rpi_b_plus_init),
+};
+const size_t rpi_models_size = ARRAY_SIZE(rpi_models);
+const char *rpi_model_string = "(BCM2836/CORTEX-A7)";
arch/arm/configs/rpi2_defconfig new file +72 -0

72 lines not on this page · raw message

arch/arm/mach-bcm283x/Kconfig +9 -0
index f4a7e67..e861268 100644
@@ -4,12 +4,21 @@ config ARCH_TEXT_BASE
 	hex
 	default 0x04000000
 
+config MACH_RPI_COMMON
+	bool
+
 choice
 	prompt "Broadcom Board type"
 
 config MACH_RPI
 	bool "RaspberryPi (BCM2835/ARM1176JZF-S)"
 	depends on ARCH_BCM2835
+	select MACH_RPI_COMMON
+
+config MACH_RPI2
+	bool "RaspberryPi 2 (BCM2836/CORTEX-A7)"
+	depends on ARCH_BCM2836
+	select MACH_RPI_COMMON
 
 endchoice
 
arch/arm/mach-bcm283x/include/mach/mbox.h +6 -3
index 09b31f2..cd9ee1f 100644
@@ -11,6 +11,8 @@
 
 #include <common.h>
 
+#include <mach/platform.h>
+
 /*
  * The BCM2835 SoC contains (at least) two CPUs; the VideoCore (a/k/a "GPU")
  * and the ARM CPU. The ARM CPU is often thought of as the main CPU.
@@ -40,7 +42,7 @@
 
 /* Raw mailbox HW */
 
-#define BCM2835_MBOX_PHYSADDR	0x2000b880
+#define BCM2835_MBOX_PHYSADDR		(BCM2835_ARM_BASE + 0x880)
 
 struct bcm2835_mbox_regs {
 	u32 read;
@@ -73,8 +75,6 @@ struct bcm2835_mbox_hdr {
 #define BCM2835_MBOX_REQ_CODE		0
 #define BCM2835_MBOX_RESP_CODE_SUCCESS	0x80000000
 
-#define BCM2835_CACHELINE_SIZE		32
-
 #define BCM2835_MBOX_STACK_ALIGN(type, name) \
 	STACK_ALIGN_ARRAY(type, name, 1, BCM2835_CACHELINE_SIZE)
 
@@ -128,6 +128,9 @@ struct bcm2835_mbox_tag_hdr {
 
 #define BCM2835_MBOX_TAG_GET_BOARD_REV	0x00010002
 
+/* RPi 2 */
+#define BCM2836_BOARD_REV_2_B		0x4
+
 /*
  * 0x2..0xf from:
  * http://raspberryalphaomega.org.uk/2013/02/06/automatic-raspberry-pi-board-revision-detection-model-a-b1-and-b2/
arch/arm/mach-bcm283x/include/mach/platform.h +9 -0
index e55085a..3b73831 100644
@@ -28,7 +28,16 @@
  * This file is manually generated.
  */
 
+#ifdef CONFIG_ARCH_BCM2835
 #define BCM2835_PERI_BASE	0x20000000
+#define BCM2835_CACHELINE_SIZE	32
+#elif defined CONFIG_ARCH_BCM2836
+#define BCM2835_PERI_BASE	0x3f000000
+#define BCM2835_CACHELINE_SIZE	64
+#else
+#error "no CONFIG_ARCH_BCM283X defined"
+#endif
+
 #define BCM2835_ST_BASE		(BCM2835_PERI_BASE + 0x3000)	/* System Timer */
 #define BCM2835_DMA_BASE	(BCM2835_PERI_BASE + 0x7000)	/* DMA controller */
 #define BCM2835_ARM_BASE	(BCM2835_PERI_BASE + 0xB000)	/* BCM2708 ARM control block */
Signature · 7 lines
2.6.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#8 lore raw
In reply to Alexander Aring
Quoted 9 lines · Alexander Aring

This patch series contains at first small cleanups which I detected by supporting/testing raspberry pi 2 and initial support for rpi2.

It introduced the mach-bcm283x which contains bcm2835 and bcm2836, because these are mostly the same. I didn't rename everything from bcm2835 to bcm283x, what I changed are the Kconfig entries only.

The complete mach-bcm283x doesn't support devicetree handling which may be the next step. Also there is still no support for dwc2 usb.

Applied, thanks.

Device tree support would indeed be very appreciated ;)

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox