diff mbox

[U-Boot,1/2] ARM: bcm283x: don't always define CONFIG_BCM2835

Message ID 1458186057-30980-1-git-send-email-swarren@wwwdotorg.org
State Accepted
Commit ed7481c7d18fe2c632b6fbe5646b32cefd2dc791
Delegated to: Tom Rini
Headers show

Commit Message

Stephen Warren March 17, 2016, 3:40 a.m. UTC
Currently, CONFIG_BCM2835 is defined for all BCM283x builds and _BCM2836
is defined when building for that SoC. That means there isn't a single
define that means "exactly BCM2835". This will complicate future patches
where BCM2835-vs-anything-else needs to be determined simply.

Modify the code to define one or the other of CONFIG_BCM2835/BCM2836 so
future patches are simpler.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
 arch/arm/mach-bcm283x/include/mach/gpio.h  | 2 +-
 arch/arm/mach-bcm283x/include/mach/mbox.h  | 2 +-
 arch/arm/mach-bcm283x/include/mach/sdhci.h | 2 +-
 arch/arm/mach-bcm283x/include/mach/timer.h | 2 +-
 arch/arm/mach-bcm283x/include/mach/wdog.h  | 2 +-
 arch/arm/mach-bcm283x/phys2bus.c           | 2 +-
 board/raspberrypi/rpi/rpi.c                | 2 +-
 include/configs/rpi-common.h               | 5 ++---
 include/configs/rpi.h                      | 1 +
 9 files changed, 10 insertions(+), 10 deletions(-)

Comments

Tom Rini March 17, 2016, 3:54 p.m. UTC | #1
On Wed, Mar 16, 2016 at 09:40:56PM -0600, Stephen Warren wrote:

> Currently, CONFIG_BCM2835 is defined for all BCM283x builds and _BCM2836
> is defined when building for that SoC. That means there isn't a single
> define that means "exactly BCM2835". This will complicate future patches
> where BCM2835-vs-anything-else needs to be determined simply.
> 
> Modify the code to define one or the other of CONFIG_BCM2835/BCM2836 so
> future patches are simpler.
> 
> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
[snip]
> diff --git a/include/configs/rpi.h b/include/configs/rpi.h
> index 86422e390da2..a788ce42e44c 100644
> --- a/include/configs/rpi.h
> +++ b/include/configs/rpi.h
> @@ -7,6 +7,7 @@
>  #ifndef __CONFIG_H
>  #define __CONFIG_H
>  
> +#define CONFIG_BCM2835
>  #define CONFIG_SYS_CACHELINE_SIZE		32
>  
>  #include "rpi-common.h"

Shouldn't we take this as the time to move it to
arch/arm/mach-bcm283x/Kconfig ?
Stephen Warren March 17, 2016, 5:35 p.m. UTC | #2
On 03/17/2016 09:54 AM, Tom Rini wrote:
> On Wed, Mar 16, 2016 at 09:40:56PM -0600, Stephen Warren wrote:
>
>> Currently, CONFIG_BCM2835 is defined for all BCM283x builds and _BCM2836
>> is defined when building for that SoC. That means there isn't a single
>> define that means "exactly BCM2835". This will complicate future patches
>> where BCM2835-vs-anything-else needs to be determined simply.
>>
>> Modify the code to define one or the other of CONFIG_BCM2835/BCM2836 so
>> future patches are simpler.
>>
>> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> [snip]
>> diff --git a/include/configs/rpi.h b/include/configs/rpi.h
>> index 86422e390da2..a788ce42e44c 100644
>> --- a/include/configs/rpi.h
>> +++ b/include/configs/rpi.h
>> @@ -7,6 +7,7 @@
>>   #ifndef __CONFIG_H
>>   #define __CONFIG_H
>>
>> +#define CONFIG_BCM2835
>>   #define CONFIG_SYS_CACHELINE_SIZE		32
>>
>>   #include "rpi-common.h"
>
> Shouldn't we take this as the time to move it to
> arch/arm/mach-bcm283x/Kconfig ?

It is probably time yes, although I'd rather do that in a separate patch 
either way. I should be able to work that patch up before sending the 
actual RPi3 board file patches.
Tom Rini March 17, 2016, 6:08 p.m. UTC | #3
On Thu, Mar 17, 2016 at 11:35:39AM -0600, Stephen Warren wrote:
> On 03/17/2016 09:54 AM, Tom Rini wrote:
> >On Wed, Mar 16, 2016 at 09:40:56PM -0600, Stephen Warren wrote:
> >
> >>Currently, CONFIG_BCM2835 is defined for all BCM283x builds and _BCM2836
> >>is defined when building for that SoC. That means there isn't a single
> >>define that means "exactly BCM2835". This will complicate future patches
> >>where BCM2835-vs-anything-else needs to be determined simply.
> >>
> >>Modify the code to define one or the other of CONFIG_BCM2835/BCM2836 so
> >>future patches are simpler.
> >>
> >>Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> >[snip]
> >>diff --git a/include/configs/rpi.h b/include/configs/rpi.h
> >>index 86422e390da2..a788ce42e44c 100644
> >>--- a/include/configs/rpi.h
> >>+++ b/include/configs/rpi.h
> >>@@ -7,6 +7,7 @@
> >>  #ifndef __CONFIG_H
> >>  #define __CONFIG_H
> >>
> >>+#define CONFIG_BCM2835
> >>  #define CONFIG_SYS_CACHELINE_SIZE		32
> >>
> >>  #include "rpi-common.h"
> >
> >Shouldn't we take this as the time to move it to
> >arch/arm/mach-bcm283x/Kconfig ?
> 
> It is probably time yes, although I'd rather do that in a separate
> patch either way. I should be able to work that patch up before
> sending the actual RPi3 board file patches.

OK:

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini March 27, 2016, 10:25 p.m. UTC | #4
On Wed, Mar 16, 2016 at 09:40:56PM -0600, Stephen Warren wrote:

> Currently, CONFIG_BCM2835 is defined for all BCM283x builds and _BCM2836
> is defined when building for that SoC. That means there isn't a single
> define that means "exactly BCM2835". This will complicate future patches
> where BCM2835-vs-anything-else needs to be determined simply.
> 
> Modify the code to define one or the other of CONFIG_BCM2835/BCM2836 so
> future patches are simpler.
> 
> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/arch/arm/mach-bcm283x/include/mach/gpio.h b/arch/arm/mach-bcm283x/include/mach/gpio.h
index c8ef8f528a21..e6e5d1605d0a 100644
--- a/arch/arm/mach-bcm283x/include/mach/gpio.h
+++ b/arch/arm/mach-bcm283x/include/mach/gpio.h
@@ -9,7 +9,7 @@ 
 #ifndef _BCM2835_GPIO_H_
 #define _BCM2835_GPIO_H_
 
-#ifdef CONFIG_BCM2836
+#ifndef CONFIG_BCM2835
 #define BCM2835_GPIO_BASE		0x3f200000
 #else
 #define BCM2835_GPIO_BASE		0x20200000
diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
index 4a143917f0f8..627acb85dc8c 100644
--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
@@ -38,7 +38,7 @@ 
 
 /* Raw mailbox HW */
 
-#ifdef CONFIG_BCM2836
+#ifndef CONFIG_BCM2835
 #define BCM2835_MBOX_PHYSADDR	0x3f00b880
 #else
 #define BCM2835_MBOX_PHYSADDR	0x2000b880
diff --git a/arch/arm/mach-bcm283x/include/mach/sdhci.h b/arch/arm/mach-bcm283x/include/mach/sdhci.h
index 2a21ccbf66ba..64e582c114f5 100644
--- a/arch/arm/mach-bcm283x/include/mach/sdhci.h
+++ b/arch/arm/mach-bcm283x/include/mach/sdhci.h
@@ -7,7 +7,7 @@ 
 #ifndef _BCM2835_SDHCI_H_
 #define _BCM2835_SDHCI_H_
 
-#ifdef CONFIG_BCM2836
+#ifndef CONFIG_BCM2835
 #define BCM2835_SDHCI_BASE 0x3f300000
 #else
 #define BCM2835_SDHCI_BASE 0x20300000
diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h
index 004c24be365a..2a85f230e86d 100644
--- a/arch/arm/mach-bcm283x/include/mach/timer.h
+++ b/arch/arm/mach-bcm283x/include/mach/timer.h
@@ -7,7 +7,7 @@ 
 #ifndef _BCM2835_TIMER_H
 #define _BCM2835_TIMER_H
 
-#ifdef CONFIG_BCM2836
+#ifndef CONFIG_BCM2835
 #define BCM2835_TIMER_PHYSADDR	0x3f003000
 #else
 #define BCM2835_TIMER_PHYSADDR	0x20003000
diff --git a/arch/arm/mach-bcm283x/include/mach/wdog.h b/arch/arm/mach-bcm283x/include/mach/wdog.h
index cbc350e84b90..7741d7ba1558 100644
--- a/arch/arm/mach-bcm283x/include/mach/wdog.h
+++ b/arch/arm/mach-bcm283x/include/mach/wdog.h
@@ -7,7 +7,7 @@ 
 #ifndef _BCM2835_WDOG_H
 #define _BCM2835_WDOG_H
 
-#ifdef CONFIG_BCM2836
+#ifndef CONFIG_BCM2835
 #define BCM2835_WDOG_PHYSADDR			0x3f100000
 #else
 #define BCM2835_WDOG_PHYSADDR			0x20100000
diff --git a/arch/arm/mach-bcm283x/phys2bus.c b/arch/arm/mach-bcm283x/phys2bus.c
index fc1c29905de3..8e9f49240ff7 100644
--- a/arch/arm/mach-bcm283x/phys2bus.c
+++ b/arch/arm/mach-bcm283x/phys2bus.c
@@ -9,7 +9,7 @@ 
 
 unsigned long phys_to_bus(unsigned long phys)
 {
-#ifdef CONFIG_BCM2836
+#ifndef CONFIG_BCM2835
 	return 0xc0000000 | phys;
 #else
 	return 0x40000000 | phys;
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index da4b6ff234d6..1fd7591f3325 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -31,7 +31,7 @@  U_BOOT_DEVICE(bcm2835_gpios) = {
 };
 
 static const struct pl01x_serial_platdata serial_platdata = {
-#ifdef CONFIG_BCM2836
+#ifndef CONFIG_BCM2835
 	.base = 0x3f201000,
 #else
 	.base = 0x20201000,
diff --git a/include/configs/rpi-common.h b/include/configs/rpi-common.h
index 1c3642612e4b..12e1adde204c 100644
--- a/include/configs/rpi-common.h
+++ b/include/configs/rpi-common.h
@@ -11,7 +11,6 @@ 
 #include <asm/arch/timer.h>
 
 /* Architecture, CPU, etc.*/
-#define CONFIG_BCM2835
 #define CONFIG_ARCH_CPU_INIT
 
 #define CONFIG_SYS_TIMER_RATE		1000000
@@ -26,7 +25,7 @@ 
  * chose to use someone else's previously registered machine ID (3139, MX51_GGC)
  * rather than obtaining a valid ID:-/
  */
-#ifndef CONFIG_BCM2836
+#ifdef CONFIG_BCM2835
 #define CONFIG_MACH_TYPE		MACH_TYPE_BCM2708
 #endif
 
@@ -80,7 +79,7 @@ 
 #define CONFIG_CMD_USB
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_DWC2
-#ifdef CONFIG_BCM2836
+#ifndef CONFIG_BCM2835
 #define CONFIG_USB_DWC2_REG_ADDR 0x3f980000
 #else
 #define CONFIG_USB_DWC2_REG_ADDR 0x20980000
diff --git a/include/configs/rpi.h b/include/configs/rpi.h
index 86422e390da2..a788ce42e44c 100644
--- a/include/configs/rpi.h
+++ b/include/configs/rpi.h
@@ -7,6 +7,7 @@ 
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_BCM2835
 #define CONFIG_SYS_CACHELINE_SIZE		32
 
 #include "rpi-common.h"