]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg: PL011 Dynamic clock freq Support
authorUdit Kumar <udit.kumar@nxp.com>
Tue, 12 Jun 2018 20:14:08 +0000 (01:44 +0530)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 13 Jun 2018 09:45:50 +0000 (11:45 +0200)
Some platform support dynamic clocking, which is controlled by some
jumper setting or hardware registers. Result of that is that PCD
PL011UartClkInHz would need to be updated for frequency change.

This patch implements support for dynamic frequency for PL011 uart.

This patch implements default lib, which is using Pcd. Platform which
needs dynamic clocking needs implement PL011UartClockLib

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
ArmPlatformPkg/ArmPlatformPkg.dec
ArmPlatformPkg/ArmPlatformPkg.dsc
ArmPlatformPkg/Include/Library/PL011UartClockLib.h [new file with mode: 0644]
ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.c [new file with mode: 0644]
ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf [new file with mode: 0644]

index dff45983b4526b2ae3cfb53bdf113b755b599c55..5f67e7415469eba47ad1175564d1c133b63e3440 100644 (file)
@@ -36,6 +36,7 @@
   LcdHwLib|Include/Library/LcdHwLib.h\r
   LcdPlatformLib|Include/Library/LcdPlatformLib.h\r
   NorFlashPlatformLib|Include/Library/NorFlashPlatformLib.h\r
+  PL011UartClockLib|Include/Library/PL011UartClockLib.h\r
   PL011UartLib|Include/Library/PL011UartLib.h\r
 \r
 [Guids.common]\r
index 0013106b94c371f827e01c6d402faa6aa42e4bdd..d504e76b2f564c83a632cef8c4542ef01fbcff62 100644 (file)
   ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.inf\r
   ArmPlatformPkg/Library/NorFlashPlatformNullLib/NorFlashPlatformNullLib.inf\r
   ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf\r
+  ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf\r
   ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf\r
   ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf\r
   ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf\r
diff --git a/ArmPlatformPkg/Include/Library/PL011UartClockLib.h b/ArmPlatformPkg/Include/Library/PL011UartClockLib.h
new file mode 100644 (file)
index 0000000..04c7d51
--- /dev/null
@@ -0,0 +1,31 @@
+/** @file\r
+*\r
+*  Copyright 2018 NXP\r
+*\r
+*  This program and the accompanying materials\r
+*  are licensed and made available under the terms and conditions of the BSD License\r
+*  which accompanies this distribution.  The full text of the license may be found at\r
+*  http://opensource.org/licenses/bsd-license.php\r
+*\r
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+\r
+#ifndef __PL011UARTCLOCKLIB_H__\r
+#define __PL011UARTCLOCKLIB_H__\r
+\r
+/**\r
+\r
+  Return baud clock frequency of  PL011.\r
+\r
+  @return return frequency of PL011 in Hz\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+PL011UartClockGetFreq (\r
+  VOID\r
+  );\r
+\r
+#endif\r
diff --git a/ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.c b/ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.c
new file mode 100644 (file)
index 0000000..c61110d
--- /dev/null
@@ -0,0 +1,29 @@
+/** @file\r
+*\r
+*  Copyright 2018 NXP\r
+*\r
+*  This program and the accompanying materials\r
+*  are licensed and made available under the terms and conditions of the BSD License\r
+*  which accompanies this distribution.  The full text of the license may be found at\r
+*  http://opensource.org/licenses/bsd-license.php\r
+*\r
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+\r
+#include <Base.h>\r
+\r
+/**\r
+  Return clock in for PL011 Uart IP\r
+\r
+  @return Pcd PL011UartClkInHz\r
+**/\r
+UINT32\r
+EFIAPI\r
+PL011UartClockGetFreq (\r
+  VOID\r
+  )\r
+{\r
+  return FixedPcdGet32 (PL011UartClkInHz);\r
+}\r
diff --git a/ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf b/ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf
new file mode 100644 (file)
index 0000000..db9bef6
--- /dev/null
@@ -0,0 +1,30 @@
+#/* @file\r
+#  Copyright 2018 NXP\r
+#\r
+#  This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution.  The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#*/\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x0001001A\r
+  BASE_NAME                      = BasePL011UartClockLib\r
+  FILE_GUID                      = af8fef24-afbb-472a-b8b7-13101a79703c\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = PL011UartClockLib\r
+\r
+[Packages]\r
+  ArmPlatformPkg/ArmPlatformPkg.dec\r
+  MdePkg/MdePkg.dec\r
+\r
+[Sources.common]\r
+  PL011UartClockLib.c\r
+\r
+[FixedPcd]\r
+  gArmPlatformTokenSpaceGuid.PL011UartClkInHz\r