Skip to contentSkip to conversation

ARM: initial multiplatform support

RFC PATCH New Rob Herring 3 participants 4 messages Aug 24, 2012

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

RFC PATCH 1/1 ARM: initial multiplatform support

From: Arnd Bergmann <[email protected]>

This lets us build a multiplatform kernel for experimental purposes. However, it will not be useful for any real work, because it relies on a number of useful things to be disabled for now:

* SMP support is turned off because of conflicting symbols. Marc Zyngier has proposed a solution by adding a new SOC operations structure to hold indirect function pointers for these, but that work is currently stalled

* We turn on SPARSE_IRQ unconditionally, which is not supported on most platforms. Each of them is currently in a different state, but most are being worked on.

* A common clock framework is in place since v3.4 but not yet being used. Work on this is on its way.

* DEBUG_LL for early debugging is currently disabled.

* THUMB2_KERNEL does not work with allyesconfig because the kernel gets too big

[Rob Herring]: Rebased to not be dependent on the mass mach header rename. As a result, omap2plus, imx, mxs and ux500 are not converted. Highbank, socfpga, and vexpress are converted. There's probably a few others that can be converted easily, too.

The kconfig and makefile changes have been simplified some. Instead of 3 kconfig symbols per mach, there are only 2. arch/arm/Kconfig is getting kind of large. I think it should be split between Kconfig and Kconfig.mach to separate out the mach specific parts.

---
 arch/arm/Kconfig                              |  107 +++++++++++++++----------
 arch/arm/Makefile                             |   16 ++--
 arch/arm/mach-multi/Kconfig                   |   42 ++++++++++
 arch/arm/mach-multi/Makefile                  |    1 +
 arch/arm/mach-multi/include/mach/gpio.h       |    1 +
 arch/arm/mach-multi/include/mach/timex.h      |    3 +
 arch/arm/mach-multi/include/mach/uncompress.h |   10 +++
 arch/arm/mach-vexpress/Makefile               |    1 +
 arch/arm/plat-versatile/Makefile              |    2 +
 9 files changed, 136 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/mach-multi/Kconfig
 create mode 100644 arch/arm/mach-multi/Makefile
 create mode 100644 arch/arm/mach-multi/include/mach/gpio.h
 create mode 100644 arch/arm/mach-multi/include/mach/timex.h
 create mode 100644 arch/arm/mach-multi/include/mach/uncompress.h
arch/arm/Kconfig +65 -42
index e91c7cd..e841262 100644
@@ -255,22 +255,18 @@ choice
 	prompt "ARM system type"
 	default ARCH_VERSATILE
 
-config ARCH_SOCFPGA
-	bool "Altera SOCFPGA family"
-	select ARCH_WANT_OPTIONAL_GPIOLIB
-	select ARM_AMBA
-	select ARM_GIC
-	select CACHE_L2X0
-	select CLKDEV_LOOKUP
+config ARCH_MULTIPLATFORM
+	bool "Allow multiple platforms to be selected"
+	select USE_OF
 	select COMMON_CLK
-	select CPU_V7
-	select DW_APB_TIMER
-	select DW_APB_TIMER_OF
-	select GENERIC_CLOCKEVENTS
-	select GPIO_PL061 if GPIOLIB
-	select HAVE_ARM_SCU
 	select SPARSE_IRQ
-	select USE_OF
+	select MULTI_IRQ_HANDLER
+	select AUTO_ZRELADDR
+	depends on MMU
+
+config ARCH_SOCFPGA_CHOICE
+	bool "Altera SOCFPGA family"
+	select ARCH_SOCFPGA
 	help
 	  This enables support for Altera SOCFPGA Cyclone V platform
 
@@ -327,21 +323,9 @@ config ARCH_VERSATILE
 	help
 	  This enables support for ARM Ltd Versatile board.
 
-config ARCH_VEXPRESS
+config ARCH_VEXPRESS_CHOICE
 	bool "ARM Ltd. Versatile Express family"
-	select ARCH_WANT_OPTIONAL_GPIOLIB
-	select ARM_AMBA
-	select ARM_TIMER_SP804
-	select CLKDEV_LOOKUP
-	select COMMON_CLK
-	select GENERIC_CLOCKEVENTS
-	select HAVE_CLK
-	select HAVE_PATA_PLATFORM
-	select ICST
-	select NO_IOPORT
-	select PLAT_VERSATILE
-	select PLAT_VERSATILE_CLCD
-	select REGULATOR_FIXED_VOLTAGE if REGULATOR
+	select ARCH_VEXPRESS
 	help
 	  This enables support for the ARM Ltd Versatile Express boards.
 
@@ -368,21 +352,8 @@ config ARCH_BCMRING
 	help
 	  Support for Broadcom's BCMRing platform.
 
-config ARCH_HIGHBANK
+config ARCH_HIGHBANK_CHOICE
 	bool "Calxeda Highbank-based"
-	select ARCH_WANT_OPTIONAL_GPIOLIB
-	select ARM_AMBA
-	select ARM_GIC
-	select ARM_TIMER_SP804
-	select CACHE_L2X0
-	select CLKDEV_LOOKUP
-	select COMMON_CLK
-	select CPU_V7
-	select GENERIC_CLOCKEVENTS
-	select HAVE_ARM_SCU
-	select HAVE_SMP
-	select SPARSE_IRQ
-	select USE_OF
 	help
 	  Support for the Calxeda Highbank SoC based boards.
 
@@ -1028,6 +999,58 @@ config ARCH_ZYNQ
 	  Support for Xilinx Zynq ARM Cortex A9 Platform
 endchoice
 
+source "arch/arm/mach-multi/Kconfig"
+
+config ARCH_SOCFPGA
+	bool "Altera SOCFPGA family" if ARCH_MULTI_V7
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARM_AMBA
+	select ARM_GIC
+	select CACHE_L2X0
+	select CLKDEV_LOOKUP
+	select COMMON_CLK
+	select CPU_V7
+	select DW_APB_TIMER
+	select DW_APB_TIMER_OF
+	select GENERIC_CLOCKEVENTS
+	select GPIO_PL061 if GPIOLIB
+	select HAVE_ARM_SCU
+	select SPARSE_IRQ
+	select USE_OF
+
+config ARCH_VEXPRESS
+	bool "" if ARCH_MULTI_V7
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARM_AMBA
+	select ARM_TIMER_SP804
+	select CLKDEV_LOOKUP
+	select COMMON_CLK
+	select GENERIC_CLOCKEVENTS
+	select HAVE_CLK
+	select HAVE_PATA_PLATFORM
+	select ICST
+	select NO_IOPORT
+	select PLAT_VERSATILE
+	select PLAT_VERSATILE_CLCD
+	select REGULATOR_FIXED_VOLTAGE if REGULATOR
+	select MAY_HAVE_SPARSE_IRQ
+
+config ARCH_HIGHBANK
+	bool "Highbank" if ARCH_MULTI_V7
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARM_AMBA
+	select ARM_GIC
+	select ARM_TIMER_SP804
+	select CACHE_L2X0
+	select CLKDEV_LOOKUP
+	select COMMON_CLK
+	select CPU_V7
+	select GENERIC_CLOCKEVENTS
+	select HAVE_ARM_SCU
+	select HAVE_SMP
+	select SPARSE_IRQ
+	select USE_OF
+
 #
 # This is sorted alphabetically by mach-* pathname.  However, plat-*
 # Kconfigs may be included either alphabetically (according to the
arch/arm/Makefile +11 -5
index 30eae87..c113e53 100644
@@ -133,6 +133,9 @@ textofs-$(CONFIG_ARCH_MSM7X30) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 
+# multiplatform directory must be first
+machine-$(CONFIG_ARCH_MULTIPLATFORM)	:= multi
+
 # Machine directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
 machine-$(CONFIG_ARCH_AT91)		:= at91
@@ -145,7 +148,7 @@ machine-$(CONFIG_ARCH_EBSA110)		:= ebsa110
 machine-$(CONFIG_ARCH_EP93XX)		:= ep93xx
 machine-$(CONFIG_ARCH_GEMINI)		:= gemini
 machine-$(CONFIG_ARCH_H720X)		:= h720x
-machine-$(CONFIG_ARCH_HIGHBANK)		:= highbank
+machine-$(CONFIG_ARCH_HIGHBANK)		+= highbank
 machine-$(CONFIG_ARCH_INTEGRATOR)	:= integrator
 machine-$(CONFIG_ARCH_IOP13XX)		:= iop13xx
 machine-$(CONFIG_ARCH_IOP32X)		:= iop32x
@@ -186,11 +189,11 @@ machine-$(CONFIG_ARCH_TEGRA)		:= tegra
 machine-$(CONFIG_ARCH_U300)		:= u300
 machine-$(CONFIG_ARCH_U8500)		:= ux500
 machine-$(CONFIG_ARCH_VERSATILE)	:= versatile
-machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
+machine-$(CONFIG_ARCH_VEXPRESS)		+= vexpress
 machine-$(CONFIG_ARCH_VT8500)		:= vt8500
 machine-$(CONFIG_ARCH_W90X900)		:= w90x900
 machine-$(CONFIG_FOOTBRIDGE)		:= footbridge
-machine-$(CONFIG_ARCH_SOCFPGA)		:= socfpga
+machine-$(CONFIG_ARCH_SOCFPGA)		+= socfpga
 machine-$(CONFIG_MACH_SPEAR1310)	:= spear13xx
 machine-$(CONFIG_MACH_SPEAR1340)	:= spear13xx
 machine-$(CONFIG_MACH_SPEAR300)		:= spear3xx
@@ -230,14 +233,17 @@ MACHINE  := arch/arm/mach-$(word 1,$(machine-y))/
 else
 MACHINE  :=
 endif
+ifeq ($(CONFIG_ARCH_MULTIPLATFORM),y)
+MACHINE  :=
+endif
 
 machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
 platdirs := $(patsubst %,arch/arm/plat-%/,$(plat-y))
 
 ifeq ($(KBUILD_SRC),)
-KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(machdirs) $(platdirs))
+KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(word 1,$(machdirs) $(platdirs)))
 else
-KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
+KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(word 1,$(machdirs) $(platdirs)))
 endif
 
 export	TEXT_OFFSET GZFLAGS MMUEXT
arch/arm/mach-multi/Kconfig new file +42 -0

42 lines not on this page · raw message

arch/arm/mach-multi/Makefile new file +1 -0
new file mode 100644
index 0000000..1bb8bf6
@@ -0,0 +1 @@
+# empty
arch/arm/mach-multi/include/mach/gpio.h new file +1 -0
new file mode 100644
index 0000000..40a8c17
@@ -0,0 +1 @@
+/* empty */
arch/arm/mach-multi/include/mach/timex.h new file +3 -0
new file mode 100644
index 0000000..929b4c4
@@ -0,0 +1,3 @@
+#ifndef CLOCK_TICK_RATE
+#define CLOCK_TICK_RATE 1000000
+#endif
arch/arm/mach-multi/include/mach/uncompress.h new file +10 -0
new file mode 100644
index 0000000..a4dec68
@@ -0,0 +1,10 @@
+#ifndef __MACH_UNCOMPRESS_H
+#define __MACH_UNCOMPRESS_H
+
+/* no-op dummies for the uncompress debugging for multiplatform kernels */
+
+static inline void putc(int c) {}
+static inline void flush(void) {}
+static inline void arch_decomp_setup(void) {}
+
+#endif
arch/arm/mach-vexpress/Makefile +1 -0
index 90551b9..1666f6e 100644
@@ -1,6 +1,7 @@
 #
 # Makefile for the linux kernel.
 #
+ccflags-y := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-versatile/include
 
 obj-y					:= v2m.o
 obj-$(CONFIG_ARCH_VEXPRESS_CA9X4)	+= ct-ca9x4.o
arch/arm/plat-versatile/Makefile +2 -0
index 272769a8..15411b1 100644
@@ -1,3 +1,5 @@
+ccflags-y := -I$(srctree)/$(src)/include
+
 obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o
 obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o
 obj-$(CONFIG_PLAT_VERSATILE_FPGA_IRQ) += fpga-irq.o
Signature · 1 line
1.7.9.5
#1 lore raw

RFC PATCH 1/1 ARM: initial multiplatform support

Quoted 5 lines · Rob Herring

From: Arnd Bergmann <[email protected]>

This lets us build a multiplatform kernel for experimental purposes. However, it will not be useful for any real work, because it relies on a number of useful things to be disabled for now:

...

Quoted 8 lines
arch/arm/Kconfig +4 -1
 
+config ARCH_SOCFPGA_CHOICE
+	bool "Altera SOCFPGA family"
+	select ARCH_SOCFPGA
 
-config ARCH_VEXPRESS
+config ARCH_VEXPRESS_CHOICE

...

Quoted 4 lines
arch/arm/Kconfig +2 -1
+	select ARCH_VEXPRESS
 
-config ARCH_HIGHBANK
+config ARCH_HIGHBANK_CHOICE

...

Quoted 1 line

help

Doesn't that need "select ARCH_HIGHBANK" too?

I see Tegra doesn't work with SPARSE_IRQ:-( I'll have to look into what's required to make that work...

#2 lore raw

RFC PATCH 1/1 ARM: initial multiplatform support

In reply to Rob Herring

Hi,

A few comments below.

Quoted 10 lines · Rob Herring

From: Arnd Bergmann <[email protected]>

This lets us build a multiplatform kernel for experimental purposes. However, it will not be useful for any real work, because it relies on a number of useful things to be disabled for now:

* SMP support is turned off because of conflicting symbols. Marc Zyngier has proposed a solution by adding a new SOC operations structure to hold indirect function pointers for these, but that work is currently stalled

On what? Review? or something else? It'd be nice to get some movement going on it again. I guess we'll bring it up next week.

Quoted 8 lines

* We turn on SPARSE_IRQ unconditionally, which is not supported on most platforms. Each of them is currently in a different state, but most are being worked on.

* A common clock framework is in place since v3.4 but not yet being used. Work on this is on its way.

* DEBUG_LL for early debugging is currently disabled.

Being able to turn it on for one platform just to debug a boot issue is still very useful. It's how powerpc handles it -- even if you can do a multiplatform kernel, for the low level debug console you have to pick one static entry. Still useful during development.

Quoted 2 lines

* THUMB2_KERNEL does not work with allyesconfig because the kernel gets too big

Ironic, but understandable.

Quoted 25 lines
---
 arch/arm/Kconfig                              |  107 +++++++++++++++----------
 arch/arm/Makefile                             |   16 ++--
 arch/arm/mach-multi/Kconfig                   |   42 ++++++++++
 arch/arm/mach-multi/Makefile                  |    1 +
 arch/arm/mach-multi/include/mach/gpio.h       |    1 +
 arch/arm/mach-multi/include/mach/timex.h      |    3 +
 arch/arm/mach-multi/include/mach/uncompress.h |   10 +++
 arch/arm/mach-vexpress/Makefile               |    1 +
 arch/arm/plat-versatile/Makefile              |    2 +
 9 files changed, 136 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/mach-multi/Kconfig
 create mode 100644 arch/arm/mach-multi/Makefile
 create mode 100644 arch/arm/mach-multi/include/mach/gpio.h
 create mode 100644 arch/arm/mach-multi/include/mach/timex.h
 create mode 100644 arch/arm/mach-multi/include/mach/uncompress.h
arch/arm/Kconfig +0 -0
index e91c7cd..e841262 100644
@@ -255,22 +255,18 @@ choice
 	prompt "ARM system type"
 	default ARCH_VERSATILE
 

arch/arm/Kconfig choice · line 260

Quoted 10 lines
arch/arm/Kconfig +3 -7
-config ARCH_SOCFPGA
-	bool "Altera SOCFPGA family"
-	select ARCH_WANT_OPTIONAL_GPIOLIB
-	select ARM_AMBA
-	select ARM_GIC
-	select CACHE_L2X0
-	select CLKDEV_LOOKUP
+config ARCH_MULTIPLATFORM
+	bool "Allow multiple platforms to be selected"
+	select USE_OF

Should this be a toplevel config option and the choice menu disabled if it's set, instead of a meta-platform?

Quoted 12 lines
arch/arm/Kconfig +8 -0
@@ -1028,6 +999,58 @@ config ARCH_ZYNQ
 	  Support for Xilinx Zynq ARM Cortex A9 Platform
 endchoice
 
+source "arch/arm/mach-multi/Kconfig"
+
+config ARCH_SOCFPGA
+	bool "Altera SOCFPGA family" if ARCH_MULTI_V7
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARM_AMBA
+	select ARM_GIC
+	select CACHE_L2X0

arch/arm/Kconfig config ARCH_ZYNQ · line 1019

Quoted 10 lines
arch/arm/Kconfig +10 -0
+	select CLKDEV_LOOKUP
+	select COMMON_CLK
+	select CPU_V7
+	select DW_APB_TIMER
+	select DW_APB_TIMER_OF
+	select GENERIC_CLOCKEVENTS
+	select GPIO_PL061 if GPIOLIB
+	select HAVE_ARM_SCU
+	select SPARSE_IRQ
+	select USE_OF

There's no need to keep these in the common arm/Kconfig now, is there? Might as well push them out to the respective mach-*/Kconfig, that will cause less churn on the common file and in general scale better.

Quoted 45 lines
arch/arm/Makefile +9 -3
index 30eae87..c113e53 100644
@@ -133,6 +133,9 @@ textofs-$(CONFIG_ARCH_MSM7X30) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 
+# multiplatform directory must be first
+machine-$(CONFIG_ARCH_MULTIPLATFORM)	:= multi
+
 # Machine directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
 machine-$(CONFIG_ARCH_AT91)		:= at91
@@ -145,7 +148,7 @@ machine-$(CONFIG_ARCH_EBSA110)		:= ebsa110
 machine-$(CONFIG_ARCH_EP93XX)		:= ep93xx
 machine-$(CONFIG_ARCH_GEMINI)		:= gemini
 machine-$(CONFIG_ARCH_H720X)		:= h720x
-machine-$(CONFIG_ARCH_HIGHBANK)		:= highbank
+machine-$(CONFIG_ARCH_HIGHBANK)		+= highbank
 machine-$(CONFIG_ARCH_INTEGRATOR)	:= integrator
 machine-$(CONFIG_ARCH_IOP13XX)		:= iop13xx
 machine-$(CONFIG_ARCH_IOP32X)		:= iop32x
@@ -186,11 +189,11 @@ machine-$(CONFIG_ARCH_TEGRA)		:= tegra
 machine-$(CONFIG_ARCH_U300)		:= u300
 machine-$(CONFIG_ARCH_U8500)		:= ux500
 machine-$(CONFIG_ARCH_VERSATILE)	:= versatile
-machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
+machine-$(CONFIG_ARCH_VEXPRESS)		+= vexpress
 machine-$(CONFIG_ARCH_VT8500)		:= vt8500
 machine-$(CONFIG_ARCH_W90X900)		:= w90x900
 machine-$(CONFIG_FOOTBRIDGE)		:= footbridge
-machine-$(CONFIG_ARCH_SOCFPGA)		:= socfpga
+machine-$(CONFIG_ARCH_SOCFPGA)		+= socfpga
 machine-$(CONFIG_MACH_SPEAR1310)	:= spear13xx
 machine-$(CONFIG_MACH_SPEAR1340)	:= spear13xx
 machine-$(CONFIG_MACH_SPEAR300)		:= spear3xx
@@ -230,14 +233,17 @@ MACHINE  := arch/arm/mach-$(word 1,$(machine-y))/
 else
 MACHINE  :=
 endif
+ifeq ($(CONFIG_ARCH_MULTIPLATFORM),y)
+MACHINE  :=
+endif
 

arch/arm/Makefile MACHINE := arch/arm/mach-$(word 1,$(machine-y))/ · line 247

Quoted 10 lines
arch/arm/Makefile +2 -2
 machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
 platdirs := $(patsubst %,arch/arm/plat-%/,$(plat-y))
 
 ifeq ($(KBUILD_SRC),)
-KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(machdirs) $(platdirs))
+KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(word 1,$(machdirs) $(platdirs)))
 else
-KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
+KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(word 1,$(machdirs) $(platdirs)))
 endif

Since the only purpose of mach-multi is to provide a few dummy header files, how about adding those under arch/arm/include/ instead and do away with the mach directory? They could then be prepended in front of these so the search path would be in the right order.

Quoted 22 lines
arch/arm/mach-multi/Kconfig new file +16 -0
new file mode 100644
index 0000000..0a6369f
@@ -0,0 +1,42 @@
+menu "Multiple platform selection"
+	depends on ARCH_MULTIPLATFORM
+
+comment "CPU Core family selection"
+
+config ARCH_MULTI_V4
+	bool "ARMv4 based platforms (FA526, StrongARM)"
+	select ARCH_MULTI_V4_V5
+	depends on !ARCH_MULTI_V6_V7
+
+config ARCH_MULTI_V4T
+	bool "ARMv4T based platforms (ARM720T, ARM920T, ...)"
+	select ARCH_MULTI_V4_V5
+	depends on !ARCH_MULTI_V6_V7
+
+config ARCH_MULTI_V5

arch/arm/mach-multi/Kconfig line 26

Quoted 10 lines
arch/arm/mach-multi/Kconfig new file +10 -0
+	bool "ARMv5 based platforms (ARM926T, XSCALE, PJ1, ...)"
+	select ARCH_MULTI_V4_V5
+	depends on !ARCH_MULTI_V6_V7
+
+config ARCH_MULTI_V4_V5
+	bool
+
+config ARCH_MULTI_V6
+	bool "ARMv6 based platforms (ARM11, Scorpion, ...)"
+	select ARCH_MULTI_V6_V7

Does it make sense to add these before any platforms are ready? I'd argue no, but I don't feel strongly about it.

Quoted 59 lines
arch/arm/mach-multi/Kconfig new file +15 -0
+config ARCH_MULTI_V7
+	bool "ARMv7 based platforms (Cortex-A, PJ4, Krait)"
+	default y
+	select ARCH_MULTI_V6_V7
+
+config ARCH_MULTI_V6_V7
+	bool
+
+config ARCH_MULTI_CPU_AUTO
+	def_bool !(ARCH_MULTI_V4 || ARCH_MULTI_V4T || ARCH_MULTI_V6_V7)
+	select ARCH_MULTI_V5
+
+endmenu
+
+comment "SoC family selection"
arch/arm/mach-multi/Makefile new file +1 -0
new file mode 100644
index 0000000..1bb8bf6
@@ -0,0 +1 @@
+# empty
arch/arm/mach-multi/include/mach/gpio.h new file +1 -0
new file mode 100644
index 0000000..40a8c17
@@ -0,0 +1 @@
+/* empty */
arch/arm/mach-multi/include/mach/timex.h new file +3 -0
new file mode 100644
index 0000000..929b4c4
@@ -0,0 +1,3 @@
+#ifndef CLOCK_TICK_RATE
+#define CLOCK_TICK_RATE 1000000
+#endif
arch/arm/mach-multi/include/mach/uncompress.h new file +10 -0
new file mode 100644
index 0000000..a4dec68
@@ -0,0 +1,10 @@
+#ifndef __MACH_UNCOMPRESS_H
+#define __MACH_UNCOMPRESS_H
+
+/* no-op dummies for the uncompress debugging for multiplatform kernels */
+
+static inline void putc(int c) {}
+static inline void flush(void) {}
+static inline void arch_decomp_setup(void) {}
+
+#endif
arch/arm/mach-vexpress/Makefile +0 -0
index 90551b9..1666f6e 100644

arch/arm/mach-vexpress/Makefile line 4

Quoted 4 lines
arch/arm/mach-vexpress/Makefile +1 -0
@@ -1,6 +1,7 @@
 #
 # Makefile for the linux kernel.
 #
+ccflags-y := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-versatile/include

cc-flags-$(CONFIG_ARCH_MULTIPLATFORM) here and for versatile?

-Olof

#3 lore raw

RFC PATCH 1/1 ARM: initial multiplatform support

Quoted 11 lines · Olof Johansson

Hi,

A few comments below.

Quoted 6 lines · Rob Herring

From: Arnd Bergmann <[email protected]>

This lets us build a multiplatform kernel for experimental purposes. However, it will not be useful for any real work, because it relies on a number of useful things to be disabled for now:

Quoted 7 lines
Quoted 4 lines

* SMP support is turned off because of conflicting symbols. Marc Zyngier has proposed a solution by adding a new SOC operations structure to hold indirect function pointers for these, but that work is currently stalled

On what? Review? or something else? It'd be nice to get some movement going on it again. I guess we'll bring it up next week.

It tends to get sent out again during/after every conference. Marc would be best to comment on the status.

Quoted 7 lines
Quoted 7 lines

* We turn on SPARSE_IRQ unconditionally, which is not supported on most platforms. Each of them is currently in a different state, but most are being worked on.

* A common clock framework is in place since v3.4 but not yet being used. Work on this is on its way.

Quoted 6 lines
Quoted 1 line

* DEBUG_LL for early debugging is currently disabled.

Being able to turn it on for one platform just to debug a boot issue is still very useful. It's how powerpc handles it -- even if you can do a multiplatform kernel, for the low level debug console you have to pick one static entry. Still useful during development.

This comment is misleading. It is possible to select it, but then you just can only use that 1 platform.

Quoted 30 lines
Quoted 2 lines

* THUMB2_KERNEL does not work with allyesconfig because the kernel gets too big

Ironic, but understandable.

Quoted 25 lines
---
 arch/arm/Kconfig                              |  107 +++++++++++++++----------
 arch/arm/Makefile                             |   16 ++--
 arch/arm/mach-multi/Kconfig                   |   42 ++++++++++
 arch/arm/mach-multi/Makefile                  |    1 +
 arch/arm/mach-multi/include/mach/gpio.h       |    1 +
 arch/arm/mach-multi/include/mach/timex.h      |    3 +
 arch/arm/mach-multi/include/mach/uncompress.h |   10 +++
 arch/arm/mach-vexpress/Makefile               |    1 +
 arch/arm/plat-versatile/Makefile              |    2 +
 9 files changed, 136 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/mach-multi/Kconfig
 create mode 100644 arch/arm/mach-multi/Makefile
 create mode 100644 arch/arm/mach-multi/include/mach/gpio.h
 create mode 100644 arch/arm/mach-multi/include/mach/timex.h
 create mode 100644 arch/arm/mach-multi/include/mach/uncompress.h
arch/arm/Kconfig +0 -0
index e91c7cd..e841262 100644
@@ -255,22 +255,18 @@ choice
 	prompt "ARM system type"
 	default ARCH_VERSATILE
 
Quoted 13 lines

arch/arm/Kconfig choice · line 260

Quoted 10 lines
arch/arm/Kconfig +3 -7
-config ARCH_SOCFPGA
-	bool "Altera SOCFPGA family"
-	select ARCH_WANT_OPTIONAL_GPIOLIB
-	select ARM_AMBA
-	select ARM_GIC
-	select CACHE_L2X0
-	select CLKDEV_LOOKUP
+config ARCH_MULTIPLATFORM
+	bool "Allow multiple platforms to be selected"
+	select USE_OF

Should this be a toplevel config option and the choice menu disabled if it's set, instead of a meta-platform?

If we get rid of mach-multi, yes.

Quoted 18 lines
Quoted 18 lines
arch/arm/Kconfig +14 -0
@@ -1028,6 +999,58 @@ config ARCH_ZYNQ
 	  Support for Xilinx Zynq ARM Cortex A9 Platform
 endchoice
 
+source "arch/arm/mach-multi/Kconfig"
+
+config ARCH_SOCFPGA
+	bool "Altera SOCFPGA family" if ARCH_MULTI_V7
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARM_AMBA
+	select ARM_GIC
+	select CACHE_L2X0
+	select CLKDEV_LOOKUP
+	select COMMON_CLK
+	select CPU_V7
+	select DW_APB_TIMER
+	select DW_APB_TIMER_OF
+	select GENERIC_CLOCKEVENTS
Quoted 8 lines

arch/arm/Kconfig config ARCH_ZYNQ · line 1019

Quoted 4 lines
arch/arm/Kconfig +4 -0
+	select GPIO_PL061 if GPIOLIB
+	select HAVE_ARM_SCU
+	select SPARSE_IRQ
+	select USE_OF

There's no need to keep these in the common arm/Kconfig now, is there? Might as well push them out to the respective mach-*/Kconfig, that will cause less churn on the common file and in general scale better.

Good point. That's better than creating a Kconfig.mach. This can probably be done for all platforms independent of multi-platform support.

Quoted 48 lines
Quoted 48 lines
arch/arm/Makefile +9 -3
index 30eae87..c113e53 100644
@@ -133,6 +133,9 @@ textofs-$(CONFIG_ARCH_MSM7X30) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 
+# multiplatform directory must be first
+machine-$(CONFIG_ARCH_MULTIPLATFORM)	:= multi
+
 # Machine directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
 machine-$(CONFIG_ARCH_AT91)		:= at91
@@ -145,7 +148,7 @@ machine-$(CONFIG_ARCH_EBSA110)		:= ebsa110
 machine-$(CONFIG_ARCH_EP93XX)		:= ep93xx
 machine-$(CONFIG_ARCH_GEMINI)		:= gemini
 machine-$(CONFIG_ARCH_H720X)		:= h720x
-machine-$(CONFIG_ARCH_HIGHBANK)		:= highbank
+machine-$(CONFIG_ARCH_HIGHBANK)		+= highbank
 machine-$(CONFIG_ARCH_INTEGRATOR)	:= integrator
 machine-$(CONFIG_ARCH_IOP13XX)		:= iop13xx
 machine-$(CONFIG_ARCH_IOP32X)		:= iop32x
@@ -186,11 +189,11 @@ machine-$(CONFIG_ARCH_TEGRA)		:= tegra
 machine-$(CONFIG_ARCH_U300)		:= u300
 machine-$(CONFIG_ARCH_U8500)		:= ux500
 machine-$(CONFIG_ARCH_VERSATILE)	:= versatile
-machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
+machine-$(CONFIG_ARCH_VEXPRESS)		+= vexpress
 machine-$(CONFIG_ARCH_VT8500)		:= vt8500
 machine-$(CONFIG_ARCH_W90X900)		:= w90x900
 machine-$(CONFIG_FOOTBRIDGE)		:= footbridge
-machine-$(CONFIG_ARCH_SOCFPGA)		:= socfpga
+machine-$(CONFIG_ARCH_SOCFPGA)		+= socfpga
 machine-$(CONFIG_MACH_SPEAR1310)	:= spear13xx
 machine-$(CONFIG_MACH_SPEAR1340)	:= spear13xx
 machine-$(CONFIG_MACH_SPEAR300)		:= spear3xx
@@ -230,14 +233,17 @@ MACHINE  := arch/arm/mach-$(word 1,$(machine-y))/
 else
 MACHINE  :=
 endif
+ifeq ($(CONFIG_ARCH_MULTIPLATFORM),y)
+MACHINE  :=
+endif
 
 machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
 platdirs := $(patsubst %,arch/arm/plat-%/,$(plat-y))
 
Quoted 12 lines

arch/arm/Makefile MACHINE := arch/arm/mach-$(word 1,$(machine-y))/ · line 247

Quoted 7 lines
arch/arm/Makefile +2 -2
 ifeq ($(KBUILD_SRC),)
-KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(machdirs) $(platdirs))
+KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(word 1,$(machdirs) $(platdirs)))
 else
-KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
+KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(word 1,$(machdirs) $(platdirs)))
 endif

Since the only purpose of mach-multi is to provide a few dummy header files, how about adding those under arch/arm/include/ instead and do away with the mach directory? They could then be prepended in front of these so the search path would be in the right order.

Yes, good idea.

Quoted 27 lines
Quoted 27 lines
arch/arm/mach-multi/Kconfig new file +21 -0
new file mode 100644
index 0000000..0a6369f
@@ -0,0 +1,42 @@
+menu "Multiple platform selection"
+	depends on ARCH_MULTIPLATFORM
+
+comment "CPU Core family selection"
+
+config ARCH_MULTI_V4
+	bool "ARMv4 based platforms (FA526, StrongARM)"
+	select ARCH_MULTI_V4_V5
+	depends on !ARCH_MULTI_V6_V7
+
+config ARCH_MULTI_V4T
+	bool "ARMv4T based platforms (ARM720T, ARM920T, ...)"
+	select ARCH_MULTI_V4_V5
+	depends on !ARCH_MULTI_V6_V7
+
+config ARCH_MULTI_V5
+	bool "ARMv5 based platforms (ARM926T, XSCALE, PJ1, ...)"
+	select ARCH_MULTI_V4_V5
+	depends on !ARCH_MULTI_V6_V7
+
+config ARCH_MULTI_V4_V5
Quoted 8 lines

arch/arm/mach-multi/Kconfig line 26

Quoted 5 lines
arch/arm/mach-multi/Kconfig new file +5 -0
+	bool
+
+config ARCH_MULTI_V6
+	bool "ARMv6 based platforms (ARM11, Scorpion, ...)"
+	select ARCH_MULTI_V6_V7

Does it make sense to add these before any platforms are ready? I'd argue no, but I don't feel strongly about it.

I'll defer that to Arnd. I'm not sure where he was going with the AUTO selection stuff.

Quoted 57 lines
Quoted 57 lines
arch/arm/mach-multi/Kconfig new file +15 -0
+config ARCH_MULTI_V7
+	bool "ARMv7 based platforms (Cortex-A, PJ4, Krait)"
+	default y
+	select ARCH_MULTI_V6_V7
+
+config ARCH_MULTI_V6_V7
+	bool
+
+config ARCH_MULTI_CPU_AUTO
+	def_bool !(ARCH_MULTI_V4 || ARCH_MULTI_V4T || ARCH_MULTI_V6_V7)
+	select ARCH_MULTI_V5
+
+endmenu
+
+comment "SoC family selection"
arch/arm/mach-multi/Makefile new file +1 -0
new file mode 100644
index 0000000..1bb8bf6
@@ -0,0 +1 @@
+# empty
arch/arm/mach-multi/include/mach/gpio.h new file +1 -0
new file mode 100644
index 0000000..40a8c17
@@ -0,0 +1 @@
+/* empty */
arch/arm/mach-multi/include/mach/timex.h new file +3 -0
new file mode 100644
index 0000000..929b4c4
@@ -0,0 +1,3 @@
+#ifndef CLOCK_TICK_RATE
+#define CLOCK_TICK_RATE 1000000
+#endif
arch/arm/mach-multi/include/mach/uncompress.h new file +10 -0
new file mode 100644
index 0000000..a4dec68
@@ -0,0 +1,10 @@
+#ifndef __MACH_UNCOMPRESS_H
+#define __MACH_UNCOMPRESS_H
+
+/* no-op dummies for the uncompress debugging for multiplatform kernels */
+
+static inline void putc(int c) {}
+static inline void flush(void) {}
+static inline void arch_decomp_setup(void) {}
+
+#endif
arch/arm/mach-vexpress/Makefile +0 -1
index 90551b9..1666f6e 100644
--- a/arch/arm/mach-vexpress/Makefile
Quoted 8 lines

arch/arm/mach-vexpress/Makefile line 4

Quoted 6 lines

+++ b/arch/arm/mach-vexpress/Makefile

arch/arm/mach-vexpress/Makefile +1 -0
@@ -1,6 +1,7 @@
 #
 # Makefile for the linux kernel.
 #
+ccflags-y := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-versatile/include

cc-flags-$(CONFIG_ARCH_MULTIPLATFORM) here and for versatile?

Yes. I'd really like to find a way to do this in arch/arm/Makefile instead.

Rob