public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pete Batard" <pete@akeo.ie>
To: devel@edk2.groups.io
Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org,
	philmd@redhat.com, samer.el-haj-mahmoud@arm.com
Subject: [edk2-platforms][PATCH v2 4/7] Platform/RPi: Use offsets for Bcm238x SoC register addresses
Date: Tue, 19 Nov 2019 11:38:06 +0000	[thread overview]
Message-ID: <20191119113809.2472-5-pete@akeo.ie> (raw)
In-Reply-To: <20191119113809.2472-1-pete@akeo.ie>

From: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>

Remove hardcoded base addresses for Mailbox, Watchdog, SDIO and
DW2 USB and use an offset indexed on PcdBcm283xRegistersAddress
instead. This is needed in preparation for adding Raspberry Pi 4
support.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h               | 4 +++-
 Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h     | 8 ++++++--
 Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h | 4 +++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h
index 88fd93934fd3..ddbf69a1d608 100644
--- a/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h
+++ b/Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwcHw.h
@@ -10,7 +10,9 @@
 #ifndef __DWCHW_H__
 #define __DWCHW_H__
 
-#define DW2_USB_BASE_ADDRESS            0x3f980000
+#define DW2_USB_OFFSET                  0x00980000
+#define DW2_USB_BASE_ADDRESS            (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
+                                        + DW2_USB_OFFSET)
 
 #define HSOTG_REG(x)    (x)
 
diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
index 8bd68c234bfd..72c8e9dc4b14 100644
--- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
+++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
@@ -23,7 +23,9 @@
 #define BCM2836_DMA_DEVICE_OFFSET                           0xc0000000
 
 /* watchdog constants */
-#define BCM2836_WDOG_BASE_ADDRESS                           0x3f100000
+#define BCM2836_WDOG_OFFSET                                 0x00100000
+#define BCM2836_WDOG_BASE_ADDRESS                           (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
+                                                            + BCM2836_WDOG_OFFSET)
 #define BCM2836_WDOG_PASSWORD                               0x5a000000
 #define BCM2836_WDOG_RSTC_OFFSET                            0x0000001c
 #define BCM2836_WDOG_WDOG_OFFSET                            0x00000024
@@ -31,7 +33,9 @@
 #define BCM2836_WDOG_RSTC_WRCFG_FULL_RESET                  0x00000020
 
 /* mailbox interface constants */
-#define BCM2836_MBOX_BASE_ADDRESS                           0x3f00b880
+#define BCM2836_MBOX_OFFSET                                 0x0000b880
+#define BCM2836_MBOX_BASE_ADDRESS                           (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
+                                                            + BCM2836_MBOX_OFFSET)
 #define BCM2836_MBOX_READ_OFFSET                            0x00000000
 #define BCM2836_MBOX_STATUS_OFFSET                          0x00000018
 #define BCM2836_MBOX_CONFIG_OFFSET                          0x0000001c
diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h
index fb0d02904156..708a1d7a4f47 100644
--- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h
+++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836Sdio.h
@@ -10,7 +10,9 @@
 #define __BCM2836_SDIO_H__
 
 //MMC/SD/SDIO1 register definitions.
-#define MMCHS1BASE        0x3F300000
+#define MMCHS1_OFFSET     0x00300000
+#define MMCHS1BASE        (FixedPcdGet64 (PcdBcm283xRegistersAddress) \
+                          + MMCHS1_OFFSET)
 
 #define MMCHS_BLK         (MMCHS1BASE + 0x4)
 #define BLEN_512BYTES     (0x200UL << 0)
-- 
2.21.0.windows.1


  parent reply	other threads:[~2019-11-19 11:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 11:38 [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Pete Batard
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 1/7] Platform/RPi: Add missing model name Pete Batard
2019-11-19 12:02   ` Philippe Mathieu-Daudé
2019-11-19 12:14     ` [edk2-devel] " Leif Lindholm
2019-11-19 12:25       ` Philippe Mathieu-Daudé
2019-11-19 12:50         ` Leif Lindholm
2019-11-19 12:25     ` Pete Batard
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 2/7] Platform/RPi: Add model family detection Pete Batard
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 3/7] Platform/RPi: Replace Bcm283x SoC base register address with a PCD Pete Batard
2019-11-19 11:43   ` Philippe Mathieu-Daudé
2019-11-19 11:57     ` Pete Batard
2019-11-19 12:16       ` Philippe Mathieu-Daudé
2019-11-19 12:44         ` Leif Lindholm
2019-11-19 12:51           ` Ard Biesheuvel
2019-11-19 11:38 ` Pete Batard [this message]
2019-11-19 11:46   ` [edk2-platforms][PATCH v2 4/7] Platform/RPi: Use offsets for Bcm238x SoC register addresses Philippe Mathieu-Daudé
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 5/7] Silicon/Broadcom: Add Bcm2711 header Pete Batard
2019-11-19 11:51   ` Philippe Mathieu-Daudé
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 6/7] Platform/RPi: Read more variables from VideoCore during early init Pete Batard
2019-11-19 11:38 ` [edk2-platforms][PATCH v2 7/7] Platform/RPi: Clean up and improve early memory init Pete Batard
2019-11-19 18:20 ` [edk2-platforms][PATCH v2 0/7] Platform/RPi: Early Raspberry Pi 4 groundwork Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191119113809.2472-5-pete@akeo.ie \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox