From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=92.121.34.21; helo=inva021.nxp.com; envelope-from=udit.kumar@nxp.com; receiver=edk2-devel@lists.01.org Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0358C2118DC5A for ; Tue, 5 Jun 2018 04:39:19 -0700 (PDT) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 75B15200011; Tue, 5 Jun 2018 13:39:17 +0200 (CEST) Received: from smtp.na-rdc02.nxp.com (inv1260.us-phx01.nxp.com [134.27.49.11]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 1470220000F; Tue, 5 Jun 2018 13:39:17 +0200 (CEST) Received: from az84smr01.freescale.net (az84smr01.freescale.net [10.64.34.197]) by inv1260.na-rdc02.nxp.com (Postfix) with ESMTP id 85DE640A56; Tue, 5 Jun 2018 04:39:16 -0700 (MST) Received: from uefi-OptiPlex-790.ap.freescale.net ([10.232.132.56]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id w55BdD3w001846; Tue, 5 Jun 2018 04:39:14 -0700 From: Udit Kumar To: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org, leif.lindholm@linaro.org Date: Tue, 5 Jun 2018 05:05:38 +0530 Message-Id: <1528155339-5050-1-git-send-email-udit.kumar@nxp.com> X-Mailer: git-send-email 1.9.1 X-Virus-Scanned: ClamAV using ClamSMTP Subject: [PATCH 1/2] ArmPlatformPkg: PL011 Dynamic clock freq Support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2018 11:39:20 -0000 Some platform support dynamic clocking, Which is controlled by some jumper setting or hardware registers. Result of that PCD PL011UartClkInHz needs to be updated for frequency change. This patch implements support for dynamic frequency for PL011 uart. This patch implement NULL lib for such platform where Pcd clock frequency to PL011 can change Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Udit Kumar --- .../Include/Library/ArmPlatformClockLib.h | 32 ++++++++++++++++++++ .../ArmPlatformClockLib.inf | 33 ++++++++++++++++++++ .../ArmPlatformClockLibNull.c | 35 ++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 ArmPlatformPkg/Include/Library/ArmPlatformClockLib.h create mode 100644 ArmPlatformPkg/Library/ArmPlatformClockLibNull/ArmPlatformClockLib.inf create mode 100644 ArmPlatformPkg/Library/ArmPlatformClockLibNull/ArmPlatformClockLibNull.c diff --git a/ArmPlatformPkg/Include/Library/ArmPlatformClockLib.h b/ArmPlatformPkg/Include/Library/ArmPlatformClockLib.h new file mode 100644 index 0000000..f9d1425 --- /dev/null +++ b/ArmPlatformPkg/Include/Library/ArmPlatformClockLib.h @@ -0,0 +1,32 @@ +/** @file +* +* Copyright 2018 NXP +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef _ARMPLATFORMCLOCKLIB_H_ +#define _ARMPLATFORMCLOCKLIB_H_ + + +/** + Return frequency of PL011. + + If this function return 0 then fixed value in Pcd will be used + + @return Return frequency of PL011 + +**/ +UINT32 +ArmPlatformGetPL011ClockFreq ( + VOID + ); + +#endif diff --git a/ArmPlatformPkg/Library/ArmPlatformClockLibNull/ArmPlatformClockLib.inf b/ArmPlatformPkg/Library/ArmPlatformClockLibNull/ArmPlatformClockLib.inf new file mode 100644 index 0000000..b708ad3 --- /dev/null +++ b/ArmPlatformPkg/Library/ArmPlatformClockLibNull/ArmPlatformClockLib.inf @@ -0,0 +1,33 @@ +#/* @file +# Copyright 2018 NXP +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#*/ + +[Defines] + INF_VERSION = 0x0001000A + BASE_NAME = ArmPlatformClockLibNull + FILE_GUID = af8fef24-afbb-472a-b8b7-13101a79703c + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmPlatformClockLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + ArmLib + DebugLib + +[Sources.common] + ArmPlatformClockLibNull.c diff --git a/ArmPlatformPkg/Library/ArmPlatformClockLibNull/ArmPlatformClockLibNull.c b/ArmPlatformPkg/Library/ArmPlatformClockLibNull/ArmPlatformClockLibNull.c new file mode 100644 index 0000000..28eaa63 --- /dev/null +++ b/ArmPlatformPkg/Library/ArmPlatformClockLibNull/ArmPlatformClockLibNull.c @@ -0,0 +1,35 @@ +/** @file +* +* Copyright 2018 NXP +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + + + +/** + Return clock in for PL011 Uart IP. +**/ +UINT32 +ArmPlatformGetPL011ClockFreq ( + VOID + ) +{ + // Implement platform specific code + // and return PL011 freq + + // Some platform supports dynamic clocking, + // This function needs to be implemented on platforms which supports + // dynamic clocking to avoid re-building of UEFI firmware for PL011 + // clock change + return 0; +} -- 1.9.1