From nobody Fri Mar 29 05:03:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65969+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65969+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; t=1602066948; cv=none; d=zohomail.com; s=zohoarc; b=M1mKzAq2udBTx/wUv/ba2wgnvx3B8BiV1lQZnCUwh5wQ0ZEa3+nr2AWTd3tIsl/hk90qODja+/fKIiEWy7OiD74rsCYDjfzCu8ZVbXCQ5dPeryvVPFb0z2AdipJA15ZElNosV4mUZq8vIQignpWwYU+/TssDTBCC1vZHkZA3IW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602066948; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=8SJ5oFzdgw5MT0zQ13WjArzWf4jsYdZYYNhEr5/04Qc=; b=HW6Q/hKAAAo0aNAlgo4FP11fTaF06etGOBpOEvhnW6IFbDPm8igM6mJY918Ak+hQtPy+E+Zla/qUwoBeHyVduP2Re2fEPw6QYfJd7AoyutfNKniGBS5FZCp+8lwHWpta9umPoC3QEez/G67QE8w7ENxJ+Bk4LQBIshGT+nFj58Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65969+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602066948796228.66860670561607; Wed, 7 Oct 2020 03:35:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id eb3xYY1788612x3NMsLq4Gbp; Wed, 07 Oct 2020 03:35:48 -0700 X-Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mx.groups.io with SMTP id smtpd.web11.9958.1602066566965309407 for ; Wed, 07 Oct 2020 03:29:27 -0700 X-Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6DFF51A0FAA; Wed, 7 Oct 2020 12:29:25 +0200 (CEST) X-Received: from inv0113.in-blr01.nxp.com (inv0113.in-blr01.nxp.com [165.114.116.118]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id DBEA61A0114; Wed, 7 Oct 2020 12:29:24 +0200 (CEST) X-Received: from uefi-OptiPlex-790.ap.freescale.net (unknown [10.232.132.78]) by inv0113.in-blr01.nxp.com (Postfix) with ESMTP id 9758A32D; Wed, 7 Oct 2020 15:59:23 +0530 (IST) From: Meenakshi Aggarwal To: ard.biesheuvel@arm.com, leif@nuviainc.com, michael.d.kinney@intel.com, devel@edk2.groups.io Cc: v.sethi@nxp.com, Meenakshi Aggarwal , Meenakshi Aggarwal Subject: [edk2-devel] [edk2-platforms v2 1/6] Silicon/NXP: Add GPIO Library support. Date: Wed, 7 Oct 2020 21:40:36 +0530 Message-Id: <1602087041-8009-2-git-send-email-meenakshi.aggarwal@oss.nxp.com> In-Reply-To: <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> References: <1600187343-18732-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,meenakshi.aggarwal@oss.nxp.com X-Gm-Message-State: jMb3UcpAQtsJWbaKkbpzMX3ux1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602066948; bh=aJOKKHCTgJTjbhgQwA4ezDQS0uYaEaOwZFcBD62Nzmk=; h=Cc:Date:From:Reply-To:Subject:To; b=VxxnjZCYJhfbYWBwULoK6x8Ibqx1aDdvYASdOUvWUsZlgK9BlRVr0yyEhmLJtSHpilT ihNkbMUByFV6dO93SyV/aq9XlqMKtQYknxFtjFKxlAUoF2z6AwqER8hN2B5ZQ9sRT0ST5 o2Y/5Cgf9iVLQIZ2ZYiK2LLHQ68KBhYuzMo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" General-purpose I/O (GPIO) module is integrated on chip. In general, the GPIO module supports up to 32 general-purpose I/O ports. Each port can be configured as an input or as an output. However, some implementations may restrict specific ports to input-only, output-only, or reserved (unimplemented). Co-authored-by: Pramod Kumar Signed-off-by: Meenakshi Aggarwal Reviewed-by: Leif Lindholm --- Silicon/NXP/Library/GpioLib/GpioLib.inf | 39 ++++++ Silicon/NXP/Include/Library/GpioLib.h | 110 ++++++++++++++++ Silicon/NXP/Library/GpioLib/GpioLib.c | 219 ++++++++++++++++++++++++++++= ++++ 3 files changed, 368 insertions(+) create mode 100644 Silicon/NXP/Library/GpioLib/GpioLib.inf create mode 100644 Silicon/NXP/Include/Library/GpioLib.h create mode 100644 Silicon/NXP/Library/GpioLib/GpioLib.c diff --git a/Silicon/NXP/Library/GpioLib/GpioLib.inf b/Silicon/NXP/Library/= GpioLib/GpioLib.inf new file mode 100644 index 000000000000..0c11a5f00a12 --- /dev/null +++ b/Silicon/NXP/Library/GpioLib/GpioLib.inf @@ -0,0 +1,39 @@ +/** @file + + Copyright 2020 NXP + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D GpioLib + FILE_GUID =3D addec2b8-d2e0-43c0-a277-41a8d42f3f4f + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D GpioLib + +[Sources.common] + GpioLib.c + +[LibraryClasses] + ArmLib + BaseLib + BaseMemoryLib + IoAccessLib + IoLib + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/NXP/NxpQoriqLs.dec + +[Pcd] + gNxpQoriqLsTokenSpaceGuid.PcdNumGpioController + gNxpQoriqLsTokenSpaceGuid.PcdGpioModuleBaseAddress + gNxpQoriqLsTokenSpaceGuid.PcdGpioControllerOffset + +[FeaturePcd] + gNxpQoriqLsTokenSpaceGuid.PcdGpioControllerBigEndian diff --git a/Silicon/NXP/Include/Library/GpioLib.h b/Silicon/NXP/Include/Li= brary/GpioLib.h new file mode 100644 index 000000000000..0345aa66de7e --- /dev/null +++ b/Silicon/NXP/Include/Library/GpioLib.h @@ -0,0 +1,110 @@ +/** @file + + Copyright 2020 NXP + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef GPIO_H__ +#define GPIO_H__ + +#include + +/* enum for GPIO number */ +typedef enum _GPIO_BLOCK { + GPIO1, + GPIO2, + GPIO3, + GPIO4, + GPIO_MAX +} GPIO_BLOCK; + +/* enum for GPIO direction */ +typedef enum _GPIO_DIRECTION { + INPUT, + OUTPUT +} GPIO_DIRECTION; + +/* enum for GPIO state */ +typedef enum _GPIO_STATE { + LOW, + HIGH +} GPIO_VAL; + +/** + GpioSetDiriection: Set GPIO direction as INPUT or OUTPUT + + @param[in] Id GPIO controller number + @param[in] Bit GPIO number + @param[in] Dir GPIO Direction as INPUT or OUTPUT + + @retval EFI_SUCCESS + **/ +EFI_STATUS +GpioSetDirection ( + IN UINT8 Id, + IN UINT32 Bit, + IN BOOLEAN Dir + ); + +/** + GpioGetDirection: Retrieve GPIO direction + + @param[in] Id GPIO controller number + @param[in] Bit GPIO number + + @retval GPIO Direction as INPUT or OUTPUT + **/ +UINT32 +GpioGetDirection ( + IN UINT8 Id, + IN UINT32 Bit + ); + + /** + GpioGetData: Retrieve GPIO Value + + @param[in] Id GPIO controller number + @param[in] Bit GPIO number + + @retval GPIO value as HIGH or LOW + **/ +UINT32 +GpioGetData ( + IN UINT8 Id, + IN UINT32 Bit + ); + +/** + GpioSetData: Set GPIO data Value + + @param[in] Id GPIO controller number + @param[in] Bit GPIO number + @param[in] Data GPIO data value to set + + @retval GPIO value as HIGH or LOW + **/ +EFI_STATUS +GpioSetData ( + IN UINT8 Id, + IN UINT32 Bit, + IN BOOLEAN Data + ); + +/** + GpioSetOpenDrain: Set GPIO as Open drain + + @param[in] Id GPIO controller number + @param[in] Bit GPIO number + @param[in] OpenDrain Set as open drain + + @retval EFI_SUCCESS + **/ +EFI_STATUS +GpioSetOpenDrain ( + IN UINT8 Id, + IN UINT32 Bit, + IN BOOLEAN OpenDrain + ); + +#endif diff --git a/Silicon/NXP/Library/GpioLib/GpioLib.c b/Silicon/NXP/Library/Gp= ioLib/GpioLib.c new file mode 100644 index 000000000000..9dd48b812a82 --- /dev/null +++ b/Silicon/NXP/Library/GpioLib/GpioLib.c @@ -0,0 +1,219 @@ +/** @file + + GPIO controller Library inmplements the functions + which will be used by other library/drivers to + get/set GPIO pin direction and get/set data on + GPIO pins. + + Copyright 2020 NXP + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include + +STATIC MMIO_OPERATIONS *mGpioOps; + +/** + Structure for GPIO Regsters + + GpDir GPIO direction register + GpOdr GPIO open drain register + GpData GPIO data register + GpIer GPIO interrupt event register + GpImr GPIO interrupt mask register + GpIcr GPIO interrupt control register + + **/ +typedef struct GpioRegs { + UINT32 GpDir; + UINT32 GpOdr; + UINT32 GpData; + UINT32 GpIer; + UINT32 GpImr; + UINT32 GpIcr; +} GPIO_REGS; + +/** + GetBaseAddr GPIO controller Base Address + + @param[in] Id GPIO controller number + + @retval GPIO controller Base Address, if found + @retval NULL, if not a valid controller number + + **/ +STATIC +VOID * +GetBaseAddr ( + IN UINT8 Id + ) +{ + + UINTN GpioBaseAddr; + UINTN MaxGpioController; + + mGpioOps =3D GetMmioOperations (FeaturePcdGet (PcdGpioControllerBigEndia= n)); + + MaxGpioController =3D PcdGet32 (PcdNumGpioController); + + if (Id < MaxGpioController) { + GpioBaseAddr =3D PcdGet64 (PcdGpioModuleBaseAddress) + + (Id * PcdGet64 (PcdGpioControllerOffset)); + return (VOID *)GpioBaseAddr; + } else { + DEBUG((DEBUG_ERROR, "Invalid Gpio Controller Id %d, Allowed Ids are %d= -%d", + Id, GPIO1, MaxGpioController)); + return NULL; + } +} + +/** + GpioSetDirection: Set GPIO direction as INPUT or OUTPUT + + @param[in] Id GPIO controller number + @param[in] Bit GPIO number + @param[in] Dir GPIO Direction as INPUT or OUTPUT + + @retval EFI_SUCCESS + **/ +EFI_STATUS +GpioSetDirection ( + IN UINT8 Id, + IN UINT32 Bit, + IN BOOLEAN Dir + ) +{ + GPIO_REGS *Regs; + UINT32 DirectionBitMask; + + Regs =3D GetBaseAddr (Id); + DirectionBitMask =3D 1 << Bit; + + if (Dir) { + mGpioOps->Or32 ((UINTN)&Regs->GpDir, DirectionBitMask); + } + else { + mGpioOps->And32 ((UINTN)&Regs->GpDir, ~DirectionBitMask); + } + + return EFI_SUCCESS; +} + +/** + GpioGetDiriection: Retrieve GPIO direction + + @param[in] Id GPIO controller number + @param[in] Bit GPIO number + + @retval GPIO Direction as INPUT or OUTPUT + **/ +UINT32 +GpioGetDirection ( + IN UINT8 Id, + IN UINT32 Bit + ) +{ + GPIO_REGS *Regs; + UINT32 Value; + UINT32 DirectionBitMask; + + Regs =3D GetBaseAddr (Id); + DirectionBitMask =3D 1 << Bit; + + Value =3D mGpioOps->Read32 ((UINTN)&Regs->GpDir); + + return (Value & DirectionBitMask); +} + +/** + GpioGetData: Retrieve GPIO Value + + @param[in] Id GPIO controller number + @param[in] Bit GPIO number + + @retval GPIO value as HIGH or LOW + **/ +UINT32 +GpioGetData ( + IN UINT8 Id, + IN UINT32 Bit + ) +{ + GPIO_REGS *Regs; + UINT32 Value; + UINT32 DataBitMask; + + Regs =3D (VOID *)GetBaseAddr (Id); + DataBitMask =3D 1 << Bit; + + Value =3D mGpioOps->Read32 ((UINTN)&Regs->GpData); + + return (Value & DataBitMask); +} + +/** + GpioSetData: Set GPIO data Value + + @param[in] Id GPIO controller number + @param[in] Bit GPIO number + @param[in] Data GPIO data value to set + + @retval GPIO value as HIGH or LOW + **/ +EFI_STATUS +GpioSetData ( + IN UINT8 Id, + IN UINT32 Bit, + IN BOOLEAN Data + ) +{ + GPIO_REGS *Regs; + UINT32 DataBitMask; + + Regs =3D GetBaseAddr (Id); + DataBitMask =3D 1 << Bit; + + if (Data) { + mGpioOps->Or32 ((UINTN)&Regs->GpData, DataBitMask); + } else { + mGpioOps->And32 ((UINTN)&Regs->GpData, ~DataBitMask); + } + + return EFI_SUCCESS; +} + +/** + GpioSetOpenDrain: Set GPIO as Open drain + + @param[in] Id GPIO controller number + @param[in] Bit GPIO number + @param[in] OpenDrain Set as open drain + + @retval EFI_SUCCESS + **/ +EFI_STATUS +GpioSetOpenDrain ( + IN UINT8 Id, + IN UINT32 Bit, + IN BOOLEAN OpenDrain + ) +{ + GPIO_REGS *Regs; + UINT32 OpenDrainBitMask; + + Regs =3D GetBaseAddr (Id); + OpenDrainBitMask =3D 1 << Bit; + + if (OpenDrain) { + mGpioOps->Or32 ((UINTN)&Regs->GpOdr, OpenDrainBitMask); + } else { + mGpioOps->And32 ((UINTN)&Regs->GpOdr, ~OpenDrainBitMask); + } + + return EFI_SUCCESS; +} --=20 1.9.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65969): https://edk2.groups.io/g/devel/message/65969 Mute This Topic: https://groups.io/mt/77359491/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 05:03:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65970+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65970+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; t=1602066948; cv=none; d=zohomail.com; s=zohoarc; b=G2PGwoYSU4pTwt9MOwVhagvUDG7FxtaE2flt6Kbh7oSOuFOPWNTRg/6vUXR0Ky6lMh1Qubq1EJ3fJmFHSJu971wLwfnXmVB0sGV5/h8ko4qC/A0VUPtihr2kDhsa+J8rKdDDznsUzLslxG/gmGy7hnY2hPSD9jKIYimX8mGwsfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602066948; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=7LdEQq9I8e3+FqyLs0PnzAGYG4POpn24gQhXbjoxj0Q=; b=DnhdcLE+HYHdxCxo3bXzhbXHeCzzCRm6fCzeLw0kbIUkqI+nLO/9ru1YPsNz4k9FsT4jte88P1yCEClO+2Bn0MpLJzrlDX9Lcsk7SbQ8bBR0rUCcTnlRCI6WWFW/wamfKeHEGHWZXQ5Hkr3pJF6VZ/f1TY0+Dwqa2CEFSh2UHsk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65970+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602066948152218.92689007162278; Wed, 7 Oct 2020 03:35:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id HyZQYY1788612xFYHmgjRD4N; Wed, 07 Oct 2020 03:35:47 -0700 X-Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mx.groups.io with SMTP id smtpd.web11.9960.1602066567428480038 for ; Wed, 07 Oct 2020 03:29:27 -0700 X-Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E23361A00C6; Wed, 7 Oct 2020 12:29:25 +0200 (CEST) X-Received: from inv0113.in-blr01.nxp.com (inv0113.in-blr01.nxp.com [165.114.116.118]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 85C631A0114; Wed, 7 Oct 2020 12:29:25 +0200 (CEST) X-Received: from uefi-OptiPlex-790.ap.freescale.net (unknown [10.232.132.78]) by inv0113.in-blr01.nxp.com (Postfix) with ESMTP id 1A17E332; Wed, 7 Oct 2020 15:59:24 +0530 (IST) From: Meenakshi Aggarwal To: ard.biesheuvel@arm.com, leif@nuviainc.com, michael.d.kinney@intel.com, devel@edk2.groups.io Cc: v.sethi@nxp.com, Meenakshi Aggarwal , Meenakshi Aggarwal Subject: [edk2-devel] [edk2-platforms v2 2/6] Platform/NXP/LS1046aFrwyPkg: MUX changes for USB Date: Wed, 7 Oct 2020 21:40:37 +0530 Message-Id: <1602087041-8009-3-git-send-email-meenakshi.aggarwal@oss.nxp.com> In-Reply-To: <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> References: <1600187343-18732-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,meenakshi.aggarwal@oss.nxp.com X-Gm-Message-State: OoecwEeAn00HSayxGS5FUPeex1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602066947; bh=u4+YJHTc4sjMBtAwBsdD5QGuMMzwQARLNm4Dh1TxU7Q=; h=Cc:Date:From:Reply-To:Subject:To; b=VzSzyLPY+UcjErTzFvuWwgQeXpfXJBgT2os1gg4DsCn596ZEOfX65A38FQhipR0SUXM oRkrk1FmZCLZcjt9a/fKVCVxv7Jsa54xSc+sBqSoDpcN4cn6sQmKOvkvqPR2UBTKI8yG9 OmUCL8UHGKUsrpVPEqBxwQf8r6VjN/w7Pkk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Second USB controller is muxed with I2c through GPIO. Setting GPIO bit to configure for second USB controller. Co-authored-by: Pramod Kumar Signed-off-by: Meenakshi Aggarwal Reviewed-by: Leif Lindholm --- Silicon/NXP/NxpQoriqLs.dec | 8 ++++++++ Silicon/NXP/LS1046A/LS1046A.dsc.inc | 5 +++++ Silicon/NXP/NxpQoriqLs.dsc.inc | 2 ++ .../Library/ArmPlatformLib/ArmPlatformLib.inf | 1 + .../Library/ArmPlatformLib/ArmPlatformLib.c | 21 +++++++++++++++++= ++++ 5 files changed, 37 insertions(+) diff --git a/Silicon/NXP/NxpQoriqLs.dec b/Silicon/NXP/NxpQoriqLs.dec index 0c3608696569..3a568c0437e7 100644 --- a/Silicon/NXP/NxpQoriqLs.dec +++ b/Silicon/NXP/NxpQoriqLs.dec @@ -29,6 +29,7 @@ [PcdsFeatureFlag] gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian|FALSE|BOOLEAN|0x00000316 gNxpQoriqLsTokenSpaceGuid.PcdPciLutBigEndian|FALSE|BOOLEAN|0x00000317 gNxpQoriqLsTokenSpaceGuid.PcdSataErratumA009185|FALSE|BOOLEAN|0x00000318 + gNxpQoriqLsTokenSpaceGuid.PcdGpioControllerBigEndian|FALSE|BOOLEAN|0x000= 00319 =20 [PcdsFixedAtBuild.common] # Pcds for PCI Express @@ -48,6 +49,13 @@ [PcdsFixedAtBuild.common] gNxpQoriqLsTokenSpaceGuid.PcdSataSize|0x0|UINT32|0x00000351 gNxpQoriqLsTokenSpaceGuid.PcdNumSataController|0x0|UINT32|0x00000352 =20 + # + # Pcds for Gpio + # + gNxpQoriqLsTokenSpaceGuid.PcdNumGpioController|0|UINT32|0x00000355 + gNxpQoriqLsTokenSpaceGuid.PcdGpioModuleBaseAddress|0|UINT64|0x00000356 + gNxpQoriqLsTokenSpaceGuid.PcdGpioControllerOffset|0|UINT64|0x00000357 + [PcdsDynamic.common] gNxpQoriqLsTokenSpaceGuid.PcdPciCfgShiftEnable|FALSE|BOOLEAN|0x00000600 gNxpQoriqLsTokenSpaceGuid.PcdPciLsGen4Ctrl|FALSE|BOOLEAN|0x00000601 diff --git a/Silicon/NXP/LS1046A/LS1046A.dsc.inc b/Silicon/NXP/LS1046A/LS10= 46A.dsc.inc index dbe7f408fce9..db110553605f 100644 --- a/Silicon/NXP/LS1046A/LS1046A.dsc.inc +++ b/Silicon/NXP/LS1046A/LS1046A.dsc.inc @@ -27,9 +27,14 @@ [PcdsDynamicDefault.common] =20 [PcdsFixedAtBuild.common] gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x021c0500 + gNxpQoriqLsTokenSpaceGuid.PcdNumGpioController|0x04 + gNxpQoriqLsTokenSpaceGuid.PcdGpioModuleBaseAddress|0x02300000 + gNxpQoriqLsTokenSpaceGuid.PcdGpioControllerOffset|0x10000 + =20 [PcdsFeatureFlag] gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian|TRUE + gNxpQoriqLsTokenSpaceGuid.PcdGpioControllerBigEndian|TRUE =20 ##########################################################################= ###### # diff --git a/Silicon/NXP/NxpQoriqLs.dsc.inc b/Silicon/NXP/NxpQoriqLs.dsc.inc index fc600de01d74..21c87df73220 100644 --- a/Silicon/NXP/NxpQoriqLs.dsc.inc +++ b/Silicon/NXP/NxpQoriqLs.dsc.inc @@ -103,6 +103,8 @@ [LibraryClasses.common] MemoryInitPeiLib|Silicon/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.i= nf UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf =20 + GpioLib|Silicon/NXP/Library/GpioLib/GpioLib.inf + [LibraryClasses.common.SEC] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsB= aseLib.inf diff --git a/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatform= Lib.inf b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib= .inf index 7802696bf39b..2e755842a714 100644 --- a/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.inf +++ b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.inf @@ -25,6 +25,7 @@ [Packages] [LibraryClasses] ArmLib DebugLib + GpioLib SocLib =20 [Sources.common] diff --git a/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatform= Lib.c b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.c index e1f20da09337..ef404991add8 100644 --- a/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.c +++ b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.c @@ -8,11 +8,18 @@ =20 #include #include +#include #include =20 #include #include =20 +/** + Documents use bit number as per Power PC notation, + so need to convert it to support ARMv8 architecture +**/ +#define USB2_MUX_SEL_GPIO (31 - 23) + ARM_CORE_INFO mLS1046aMpCoreInfoTable[] =3D { { // Cluster 0, Core 0 @@ -89,6 +96,19 @@ NxpPlatformGetClock( } =20 /** + FRWY-LS1046A GPIO 23 use for USB2 + mux seclection +**/ +STATIC VOID MuxSelectUsb2 (VOID) +{ + + GpioSetDirection (GPIO3, USB2_MUX_SEL_GPIO, OUTPUT); + GpioSetData (GPIO3, USB2_MUX_SEL_GPIO, HIGH); + + return; +} + +/** Initialize controllers that must setup in the normal world =20 This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/Pl= atformPei @@ -101,6 +121,7 @@ ArmPlatformInitialize ( ) { SocInit (); + MuxSelectUsb2 (); =20 return EFI_SUCCESS; } --=20 1.9.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65970): https://edk2.groups.io/g/devel/message/65970 Mute This Topic: https://groups.io/mt/77359492/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 05:03:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65971+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65971+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; t=1602066948; cv=none; d=zohomail.com; s=zohoarc; b=U+qsQrfab1rBxGmI4HSx/EC7qvw/YiMDSAUYIHrBdrxbqqoGmZD/RJrd0mDAI+8jmqbL0V0SNlNmZZBo9+oujkoKhdXcx58iarLo85uJG/mCPUsYGEJugT9XH4TFn+thGLZ7mzKJ1HOc+YMYJ9opXzsML+hncrKxbp7fkfPbmyA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602066948; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=gUvsxO6PmXp/O8H0cB6fOdrudzkqsP1zJAtYl8ubfgg=; b=d2V2qNSuOjMNoxAY7VtVrPn7aaZnW/+C9IKbyTf0yY+7SY/eZHeZusb6TUDpvDq6VKhqLLVweRoxc3snUGWrchLDERDQ3uywCkFOCVW1IiecqYI0wgdz7GEVDWfZ3Pe9JqHlhmENueOARO5n2vpMYP6EYjqhzdq02yDtVntCIRk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65971+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602066948329400.41660845151955; Wed, 7 Oct 2020 03:35:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id DPq6YY1788612x3aoDSjnYU1; Wed, 07 Oct 2020 03:35:47 -0700 X-Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mx.groups.io with SMTP id smtpd.web11.9961.1602066567555607050 for ; Wed, 07 Oct 2020 03:29:28 -0700 X-Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 356B91A0114; Wed, 7 Oct 2020 12:29:26 +0200 (CEST) X-Received: from inv0113.in-blr01.nxp.com (inv0113.in-blr01.nxp.com [165.114.116.118]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id CC9D71A17C3; Wed, 7 Oct 2020 12:29:25 +0200 (CEST) X-Received: from uefi-OptiPlex-790.ap.freescale.net (unknown [10.232.132.78]) by inv0113.in-blr01.nxp.com (Postfix) with ESMTP id 912A935A; Wed, 7 Oct 2020 15:59:24 +0530 (IST) From: Meenakshi Aggarwal To: ard.biesheuvel@arm.com, leif@nuviainc.com, michael.d.kinney@intel.com, devel@edk2.groups.io Cc: v.sethi@nxp.com, Meenakshi Aggarwal , Meenakshi Aggarwal Subject: [edk2-devel] [edk2-platforms v2 3/6] Silicon/NXP: Add SCFG support for Chassis2 Date: Wed, 7 Oct 2020 21:40:38 +0530 Message-Id: <1602087041-8009-4-git-send-email-meenakshi.aggarwal@oss.nxp.com> In-Reply-To: <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> References: <1600187343-18732-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,meenakshi.aggarwal@oss.nxp.com X-Gm-Message-State: E2duOzP3WHUCZolCrFw4RwMox1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602066947; bh=Psls7BJRXjmho/zHVBQIPvV+LoKVm1Aqcg2FKdLWo2A=; h=Cc:Date:From:Reply-To:Subject:To; b=gUow0vCIYsR6mZ0XHysugeuHHL3/okt9wJz+is8q1iM9Z8H14sjXQtKSG8XI3M7+2c2 RjhVSNV27AeQvls/X7Ovr+Wc6GhUg8kf/HdxkGZlZsozaJr/vFcAoDzS40vRmAhjb+k+R 68nu75XpwElCFG0xvfv+6uOBvCsi4w+N3vw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for SCFG (Supplemental Configuration Unit) register space and helper functions to R/W SCFG registers Signed-off-by: Meenakshi Aggarwal Reviewed-by: Leif Lindholm --- Silicon/NXP/NxpQoriqLs.dec | 1 + Silicon/NXP/Chassis2/Include/Chassis.h | 108 +++++++++++++++++= ++++ Silicon/NXP/Include/Library/ChassisLib.h | 42 ++++++++ .../NXP/Chassis2/Library/ChassisLib/ChassisLib.c | 63 ++++++++++++ 4 files changed, 214 insertions(+) diff --git a/Silicon/NXP/NxpQoriqLs.dec b/Silicon/NXP/NxpQoriqLs.dec index 3a568c0437e7..90dce69fd472 100644 --- a/Silicon/NXP/NxpQoriqLs.dec +++ b/Silicon/NXP/NxpQoriqLs.dec @@ -30,6 +30,7 @@ [PcdsFeatureFlag] gNxpQoriqLsTokenSpaceGuid.PcdPciLutBigEndian|FALSE|BOOLEAN|0x00000317 gNxpQoriqLsTokenSpaceGuid.PcdSataErratumA009185|FALSE|BOOLEAN|0x00000318 gNxpQoriqLsTokenSpaceGuid.PcdGpioControllerBigEndian|FALSE|BOOLEAN|0x000= 00319 + gNxpQoriqLsTokenSpaceGuid.PcdScfgBigEndian|FALSE|BOOLEAN|0x00000320 =20 [PcdsFixedAtBuild.common] # Pcds for PCI Express diff --git a/Silicon/NXP/Chassis2/Include/Chassis.h b/Silicon/NXP/Chassis2/= Include/Chassis.h index 7e8bf224884b..6dfce425a0b0 100644 --- a/Silicon/NXP/Chassis2/Include/Chassis.h +++ b/Silicon/NXP/Chassis2/Include/Chassis.h @@ -11,6 +11,7 @@ #include =20 #define NXP_LAYERSCAPE_CHASSIS2_DCFG_ADDRESS 0x1EE0000 +#define NXP_LAYERSCAPE_CHASSIS2_SCFG_ADDRESS 0x1570000 =20 #define SVR_SOC_VER(svr) (((svr) >> 8) & 0xFFFFFE) #define SVR_MAJOR(svr) (((svr) >> 4) & 0xf) @@ -45,4 +46,111 @@ typedef struct { } NXP_LAYERSCAPE_CHASSIS2_DEVICE_CONFIG; #pragma pack() =20 +/* Supplemental Configuration Unit (SCFG) */ +typedef struct { + UINT8 Res000[0x070-0x000]; + UINT32 Usb1Prm1Cr; + UINT32 Usb1Prm2Cr; + UINT32 Usb1Prm3Cr; + UINT32 Usb2Prm1Cr; + UINT32 Usb2Prm2Cr; + UINT32 Usb2Prm3Cr; + UINT32 Usb3Prm1Cr; + UINT32 Usb3Prm2Cr; + UINT32 Usb3Prm3Cr; + UINT8 Res094[0x100-0x094]; + UINT32 Usb2Icid; + UINT32 Usb3Icid; + UINT8 Res108[0x114-0x108]; + UINT32 DmaIcid; + UINT32 SataIcid; + UINT32 Usb1Icid; + UINT32 QeIcid; + UINT32 SdhcIcid; + UINT32 EdmaIcid; + UINT32 EtrIcid; + UINT32 Core0SftRst; + UINT32 Core1SftRst; + UINT32 Core2SftRst; + UINT32 Core3SftRst; + UINT8 Res140[0x158-0x140]; + UINT32 AltCBar; + UINT32 QspiCfg; + UINT8 Res160[0x180-0x160]; + UINT32 DmaMcr; + UINT8 Res184[0x188-0x184]; + UINT32 GicAlign; + UINT32 DebugIcid; + UINT8 Res190[0x1a4-0x190]; + UINT32 SnpCnfgCr; +#define SCFG_SNPCNFGCR_SECRDSNP BIT31 +#define SCFG_SNPCNFGCR_SECWRSNP BIT30 +#define SCFG_SNPCNFGCR_SATARDSNP BIT23 +#define SCFG_SNPCNFGCR_SATAWRSNP BIT22 +#define SCFG_SNPCNFGCR_USB1RDSNP BIT21 +#define SCFG_SNPCNFGCR_USB1WRSNP BIT20 +#define SCFG_SNPCNFGCR_USB2RDSNP BIT15 +#define SCFG_SNPCNFGCR_USB2WRSNP BIT16 +#define SCFG_SNPCNFGCR_USB3RDSNP BIT13 +#define SCFG_SNPCNFGCR_USB3WRSNP BIT14 + UINT8 Res1a8[0x1ac-0x1a8]; + UINT32 IntpCr; + UINT8 Res1b0[0x204-0x1b0]; + UINT32 CoreSrEnCr; + UINT8 Res208[0x220-0x208]; + UINT32 RvBar00; + UINT32 RvBar01; + UINT32 RvBar10; + UINT32 RvBar11; + UINT32 RvBar20; + UINT32 RvBar21; + UINT32 RvBar30; + UINT32 RvBar31; + UINT32 LpmCsr; + UINT8 Res244[0x400-0x244]; + UINT32 QspIdQScr; + UINT32 EcgTxcMcr; + UINT32 SdhcIoVSelCr; + UINT32 RcwPMuxCr0; + /**Setting RCW PinMux Register bits 17-19 to select USB2_DRVVBUS + Setting RCW PinMux Register bits 21-23 to select USB2_PWRFAULT + Setting RCW PinMux Register bits 25-27 to select USB3_DRVVBUS + Setting RCW PinMux Register bits 29-31 to select USB3_DRVVBUS + **/ +#define SCFG_RCWPMUXCRO_SELCR_USB 0x3333 + /**Setting RCW PinMux Register bits 17-19 to select USB2_DRVVBUS + Setting RCW PinMux Register bits 21-23 to select USB2_PWRFAULT + Setting RCW PinMux Register bits 25-27 to select IIC4_SCL + Setting RCW PinMux Register bits 29-31 to select IIC4_SDA + **/ +#define SCFG_RCWPMUXCRO_NOT_SELCR_USB 0x3300 + UINT32 UsbDrvVBusSelCr; +#define SCFG_USBDRVVBUS_SELCR_USB1 0x00000000 +#define SCFG_USBDRVVBUS_SELCR_USB2 0x00000001 +#define SCFG_USBDRVVBUS_SELCR_USB3 0x00000003 + UINT32 UsbPwrFaultSelCr; +#define SCFG_USBPWRFAULT_INACTIVE 0x00000000 +#define SCFG_USBPWRFAULT_SHARED 0x00000001 +#define SCFG_USBPWRFAULT_DEDICATED 0x00000002 +#define SCFG_USBPWRFAULT_USB3_SHIFT 4 +#define SCFG_USBPWRFAULT_USB2_SHIFT 2 +#define SCFG_USBPWRFAULT_USB1_SHIFT 0 + UINT32 UsbRefclkSelcr1; + UINT32 UsbRefclkSelcr2; + UINT32 UsbRefclkSelcr3; + UINT8 Res424[0x600-0x424]; + UINT32 ScratchRw[4]; + UINT8 Res610[0x680-0x610]; + UINT32 CoreBCr; + UINT8 Res684[0x1000-0x684]; + UINT32 Pex1MsiIr; + UINT32 Pex1MsiR; + UINT8 Res1008[0x2000-0x1008]; + UINT32 Pex2; + UINT32 Pex2MsiR; + UINT8 Res2008[0x3000-0x2008]; + UINT32 Pex3MsiIr; + UINT32 Pex3MsiR; +} NXP_LAYERSCAPE_CHASSIS2_SUPPLEMENTAL_CONFIG; + #endif // CHASSIS_H__ diff --git a/Silicon/NXP/Include/Library/ChassisLib.h b/Silicon/NXP/Include= /Library/ChassisLib.h index 89992a4b6fd5..a038d8e5ce31 100644 --- a/Silicon/NXP/Include/Library/ChassisLib.h +++ b/Silicon/NXP/Include/Library/ChassisLib.h @@ -13,6 +13,48 @@ #include =20 /** + Or Scfg register + + @param Address The MMIO register to read. + + @return The value read. +**/ +UINT32 +EFIAPI +ScfgOr32 ( + IN UINTN Address, + IN UINT32 Value + ); + +/** + Read Scfg register + + @param Address The MMIO register to read. + + @return The value read. +**/ +UINT32 +EFIAPI +ScfgRead32 ( + IN UINTN Address + ); + +/** + Write Scfg register + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + + @return Value. +**/ +UINT32 +EFIAPI +ScfgWrite32 ( + IN UINTN Address, + IN UINT32 Value + ); + +/** Read Dcfg register =20 @param Address The MMIO register to read. diff --git a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c b/Silicon= /NXP/Chassis2/Library/ChassisLib/ChassisLib.c index 91b19f832f00..e6410a53f480 100644 --- a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c +++ b/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c @@ -15,6 +15,69 @@ #include =20 /** + Or Scfg register + + @param Address The MMIO register to read. + + @return The value read. +**/ +UINT32 +EFIAPI +ScfgOr32 ( + IN UINTN Address, + IN UINT32 Value + ) +{ + MMIO_OPERATIONS *ScfgOps; + + ScfgOps =3D GetMmioOperations (FeaturePcdGet (PcdScfgBigEndian)); + + return ScfgOps->Or32 (Address, Value); +} + +/** + Read Scfg register + + @param Address The MMIO register to read. + + @return The value read. +**/ +UINT32 +EFIAPI +ScfgRead32 ( + IN UINTN Address + ) +{ + MMIO_OPERATIONS *ScfgOps; + + ScfgOps =3D GetMmioOperations (FeaturePcdGet (PcdScfgBigEndian)); + + return ScfgOps->Read32 (Address); +} + +/** + Write Scfg register + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + + @return Value. +**/ +UINT32 +EFIAPI +ScfgWrite32 ( + IN UINTN Address, + IN UINT32 Value + ) +{ + MMIO_OPERATIONS *ScfgOps; + + ScfgOps =3D GetMmioOperations (FeaturePcdGet (PcdScfgBigEndian)); + + return ScfgOps->Write32 (Address, Value); +} + +/** Read Dcfg register =20 @param Address The MMIO register to read. --=20 1.9.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65971): https://edk2.groups.io/g/devel/message/65971 Mute This Topic: https://groups.io/mt/77359493/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 05:03:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65972+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65972+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; t=1602066949; cv=none; d=zohomail.com; s=zohoarc; b=I8HLxhF2ok5pqhB9H8N5N+M6e3OGCoqT1Sp92MzJvU4RTtrfWwDUuxUXhI7qDjMRJ7cXmerDHc9Yj/8++XfmHYzatnf++1VnaMdHuz2Kxa9BjGIDo+xrQXozVkTbLFUvopGUUS6epjaM5XQIwFnzo4OEjAXRs4AffbnZjY/j9ts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602066949; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=BiOM5GZeYWwcE6rPqfDI2I8wie1/PiaTTzXo8k3vq/I=; b=LvNWlhAAdeGOvzX+HhWZKlbuS153t4SowTRVCRq4wfA7qHbBrXz1eme09rAfS3ePRno789Po8TcRSvw28v0zjYg/RvXvQkbZFwtuADO1S/5Xj3utnAG3gjrV7g5ndxXKwKtj1C/qizF/MJPMIQu5p6JwLWNLoly5nnEyzzcDRQ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65972+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602066949287967.3444103743824; Wed, 7 Oct 2020 03:35:49 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 807nYY1788612xaUEV6OIUhQ; Wed, 07 Oct 2020 03:35:48 -0700 X-Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mx.groups.io with SMTP id smtpd.web10.10063.1602066568236229149 for ; Wed, 07 Oct 2020 03:29:28 -0700 X-Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id ABBDA1A17C3; Wed, 7 Oct 2020 12:29:26 +0200 (CEST) X-Received: from inv0113.in-blr01.nxp.com (inv0113.in-blr01.nxp.com [165.114.116.118]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 4635A1A151D; Wed, 7 Oct 2020 12:29:26 +0200 (CEST) X-Received: from uefi-OptiPlex-790.ap.freescale.net (unknown [10.232.132.78]) by inv0113.in-blr01.nxp.com (Postfix) with ESMTP id 0A39235E; Wed, 7 Oct 2020 15:59:25 +0530 (IST) From: Meenakshi Aggarwal To: ard.biesheuvel@arm.com, leif@nuviainc.com, michael.d.kinney@intel.com, devel@edk2.groups.io Cc: v.sethi@nxp.com, Meenakshi Aggarwal , Meenakshi Aggarwal Subject: [edk2-devel] [edk2-platforms v2 4/6] Silicon/NXP: Implement USB Errata Workarounds Date: Wed, 7 Oct 2020 21:40:39 +0530 Message-Id: <1602087041-8009-5-git-send-email-meenakshi.aggarwal@oss.nxp.com> In-Reply-To: <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> References: <1600187343-18732-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,meenakshi.aggarwal@oss.nxp.com X-Gm-Message-State: lAU369DivPXFOTedU8VF5tfsx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602066948; bh=hVOfKHHDhQsRFTIfOUabmWeV7BoO7SkWiWB/feXd9S4=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=wDxjP0o6W9YFFrvyo7MmKnX2M8dJMcWQPS1XAD6pL4UZXIYLQfsoofiC7yA+e24Ap2a iYedOJkSNFNiSV99vwJ1l6+OcIieFRKFtnAlHbcJrCeAZPAfmsKSiyo668VHCwWtcAQc0 afbNZ4gl3HXGuqOajGdPffHup7FW3Z8kvbo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Implement workarounds for USB errata A009008, A009798, A008997, A009007 for chassis2 Signed-off-by: Meenakshi Aggarwal --- .../NXP/Chassis2/Library/ChassisLib/ChassisLib.inf | 2 + Silicon/NXP/Chassis2/Include/Chassis.h | 4 + Silicon/NXP/Chassis2/Library/ChassisLib/Erratum.h | 23 +++ Silicon/NXP/Include/Library/ChassisLib.h | 20 +++ Silicon/NXP/Chassis2/Library/ChassisLib/Erratum.c | 165 +++++++++++++++++= ++++ 5 files changed, 214 insertions(+) create mode 100644 Silicon/NXP/Chassis2/Library/ChassisLib/Erratum.h create mode 100644 Silicon/NXP/Chassis2/Library/ChassisLib/Erratum.c diff --git a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf b/Silic= on/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf index f5dbd1349dc5..d64286b199c6 100644 --- a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf +++ b/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf @@ -28,6 +28,8 @@ [LibraryClasses] =20 [Sources.common] ChassisLib.c + Erratum.c =20 [FeaturePcd] gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian + gNxpQoriqLsTokenSpaceGuid.PcdScfgBigEndian diff --git a/Silicon/NXP/Chassis2/Include/Chassis.h b/Silicon/NXP/Chassis2/= Include/Chassis.h index 6dfce425a0b0..f8fa7ed67596 100644 --- a/Silicon/NXP/Chassis2/Include/Chassis.h +++ b/Silicon/NXP/Chassis2/Include/Chassis.h @@ -27,6 +27,10 @@ #define SCR0_CLIENTPD_MASK 0x00000001 #define SACR_PAGESIZE_MASK 0x00010000 =20 +#define USB_PHY1_BASE_ADDRESS 0x084F0000 +#define USB_PHY2_BASE_ADDRESS 0x08500000 +#define USB_PHY3_BASE_ADDRESS 0x08510000 + /** The Device Configuration Unit provides general purpose configuration and status for the device. These registers only support 32-bit accesses. diff --git a/Silicon/NXP/Chassis2/Library/ChassisLib/Erratum.h b/Silicon/NX= P/Chassis2/Library/ChassisLib/Erratum.h new file mode 100644 index 000000000000..0231ef0a283d --- /dev/null +++ b/Silicon/NXP/Chassis2/Library/ChassisLib/Erratum.h @@ -0,0 +1,23 @@ +/** @file +* Header defining the Base addresses, sizes, flags etc for Erratas +* +* Copyright 2020 NXP +* + SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#ifndef ERRATUM_H__ +#define ERRATUM_H__ + +#define USB_TXVREFTUNE 0x9 +#define USB_SQRXTUNE 0xFC7FFFFF +#define USB_PCSTXSWINGFULL 0x47 +#define USB_PHY_RX_EQ_VAL_1 0x0000 +#define USB_PHY_RX_EQ_VAL_2 0x8000 +#define USB_PHY_RX_EQ_VAL_3 0x8003 +#define USB_PHY_RX_EQ_VAL_4 0x800b + +#define USB_PHY_RX_OVRD_IN_HI 0x200c + +#endif diff --git a/Silicon/NXP/Include/Library/ChassisLib.h b/Silicon/NXP/Include= /Library/ChassisLib.h index a038d8e5ce31..c99368b4733d 100644 --- a/Silicon/NXP/Include/Library/ChassisLib.h +++ b/Silicon/NXP/Include/Library/ChassisLib.h @@ -90,4 +90,24 @@ ChassisInit ( VOID ); =20 +VOID +ErratumA009008 ( + VOID + ); + +VOID +ErratumA009798 ( + VOID + ); + +VOID +ErratumA008997 ( + VOID + ); + +VOID +ErratumA009007 ( + VOID + ); + #endif // CHASSIS_LIB_H__ diff --git a/Silicon/NXP/Chassis2/Library/ChassisLib/Erratum.c b/Silicon/NX= P/Chassis2/Library/ChassisLib/Erratum.c new file mode 100644 index 000000000000..96afb1850853 --- /dev/null +++ b/Silicon/NXP/Chassis2/Library/ChassisLib/Erratum.c @@ -0,0 +1,165 @@ +/** @file + This file containa all erratas need to be applied on different SoCs. + + Copyright 2020 NXP + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include + +#include "Erratum.h" + +/* +* A-009008 : USB High Speed (HS) eye height adjustment +* Affects : USB +* Description: USB HS eye diagram fails with the default +* value at many corners, particularly at a +* high temperature (105=C2=B0C). +* Impact : USB HS eye diagram may fail using the default value. +*/ +VOID +ErratumA009008 ( + VOID + ) +{ + NXP_LAYERSCAPE_CHASSIS2_SUPPLEMENTAL_CONFIG *Scfg; + UINT32 Value; + + Scfg =3D (NXP_LAYERSCAPE_CHASSIS2_SUPPLEMENTAL_CONFIG *)NXP_LAYERSCAPE_C= HASSIS2_SCFG_ADDRESS; + + Value =3D ScfgRead32 ((UINTN)&Scfg->Usb1Prm1Cr); + Value &=3D ~(0xF << 6); + ScfgWrite32 ((UINTN)&Scfg->Usb1Prm1Cr, Value|(USB_TXVREFTUNE << 6)); + Value =3D ScfgRead32 ((UINTN)&Scfg->Usb2Prm1Cr); + Value &=3D ~(0xF << 6); + ScfgWrite32 ((UINTN)&Scfg->Usb2Prm1Cr, Value|(USB_TXVREFTUNE << 6)); + Value =3D ScfgRead32 ((UINTN)&Scfg->Usb3Prm1Cr); + Value &=3D ~(0xF << 6); + ScfgWrite32 ((UINTN)&Scfg->Usb3Prm1Cr, Value|(USB_TXVREFTUNE << 6)); + + return; +} + +/* +* A-009798 : USB high speed squelch threshold adjustment +* Affects : USB +* Description: The default setting for USB high speed +* squelch threshold results in a threshold close +* to or lower than 100mV. This leads to a receiver +* compliance test failure for a 100mV threshold. +* Impact : If the errata is not applied, only the USB high +* speed receiver sensitivity compliance test fails, +* however USB data continues to transfer. +*/ +VOID +ErratumA009798 ( + VOID + ) +{ + NXP_LAYERSCAPE_CHASSIS2_SUPPLEMENTAL_CONFIG *Scfg; + UINT32 Value; + + Scfg =3D (NXP_LAYERSCAPE_CHASSIS2_SUPPLEMENTAL_CONFIG *)NXP_LAYERSCAPE_C= HASSIS2_SCFG_ADDRESS; + + Value =3D ScfgRead32 ((UINTN)&Scfg->Usb1Prm1Cr); + ScfgWrite32 ((UINTN)&Scfg->Usb1Prm1Cr, Value & USB_SQRXTUNE); + Value =3D ScfgRead32 ((UINTN)&Scfg->Usb2Prm1Cr); + ScfgWrite32 ((UINTN)&Scfg->Usb2Prm1Cr, Value & USB_SQRXTUNE); + Value =3D ScfgRead32 ((UINTN)&Scfg->Usb3Prm1Cr); + ScfgWrite32 ((UINTN)&Scfg->Usb3Prm1Cr, Value & USB_SQRXTUNE); + + return; +} + +/* +* A-008997 : USB3 LFPS peak-to-peak differential output +* voltage adjustment settings +* Affects : USB +* Description: Low Frequency Periodic Signaling (LFPS) +* peak-to-peak differential output voltage test +* compliance fails using default transmitter settings. +* Software is required to change the transmitter +* signal swings to pass compliance tests. +* Impact : LFPS peak-to-peak differential output voltage +* compliance test fails. +*/ +VOID +ErratumA008997 ( + VOID + ) +{ + NXP_LAYERSCAPE_CHASSIS2_SUPPLEMENTAL_CONFIG *Scfg; + UINT32 Value; + + Scfg =3D (NXP_LAYERSCAPE_CHASSIS2_SUPPLEMENTAL_CONFIG *)NXP_LAYERSCAPE_C= HASSIS2_SCFG_ADDRESS; + + Value =3D ScfgRead32 ((UINTN)&Scfg->Usb1Prm2Cr); + Value &=3D ~(0x7F << 9); + ScfgWrite32 ((UINTN)&Scfg->Usb1Prm2Cr, Value | (USB_PCSTXSWINGFULL << 9)= ); + Value =3D ScfgRead32 ((UINTN)&Scfg->Usb2Prm2Cr); + Value &=3D ~(0x7F << 9); + ScfgWrite32 ((UINTN)&Scfg->Usb2Prm2Cr, Value | (USB_PCSTXSWINGFULL << 9)= ); + Value =3D ScfgRead32 ((UINTN)&Scfg->Usb3Prm2Cr); + Value &=3D ~(0x7F << 9); + ScfgWrite32 ((UINTN)&Scfg->Usb3Prm2Cr, Value | (USB_PCSTXSWINGFULL << 9)= ); + + return; +} + +/* +* A-009007 : USB3PHY observing intermittent failure in +* receive compliance tests at higher jitter frequency +* using default register values +* Affects : USB +* Description: Receive compliance tests may fail intermittently at +* high jitter frequencies using default register values. +* Impact : Receive compliance test fails at default register setting. +*/ + +VOID +ConfigUsbLane0 ( + IN UINTN UsbPhy + ) +{ + UINTN RegAddress; + + RegAddress =3D UsbPhy + USB_PHY_RX_OVRD_IN_HI; + + ArmDataMemoryBarrier (); + MmioWrite16 (RegAddress, USB_PHY_RX_EQ_VAL_1); + ArmDataMemoryBarrier (); + MmioWrite16 (RegAddress, USB_PHY_RX_EQ_VAL_2); + ArmDataMemoryBarrier (); + MmioWrite16 (RegAddress, USB_PHY_RX_EQ_VAL_3); + ArmDataMemoryBarrier (); + MmioWrite16 (RegAddress, USB_PHY_RX_EQ_VAL_4); + + return; +} + +VOID +ErratumA009007 ( + VOID + ) +{ + UINTN UsbPhy; + + UsbPhy =3D USB_PHY1_BASE_ADDRESS; + ConfigUsbLane0 (UsbPhy); + + UsbPhy =3D USB_PHY2_BASE_ADDRESS; + ConfigUsbLane0 (UsbPhy); + + UsbPhy =3D USB_PHY3_BASE_ADDRESS; + ConfigUsbLane0 (UsbPhy); + + return; +} --=20 1.9.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65972): https://edk2.groups.io/g/devel/message/65972 Mute This Topic: https://groups.io/mt/77359494/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 05:03:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65973+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65973+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; t=1602066950; cv=none; d=zohomail.com; s=zohoarc; b=VhR9RCHx+1EPP0cgs8Uc5EQcaWiPkjtG2h2pn0RDKX6lyc19YtZ35w3NnGou+MWAz/beU99beaMTDQ20qgdtkyZ+kJ5u4+b7xseXr1rNSubKWEJusJfGWiwsZHdqw9kV9ANkWTodJi9L3CDhmlz4r5PMd2ywwLgfnPazT4Rzbkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602066950; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=p5F8wV7zxwl0VHP4Roqb3cZ3awDHkySiXf6nCw9azjM=; b=R3Wnr12zGpvHXB46+KHO3RMIUehb9VI/4YRQYY1p/z4QxFWcvHUgqRCDK5vEusuxgf9Y15mEt18CmZpIkXfpmeuwYMlS4ScDL9tWoRRMClwdu25JkFzS56SlSH89htEapaO4ppgl+/Ezh4321GYsuUMh5ASIGiBbtY785ZuzDnI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65973+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602066950255412.45236421120285; Wed, 7 Oct 2020 03:35:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZRx5YY1788612xeCuz5xb3Cz; Wed, 07 Oct 2020 03:35:49 -0700 X-Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mx.groups.io with SMTP id smtpd.web10.10064.1602066568664743904 for ; Wed, 07 Oct 2020 03:29:29 -0700 X-Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 2725D1A1515; Wed, 7 Oct 2020 12:29:27 +0200 (CEST) X-Received: from inv0113.in-blr01.nxp.com (inv0113.in-blr01.nxp.com [165.114.116.118]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id BF4A51A151D; Wed, 7 Oct 2020 12:29:26 +0200 (CEST) X-Received: from uefi-OptiPlex-790.ap.freescale.net (unknown [10.232.132.78]) by inv0113.in-blr01.nxp.com (Postfix) with ESMTP id 785E232D; Wed, 7 Oct 2020 15:59:25 +0530 (IST) From: Meenakshi Aggarwal To: ard.biesheuvel@arm.com, leif@nuviainc.com, michael.d.kinney@intel.com, devel@edk2.groups.io Cc: v.sethi@nxp.com, Meenakshi Aggarwal , Meenakshi Aggarwal Subject: [edk2-devel] [edk2-platforms v2 5/6] Silicon/NXP/LS1046A: Apply USB errata workarounds Date: Wed, 7 Oct 2020 21:40:40 +0530 Message-Id: <1602087041-8009-6-git-send-email-meenakshi.aggarwal@oss.nxp.com> In-Reply-To: <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> References: <1600187343-18732-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,meenakshi.aggarwal@oss.nxp.com X-Gm-Message-State: U5LWOgzXTq0DqDzKa6ntvAtEx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602066949; bh=JYX7XqcsFywJ3BeksbAEePjvyUrMkvRK88oDZDC0OYA=; h=Cc:Date:From:Reply-To:Subject:To; b=QSGbdylsrCyvdfn/ndWt3eSI7uFmwBZzWJGTgkW+MRLXQ6HPF+DX1/N7dDMeU4Snb+p W/7dUqguhtIOW2yGYtVjkoQCWdbMIzmtx+pvJS9xubajgXj4w/e8HbH35q/VInqjWAN6l np0yqXHdruVXPiN6165acOISRMw2qy0GCic= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Apply USB errata workarounds for LS1046A SoC and make SATA, USB and SEC snoopable. Signed-off-by: Meenakshi Aggarwal --- Silicon/NXP/LS1046A/LS1046A.dsc.inc | 1 + Silicon/NXP/LS1046A/Library/SocLib/SocLib.inf | 2 + Silicon/NXP/LS1046A/Include/Soc.h | 2 + Silicon/NXP/LS1046A/Library/SocLib/SocLib.c | 66 +++++++++++++++++++++++= ++++ 4 files changed, 71 insertions(+) diff --git a/Silicon/NXP/LS1046A/LS1046A.dsc.inc b/Silicon/NXP/LS1046A/LS10= 46A.dsc.inc index db110553605f..4e1d6a7ae7a2 100644 --- a/Silicon/NXP/LS1046A/LS1046A.dsc.inc +++ b/Silicon/NXP/LS1046A/LS1046A.dsc.inc @@ -34,6 +34,7 @@ [PcdsFixedAtBuild.common] =20 [PcdsFeatureFlag] gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian|TRUE + gNxpQoriqLsTokenSpaceGuid.PcdScfgBigEndian|TRUE gNxpQoriqLsTokenSpaceGuid.PcdGpioControllerBigEndian|TRUE =20 ##########################################################################= ###### diff --git a/Silicon/NXP/LS1046A/Library/SocLib/SocLib.inf b/Silicon/NXP/LS= 1046A/Library/SocLib/SocLib.inf index 01ed0f6592d2..e2336bb18f29 100644 --- a/Silicon/NXP/LS1046A/Library/SocLib/SocLib.inf +++ b/Silicon/NXP/LS1046A/Library/SocLib/SocLib.inf @@ -14,6 +14,7 @@ [Defines] LIBRARY_CLASS =3D SocLib =20 [Packages] + ArmPkg/ArmPkg.dec MdePkg/MdePkg.dec Silicon/NXP/Chassis2/Chassis2.dec Silicon/NXP/LS1046A/LS1046A.dec @@ -25,3 +26,4 @@ [LibraryClasses] =20 [Sources.common] SocLib.c + diff --git a/Silicon/NXP/LS1046A/Include/Soc.h b/Silicon/NXP/LS1046A/Includ= e/Soc.h index 84f433d5cb94..e1d97e531263 100644 --- a/Silicon/NXP/LS1046A/Include/Soc.h +++ b/Silicon/NXP/LS1046A/Include/Soc.h @@ -25,6 +25,7 @@ #define LS1046A_QSPI0_SIZE (SIZE_512MB) =20 #define LS1046A_DCFG_ADDRESS NXP_LAYERSCAPE_CHASSIS2_DCFG_ADDRESS +#define LS1046A_SCFG_ADDRESS NXP_LAYERSCAPE_CHASSIS2_SCFG_ADDRESS =20 /** Reset Control Word (RCW) Bits @@ -59,5 +60,6 @@ Bit(s) | Field Name | Description | Not= es/comments #define SYS_PLL_RAT(x) (((x) >> 25) & 0x1f) // Bits 2-6 =20 typedef NXP_LAYERSCAPE_CHASSIS2_DEVICE_CONFIG LS1046A_DEVICE_CONFIG; +typedef NXP_LAYERSCAPE_CHASSIS2_SUPPLEMENTAL_CONFIG LS1046A_SUPPLEMENTAL_C= ONFIG; =20 #endif // SOC_H__ diff --git a/Silicon/NXP/LS1046A/Library/SocLib/SocLib.c b/Silicon/NXP/LS10= 46A/Library/SocLib/SocLib.c index 3b15aee6ecae..80342d7230e4 100644 --- a/Silicon/NXP/LS1046A/Library/SocLib/SocLib.c +++ b/Silicon/NXP/LS1046A/Library/SocLib/SocLib.c @@ -11,6 +11,8 @@ #include #include #include + +#include #include =20 /** @@ -65,6 +67,47 @@ SocGetClock ( } =20 /** + Function to select pins depending upon pcd using supplemental + configuration unit(SCFG) extended RCW controlled pinmux control + register which contains the bits to provide pin multiplexing control. + This register is reset on HRESET. + **/ +STATIC +VOID +ConfigScfgMux (VOID) +{ + LS1046A_SUPPLEMENTAL_CONFIG *Scfg; + UINT32 UsbPwrFault; + + Scfg =3D (LS1046A_SUPPLEMENTAL_CONFIG *)LS1046A_SCFG_ADDRESS; + // Configures functionality of the IIC3_SCL to USB2_DRVVBUS + // Configures functionality of the IIC3_SDA to USB2_PWRFAULT + // USB3 is not used, configure mux to IIC4_SCL/IIC4_SDA + ScfgWrite32 ((UINTN)&Scfg->RcwPMuxCr0, SCFG_RCWPMUXCRO_NOT_SELCR_USB); + + ScfgWrite32 ((UINTN)&Scfg->UsbDrvVBusSelCr, SCFG_USBDRVVBUS_SELCR_USB1); + UsbPwrFault =3D (SCFG_USBPWRFAULT_DEDICATED << SCFG_USBPWRFAULT_USB3_SHI= FT) | + (SCFG_USBPWRFAULT_DEDICATED << SCFG_USBPWRFAULT_USB2_SHIFT= ) | + (SCFG_USBPWRFAULT_SHARED << SCFG_USBPWRFAULT_USB1_SHIFT); + ScfgWrite32 ((UINTN)&Scfg->UsbPwrFaultSelCr, UsbPwrFault); + ScfgWrite32 ((UINTN)&Scfg->UsbPwrFaultSelCr, UsbPwrFault); +} + +STATIC +VOID +ApplyErrata ( + VOID + ) +{ + ErratumA009008 (); + ErratumA009798 (); + ErratumA008997 (); + ErratumA009007 (); +} + + + +/** Function to initialize SoC specific constructs **/ VOID @@ -72,7 +115,30 @@ SocInit ( VOID ) { + LS1046A_SUPPLEMENTAL_CONFIG *Scfg; + + Scfg =3D (LS1046A_SUPPLEMENTAL_CONFIG *)LS1046A_SCFG_ADDRESS; + + /* Make SEC, SATA and USB reads and writes snoopable */ + ScfgOr32((UINTN)&Scfg->SnpCnfgCr, SCFG_SNPCNFGCR_SECRDSNP | + SCFG_SNPCNFGCR_SECWRSNP | SCFG_SNPCNFGCR_USB1RDSNP | + SCFG_SNPCNFGCR_USB1WRSNP | SCFG_SNPCNFGCR_USB2RDSNP | + SCFG_SNPCNFGCR_USB2WRSNP | SCFG_SNPCNFGCR_USB3RDSNP | + SCFG_SNPCNFGCR_USB3WRSNP | SCFG_SNPCNFGCR_SATARDSNP | + SCFG_SNPCNFGCR_SATAWRSNP); + + ApplyErrata (); ChassisInit (); =20 + // + // Due to the extensive functionality present on the chip and the limite= d number of external + // signals available, several functional blocks share signal resources t= hrough multiplexing. + // In this case when there is alternate functionality between multiple f= unctional blocks, + // the signal's function is determined at the chip level (rather than at= the block level) + // typically by a reset configuration word (RCW) option. Some of the sig= nals' function are + // determined externel to RCW at Power-on Reset Sequence. + // + ConfigScfgMux (); + return; } --=20 1.9.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65973): https://edk2.groups.io/g/devel/message/65973 Mute This Topic: https://groups.io/mt/77359495/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 05:03:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65974+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65974+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; t=1602066949; cv=none; d=zohomail.com; s=zohoarc; b=CdbCC7fyPQYI6zFLg65bIJWz2NmQpk4ZxcffRpuw1DpGDDCTBtlFi7LUv/P1JLFXpOOsa2Xh9ikbeP7F0w6Wy8vzn8G4MqrRma9c7NV/3I7SDBcciBQkyPfUv/Y9RSgNKCVpq9rueoKxoc0e7B6zswFX83fkCSeMRsrub/yvPNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602066949; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=YKSJEaUYkt850d5KsRVmnJGllZT+yC7RZsmtH+1Bim8=; b=Mof+kfIlpWcMlR8aAtu+TrW7aitD9iP33ZZ0eCbd1X9N1g5JtvaR5F1RVRejDlVkB62pfx/+4qFb75E6yDBuNEIrz8TtgdgZi4GlzqQtLWKb8dHOsI2VJl/C26JCR0rNBpQoa+MDNodA+CMwqZOUKdb6NlK6eokEKOfpOSxFZfQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65974+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602066949774471.40003154497197; Wed, 7 Oct 2020 03:35:49 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id qDB7YY1788612xszBj6EsVML; Wed, 07 Oct 2020 03:35:49 -0700 X-Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mx.groups.io with SMTP id smtpd.web10.10065.1602066569273230421 for ; Wed, 07 Oct 2020 03:29:29 -0700 X-Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 74D1E1A17DE; Wed, 7 Oct 2020 12:29:27 +0200 (CEST) X-Received: from inv0113.in-blr01.nxp.com (inv0113.in-blr01.nxp.com [165.114.116.118]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 3F6831A151D; Wed, 7 Oct 2020 12:29:27 +0200 (CEST) X-Received: from uefi-OptiPlex-790.ap.freescale.net (unknown [10.232.132.78]) by inv0113.in-blr01.nxp.com (Postfix) with ESMTP id EEF0C332; Wed, 7 Oct 2020 15:59:25 +0530 (IST) From: Meenakshi Aggarwal To: ard.biesheuvel@arm.com, leif@nuviainc.com, michael.d.kinney@intel.com, devel@edk2.groups.io Cc: v.sethi@nxp.com, Meenakshi Aggarwal , Meenakshi Aggarwal Subject: [edk2-devel] [edk2-platforms v2 6/6] LS1046aFrwy: Enable USB support for LS1046AFRWY board. Date: Wed, 7 Oct 2020 21:40:41 +0530 Message-Id: <1602087041-8009-7-git-send-email-meenakshi.aggarwal@oss.nxp.com> In-Reply-To: <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> References: <1600187343-18732-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> <1602087041-8009-1-git-send-email-meenakshi.aggarwal@oss.nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,meenakshi.aggarwal@oss.nxp.com X-Gm-Message-State: Ln7iTS8rbsvtQZiN9RzauHWux1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602066949; bh=KOm8pwXnc3eVpMJcPIwK3MCplbhscAcjSt0uLydxjDI=; h=Cc:Date:From:Reply-To:Subject:To; b=NTxa9Feqd6xt6TtpUt9x1AfbndIsoBU20SvBN2GDREQTj5b8qYbP7thQQdR6zTmZkBm NFlOBiIs71TXnIZKj/+M1x309apP1bkVCbUMbiu1eDwLAUByRH19jRFKeFxVuuK7jpqVr z5/uxegAwGumqIyS/rUcSdlBhdwtKfXaIec= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Meenakshi Aggarwal Reviewed-by: Leif Lindholm --- Silicon/NXP/LS1046A/LS1046A.dsc.inc | 3 +++ Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc | 2 ++ Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.fdf | 13 +++++++++++++ 3 files changed, 18 insertions(+) mode change 100644 =3D> 100755 Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.= dsc mode change 100644 =3D> 100755 Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.= fdf diff --git a/Silicon/NXP/LS1046A/LS1046A.dsc.inc b/Silicon/NXP/LS1046A/LS10= 46A.dsc.inc index 4e1d6a7ae7a2..7004533ed5f1 100644 --- a/Silicon/NXP/LS1046A/LS1046A.dsc.inc +++ b/Silicon/NXP/LS1046A/LS1046A.dsc.inc @@ -31,6 +31,9 @@ [PcdsFixedAtBuild.common] gNxpQoriqLsTokenSpaceGuid.PcdGpioModuleBaseAddress|0x02300000 gNxpQoriqLsTokenSpaceGuid.PcdGpioControllerOffset|0x10000 =20 + gNxpQoriqLsTokenSpaceGuid.PcdUsbBaseAddr|0x2F00000 + gNxpQoriqLsTokenSpaceGuid.PcdUsbSize|0x100000 + gNxpQoriqLsTokenSpaceGuid.PcdNumUsbController|3 =20 [PcdsFeatureFlag] gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian|TRUE diff --git a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc b/Platform/NXP/= LS1046aFrwyPkg/LS1046aFrwyPkg.dsc old mode 100644 new mode 100755 index 3f29dadd5d1d..266fdbd2b4d3 --- a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc +++ b/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc @@ -43,4 +43,6 @@ [Components.common] gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE } =20 + Silicon/NXP/Drivers/UsbHcdInitDxe/UsbHcd.inf + ## diff --git a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.fdf b/Platform/NXP/= LS1046aFrwyPkg/LS1046aFrwyPkg.fdf old mode 100644 new mode 100755 index 24af547729c7..34c4e5a02516 --- a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.fdf +++ b/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.fdf @@ -120,6 +120,19 @@ [FV.FvMain] INF FatPkg/EnhancedFatDxe/Fat.inf INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i= nf =20 + INF MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciD= eviceDxe.inf + + # + # USB Support + # + INF MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf + INF MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf + INF MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf + INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf + INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + + INF Silicon/NXP/Drivers/UsbHcdInitDxe/UsbHcd.inf + # # UEFI application (Shell Embedded Boot Loader) # --=20 1.9.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65974): https://edk2.groups.io/g/devel/message/65974 Mute This Topic: https://groups.io/mt/77359496/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-