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
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#50884): https://edk2.groups.io/g/devel/message/50884
Mute This Topic: https://groups.io/mt/60553575/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
On 11/19/19 12:38 PM, Pete Batard wrote: > 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. > Similarly to the previous patch, I'd expect Samer's S-o-b. > 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) I'm glad you considered v1 comment, now v2 is way simpler to review. Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> > #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) > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50889): https://edk2.groups.io/g/devel/message/50889 Mute This Topic: https://groups.io/mt/60553575/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.