[edk2-devel] [PATCH edk2-platforms v2 5/9] Silicon/NXP: Implement PL011UartClockLib for NXP platforms

Pankaj Bansal posted 9 patches 4 years, 6 months ago
There is a newer version of this series
[edk2-devel] [PATCH edk2-platforms v2 5/9] Silicon/NXP: Implement PL011UartClockLib for NXP platforms
Posted by Pankaj Bansal 4 years, 6 months ago
From: Pankaj Bansal <pankaj.bansal@nxp.com>

In NXP SOCs the UART clock is derived from System clock after PLL
multiplication. Therefore, add the PL011UartClockLib implementation
for NXP platforms.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
---

Notes:
    V2:
    - No change

 Silicon/NXP/Library/PL011UartClockLib/PL011UartClockLib.inf | 24 ++++++++++++++++++++
 Silicon/NXP/Library/PL011UartClockLib/PL011UartClockLib.c   | 22 ++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/Silicon/NXP/Library/PL011UartClockLib/PL011UartClockLib.inf b/Silicon/NXP/Library/PL011UartClockLib/PL011UartClockLib.inf
new file mode 100644
index 000000000000..b771dba7697f
--- /dev/null
+++ b/Silicon/NXP/Library/PL011UartClockLib/PL011UartClockLib.inf
@@ -0,0 +1,24 @@
+#/* @file
+#  Copyright 2018, 2020 NXP
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#*/
+
+[Defines]
+  INF_VERSION                    = 0x0001001A
+  BASE_NAME                      = PL011UartClockLib
+  FILE_GUID                      = af8fef24-afbb-472a-b8b7-13101a79703c
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = PL011UartClockLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  Silicon/NXP/NxpQoriqLs.dec
+
+[Sources.common]
+  PL011UartClockLib.c
+
+[LibraryClasses]
+  ArmPlatformLib
diff --git a/Silicon/NXP/Library/PL011UartClockLib/PL011UartClockLib.c b/Silicon/NXP/Library/PL011UartClockLib/PL011UartClockLib.c
new file mode 100644
index 000000000000..3814685585eb
--- /dev/null
+++ b/Silicon/NXP/Library/PL011UartClockLib/PL011UartClockLib.c
@@ -0,0 +1,22 @@
+/** @file
+*
+*  Copyright 2018, 2020 NXP
+*
+*  SPDX-License-Identifier: BSD-2-Clause-Patent
+*
+**/
+
+#include <Base.h>
+#include <Ppi/NxpPlatformGetClock.h>
+
+/**
+  Return clock in for PL011 Uart IP
+**/
+UINT32
+EFIAPI
+PL011UartClockGetFreq (
+  VOID
+  )
+{
+  return gPlatformGetClockPpi.PlatformGetClock (NXP_UART_CLOCK, 0);
+}
-- 
2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#60325): https://edk2.groups.io/g/devel/message/60325
Mute This Topic: https://groups.io/mt/74496020/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-