diff mbox

[U-Boot,6/7] ARM: bcm283x: merge BCM2835/BCM2836 directories into mach-bcm283x

Message ID 1426502117-15281-7-git-send-email-yamada.masahiro@socionext.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Masahiro Yamada March 16, 2015, 10:35 a.m. UTC
BCM2835 (used on Raspberry Pi) and BCM2836 (used on Raspberry Pi 2)
are similar enough.  One of the biggest differences is the ARM
processor.  It is reasonable to collect the source files into a
single place, arch/arm/mach-bcm283x/.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Stephen Warren <swarren@nvidia.com>
---

 arch/arm/Kconfig                                   | 15 +++-----
 arch/arm/Makefile                                  |  1 +
 arch/arm/cpu/arm1176/Makefile                      |  2 --
 arch/arm/cpu/arm1176/bcm2835/Kconfig               | 12 -------
 arch/arm/cpu/armv7/Makefile                        |  1 -
 arch/arm/cpu/armv7/bcm2835/Makefile                | 13 -------
 arch/arm/mach-bcm283x/Kconfig                      | 40 ++++++++++++++++++++++
 .../{cpu/arm1176/bcm2835 => mach-bcm283x}/Makefile |  2 +-
 .../{cpu/arm1176/bcm2835 => mach-bcm283x}/init.c   |  0
 .../bcm2835 => mach-bcm283x}/lowlevel_init.S       |  0
 .../{cpu/arm1176/bcm2835 => mach-bcm283x}/mbox.c   |  0
 .../{cpu/arm1176/bcm2835 => mach-bcm283x}/reset.c  |  0
 .../{cpu/arm1176/bcm2835 => mach-bcm283x}/timer.c  |  0
 board/raspberrypi/rpi/Kconfig                      | 15 --------
 board/raspberrypi/rpi_2/Kconfig                    | 15 --------
 configs/rpi_2_defconfig                            |  1 +
 configs/rpi_defconfig                              |  1 +
 17 files changed, 48 insertions(+), 70 deletions(-)
 delete mode 100644 arch/arm/cpu/arm1176/bcm2835/Kconfig
 delete mode 100644 arch/arm/cpu/armv7/bcm2835/Makefile
 create mode 100644 arch/arm/mach-bcm283x/Kconfig
 rename arch/arm/{cpu/arm1176/bcm2835 => mach-bcm283x}/Makefile (72%)
 rename arch/arm/{cpu/arm1176/bcm2835 => mach-bcm283x}/init.c (100%)
 rename arch/arm/{cpu/arm1176/bcm2835 => mach-bcm283x}/lowlevel_init.S (100%)
 rename arch/arm/{cpu/arm1176/bcm2835 => mach-bcm283x}/mbox.c (100%)
 rename arch/arm/{cpu/arm1176/bcm2835 => mach-bcm283x}/reset.c (100%)
 rename arch/arm/{cpu/arm1176/bcm2835 => mach-bcm283x}/timer.c (100%)
 delete mode 100644 board/raspberrypi/rpi/Kconfig
 delete mode 100644 board/raspberrypi/rpi_2/Kconfig

Comments

Stephen Warren March 17, 2015, 3:39 a.m. UTC | #1
On 03/16/2015 04:35 AM, Masahiro Yamada wrote:
> BCM2835 (used on Raspberry Pi) and BCM2836 (used on Raspberry Pi 2)
> are similar enough.  One of the biggest differences is the ARM
> processor.  It is reasonable to collect the source files into a
> single place, arch/arm/mach-bcm283x/.

> diff --git a/arch/arm/cpu/arm1176/bcm2835/Makefile b/arch/arm/mach-bcm283x/Makefile

> -obj-y	:= lowlevel_init.o
> +obj-$(CONFIG_TARGET_RPI) += lowlevel_init.o
>  obj-y	+= init.o reset.o timer.o mbox.o

Why is only one file conditional; shouldn't they all be either -y or
-$(CONFIG_TARGET_RPI)?
Masahiro Yamada March 17, 2015, 3:51 a.m. UTC | #2
Hi Stephen,



2015-03-17 12:39 GMT+09:00 Stephen Warren <swarren@nvidia.com>:
> On 03/16/2015 04:35 AM, Masahiro Yamada wrote:
>> BCM2835 (used on Raspberry Pi) and BCM2836 (used on Raspberry Pi 2)
>> are similar enough.  One of the biggest differences is the ARM
>> processor.  It is reasonable to collect the source files into a
>> single place, arch/arm/mach-bcm283x/.
>
>> diff --git a/arch/arm/cpu/arm1176/bcm2835/Makefile b/arch/arm/mach-bcm283x/Makefile
>
>> -obj-y        := lowlevel_init.o
>> +obj-$(CONFIG_TARGET_RPI) += lowlevel_init.o
>>  obj-y        += init.o reset.o timer.o mbox.o
>
> Why is only one file conditional; shouldn't they all be either -y or
> -$(CONFIG_TARGET_RPI)?
> _______________________________________________



This patch just moves source files, not changing the behavior.

If you see arch/arm/cpu/armv7/bcm2835/Makefile (it is added by you),

--------------->8------------------
src_dir := ../../arm1176/bcm2835/

obj-y   :=
obj-y   += $(src_dir)/init.o
obj-y   += $(src_dir)/reset.o
obj-y   += $(src_dir)/timer.o
obj-y   += $(src_dir)/mbox.o
--------------8<------------------


BCM2836 borrows source files from BCM2835, except lowlevel_init.S.

I intended to reflect the same behavior.



Anyway, lowlevel_init is not linked for Raspberry Pi2
because you added CONFIG_SKIP_LOWLEVEL_INIT to include/configs/rpi_2.h
Stephen Warren March 17, 2015, 4:23 a.m. UTC | #3
On 03/16/2015 09:51 PM, Masahiro Yamada wrote:
> Hi Stephen,
> 
> 
> 
> 2015-03-17 12:39 GMT+09:00 Stephen Warren <swarren@nvidia.com>:
>> On 03/16/2015 04:35 AM, Masahiro Yamada wrote:
>>> BCM2835 (used on Raspberry Pi) and BCM2836 (used on Raspberry Pi 2)
>>> are similar enough.  One of the biggest differences is the ARM
>>> processor.  It is reasonable to collect the source files into a
>>> single place, arch/arm/mach-bcm283x/.
>>
>>> diff --git a/arch/arm/cpu/arm1176/bcm2835/Makefile b/arch/arm/mach-bcm283x/Makefile
>>
>>> -obj-y        := lowlevel_init.o
>>> +obj-$(CONFIG_TARGET_RPI) += lowlevel_init.o
>>>  obj-y        += init.o reset.o timer.o mbox.o
>>
>> Why is only one file conditional; shouldn't they all be either -y or
>> -$(CONFIG_TARGET_RPI)?
> 
> This patch just moves source files, not changing the behavior.
> 
> If you see arch/arm/cpu/armv7/bcm2835/Makefile (it is added by you),
> 
> --------------->8------------------
> src_dir := ../../arm1176/bcm2835/
> 
> obj-y   :=
> obj-y   += $(src_dir)/init.o
> obj-y   += $(src_dir)/reset.o
> obj-y   += $(src_dir)/timer.o
> obj-y   += $(src_dir)/mbox.o
> --------------8<------------------
> 
> 
> BCM2836 borrows source files from BCM2835, except lowlevel_init.S.
> 
> I intended to reflect the same behavior.
> 
> Anyway, lowlevel_init is not linked for Raspberry Pi2
> because you added CONFIG_SKIP_LOWLEVEL_INIT to include/configs/rpi_2.h

OK, that makes sense. But, shouldn't the bcm2835-specific file be left
in its existing location rather than putting it into a common location
when it isn't common?
Masahiro Yamada March 17, 2015, 6:11 a.m. UTC | #4
Hi Stephen,


2015-03-17 13:23 GMT+09:00 Stephen Warren <swarren@nvidia.com>:
> On 03/16/2015 09:51 PM, Masahiro Yamada wrote:
>> Hi Stephen,
>>
>>
>>
>> 2015-03-17 12:39 GMT+09:00 Stephen Warren <swarren@nvidia.com>:
>>> On 03/16/2015 04:35 AM, Masahiro Yamada wrote:
>>>> BCM2835 (used on Raspberry Pi) and BCM2836 (used on Raspberry Pi 2)
>>>> are similar enough.  One of the biggest differences is the ARM
>>>> processor.  It is reasonable to collect the source files into a
>>>> single place, arch/arm/mach-bcm283x/.
>>>
>>>> diff --git a/arch/arm/cpu/arm1176/bcm2835/Makefile b/arch/arm/mach-bcm283x/Makefile
>>>
>>>> -obj-y        := lowlevel_init.o
>>>> +obj-$(CONFIG_TARGET_RPI) += lowlevel_init.o
>>>>  obj-y        += init.o reset.o timer.o mbox.o
>>>
>>> Why is only one file conditional; shouldn't they all be either -y or
>>> -$(CONFIG_TARGET_RPI)?
>>
>> This patch just moves source files, not changing the behavior.
>>
>> If you see arch/arm/cpu/armv7/bcm2835/Makefile (it is added by you),
>>
>> --------------->8------------------
>> src_dir := ../../arm1176/bcm2835/
>>
>> obj-y   :=
>> obj-y   += $(src_dir)/init.o
>> obj-y   += $(src_dir)/reset.o
>> obj-y   += $(src_dir)/timer.o
>> obj-y   += $(src_dir)/mbox.o
>> --------------8<------------------
>>
>>
>> BCM2836 borrows source files from BCM2835, except lowlevel_init.S.
>>
>> I intended to reflect the same behavior.
>>
>> Anyway, lowlevel_init is not linked for Raspberry Pi2
>> because you added CONFIG_SKIP_LOWLEVEL_INIT to include/configs/rpi_2.h
>
> OK, that makes sense. But, shouldn't the bcm2835-specific file be left
> in its existing location rather than putting it into a common location
> when it isn't common?
> _______________________________________________



I'd like to remove arch/arm/cpu/arm1176/bcm2835.
My motivation is to collect all the BCM283x source files under
arch/arm/mach-bcm283x.


If we have bcm2835-specific files in the future (although I do not think so),
we can create  arch/arm/mach-bcm283x/bcm2835/ directory.
diff mbox

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b9ebee1..9292e98 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -286,13 +286,8 @@  config TARGET_MX35PDK
 	bool "Support mx35pdk"
 	select CPU_ARM1136
 
-config TARGET_RPI
-	bool "Support rpi"
-	select CPU_ARM1176
-
-config TARGET_RPI_2
-	bool "Support rpi_2"
-	select CPU_V7
+config ARCH_BCM283X
+	bool "Broadcom BCM283X family"
 
 config TARGET_INTEGRATORAP_CM946ES
 	bool "Support integratorap_cm946es"
@@ -723,9 +718,9 @@  endchoice
 
 source "arch/arm/mach-at91/Kconfig"
 
-source "arch/arm/mach-davinci/Kconfig"
+source "arch/arm/mach-bcm283x/Kconfig"
 
-source "arch/arm/cpu/arm1176/bcm2835/Kconfig"
+source "arch/arm/mach-davinci/Kconfig"
 
 source "arch/arm/cpu/armv7/exynos/Kconfig"
 
@@ -834,8 +829,6 @@  source "board/palmtreo680/Kconfig"
 source "board/phytec/pcm051/Kconfig"
 source "board/ppcag/bg0900/Kconfig"
 source "board/pxa255_idp/Kconfig"
-source "board/raspberrypi/rpi/Kconfig"
-source "board/raspberrypi/rpi_2/Kconfig"
 source "board/samsung/smdk2410/Kconfig"
 source "board/sandisk/sansa_fuze_plus/Kconfig"
 source "board/scb9328/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 08946de..bac3cb2 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -5,6 +5,7 @@ 
 # Machine directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
 machine-$(CONFIG_ARCH_AT91)		+= at91
+machine-$(CONFIG_ARCH_BCM283X)		+= bcm283x
 machine-$(CONFIG_ARCH_DAVINCI)		+= davinci
 machine-$(CONFIG_ARCH_HIGHBANK)		+= highbank
 machine-$(CONFIG_ARCH_KEYSTONE)		+= keystone
diff --git a/arch/arm/cpu/arm1176/Makefile b/arch/arm/cpu/arm1176/Makefile
index 480e130..deec427 100644
--- a/arch/arm/cpu/arm1176/Makefile
+++ b/arch/arm/cpu/arm1176/Makefile
@@ -10,5 +10,3 @@ 
 
 extra-y	= start.o
 obj-y	= cpu.o
-
-obj-$(CONFIG_BCM2835) += bcm2835/
diff --git a/arch/arm/cpu/arm1176/bcm2835/Kconfig b/arch/arm/cpu/arm1176/bcm2835/Kconfig
deleted file mode 100644
index 73cc72b..0000000
--- a/arch/arm/cpu/arm1176/bcm2835/Kconfig
+++ /dev/null
@@ -1,12 +0,0 @@ 
-if TARGET_RPI || TARGET_RPI_2
-
-config DM
-	default y
-
-config DM_SERIAL
-	default y
-
-config DM_GPIO
-	default y
-
-endif
diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
index 1312a9d..21fc03b 100644
--- a/arch/arm/cpu/armv7/Makefile
+++ b/arch/arm/cpu/armv7/Makefile
@@ -39,7 +39,6 @@  endif
 
 obj-$(if $(filter am33xx,$(SOC)),y) += am33xx/
 obj-$(if $(filter armada-xp,$(SOC)),y) += armada-xp/
-obj-$(CONFIG_BCM2835) += bcm2835/
 obj-$(if $(filter bcm281xx,$(SOC)),y) += bcm281xx/
 obj-$(if $(filter bcmcygnus,$(SOC)),y) += bcmcygnus/
 obj-$(if $(filter bcmnsp,$(SOC)),y) += bcmnsp/
diff --git a/arch/arm/cpu/armv7/bcm2835/Makefile b/arch/arm/cpu/armv7/bcm2835/Makefile
deleted file mode 100644
index ed1ee47..0000000
--- a/arch/arm/cpu/armv7/bcm2835/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@ 
-#
-# (C) Copyright 2012 Stephen Warren
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-src_dir := ../../arm1176/bcm2835/
-
-obj-y	:=
-obj-y	+= $(src_dir)/init.o
-obj-y	+= $(src_dir)/reset.o
-obj-y	+= $(src_dir)/timer.o
-obj-y	+= $(src_dir)/mbox.o
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
new file mode 100644
index 0000000..d5e09e8
--- /dev/null
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -0,0 +1,40 @@ 
+menu "Broadcom BCM283X family"
+	depends on ARCH_BCM283X
+
+choice
+	prompt "Broadcom BCM283X board select"
+
+config TARGET_RPI
+	bool "Raspberry Pi"
+	select CPU_ARM1176
+
+config TARGET_RPI_2
+	bool "Raspberry Pi 2"
+	select CPU_V7
+
+endchoice
+
+config DM
+	default y
+
+config DM_SERIAL
+	default y
+
+config DM_GPIO
+	default y
+
+config SYS_BOARD
+	default "rpi" if TARGET_RPI
+	default "rpi_2" if TARGET_RPI_2
+
+config SYS_VENDOR
+	default "raspberrypi"
+
+config SYS_SOC
+	default "bcm2835"
+
+config SYS_CONFIG_NAME
+	default "rpi" if TARGET_RPI
+	default "rpi_2" if TARGET_RPI_2
+
+endmenu
diff --git a/arch/arm/cpu/arm1176/bcm2835/Makefile b/arch/arm/mach-bcm283x/Makefile
similarity index 72%
rename from arch/arm/cpu/arm1176/bcm2835/Makefile
rename to arch/arm/mach-bcm283x/Makefile
index 7e5dbe1..2505428 100644
--- a/arch/arm/cpu/arm1176/bcm2835/Makefile
+++ b/arch/arm/mach-bcm283x/Makefile
@@ -4,5 +4,5 @@ 
 # SPDX-License-Identifier:	GPL-2.0
 #
 
-obj-y	:= lowlevel_init.o
+obj-$(CONFIG_TARGET_RPI) += lowlevel_init.o
 obj-y	+= init.o reset.o timer.o mbox.o
diff --git a/arch/arm/cpu/arm1176/bcm2835/init.c b/arch/arm/mach-bcm283x/init.c
similarity index 100%
rename from arch/arm/cpu/arm1176/bcm2835/init.c
rename to arch/arm/mach-bcm283x/init.c
diff --git a/arch/arm/cpu/arm1176/bcm2835/lowlevel_init.S b/arch/arm/mach-bcm283x/lowlevel_init.S
similarity index 100%
rename from arch/arm/cpu/arm1176/bcm2835/lowlevel_init.S
rename to arch/arm/mach-bcm283x/lowlevel_init.S
diff --git a/arch/arm/cpu/arm1176/bcm2835/mbox.c b/arch/arm/mach-bcm283x/mbox.c
similarity index 100%
rename from arch/arm/cpu/arm1176/bcm2835/mbox.c
rename to arch/arm/mach-bcm283x/mbox.c
diff --git a/arch/arm/cpu/arm1176/bcm2835/reset.c b/arch/arm/mach-bcm283x/reset.c
similarity index 100%
rename from arch/arm/cpu/arm1176/bcm2835/reset.c
rename to arch/arm/mach-bcm283x/reset.c
diff --git a/arch/arm/cpu/arm1176/bcm2835/timer.c b/arch/arm/mach-bcm283x/timer.c
similarity index 100%
rename from arch/arm/cpu/arm1176/bcm2835/timer.c
rename to arch/arm/mach-bcm283x/timer.c
diff --git a/board/raspberrypi/rpi/Kconfig b/board/raspberrypi/rpi/Kconfig
deleted file mode 100644
index 6a538cf..0000000
--- a/board/raspberrypi/rpi/Kconfig
+++ /dev/null
@@ -1,15 +0,0 @@ 
-if TARGET_RPI
-
-config SYS_BOARD
-	default "rpi"
-
-config SYS_VENDOR
-	default "raspberrypi"
-
-config SYS_SOC
-	default "bcm2835"
-
-config SYS_CONFIG_NAME
-	default "rpi"
-
-endif
diff --git a/board/raspberrypi/rpi_2/Kconfig b/board/raspberrypi/rpi_2/Kconfig
deleted file mode 100644
index 032184d..0000000
--- a/board/raspberrypi/rpi_2/Kconfig
+++ /dev/null
@@ -1,15 +0,0 @@ 
-if TARGET_RPI_2
-
-config SYS_BOARD
-	default "rpi_2"
-
-config SYS_VENDOR
-	default "raspberrypi"
-
-config SYS_SOC
-	default "bcm2835"
-
-config SYS_CONFIG_NAME
-	default "rpi_2"
-
-endif
diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig
index 3075321..965fcae 100644
--- a/configs/rpi_2_defconfig
+++ b/configs/rpi_2_defconfig
@@ -1,2 +1,3 @@ 
 CONFIG_ARM=y
+CONFIG_ARCH_BCM283X=y
 CONFIG_TARGET_RPI_2=y
diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig
index 9379cf0..8de1d9f 100644
--- a/configs/rpi_defconfig
+++ b/configs/rpi_defconfig
@@ -1,2 +1,3 @@ 
 CONFIG_ARM=y
+CONFIG_ARCH_BCM283X=y
 CONFIG_TARGET_RPI=y