public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Platform/devel-riscv-v2 PATCHv5-3] SiFive/U5SeriesPkg: Add PCD of system clock for U5 series platforms
@ 2019-11-22  2:13 Abner Chang
  0 siblings, 0 replies; only message in thread
From: Abner Chang @ 2019-11-22  2:13 UTC (permalink / raw)
  To: devel
  Cc: abner.chang, Michael D Kinney, Ard Biesheuvel, Leif Lindholm,
	Gilbert Chen

Create PCD for SiFive U5 series platforms clock setting.

Signed-off-by: Abner Chang <abner.chang@hpe.com>

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
---
 Platform/SiFive/U5SeriesPkg/U5SeriesPkg.dec                 |  7 ++++---
 .../SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc   | 11 ++++++-----
 .../FreedomU540HiFiveUnleashedBoard/U540.fdf.inc            | 13 +++++++------
 .../Library/OpensbiPlatformLib/OpensbiPlatformLib.inf       |  1 +
 .../Library/OpensbiPlatformLib/OpensbiPlatformLib.inf       |  1 +
 .../SiFive/U5SeriesPkg/Library/SerialIoLib/SerialIoLib.inf  |  1 +
 .../Library/OpensbiPlatformLib/Platform.c                   |  2 +-
 .../Library/OpensbiPlatformLib/Platform.c                   |  2 +-
 .../SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c  |  2 +-
 9 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/Platform/SiFive/U5SeriesPkg/U5SeriesPkg.dec b/Platform/SiFive/U5SeriesPkg/U5SeriesPkg.dec
index a01135b..7f9de20 100644
--- a/Platform/SiFive/U5SeriesPkg/U5SeriesPkg.dec
+++ b/Platform/SiFive/U5SeriesPkg/U5SeriesPkg.dec
@@ -23,9 +23,10 @@
   gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid  = {0x725B804B, 0x10B5, 0x4326, { 0xAD, 0xFF, 0x59, 0xCE, 0x6E, 0xFD, 0x5B, 0x36 }}
 
 [PcdsFixedAtBuild]
-  gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores|0x8|UINT32|0x00001000
-  gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported|TRUE|BOOLEAN|0x00001001
-  gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase|0x0|UINT32|0x00001002
+  gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock|0x0|UINT32|0x00001000
+  gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores|0x8|UINT32|0x00001001
+  gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported|TRUE|BOOLEAN|0x00001002
+  gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase|0x0|UINT32|0x00001003
 
 [PcdsPatchableInModule]
 
diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc
index 936ff22..effff62 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc
@@ -46,10 +46,11 @@ SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamBase = $(CODE_BASE_ADDRES
 SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamSize = 0x10000
 
 
-SET gUefiRiscVPkgTokenSpaceGuid.PcdRiscVMachineTimerFrequencyInHerz = 1000000
-SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdHartCount             = 4     # Total cores on U500 platform
-SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores = 4     # Total U5 cores enabled on U500 platform
-SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported   = False # Enable optional E51 MC core?
-SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId            = 0     # Boot hart ID
+SET gUefiRiscVPkgTokenSpaceGuid.PcdRiscVMachineTimerFrequencyInHerz    = 1000000
+SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock = 100000000 # 100Mhz system clock
+SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdHartCount                   = 4         # Total cores on U500 platform
+SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores       = 4         # Total U5 cores enabled on U500 platform
+SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported         = False     # Enable optional E51 MC core?
+SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId                  = 0         # Boot hart ID
 
 SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase = 0x54000000
diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc
index 00a2315..3e8d833 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc
@@ -46,9 +46,10 @@ SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamBase = $(CODE_BASE_ADDRES
 SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamSize = 0x10000
 
 
-SET gUefiRiscVPkgTokenSpaceGuid.PcdRiscVMachineTimerFrequencyInHerz = 1000000
-SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdHartCount             = 5          # Total cores on U540 platform
-SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId            = 1          # Boot hart ID
-SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores = 4          # Total U5 cores enabled on U540 platform
-SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported   = True       # E51 MC exists.
-SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase      = 0x10010000 # Serial port base address
+SET gUefiRiscVPkgTokenSpaceGuid.PcdRiscVMachineTimerFrequencyInHerz    = 1000000
+SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock = 1000000000 # 1GHz system clock
+SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdHartCount                   = 5          # Total cores on U540 platform
+SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId                  = 1          # Boot hart ID
+SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores       = 4          # Total U5 cores enabled on U540 platform
+SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported         = True       # E51 MC exists.
+SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase            = 0x10010000 # Serial port base address
diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf
index 60aec6d..e1b4627 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf
@@ -50,3 +50,4 @@
   gUefiRiscVPlatformPkgTokenSpaceGuid.PcdOpenSbiStackSize
 
   gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase
+  gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock
diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf
index 21710d4..0fdc558 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf
@@ -50,3 +50,4 @@
   gUefiRiscVPlatformPkgTokenSpaceGuid.PcdOpenSbiStackSize
 
   gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase
+  gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock
diff --git a/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialIoLib.inf b/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialIoLib.inf
index 0044f84..941e309 100644
--- a/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialIoLib.inf
+++ b/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialIoLib.inf
@@ -33,6 +33,7 @@
 
 [FixedPcd]
   gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase
+  gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock
 
 [Sources]
   SerialPortLib.c
diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/Platform.c b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/Platform.c
index bcdb643..1577b01 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/Platform.c
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/Platform.c
@@ -27,7 +27,7 @@
 #define U500_HART_STACK_SIZE    FixedPcdGet32(PcdOpenSbiStackSize)
 #define U500_BOOT_HART_ID       FixedPcdGet32(PcdBootHartId)
 
-#define U500_SYS_CLK            100000000
+#define U500_SYS_CLK            FixedPcdGet32(PcdU5PlatformSystemClock)
 
 #define U500_PLIC_ADDR              0xc000000
 #define U500_PLIC_NUM_SOURCES       0x35
diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c
index b9deec6..3b36379 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c
@@ -27,7 +27,7 @@
 #define U540_HART_STACK_SIZE    FixedPcdGet32(PcdOpenSbiStackSize)
 #define U540_BOOT_HART_ID       FixedPcdGet32(PcdBootHartId)
 
-#define U540_SYS_CLK              100000000
+#define U540_SYS_CLK              FixedPcdGet32(PcdU5PlatformSystemClock)
 
 #define U540_PLIC_ADDR            0xc000000
 #define U540_PLIC_NUM_SOURCES     0x35
diff --git a/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c b/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c
index 5e06515..504db0f 100644
--- a/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c
+++ b/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c
@@ -24,7 +24,7 @@
 //---------------------------------------------
 
 #define UART_BAUDRATE  115200
-#define SYS_CLK        100000000
+#define SYS_CLK        FixedPcdGet32(PcdU5PlatformSystemClock)
 
 BOOLEAN Initiated = FALSE;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-22  2:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-22  2:13 [Platform/devel-riscv-v2 PATCHv5-3] SiFive/U5SeriesPkg: Add PCD of system clock for U5 series platforms Abner Chang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox