From nobody Thu Apr 25 00:29:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=nxp.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 152826501523644.11992190594208; Tue, 5 Jun 2018 23:03:35 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C19EA2118B7A5; Tue, 5 Jun 2018 23:03:33 -0700 (PDT) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) (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 211B2202E5342 for ; Tue, 5 Jun 2018 23:03:32 -0700 (PDT) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6BEE21A0075; Wed, 6 Jun 2018 08:03:30 +0200 (CEST) Received: from smtp.na-rdc02.nxp.com (inv1260.us-phx01.nxp.com [134.27.49.11]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0BD9C1A020F; Wed, 6 Jun 2018 08:03:30 +0200 (CEST) Received: from az84smr01.freescale.net (az84smr01.freescale.net [10.64.34.197]) by inv1260.na-rdc02.nxp.com (Postfix) with ESMTP id C2BCC40C72; Tue, 5 Jun 2018 23:03:29 -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 w5663ORH005217; Tue, 5 Jun 2018 23:03:28 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=92.121.34.13; helo=inva020.nxp.com; envelope-from=udit.kumar@nxp.com; receiver=edk2-devel@lists.01.org From: Udit Kumar To: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, edk2-devel@lists.01.org Date: Tue, 5 Jun 2018 23:29:54 +0530 Message-Id: <1528221595-22145-2-git-send-email-udit.kumar@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1528221595-22145-1-git-send-email-udit.kumar@nxp.com> References: <1528221595-22145-1-git-send-email-udit.kumar@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [edk2] [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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 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 --- ArmPlatformPkg/ArmPlatformPkg.dec | 1 + ArmPlatformPkg/Include/Library/PL011UartClockLib.h | 32 +++++++++++++++++++ .../Library/PL011UartClockLib/PL011UartClockLib.c | 29 +++++++++++++++++ .../PL011UartClockLib/PL011UartClockLib.inf | 37 ++++++++++++++++++= ++++ 4 files changed, 99 insertions(+) create mode 100644 ArmPlatformPkg/Include/Library/PL011UartClockLib.h create mode 100644 ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClock= Lib.c create mode 100644 ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClock= Lib.inf diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatform= Pkg.dec index dff4598..5f67e74 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dec +++ b/ArmPlatformPkg/ArmPlatformPkg.dec @@ -36,6 +36,7 @@ LcdHwLib|Include/Library/LcdHwLib.h LcdPlatformLib|Include/Library/LcdPlatformLib.h NorFlashPlatformLib|Include/Library/NorFlashPlatformLib.h + PL011UartClockLib|Include/Library/PL011UartClockLib.h PL011UartLib|Include/Library/PL011UartLib.h =20 [Guids.common] diff --git a/ArmPlatformPkg/Include/Library/PL011UartClockLib.h b/ArmPlatfo= rmPkg/Include/Library/PL011UartClockLib.h new file mode 100644 index 0000000..93813a0 --- /dev/null +++ b/ArmPlatformPkg/Include/Library/PL011UartClockLib.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 B= SD 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 IM= PLIED. +* +**/ + +#ifndef __PL011CLOCKLIB_H__ +#define __PL011CLOCKLIB_H__ + + +/** + Return frequency of PL011. + + By default this function returns FixedPcdGet32 (PL011UartClkInHz) + + @return Return frequency of PL011 + +**/ +UINT32 +ArmPlatformGetPL011ClockFreq ( + VOID + ); + +#endif diff --git a/ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.c b= /ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.c new file mode 100644 index 0000000..b56af14 --- /dev/null +++ b/ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.c @@ -0,0 +1,29 @@ +/** @file +* +* Copyright 2018 NXP +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +* +**/ + +#include + +/** + Return clock in for PL011 Uart IP. +**/ +UINT32 +ArmPlatformGetPL011ClockFreq ( + VOID + ) +{ + // This function needs to be implemented on platforms which supports + // dynamic clocking to avoid re-building of UEFI firmware for PL011 + // clock change + return FixedPcdGet32 (PL011UartClkInHz); +} diff --git a/ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf= b/ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf new file mode 100644 index 0000000..5f6f699 --- /dev/null +++ b/ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf @@ -0,0 +1,37 @@ +#/* @file +# Copyright 2018 NXP +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +# +#*/ + +[Defines] + INF_VERSION =3D 0x0001000A + BASE_NAME =3D PL011UartClockLib + FILE_GUID =3D af8fef24-afbb-472a-b8b7-13101a79703c + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D PL011UartClockLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + ArmLib + DebugLib + +[Sources.common] + PL011UartClockLib.c + +[FixedPcd] + gArmPlatformTokenSpaceGuid.PL011UartClkInHz + --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu Apr 25 00:29:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=nxp.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528265018116969.734295567807; Tue, 5 Jun 2018 23:03:38 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F24EF2118F772; Tue, 5 Jun 2018 23:03:35 -0700 (PDT) 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 E145A2110D503 for ; Tue, 5 Jun 2018 23:03:34 -0700 (PDT) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id A683D2000D8; Wed, 6 Jun 2018 08:03:32 +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 70D5A20009A; Wed, 6 Jun 2018 08:03:32 +0200 (CEST) Received: from az84smr01.freescale.net (az84smr01.freescale.net [10.64.34.197]) by inv1260.na-rdc02.nxp.com (Postfix) with ESMTP id 2FE8440A6F; Tue, 5 Jun 2018 23:03:32 -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 w5663ORI005217; Tue, 5 Jun 2018 23:03:30 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; 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 From: Udit Kumar To: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, edk2-devel@lists.01.org Date: Tue, 5 Jun 2018 23:29:55 +0530 Message-Id: <1528221595-22145-3-git-send-email-udit.kumar@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1528221595-22145-1-git-send-email-udit.kumar@nxp.com> References: <1528221595-22145-1-git-send-email-udit.kumar@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [edk2] [PATCH 2/2] ArmPlatformPkg: Include PL011UartClock Lib 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch includes, PL011UartClock lib. In case of no implemenation of this Clock Lib, Pcd value will be used for PL011 frequency. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Udit Kumar --- ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c | 5 +++-- ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c= b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c index 6aa8063..c73e8db 100644 --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c @@ -19,6 +19,7 @@ =20 #include #include +#include #include #include =20 @@ -48,7 +49,7 @@ SerialPortInitialize ( =20 return PL011UartInitializePort ( (UINTN)FixedPcdGet64 (PcdSerialRegisterBase), - FixedPcdGet32 (PL011UartClkInHz), + ArmPlatformGetPL011ClockFreq(), &BaudRate, &ReceiveFifoDepth, &Parity, @@ -156,7 +157,7 @@ SerialPortSetAttributes ( { return PL011UartInitializePort ( (UINTN)FixedPcdGet64 (PcdSerialRegisterBase), - FixedPcdGet32 (PL011UartClkInHz), + ArmPlatformGetPL011ClockFreq(), BaudRate, ReceiveFifoDepth, Parity, diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.i= nf b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf index 3683e06..5ce5b2f 100644 --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf @@ -26,6 +26,7 @@ PL011SerialPortLib.c =20 [LibraryClasses] + PL011UartClockLib PL011UartLib PcdLib =20 --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel