ARM: bcm283x: Add BCM283x_BASE define
authorMatthias Brugger <mbrugger@suse.com>
Wed, 24 Jul 2019 14:39:05 +0000 (15:39 +0100)
committerMatthias Brugger <mbrugger@suse.com>
Fri, 6 Sep 2019 16:16:59 +0000 (18:16 +0200)
Devices of bcm283x have different base address, depending if they are on
bcm2835 or bcm2836/7. Use BCM283x_BASE depending on the SoC you want to
build and only add the offset in the header files.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Andrei Gherzan <andrei@balena.io>
arch/arm/mach-bcm283x/Kconfig
arch/arm/mach-bcm283x/include/mach/mbox.h
arch/arm/mach-bcm283x/include/mach/sdhci.h
arch/arm/mach-bcm283x/include/mach/timer.h
arch/arm/mach-bcm283x/include/mach/wdog.h

index 3eb5a9a897b19ddbf3e85627dfd278585a1c8ac8..8e69914a835605205d377a304882eb6b5fdb477e 100644 (file)
@@ -141,4 +141,9 @@ config SYS_SOC
 config SYS_CONFIG_NAME
        default "rpi"
 
+config BCM283x_BASE
+       hex
+       default "0x20000000" if BCM2835
+       default "0x3f000000" if BCM2836 || BCM2837
+
 endmenu
index f8928035584cddd42d0533dd9af1c9c30d4fda36..1e4718d83d1c288928ae818a506071978bb5495d 100644 (file)
 
 /* Raw mailbox HW */
 
-#ifndef CONFIG_BCM2835
-#define BCM2835_MBOX_PHYSADDR  0x3f00b880
-#else
-#define BCM2835_MBOX_PHYSADDR  0x2000b880
-#endif
+#define BCM2835_MBOX_PHYSADDR  (CONFIG_BCM283x_BASE + 0x0000b880)
 
 struct bcm2835_mbox_regs {
        u32 read;
index 5cb6ec3340ace46bef4e884ae5f7e056abb594d5..b443c379d8cfb592f9e066934aa78461b1505f2f 100644 (file)
@@ -6,11 +6,7 @@
 #ifndef _BCM2835_SDHCI_H_
 #define _BCM2835_SDHCI_H_
 
-#ifndef CONFIG_BCM2835
-#define BCM2835_SDHCI_BASE 0x3f300000
-#else
-#define BCM2835_SDHCI_BASE 0x20300000
-#endif
+#define BCM2835_SDHCI_BASE (CONFIG_BCM283x_BASE + 0x00300000)
 
 int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq);
 
index 56b0c356bb47bd111227e2fbdc6df06768a5b839..014355e759ad18ef6552f4b9968eb7fb677b617c 100644 (file)
@@ -6,11 +6,7 @@
 #ifndef _BCM2835_TIMER_H
 #define _BCM2835_TIMER_H
 
-#ifndef CONFIG_BCM2835
-#define BCM2835_TIMER_PHYSADDR 0x3f003000
-#else
-#define BCM2835_TIMER_PHYSADDR 0x20003000
-#endif
+#define BCM2835_TIMER_PHYSADDR (CONFIG_BCM283x_BASE + 0x00003000)
 
 #define BCM2835_TIMER_CS_M3    (1 << 3)
 #define BCM2835_TIMER_CS_M2    (1 << 2)
index 99c88e5df71488b0475b27cb5aa1c9ab2eb0d159..8292b3cf1f7a9d30a27da586dfcdbc22238e0152 100644 (file)
@@ -6,11 +6,7 @@
 #ifndef _BCM2835_WDOG_H
 #define _BCM2835_WDOG_H
 
-#ifndef CONFIG_BCM2835
-#define BCM2835_WDOG_PHYSADDR                  0x3f100000
-#else
-#define BCM2835_WDOG_PHYSADDR                  0x20100000
-#endif
+#define BCM2835_WDOG_PHYSADDR  (CONFIG_BCM283x_BASE + 0x00100000)
 
 struct bcm2835_wdog_regs {
        u32 unknown0[7];