arm: bcm2835: move to the multiplatform support
Subsystems (4)
PATCH 1/2 arm: bcm2835: move to the multiplatform support
This commit integrates the bcm2835 into the list of platforms supported by the multiplatform mechanism, which makes it possible to build a single kernel binary image that boots on various SoCs.
In order to make this happen, we have to:
* Move the ARCH_BCM2835 Kconfig option down to arch/arm/mach-bcm2835/Kconfig and make a few adjustements.
* Move the DEBUG_LL/earlyprintk support from arch/arm/mach-bcm2835/include/mach/ to arch/arm/include/debug/
* Remove files that have become useless (timex.h, uncompress.h)
* Move the last remaining header file bcm2835_soc.h down to arch/arm/mach-bcm2835/.
The resulting binary kernel has been successfully booted on both the Rasberry Pi platform and the Globalscale Mirabox (a Marvell Armada 370 based platform).
---
Note that if you have CONFIG_VFP enabled, you need "[PATCH v3] ARM:
vfp: fix save and restore when running on pre-VFPv3 and CONFIG_VFPv3 set" to be applied in order to avoid a VFP-related kernel panic when starting the first userspace application. Thanks to Albin Tonnerre for pointing me to the right fix for this problem!
---
arch/arm/Kconfig | 20 +--------
arch/arm/Kconfig.debug | 8 ++++
.../mach/debug-macro.S => include/debug/bcm2835.S} | 3 +-
arch/arm/mach-bcm2835/Kconfig | 18 ++++++++
arch/arm/mach-bcm2835/Makefile.boot | 3 --
arch/arm/mach-bcm2835/bcm2835.c | 2 +-
.../{include/mach/bcm2835_soc.h => bcm2835.h} | 2 -
arch/arm/mach-bcm2835/include/mach/timex.h | 26 -----------
arch/arm/mach-bcm2835/include/mach/uncompress.h | 45 --------------------
9 files changed, 31 insertions(+), 96 deletions(-)
rename arch/arm/{mach-bcm2835/include/mach/debug-macro.S => include/debug/bcm2835.S} (86%)
create mode 100644 arch/arm/mach-bcm2835/Kconfig
delete mode 100644 arch/arm/mach-bcm2835/Makefile.boot
rename arch/arm/mach-bcm2835/{include/mach/bcm2835_soc.h => bcm2835.h} (91%)
delete mode 100644 arch/arm/mach-bcm2835/include/mach/timex.h
delete mode 100644 arch/arm/mach-bcm2835/include/mach/uncompress.harch/arm/Kconfig +2 -18
@@ -334,24 +334,6 @@ config ARCH_AT91 This enables support for systems based on Atmel AT91RM9200 and AT91SAM9* processors. -config ARCH_BCM2835 - bool "Broadcom BCM2835 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 - select USE_IRQCHIP - help - This enables support for the Broadcom BCM2835 SoC. This SoC is - use in the Raspberry Pi, and Roku 2 devices. - config ARCH_CNS3XXX bool "Cavium Networks CNS3XXX family" select ARM_GIC
@@ -1023,6 +1005,8 @@ source "arch/arm/mach-mvebu/Kconfig" source "arch/arm/mach-at91/Kconfig" +source "arch/arm/mach-bcm2835/Kconfig" + source "arch/arm/mach-clps711x/Kconfig" source "arch/arm/mach-cns3xxx/Kconfig"
arch/arm/Kconfig.debug +8 -0
@@ -89,6 +89,13 @@ choice bool "Kernel low-level debugging on 9263 and 9g45" depends on HAVE_AT91_DBGU1 + config DEBUG_BCM2835_UART + bool "Kernel low-level debugging messages via BCM2835 UART" + depends on ARCH_BCM2835 + help + Say Y here if you want kernel low-level debugging support + on BCM2835 based platforms. + config DEBUG_CLPS711X_UART1 bool "Kernel low-level debugging messages via UART1" depends on ARCH_CLPS711X
@@ -411,6 +418,7 @@ endchoice config DEBUG_LL_INCLUDE string + default "debug/bcm2835.S" if DEBUG_BCM2835_UART default "debug/icedcc.S" if DEBUG_ICEDCC default "debug/highbank.S" if DEBUG_HIGHBANK_UART default "debug/mvebu.S" if DEBUG_MVEBU_UART
arch/arm/include/debug/bcm2835.S renamed from arch/arm/mach-bcm2835/include/mach/debug-macro.S +2 -1
@@ -11,7 +11,8 @@ * */ -#include <mach/bcm2835_soc.h> +#define BCM2835_DEBUG_PHYS 0x20201000 +#define BCM2835_DEBUG_VIRT 0xf0201000 .macro addruart, rp, rv, tmp ldr \rp, =BCM2835_DEBUG_PHYS
arch/arm/mach-bcm2835/Kconfig new file +18 -0
@@ -0,0 +1,18 @@ +config ARCH_BCM2835 + bool "Broadcom BCM2835 family" if ARCH_MULTI_V6 + 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 + select USE_IRQCHIP + help + This enables support for the Broadcom BCM2835 SoC. This SoC is + use in the Raspberry Pi, and Roku 2 devices. +
arch/arm/mach-bcm2835/Makefile.boot deleted +0 -3
@@ -1,3 +0,0 @@ - zreladdr-y := 0x00008000 -params_phys-y := 0x00000100 -initrd_phys-y := 0x00800000
arch/arm/mach-bcm2835/bcm2835.c +1 -1
@@ -21,7 +21,7 @@#include <asm/mach/arch.h> #include <asm/mach/map.h> -#include <mach/bcm2835_soc.h> +#include "bcm2835.h" static struct map_desc io_map__initdata = { .virtual =BCM2835_PERIPH_VIRT ,
arch/arm/mach-bcm2835/bcm2835.h renamed from arch/arm/mach-bcm2835/include/mach/bcm2835_soc.h +0 -2
@@ -23,7 +23,5 @@#define BCM2835_PERIPH_PHYS 0x20000000#define BCM2835_PERIPH_VIRT 0xf0000000#define BCM2835_PERIPH_SIZE SZ_16M -#define BCM2835_DEBUG_PHYS 0x20201000 -#define BCM2835_DEBUG_VIRT 0xf0201000#endif
arch/arm/mach-bcm2835/include/mach/timex.h deleted +0 -26
@@ -1,26 +0,0 @@ -/* -* BCM2835 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-bcm2835/include/mach/uncompress.h deleted +0 -45
45 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 2/2 arm: bcm2835: properly use IOMEM() to define virtual address constants
Like we now do for all ARM platforms, use IOMEM() to define virtual address constants, so that they get typed as 'void __iomem *' pointers. It for now requires a cast when defining the map_desc entry, but that cast should disappear once we switch map_desc to the usage of 'void __iomem *' pointers.
--- arch/arm/mach-bcm2835/bcm2835.c | 2 +- arch/arm/mach-bcm2835/bcm2835.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-bcm2835/bcm2835.c +1 -1
@@ -24,7 +24,7 @@#include "bcm2835.h" static struct map_desc io_map__initdata = { - .virtual =BCM2835_PERIPH_VIRT , + .virtual = (unsigned long )BCM2835_PERIPH_VIRT , .pfn =__phys_to_pfn (BCM2835_PERIPH_PHYS ), .length =BCM2835_PERIPH_SIZE , .type =MT_DEVICE
arch/arm/mach-bcm2835/bcm2835.h +1 -1
@@ -21,7 +21,7 @@#include <asm/sizes.h> #define BCM2835_PERIPH_PHYS 0x20000000 -#define BCM2835_PERIPH_VIRT 0xf0000000 +#define BCM2835_PERIPH_VIRT IOMEM(0xf0000000)#define BCM2835_PERIPH_SIZE SZ_16M#endif
Signature · 1 line
1.7.9.5
PATCH 2/2 arm: bcm2835: properly use IOMEM() to define virtual address constants
arch/arm/mach-bcm2835/bcm2835.c line 27
Quoted 11 lines · Thomas Petazzoni
Like we now do for all ARM platforms, use
IOMEM()to define virtual address constants, so that they get typed as 'void__iomem*' pointers. It for now requires a cast when defining themap_descentry, but that cast should disappear once we switchmap_descto the usage of 'void__iomem*' pointers.arch/arm/mach-bcm2835/bcm2835.c +1
-1static struct map_desc io_map__initdata = { - .virtual =BCM2835_PERIPH_VIRT , + .virtual = (unsigned long )BCM2835_PERIPH_VIRT ,
Very nit-picky, but there shouldn't be a space after the cast there.
PATCH 1/2 arm: bcm2835: move to the multiplatform support
In reply to Thomas PetazzoniQuoted 3 lines · Thomas Petazzoni
This commit integrates the bcm2835 into the list of platforms supported by the multiplatform mechanism, which makes it possible to build a single kernel binary image that boots on various SoCs.
...
Quoted 5 lines
Note that if you have
CONFIG_VFPenabled, you need "[PATCH v3] ARM:
vfp: fix save and restore when running on pre-VFPv3 andCONFIG_VFPv3set" to be applied in order to avoid a VFP-related kernel panic when starting the first userspace application. Thanks to Albin Tonnerre for pointing me to the right fix for this problem!
Since CONFIG_VFP is enabled in bcm2835_defconfig (or in general, could be enabled in anyone's .config), I guess that means I can't apply the patch yet, because the VFP fix you mention above doesn't seem to have been applied anywhere, so applying it would cause bcm2835_defconfig to be unbootable. To apply this, I'd need to merge in a branch containing the VFP fix first.
What branch is this patch series based on? Neither "git am" not "git am -3" will apply the series; apparently my repo doesn't have the blobs to perform the 3-way merge -3 invokes even though I have a remote for linux-next which should pick up most blob sources.
A couple minor comments on the code itself:
arch/arm/Kconfig.debug choice · line 98
Quoted 9 lines
arch/arm/Kconfig.debug +7
-0+ config DEBUG_BCM2835_UART + bool "Kernel low-level debugging messages via BCM2835 UART" + depends on ARCH_BCM2835 + help + Say Y here if you want kernel low-level debugging support + on BCM2835 based platforms. +
Since the SoC has multiple UARTs, does it make sense to rename that something like DEBUG_BM2835_PL011_UART?
arch/arm/include/debug/bcm2835.S line 15
Quoted 5 lines
arch/arm/include/debug/bcm2835.S renamed from arch/arm/mach-bcm2835/include/mach/debug-macro.S +2
-1-#include <mach/bcm2835_soc.h> +#define BCM2835_DEBUG_PHYS 0x20201000 +#define BCM2835_DEBUG_VIRT 0xf0201000
Especially since I have to wait to apply this anyway, I'd prefer to avoid that part of this patch, by calling debug_ll_io_init() from bcm2835_map_io(). That patch unfortunately also isn't checked in yet, but I'll try to chase it down.
PATCH 1/2 arm: bcm2835: move to the multiplatform support
Stephen,
Thanks for taking the time to look at this patch.
Quoted 6 lines · Stephen Warren
Since
CONFIG_VFPis enabled inbcm2835_defconfig(or in general, could be enabled in anyone's .config), I guess that means I can't apply the patch yet, because the VFP fix you mention above doesn't seem to have been applied anywhere, so applying it would causebcm2835_defconfigto be unbootable. To apply this, I'd need to merge in a branch containing the VFP fix first.
I'm pretty sure the VFP fix will land somewhere at some point, we can wait this moment to merge this multiplatform bcm2835 support patch.
Quoted 4 lines
What branch is this patch series based on? Neither "git am" not "git am -3" will apply the series; apparently my repo doesn't have the blobs to perform the 3-way merge -3 invokes even though I have a remote for linux-next which should pick up most blob sources.
This is my fault, sorry. I based this patch on a branch that contains the VFP fix + the irqchip changes I've been proposing. I can resend a new version based on 3.7-rc3, or arm-soc/for-next, at your preference.
Quoted 4 lines
A couple minor comments on the code itself:
Quoted 1 line
arch/arm/Kconfig.debug +0
-0
Quoted 10 lines
arch/arm/Kconfig.debug choice · line 98
Quoted 7 lines
arch/arm/Kconfig.debug +7
-0+ config DEBUG_BCM2835_UART + bool "Kernel low-level debugging messages via BCM2835 UART" + depends on ARCH_BCM2835 + help + Say Y here if you want kernel low-level debugging support + on BCM2835 based platforms. +Since the SoC has multiple UARTs, does it make sense to rename that something like
DEBUG_BM2835_PL011_UART?
Agreed.
Quoted 10 lines
arch/arm/include/debug/bcm2835.S line 15
Quoted 5 lines
arch/arm/include/debug/bcm2835.S renamed from arch/arm/mach-bcm2835/include/mach/debug-macro.S +2
-1-#include <mach/bcm2835_soc.h> +#define BCM2835_DEBUG_PHYS 0x20201000 +#define BCM2835_DEBUG_VIRT 0xf0201000Especially since I have to wait to apply this anyway, I'd prefer to avoid that part of this patch, by calling
debug_ll_io_init()frombcm2835_map_io(). That patch unfortunately also isn't checked in yet, but I'll try to chase it down.
Ok, fine with that. I can respin this multiplatform patch once VFP and debug_ll_io_init() are available.
Thanks,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/2 arm: bcm2835: move to the multiplatform support
Quoted 16 lines · Thomas Petazzoni
Stephen,
Thanks for taking the time to look at this patch.
Quoted 6 lines · Stephen Warren
Since
CONFIG_VFPis enabled inbcm2835_defconfig(or in general, could be enabled in anyone's .config), I guess that means I can't apply the patch yet, because the VFP fix you mention above doesn't seem to have been applied anywhere, so applying it would causebcm2835_defconfigto be unbootable. To apply this, I'd need to merge in a branch containing the VFP fix first.I'm pretty sure the VFP fix will land somewhere at some point, we can wait this moment to merge this multiplatform bcm2835 support patch.
Quoted 8 lines
Quoted 4 lines
What branch is this patch series based on? Neither "git am" not "git am -3" will apply the series; apparently my repo doesn't have the blobs to perform the 3-way merge -3 invokes even though I have a remote for linux-next which should pick up most blob sources.
This is my fault, sorry. I based this patch on a branch that contains the VFP fix + the irqchip changes I've been proposing. I can resend a new version based on 3.7-rc3, or arm-soc/for-next, at your preference.
(Once the dependencies are in arm-soc somewhere...) It'd be best to base it on v3.7-rcN, either with/without the VFP and debug_ll_io_init() patches merged (since I'll apply the patch only on top of those two patches anyway.
Thanks.
PATCH 1/2 arm: bcm2835: move to the multiplatform support
In reply to Thomas PetazzoniQuoted 3 lines · Thomas Petazzoni
This commit integrates the bcm2835 into the list of platforms supported by the multiplatform mechanism, which makes it possible to build a single kernel binary image that boots on various SoCs.
...
Quoted 6 lines
---
Note that if you haveCONFIG_VFPenabled, you need "[PATCH v3] ARM:
vfp: fix save and restore when running on pre-VFPv3 andCONFIG_VFPv3set" to be applied in order to avoid a VFP-related kernel panic when starting the first userspace application. Thanks to Albin Tonnerre for pointing me to the right fix for this problem!
Thomas, just a heads up - the VFP commit you mention above should show up in v3.7-rc5 which I imagine will be released this weekend, and the debug_ll_io_init feature I mentioned in another response is already available is arm-soc branch devel/debug_ll_init. If you rebase this patch on a merge of those two branches, it should be in good shape for me to apply it.
Thanks.
PATCH 1/2 arm: bcm2835: move to the multiplatform support
Stephen,
Quoted 6 lines · Stephen Warren
Thomas, just a heads up - the VFP commit you mention above should show up in v3.7-rc5 which I imagine will be released this weekend, and the
debug_ll_io_initfeature I mentioned in another response is already available is arm-soc branch devel/debug_ll_init. If you rebase this patch on a merge of those two branches, it should be in good shape for me to apply it.
Excellent, thanks for the heads up! As I've said in another e-mail, I was at ELCE this week, which obviously means I wasn't able to do any sort of kernel development. I'm back now, and planning to work on this and the irqchip things.
Thanks,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com