* [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart
@ 2022-01-28 15:38 Adrien Thierry
2022-01-29 15:19 ` [edk2-devel] " Ard Biesheuvel
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Adrien Thierry @ 2022-01-28 15:38 UTC (permalink / raw)
To: devel; +Cc: Adrien Thierry, Ard Biesheuvel, Leif Lindholm, Pete Batard
Describe the miniuart clock frequency in a _DSD property, so that it can
be read from the Linux driver.
The miniuart clock frequency is the core clock frequency on the
Raspberry Pi. It can be modified by the user using the 'core_freq'
property in the config.txt file. So, we fetch it from the underlying
Raspberry Pi firmware.
Signed-off-by: Adrien Thierry <athierry@redhat.com>
---
Platform/RaspberryPi/AcpiTables/Uart.asl | 14 ++++++++++++++
Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 9 +++++++++
.../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 +
Platform/RaspberryPi/RPi3/RPi3.dsc | 5 +++++
Platform/RaspberryPi/RPi4/RPi4.dsc | 5 +++++
Platform/RaspberryPi/RaspberryPi.dec | 1 +
6 files changed, 35 insertions(+)
diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryPi/AcpiTables/Uart.asl
index 974f06d3bc..ef5165be98 100644
--- a/Platform/RaspberryPi/AcpiTables/Uart.asl
+++ b/Platform/RaspberryPi/AcpiTables/Uart.asl
@@ -77,6 +77,20 @@ Device (URTM)
MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MINI_UART_OFFSET)
Return (^RBUF)
}
+
+ //
+ // Mini Uart Clock Rate will be dynamically updated during boot
+ // 0x4D 0x55 0x43 0x52 0xC 0x1000000 (Value must be > 16777215)
+ //
+ Name (MUCR, 0x1000000)
+
+ Name (_DSD, Package ()
+ {
+ ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package ()
+ {
+ Package (2) { "clock-frequency", MUCR },
+ }
+ })
}
//
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index 415d99fadb..3dcf2bac0d 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -44,6 +44,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
STATIC UINT32 mModelFamily = 0;
STATIC UINT32 mModelInstalledMB = 0;
STATIC UINT32 mModelRevision = 0;
+STATIC UINT32 mCoreClockRate = 0;
STATIC EFI_MAC_ADDRESS mMacAddress;
@@ -798,6 +799,7 @@ STATIC CONST AML_NAME_OP_REPLACE SsdtEmmcNameOpReplace[] = {
STATIC CONST AML_NAME_OP_REPLACE DsdtNameOpReplace[] = {
{ "URIU", PcdToken (PcdUartInUse) },
+ { "MUCR", PcdToken (PcdMiniUartClockRate) },
{ }
};
@@ -944,6 +946,13 @@ ConfigInitialize (
DEBUG ((DEBUG_INFO, "Current Raspberry Pi revision %x\n", mModelRevision));
}
+ Status = mFwProtocol->GetClockRate (RPI_MBOX_CLOCK_RATE_CORE, &mCoreClockRate);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((DEBUG_ERROR, "Couldn't get the Raspberry Pi core clock rate: %r\n", Status));
+ } else {
+ PcdSet32S (PcdMiniUartClockRate, mCoreClockRate);
+ }
+
Status = SetupVariables ();
if (Status != EFI_SUCCESS) {
DEBUG ((DEBUG_ERROR, "Couldn't not setup NV vars: %r\n", Status));
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
index e6e22ad82e..6f6e8f42ac 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
@@ -95,6 +95,7 @@
gRaspberryPiTokenSpaceGuid.PcdFanTemp
gRaspberryPiTokenSpaceGuid.PcdUartInUse
gRaspberryPiTokenSpaceGuid.PcdXhciPci
+ gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate
[Depex]
gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid
diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
index 6ab5d1ae6d..6dc48dc233 100644
--- a/Platform/RaspberryPi/RPi3/RPi3.dsc
+++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
@@ -561,6 +561,11 @@
#
gRaspberryPiTokenSpaceGuid.PcdUartInUse|1
+ #
+ # Mini-UART clock rate
+ #
+ gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|250000000
+
################################################################################
#
# Components Section - list of all EDK II Modules needed by this Platform
diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
index 44ed60ab2f..a9c0c36bb1 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -580,6 +580,11 @@
#
gRaspberryPiTokenSpaceGuid.PcdUartInUse|0
+ #
+ # Mini-UART clock rate
+ #
+ gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|500000000
+
################################################################################
#
# Components Section - list of all EDK II Modules needed by this Platform
diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/RaspberryPi.dec
index 797be59274..17b6061a05 100644
--- a/Platform/RaspberryPi/RaspberryPi.dec
+++ b/Platform/RaspberryPi/RaspberryPi.dec
@@ -72,3 +72,4 @@
gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F
gRaspberryPiTokenSpaceGuid.PcdUartInUse|1|UINT32|0x00000021
gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000022
+ gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|0|UINT32|0x00000023
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [edk2-devel] [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart
2022-01-28 15:38 [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart Adrien Thierry
@ 2022-01-29 15:19 ` Ard Biesheuvel
2022-01-31 12:34 ` Leif Lindholm
2022-01-31 16:12 ` [edk2-devel] " Jeremy Linton
2 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2022-01-29 15:19 UTC (permalink / raw)
To: edk2-devel-groups-io, Adrien Thierry, Jeremy Linton
Cc: Ard Biesheuvel, Leif Lindholm, Pete Batard
(+ Jeremy)
On Fri, 28 Jan 2022 at 16:40, Adrien Thierry <athierry@redhat.com> wrote:
>
> Describe the miniuart clock frequency in a _DSD property, so that it can
> be read from the Linux driver.
>
> The miniuart clock frequency is the core clock frequency on the
> Raspberry Pi. It can be modified by the user using the 'core_freq'
> property in the config.txt file. So, we fetch it from the underlying
> Raspberry Pi firmware.
>
> Signed-off-by: Adrien Thierry <athierry@redhat.com>
> ---
> Platform/RaspberryPi/AcpiTables/Uart.asl | 14 ++++++++++++++
> Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 9 +++++++++
> .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 +
> Platform/RaspberryPi/RPi3/RPi3.dsc | 5 +++++
> Platform/RaspberryPi/RPi4/RPi4.dsc | 5 +++++
> Platform/RaspberryPi/RaspberryPi.dec | 1 +
> 6 files changed, 35 insertions(+)
>
> diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryPi/AcpiTables/Uart.asl
> index 974f06d3bc..ef5165be98 100644
> --- a/Platform/RaspberryPi/AcpiTables/Uart.asl
> +++ b/Platform/RaspberryPi/AcpiTables/Uart.asl
> @@ -77,6 +77,20 @@ Device (URTM)
> MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MINI_UART_OFFSET)
>
> Return (^RBUF)
>
> }
>
> +
>
> + //
>
> + // Mini Uart Clock Rate will be dynamically updated during boot
>
> + // 0x4D 0x55 0x43 0x52 0xC 0x1000000 (Value must be > 16777215)
>
> + //
>
> + Name (MUCR, 0x1000000)
>
> +
>
> + Name (_DSD, Package ()
>
> + {
>
> + ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package ()
>
> + {
>
> + Package (2) { "clock-frequency", MUCR },
>
> + }
>
> + })
>
> }
>
>
>
> //
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> index 415d99fadb..3dcf2bac0d 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> @@ -44,6 +44,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
> STATIC UINT32 mModelFamily = 0;
>
> STATIC UINT32 mModelInstalledMB = 0;
>
> STATIC UINT32 mModelRevision = 0;
>
> +STATIC UINT32 mCoreClockRate = 0;
>
>
>
> STATIC EFI_MAC_ADDRESS mMacAddress;
>
>
>
> @@ -798,6 +799,7 @@ STATIC CONST AML_NAME_OP_REPLACE SsdtEmmcNameOpReplace[] = {
>
>
> STATIC CONST AML_NAME_OP_REPLACE DsdtNameOpReplace[] = {
>
> { "URIU", PcdToken (PcdUartInUse) },
>
> + { "MUCR", PcdToken (PcdMiniUartClockRate) },
>
> { }
>
> };
>
>
>
> @@ -944,6 +946,13 @@ ConfigInitialize (
> DEBUG ((DEBUG_INFO, "Current Raspberry Pi revision %x\n", mModelRevision));
>
> }
>
>
>
> + Status = mFwProtocol->GetClockRate (RPI_MBOX_CLOCK_RATE_CORE, &mCoreClockRate);
>
> + if (Status != EFI_SUCCESS) {
>
> + DEBUG ((DEBUG_ERROR, "Couldn't get the Raspberry Pi core clock rate: %r\n", Status));
>
> + } else {
>
> + PcdSet32S (PcdMiniUartClockRate, mCoreClockRate);
>
> + }
>
> +
>
> Status = SetupVariables ();
>
> if (Status != EFI_SUCCESS) {
>
> DEBUG ((DEBUG_ERROR, "Couldn't not setup NV vars: %r\n", Status));
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> index e6e22ad82e..6f6e8f42ac 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> @@ -95,6 +95,7 @@
> gRaspberryPiTokenSpaceGuid.PcdFanTemp
>
> gRaspberryPiTokenSpaceGuid.PcdUartInUse
>
> gRaspberryPiTokenSpaceGuid.PcdXhciPci
>
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate
>
>
>
> [Depex]
>
> gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid
>
> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
> index 6ab5d1ae6d..6dc48dc233 100644
> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
> @@ -561,6 +561,11 @@
> #
>
> gRaspberryPiTokenSpaceGuid.PcdUartInUse|1
>
>
>
> + #
>
> + # Mini-UART clock rate
>
> + #
>
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|250000000
>
> +
>
> ################################################################################
>
> #
>
> # Components Section - list of all EDK II Modules needed by this Platform
>
> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
> index 44ed60ab2f..a9c0c36bb1 100644
> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc
> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
> @@ -580,6 +580,11 @@
> #
>
> gRaspberryPiTokenSpaceGuid.PcdUartInUse|0
>
>
>
> + #
>
> + # Mini-UART clock rate
>
> + #
>
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|500000000
>
> +
>
> ################################################################################
>
> #
>
> # Components Section - list of all EDK II Modules needed by this Platform
>
> diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/RaspberryPi.dec
> index 797be59274..17b6061a05 100644
> --- a/Platform/RaspberryPi/RaspberryPi.dec
> +++ b/Platform/RaspberryPi/RaspberryPi.dec
> @@ -72,3 +72,4 @@
> gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F
>
> gRaspberryPiTokenSpaceGuid.PcdUartInUse|1|UINT32|0x00000021
>
> gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000022
>
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|0|UINT32|0x00000023
>
> --
> 2.17.1
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart
2022-01-28 15:38 [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart Adrien Thierry
2022-01-29 15:19 ` [edk2-devel] " Ard Biesheuvel
@ 2022-01-31 12:34 ` Leif Lindholm
2022-01-31 16:12 ` [edk2-devel] " Jeremy Linton
2 siblings, 0 replies; 9+ messages in thread
From: Leif Lindholm @ 2022-01-31 12:34 UTC (permalink / raw)
To: Adrien Thierry; +Cc: devel, Ard Biesheuvel, Pete Batard, Jeremy Linton
+Jeremy
On Fri, Jan 28, 2022 at 10:38:18 -0500, Adrien Thierry wrote:
> Describe the miniuart clock frequency in a _DSD property, so that it can
> be read from the Linux driver.
>
> The miniuart clock frequency is the core clock frequency on the
> Raspberry Pi. It can be modified by the user using the 'core_freq'
> property in the config.txt file. So, we fetch it from the underlying
> Raspberry Pi firmware.
>
> Signed-off-by: Adrien Thierry <athierry@redhat.com>
> ---
> Platform/RaspberryPi/AcpiTables/Uart.asl | 14 ++++++++++++++
> Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 9 +++++++++
> .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 +
> Platform/RaspberryPi/RPi3/RPi3.dsc | 5 +++++
> Platform/RaspberryPi/RPi4/RPi4.dsc | 5 +++++
> Platform/RaspberryPi/RaspberryPi.dec | 1 +
> 6 files changed, 35 insertions(+)
>
> diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryPi/AcpiTables/Uart.asl
> index 974f06d3bc..ef5165be98 100644
> --- a/Platform/RaspberryPi/AcpiTables/Uart.asl
> +++ b/Platform/RaspberryPi/AcpiTables/Uart.asl
> @@ -77,6 +77,20 @@ Device (URTM)
> MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MINI_UART_OFFSET)
> Return (^RBUF)
> }
> +
> + //
> + // Mini Uart Clock Rate will be dynamically updated during boot
> + // 0x4D 0x55 0x43 0x52 0xC 0x1000000 (Value must be > 16777215)
> + //
> + Name (MUCR, 0x1000000)
> +
> + Name (_DSD, Package ()
> + {
> + ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package ()
> + {
> + Package (2) { "clock-frequency", MUCR },
> + }
> + })
> }
>
> //
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> index 415d99fadb..3dcf2bac0d 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> @@ -44,6 +44,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
> STATIC UINT32 mModelFamily = 0;
> STATIC UINT32 mModelInstalledMB = 0;
> STATIC UINT32 mModelRevision = 0;
> +STATIC UINT32 mCoreClockRate = 0;
>
> STATIC EFI_MAC_ADDRESS mMacAddress;
>
> @@ -798,6 +799,7 @@ STATIC CONST AML_NAME_OP_REPLACE SsdtEmmcNameOpReplace[] = {
>
> STATIC CONST AML_NAME_OP_REPLACE DsdtNameOpReplace[] = {
> { "URIU", PcdToken (PcdUartInUse) },
> + { "MUCR", PcdToken (PcdMiniUartClockRate) },
> { }
> };
>
> @@ -944,6 +946,13 @@ ConfigInitialize (
> DEBUG ((DEBUG_INFO, "Current Raspberry Pi revision %x\n", mModelRevision));
> }
>
> + Status = mFwProtocol->GetClockRate (RPI_MBOX_CLOCK_RATE_CORE, &mCoreClockRate);
> + if (Status != EFI_SUCCESS) {
> + DEBUG ((DEBUG_ERROR, "Couldn't get the Raspberry Pi core clock rate: %r\n", Status));
> + } else {
> + PcdSet32S (PcdMiniUartClockRate, mCoreClockRate);
> + }
> +
> Status = SetupVariables ();
> if (Status != EFI_SUCCESS) {
> DEBUG ((DEBUG_ERROR, "Couldn't not setup NV vars: %r\n", Status));
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> index e6e22ad82e..6f6e8f42ac 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> @@ -95,6 +95,7 @@
> gRaspberryPiTokenSpaceGuid.PcdFanTemp
> gRaspberryPiTokenSpaceGuid.PcdUartInUse
> gRaspberryPiTokenSpaceGuid.PcdXhciPci
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate
>
> [Depex]
> gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid
> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
> index 6ab5d1ae6d..6dc48dc233 100644
> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
> @@ -561,6 +561,11 @@
> #
> gRaspberryPiTokenSpaceGuid.PcdUartInUse|1
>
> + #
> + # Mini-UART clock rate
> + #
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|250000000
> +
> ################################################################################
> #
> # Components Section - list of all EDK II Modules needed by this Platform
> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
> index 44ed60ab2f..a9c0c36bb1 100644
> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc
> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
> @@ -580,6 +580,11 @@
> #
> gRaspberryPiTokenSpaceGuid.PcdUartInUse|0
>
> + #
> + # Mini-UART clock rate
> + #
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|500000000
> +
> ################################################################################
> #
> # Components Section - list of all EDK II Modules needed by this Platform
> diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/RaspberryPi.dec
> index 797be59274..17b6061a05 100644
> --- a/Platform/RaspberryPi/RaspberryPi.dec
> +++ b/Platform/RaspberryPi/RaspberryPi.dec
> @@ -72,3 +72,4 @@
> gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F
> gRaspberryPiTokenSpaceGuid.PcdUartInUse|1|UINT32|0x00000021
> gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000022
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|0|UINT32|0x00000023
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [edk2-devel] [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart
2022-01-28 15:38 [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart Adrien Thierry
2022-01-29 15:19 ` [edk2-devel] " Ard Biesheuvel
2022-01-31 12:34 ` Leif Lindholm
@ 2022-01-31 16:12 ` Jeremy Linton
2022-01-31 17:36 ` Ard Biesheuvel
2 siblings, 1 reply; 9+ messages in thread
From: Jeremy Linton @ 2022-01-31 16:12 UTC (permalink / raw)
To: devel, athierry; +Cc: Ard Biesheuvel, Leif Lindholm, Pete Batard
Hi,
On 1/28/22 09:38, Adrien Thierry via groups.io wrote:
> Describe the miniuart clock frequency in a _DSD property, so that it can
> be read from the Linux driver.
>
> The miniuart clock frequency is the core clock frequency on the
> Raspberry Pi. It can be modified by the user using the 'core_freq'
> property in the config.txt file. So, we fetch it from the underlying
> Raspberry Pi firmware.
Sorry about the delay, I've been out a bit.
So, this all looks good to me, and it passes the patch checker, the
trick now will be landing the linux patch.
Thanks,
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
>
> Signed-off-by: Adrien Thierry <athierry@redhat.com>
> ---
> Platform/RaspberryPi/AcpiTables/Uart.asl | 14 ++++++++++++++
> Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 9 +++++++++
> .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 +
> Platform/RaspberryPi/RPi3/RPi3.dsc | 5 +++++
> Platform/RaspberryPi/RPi4/RPi4.dsc | 5 +++++
> Platform/RaspberryPi/RaspberryPi.dec | 1 +
> 6 files changed, 35 insertions(+)
>
> diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryPi/AcpiTables/Uart.asl
> index 974f06d3bc..ef5165be98 100644
> --- a/Platform/RaspberryPi/AcpiTables/Uart.asl
> +++ b/Platform/RaspberryPi/AcpiTables/Uart.asl
> @@ -77,6 +77,20 @@ Device (URTM)
> MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MINI_UART_OFFSET)
>
> Return (^RBUF)
>
> }
>
> +
>
> + //
>
> + // Mini Uart Clock Rate will be dynamically updated during boot
>
> + // 0x4D 0x55 0x43 0x52 0xC 0x1000000 (Value must be > 16777215)
>
> + //
>
> + Name (MUCR, 0x1000000)
>
> +
>
> + Name (_DSD, Package ()
>
> + {
>
> + ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package ()
>
> + {
>
> + Package (2) { "clock-frequency", MUCR },
>
> + }
>
> + })
>
> }
>
>
>
> //
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> index 415d99fadb..3dcf2bac0d 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> @@ -44,6 +44,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
> STATIC UINT32 mModelFamily = 0;
>
> STATIC UINT32 mModelInstalledMB = 0;
>
> STATIC UINT32 mModelRevision = 0;
>
> +STATIC UINT32 mCoreClockRate = 0;
>
>
>
> STATIC EFI_MAC_ADDRESS mMacAddress;
>
>
>
> @@ -798,6 +799,7 @@ STATIC CONST AML_NAME_OP_REPLACE SsdtEmmcNameOpReplace[] = {
>
>
> STATIC CONST AML_NAME_OP_REPLACE DsdtNameOpReplace[] = {
>
> { "URIU", PcdToken (PcdUartInUse) },
>
> + { "MUCR", PcdToken (PcdMiniUartClockRate) },
>
> { }
>
> };
>
>
>
> @@ -944,6 +946,13 @@ ConfigInitialize (
> DEBUG ((DEBUG_INFO, "Current Raspberry Pi revision %x\n", mModelRevision));
>
> }
>
>
>
> + Status = mFwProtocol->GetClockRate (RPI_MBOX_CLOCK_RATE_CORE, &mCoreClockRate);
>
> + if (Status != EFI_SUCCESS) {
>
> + DEBUG ((DEBUG_ERROR, "Couldn't get the Raspberry Pi core clock rate: %r\n", Status));
>
> + } else {
>
> + PcdSet32S (PcdMiniUartClockRate, mCoreClockRate);
>
> + }
>
> +
>
> Status = SetupVariables ();
>
> if (Status != EFI_SUCCESS) {
>
> DEBUG ((DEBUG_ERROR, "Couldn't not setup NV vars: %r\n", Status));
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> index e6e22ad82e..6f6e8f42ac 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> @@ -95,6 +95,7 @@
> gRaspberryPiTokenSpaceGuid.PcdFanTemp
>
> gRaspberryPiTokenSpaceGuid.PcdUartInUse
>
> gRaspberryPiTokenSpaceGuid.PcdXhciPci
>
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate
>
>
>
> [Depex]
>
> gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid
>
> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
> index 6ab5d1ae6d..6dc48dc233 100644
> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
> @@ -561,6 +561,11 @@
> #
>
> gRaspberryPiTokenSpaceGuid.PcdUartInUse|1
>
>
>
> + #
>
> + # Mini-UART clock rate
>
> + #
>
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|250000000
>
> +
>
> ################################################################################
>
> #
>
> # Components Section - list of all EDK II Modules needed by this Platform
>
> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
> index 44ed60ab2f..a9c0c36bb1 100644
> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc
> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
> @@ -580,6 +580,11 @@
> #
>
> gRaspberryPiTokenSpaceGuid.PcdUartInUse|0
>
>
>
> + #
>
> + # Mini-UART clock rate
>
> + #
>
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|500000000
>
> +
>
> ################################################################################
>
> #
>
> # Components Section - list of all EDK II Modules needed by this Platform
>
> diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/RaspberryPi.dec
> index 797be59274..17b6061a05 100644
> --- a/Platform/RaspberryPi/RaspberryPi.dec
> +++ b/Platform/RaspberryPi/RaspberryPi.dec
> @@ -72,3 +72,4 @@
> gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F
>
> gRaspberryPiTokenSpaceGuid.PcdUartInUse|1|UINT32|0x00000021
>
> gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000022
>
> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|0|UINT32|0x00000023
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [edk2-devel] [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart
2022-01-31 16:12 ` [edk2-devel] " Jeremy Linton
@ 2022-01-31 17:36 ` Ard Biesheuvel
2022-01-31 21:33 ` Adrien Thierry
2022-02-01 5:40 ` Jeremy Linton
0 siblings, 2 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2022-01-31 17:36 UTC (permalink / raw)
To: Jeremy Linton
Cc: edk2-devel-groups-io, Adrien Thierry, Ard Biesheuvel,
Leif Lindholm, Pete Batard
On Mon, 31 Jan 2022 at 17:13, Jeremy Linton <jeremy.linton@arm.com> wrote:
>
> Hi,
>
> On 1/28/22 09:38, Adrien Thierry via groups.io wrote:
> > Describe the miniuart clock frequency in a _DSD property, so that it can
> > be read from the Linux driver.
> >
> > The miniuart clock frequency is the core clock frequency on the
> > Raspberry Pi. It can be modified by the user using the 'core_freq'
> > property in the config.txt file. So, we fetch it from the underlying
> > Raspberry Pi firmware.
>
> Sorry about the delay, I've been out a bit.
>
> So, this all looks good to me, and it passes the patch checker, the
> trick now will be landing the linux patch.
>
>
> Thanks,
>
> Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
>
Thanks. Could this be resent without whitespace damage please?
Also, a link the to Linux patch would be helpful.
>
>
> >
> > Signed-off-by: Adrien Thierry <athierry@redhat.com>
> > ---
> > Platform/RaspberryPi/AcpiTables/Uart.asl | 14 ++++++++++++++
> > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 9 +++++++++
> > .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 +
> > Platform/RaspberryPi/RPi3/RPi3.dsc | 5 +++++
> > Platform/RaspberryPi/RPi4/RPi4.dsc | 5 +++++
> > Platform/RaspberryPi/RaspberryPi.dec | 1 +
> > 6 files changed, 35 insertions(+)
> >
> > diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryPi/AcpiTables/Uart.asl
> > index 974f06d3bc..ef5165be98 100644
> > --- a/Platform/RaspberryPi/AcpiTables/Uart.asl
> > +++ b/Platform/RaspberryPi/AcpiTables/Uart.asl
> > @@ -77,6 +77,20 @@ Device (URTM)
> > MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MINI_UART_OFFSET)
> >
> > Return (^RBUF)
> >
> > }
> >
> > +
> >
> > + //
> >
> > + // Mini Uart Clock Rate will be dynamically updated during boot
> >
> > + // 0x4D 0x55 0x43 0x52 0xC 0x1000000 (Value must be > 16777215)
> >
> > + //
> >
> > + Name (MUCR, 0x1000000)
> >
> > +
> >
> > + Name (_DSD, Package ()
> >
> > + {
> >
> > + ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package ()
> >
> > + {
> >
> > + Package (2) { "clock-frequency", MUCR },
> >
> > + }
> >
> > + })
> >
> > }
> >
> >
> >
> > //
> >
> > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> > index 415d99fadb..3dcf2bac0d 100644
> > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> > @@ -44,6 +44,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
> > STATIC UINT32 mModelFamily = 0;
> >
> > STATIC UINT32 mModelInstalledMB = 0;
> >
> > STATIC UINT32 mModelRevision = 0;
> >
> > +STATIC UINT32 mCoreClockRate = 0;
> >
> >
> >
> > STATIC EFI_MAC_ADDRESS mMacAddress;
> >
> >
> >
> > @@ -798,6 +799,7 @@ STATIC CONST AML_NAME_OP_REPLACE SsdtEmmcNameOpReplace[] = {
> >
> >
> > STATIC CONST AML_NAME_OP_REPLACE DsdtNameOpReplace[] = {
> >
> > { "URIU", PcdToken (PcdUartInUse) },
> >
> > + { "MUCR", PcdToken (PcdMiniUartClockRate) },
> >
> > { }
> >
> > };
> >
> >
> >
> > @@ -944,6 +946,13 @@ ConfigInitialize (
> > DEBUG ((DEBUG_INFO, "Current Raspberry Pi revision %x\n", mModelRevision));
> >
> > }
> >
> >
> >
> > + Status = mFwProtocol->GetClockRate (RPI_MBOX_CLOCK_RATE_CORE, &mCoreClockRate);
> >
> > + if (Status != EFI_SUCCESS) {
> >
> > + DEBUG ((DEBUG_ERROR, "Couldn't get the Raspberry Pi core clock rate: %r\n", Status));
> >
> > + } else {
> >
> > + PcdSet32S (PcdMiniUartClockRate, mCoreClockRate);
> >
> > + }
> >
> > +
> >
> > Status = SetupVariables ();
> >
> > if (Status != EFI_SUCCESS) {
> >
> > DEBUG ((DEBUG_ERROR, "Couldn't not setup NV vars: %r\n", Status));
> >
> > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> > index e6e22ad82e..6f6e8f42ac 100644
> > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> > @@ -95,6 +95,7 @@
> > gRaspberryPiTokenSpaceGuid.PcdFanTemp
> >
> > gRaspberryPiTokenSpaceGuid.PcdUartInUse
> >
> > gRaspberryPiTokenSpaceGuid.PcdXhciPci
> >
> > + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate
> >
> >
> >
> > [Depex]
> >
> > gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid
> >
> > diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
> > index 6ab5d1ae6d..6dc48dc233 100644
> > --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
> > +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
> > @@ -561,6 +561,11 @@
> > #
> >
> > gRaspberryPiTokenSpaceGuid.PcdUartInUse|1
> >
> >
> >
> > + #
> >
> > + # Mini-UART clock rate
> >
> > + #
> >
> > + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|250000000
> >
> > +
> >
> > ################################################################################
> >
> > #
> >
> > # Components Section - list of all EDK II Modules needed by this Platform
> >
> > diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
> > index 44ed60ab2f..a9c0c36bb1 100644
> > --- a/Platform/RaspberryPi/RPi4/RPi4.dsc
> > +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
> > @@ -580,6 +580,11 @@
> > #
> >
> > gRaspberryPiTokenSpaceGuid.PcdUartInUse|0
> >
> >
> >
> > + #
> >
> > + # Mini-UART clock rate
> >
> > + #
> >
> > + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|500000000
> >
> > +
> >
> > ################################################################################
> >
> > #
> >
> > # Components Section - list of all EDK II Modules needed by this Platform
> >
> > diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/RaspberryPi.dec
> > index 797be59274..17b6061a05 100644
> > --- a/Platform/RaspberryPi/RaspberryPi.dec
> > +++ b/Platform/RaspberryPi/RaspberryPi.dec
> > @@ -72,3 +72,4 @@
> > gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F
> >
> > gRaspberryPiTokenSpaceGuid.PcdUartInUse|1|UINT32|0x00000021
> >
> > gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000022
> >
> > + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|0|UINT32|0x00000023
> >
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [edk2-devel] [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart
2022-01-31 17:36 ` Ard Biesheuvel
@ 2022-01-31 21:33 ` Adrien Thierry
2022-01-31 22:20 ` Ard Biesheuvel
2022-02-01 5:40 ` Jeremy Linton
1 sibling, 1 reply; 9+ messages in thread
From: Adrien Thierry @ 2022-01-31 21:33 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Jeremy Linton, edk2-devel-groups-io, Ard Biesheuvel,
Leif Lindholm, Pete Batard
Thanks Jeremy for reviewing!
> Thanks. Could this be resent without whitespace damage please?
Hi! Which whitespace damage are you referring to?
> Also, a link the to Linux patch would be helpful.
I haven't posted a Linux patch yet. Would you like me to post it before
sending a v2 for this patch?
Thanks,
Adrien
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [edk2-devel] [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart
2022-01-31 21:33 ` Adrien Thierry
@ 2022-01-31 22:20 ` Ard Biesheuvel
0 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2022-01-31 22:20 UTC (permalink / raw)
To: Adrien Thierry
Cc: Jeremy Linton, edk2-devel-groups-io, Ard Biesheuvel,
Leif Lindholm, Pete Batard
On Mon, 31 Jan 2022 at 22:33, Adrien Thierry <athierry@redhat.com> wrote:
>
> Thanks Jeremy for reviewing!
>
> > Thanks. Could this be resent without whitespace damage please?
>
> Hi! Which whitespace damage are you referring to?
>
The patch does not apply because every other line is a blank line.
> > Also, a link the to Linux patch would be helpful.
>
> I haven't posted a Linux patch yet. Would you like me to post it before
> sending a v2 for this patch?
>
Yes, please. I am not going to merge this if it needs to be changed
again two weeks later.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [edk2-devel] [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart
2022-01-31 17:36 ` Ard Biesheuvel
2022-01-31 21:33 ` Adrien Thierry
@ 2022-02-01 5:40 ` Jeremy Linton
2022-02-01 19:21 ` Adrien Thierry
1 sibling, 1 reply; 9+ messages in thread
From: Jeremy Linton @ 2022-02-01 5:40 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: edk2-devel-groups-io, Adrien Thierry, Ard Biesheuvel,
Leif Lindholm, Pete Batard
On 1/31/22 11:36, Ard Biesheuvel wrote:
> On Mon, 31 Jan 2022 at 17:13, Jeremy Linton <jeremy.linton@arm.com> wrote:
>>
>> Hi,
>>
>> On 1/28/22 09:38, Adrien Thierry via groups.io wrote:
>>> Describe the miniuart clock frequency in a _DSD property, so that it can
>>> be read from the Linux driver.
>>>
>>> The miniuart clock frequency is the core clock frequency on the
>>> Raspberry Pi. It can be modified by the user using the 'core_freq'
>>> property in the config.txt file. So, we fetch it from the underlying
>>> Raspberry Pi firmware.
>>
>> Sorry about the delay, I've been out a bit.
>>
>> So, this all looks good to me, and it passes the patch checker, the
>> trick now will be landing the linux patch.
>>
>>
>> Thanks,
>>
>> Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
>>
>
> Thanks. Could this be resent without whitespace damage please?
> Also, a link the to Linux patch would be helpful.
Hmm, I've had that problem a couple times too with these postings,
although it usually appeared to be something groups.io was doing because
direct cc's to myself were correct. I've got a little script to remove
the double lines, which is what I ran this through before git am'ing it.
>
>
>>
>>
>>>
>>> Signed-off-by: Adrien Thierry <athierry@redhat.com>
>>> ---
>>> Platform/RaspberryPi/AcpiTables/Uart.asl | 14 ++++++++++++++
>>> Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 9 +++++++++
>>> .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 +
>>> Platform/RaspberryPi/RPi3/RPi3.dsc | 5 +++++
>>> Platform/RaspberryPi/RPi4/RPi4.dsc | 5 +++++
>>> Platform/RaspberryPi/RaspberryPi.dec | 1 +
>>> 6 files changed, 35 insertions(+)
>>>
>>> diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryPi/AcpiTables/Uart.asl
>>> index 974f06d3bc..ef5165be98 100644
>>> --- a/Platform/RaspberryPi/AcpiTables/Uart.asl
>>> +++ b/Platform/RaspberryPi/AcpiTables/Uart.asl
>>> @@ -77,6 +77,20 @@ Device (URTM)
>>> MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MINI_UART_OFFSET)
>>>
>>> Return (^RBUF)
>>>
>>> }
>>>
>>> +
>>>
>>> + //
>>>
>>> + // Mini Uart Clock Rate will be dynamically updated during boot
>>>
>>> + // 0x4D 0x55 0x43 0x52 0xC 0x1000000 (Value must be > 16777215)
>>>
>>> + //
>>>
>>> + Name (MUCR, 0x1000000)
>>>
>>> +
>>>
>>> + Name (_DSD, Package ()
>>>
>>> + {
>>>
>>> + ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package ()
>>>
>>> + {
>>>
>>> + Package (2) { "clock-frequency", MUCR },
>>>
>>> + }
>>>
>>> + })
>>>
>>> }
>>>
>>>
>>>
>>> //
>>>
>>> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
>>> index 415d99fadb..3dcf2bac0d 100644
>>> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
>>> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
>>> @@ -44,6 +44,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
>>> STATIC UINT32 mModelFamily = 0;
>>>
>>> STATIC UINT32 mModelInstalledMB = 0;
>>>
>>> STATIC UINT32 mModelRevision = 0;
>>>
>>> +STATIC UINT32 mCoreClockRate = 0;
>>>
>>>
>>>
>>> STATIC EFI_MAC_ADDRESS mMacAddress;
>>>
>>>
>>>
>>> @@ -798,6 +799,7 @@ STATIC CONST AML_NAME_OP_REPLACE SsdtEmmcNameOpReplace[] = {
>>>
>>>
>>> STATIC CONST AML_NAME_OP_REPLACE DsdtNameOpReplace[] = {
>>>
>>> { "URIU", PcdToken (PcdUartInUse) },
>>>
>>> + { "MUCR", PcdToken (PcdMiniUartClockRate) },
>>>
>>> { }
>>>
>>> };
>>>
>>>
>>>
>>> @@ -944,6 +946,13 @@ ConfigInitialize (
>>> DEBUG ((DEBUG_INFO, "Current Raspberry Pi revision %x\n", mModelRevision));
>>>
>>> }
>>>
>>>
>>>
>>> + Status = mFwProtocol->GetClockRate (RPI_MBOX_CLOCK_RATE_CORE, &mCoreClockRate);
>>>
>>> + if (Status != EFI_SUCCESS) {
>>>
>>> + DEBUG ((DEBUG_ERROR, "Couldn't get the Raspberry Pi core clock rate: %r\n", Status));
>>>
>>> + } else {
>>>
>>> + PcdSet32S (PcdMiniUartClockRate, mCoreClockRate);
>>>
>>> + }
>>>
>>> +
>>>
>>> Status = SetupVariables ();
>>>
>>> if (Status != EFI_SUCCESS) {
>>>
>>> DEBUG ((DEBUG_ERROR, "Couldn't not setup NV vars: %r\n", Status));
>>>
>>> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
>>> index e6e22ad82e..6f6e8f42ac 100644
>>> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
>>> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
>>> @@ -95,6 +95,7 @@
>>> gRaspberryPiTokenSpaceGuid.PcdFanTemp
>>>
>>> gRaspberryPiTokenSpaceGuid.PcdUartInUse
>>>
>>> gRaspberryPiTokenSpaceGuid.PcdXhciPci
>>>
>>> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate
>>>
>>>
>>>
>>> [Depex]
>>>
>>> gPcdProtocolGuid AND gRaspberryPiFirmwareProtocolGuid
>>>
>>> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
>>> index 6ab5d1ae6d..6dc48dc233 100644
>>> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
>>> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
>>> @@ -561,6 +561,11 @@
>>> #
>>>
>>> gRaspberryPiTokenSpaceGuid.PcdUartInUse|1
>>>
>>>
>>>
>>> + #
>>>
>>> + # Mini-UART clock rate
>>>
>>> + #
>>>
>>> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|250000000
>>>
>>> +
>>>
>>> ################################################################################
>>>
>>> #
>>>
>>> # Components Section - list of all EDK II Modules needed by this Platform
>>>
>>> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
>>> index 44ed60ab2f..a9c0c36bb1 100644
>>> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc
>>> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
>>> @@ -580,6 +580,11 @@
>>> #
>>>
>>> gRaspberryPiTokenSpaceGuid.PcdUartInUse|0
>>>
>>>
>>>
>>> + #
>>>
>>> + # Mini-UART clock rate
>>>
>>> + #
>>>
>>> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|500000000
>>>
>>> +
>>>
>>> ################################################################################
>>>
>>> #
>>>
>>> # Components Section - list of all EDK II Modules needed by this Platform
>>>
>>> diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/RaspberryPi.dec
>>> index 797be59274..17b6061a05 100644
>>> --- a/Platform/RaspberryPi/RaspberryPi.dec
>>> +++ b/Platform/RaspberryPi/RaspberryPi.dec
>>> @@ -72,3 +72,4 @@
>>> gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F
>>>
>>> gRaspberryPiTokenSpaceGuid.PcdUartInUse|1|UINT32|0x00000021
>>>
>>> gRaspberryPiTokenSpaceGuid.PcdXhciPci|0|UINT32|0x00000022
>>>
>>> + gRaspberryPiTokenSpaceGuid.PcdMiniUartClockRate|0|UINT32|0x00000023
>>>
>>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [edk2-devel] [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart
2022-02-01 5:40 ` Jeremy Linton
@ 2022-02-01 19:21 ` Adrien Thierry
0 siblings, 0 replies; 9+ messages in thread
From: Adrien Thierry @ 2022-02-01 19:21 UTC (permalink / raw)
To: Jeremy Linton
Cc: Ard Biesheuvel, edk2-devel-groups-io, Ard Biesheuvel,
Leif Lindholm, Pete Batard
> Hmm, I've had that problem a couple times too with these postings,
> although it usually appeared to be something groups.io was doing because
> direct cc's to myself were correct. I've got a little script to remove
> the double lines, which is what I ran this through before git am'ing it.
Thanks Ard and Jeremy! I think I might have found the reason for those
blank lines [1]
I will send a v2 that hopefully fixes this.
[1] https://edk2.groups.io/g/devel/topic/66206907#51715
Adrien
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-02-01 19:21 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-28 15:38 [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart Adrien Thierry
2022-01-29 15:19 ` [edk2-devel] " Ard Biesheuvel
2022-01-31 12:34 ` Leif Lindholm
2022-01-31 16:12 ` [edk2-devel] " Jeremy Linton
2022-01-31 17:36 ` Ard Biesheuvel
2022-01-31 21:33 ` Adrien Thierry
2022-01-31 22:20 ` Ard Biesheuvel
2022-02-01 5:40 ` Jeremy Linton
2022-02-01 19:21 ` Adrien Thierry
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox