From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.66]) by mx.groups.io with SMTP id smtpd.web11.2063.1588225909989320005 for ; Wed, 29 Apr 2020 22:51:50 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nxp1.onmicrosoft.com header.s=selector2-nxp1-onmicrosoft-com header.b=QcA9GdKW; spf=pass (domain: oss.nxp.com, ip: 40.107.21.66, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EY7jiuRfj9u5I2jsLGi3ARmBAUEQdCM8eimw9pWMW81P3uq2QqHcZL623A8vwl+anmvihaQHJvL7t6xvxqvgjimtiM5EcTNuTwzmM6O9Z3apLG38TjLLIFu7H9FrifjfHzJrCezYNWb3yfRhKOpvNvnE0+SQFxMtwLQC7dJqxTEha5Q1ER7Zg7FvDpKht84pEBfiQwcq5ZvkGXK8K++7X87xQAh1EeJt1yhBF2hrSL0dFWnXg+aU9aBqKr2BGfZYFF5serZ6pIpM3a4gi1FzlvFWqO2DwMuxwkxzFmkE4nXb9zenDgYNFGIXA/2XJtXwWnn/JnznPjIx78RS838vGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sJ6Y4DLYRsIzZULF1bBBPdhN/NRSD51o4Kzi/3uL+0M=; b=hip/YW+3+BkPopntDBDZvVQvc2YZ7/HfO3/k7brq1mqLfFbDiMpotfaUOKgU65CBMY2zykjWjlGO9SYHDE5NG8J/T8jMI5n/GGi6gNrlrnYrlQoGudOG5Csn4DCiK+8i/4np2dcXm24Ew7L1ZylAPsujTgjpinxLzFSvam+RTIuaV05p6vX30ebtXggxrg+yTEOlwa4hob59EcVrJpNzflebg0QPJ0wBMtvqnl+9KjOPkfSyWJ7XX7y/KfnEs39fVUzRI5JSCWw5iAs4ELZaN8YPtrUG0l71QbxSwXdhcyxRewnfjDV/hCZnZhv4v1Ar8De2CNr5tJrUv0U1opb+bw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sJ6Y4DLYRsIzZULF1bBBPdhN/NRSD51o4Kzi/3uL+0M=; b=QcA9GdKWMThk/y1bzWC/oxjf3oGrxoBcZ/2xb2be56/K1Eu9AXhHDiY5no+3jAuqDup4b8CP8dsGJPlaisQgrmg0HZYC9iGuOUtH5ytbSP4hOnZjABAArNSCPulWLcem/hnCuygrMmWg0jM5rOAFaKLY48LET/eOp1krOxIoOx0= Authentication-Results: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) by VI1PR04MB4429.eurprd04.prod.outlook.com (2603:10a6:803:6e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 30 Apr 2020 05:51:47 +0000 Received: from VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::45c4:8846:5327:9513]) by VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::45c4:8846:5327:9513%7]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 05:51:47 +0000 From: "Pankaj Bansal" To: Leif Lindholm , Meenakshi Aggarwal , Michael D Kinney , devel@edk2.groups.io, Varun Sethi , Samer El-Haj-Mahmoud , Jon Nettleton , Ard Biesheuvel Subject: [PATCH edk2-platforms v4 16/24] Silicon/NXP: Add Chassis2 Package Date: Fri, 1 May 2020 11:19:47 +0530 Message-ID: <20200501054955.13025-17-pankaj.bansal@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501054955.13025-1-pankaj.bansal@oss.nxp.com> References: <20200501054955.13025-1-pankaj.bansal@oss.nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) To VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) Return-Path: pankaj.bansal@oss.nxp.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from uefi-workstation.ap.freescale.net (92.120.0.69) by SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.14 via Frontend Transport; Thu, 30 Apr 2020 05:51:45 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [92.120.0.69] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: db070cd3-5936-4245-f373-08d7ecca9212 X-MS-TrafficTypeDiagnostic: VI1PR04MB4429:|VI1PR04MB4429: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:989; X-Forefront-PRVS: 0389EDA07F X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5933.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(136003)(376002)(39860400002)(346002)(366004)(396003)(6512007)(26005)(16526019)(5660300002)(478600001)(186003)(2906002)(110136005)(52116002)(6486002)(316002)(8676002)(6506007)(66476007)(19627235002)(86362001)(2616005)(66946007)(44832011)(956004)(66556008)(1076003)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qHMhmyD6FLnCDDj+o93fX+OHdz3sBAr79HTwcLu3NdIdw7vmVmm7eg0PxeYXwngfjwQefoLtrkGly3+3nafL7+spK2TcpY6hB3ReAGz3VzZ1bbVsXUHIC0ICmcLsxwCgcR6QpG51ZAzMell4z8NXetVG4whoA8iMvJh5b7oRHmB6sktQ389JNH6b8NMO+cTFGhrN05s9ZdaDuOJy67prOSnRii2Yip0o6gwQbN37PE3ltUitgyI2GFiJp0AlZgiBDLqLiFgn745iYfnw2jHCJsxOAItM858FfC4YTdh7V6bZj67jz8+WlqLAQK5gHtsqEUefYEGOKgMf04/eWz57zUCVFXkS3Meu8CIlTErZBfdKtIDsO+laZ48IPmAmN+hVGiwevtqMJCCHBruXei1XacUncKqYB3RwFW3HenB7++ze38IRHxMTW6kp9JKWmik4 X-MS-Exchange-AntiSpam-MessageData: IFa4rypTs+nC48dDUXyejyT4zzchxwTrlstu9EKw4JCca/9NxL1ewX6mXZ53N9dPSy1+MWSLYCiNf4yZcbzHLh78QcHOkgthpmG2AZFOhy6xgqPPD55kLCVgDOxSXZ8Zb9vyPgsVIb1izJn2YszxZhA21MwK6AeiuzZRDEOE8G66wmvLaPb9hNeZR4G3vs+YBvr4jkd1fdxOLDDmgsAHvtmc5M0S015gvbvzMy//pyKSbOxHGcuE1WAExyGdl4vY2TYPE8xiayIpR4v6Iw1QWK3AdMj6lDX3m+BMIY02heuA2kFRyiVmWncTINIfNaTbCPhbZ27wUFQGd+INQBssu3lz686KanwNcsmOdNsZgctutHyY/3rH1c+hHM4CUO6eNW7EkmnQc2J3qEZ0LMRh9CUcebuuyRTHVtl+Or3PeFhRovjyAi0vL2m9gFWrsszAnz6iSH1FNyzMU3rTsixXaBJdhtvDDs7fb1B01s1Nr4I0xTG+wEEpFKn/vnBrtF4XIQ/vpYAMXUpLNufPcunvBI7gBsTz1FL5PRo/xl+VZy0A4qvhl98OfPB768FJvkPuMQfhucUHliw2114ToO56qDIi6GyngdS1GQ1J1T3olYMko9n04/4Y7h9M+a1qr2Y4FPfdxZ+nuLqcXLdqywJaBMfHbOfDrkyXQpWP8govrKrQJcF3hT4LSeSxJ9C4uXjBVa2kCYK2XVGOztGJoQE/4ueIEk+omu0s+ZSYKD4J1FYqg600ND7bNRm/HOczgI1UjEx6xFoVi4HSAfydL0POJtjN8k1JVYy06P2wenD76lU= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: db070cd3-5936-4245-f373-08d7ecca9212 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 05:51:47.6467 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7TihaUOQM6XC90wH6KXgmJeLLuj+1JrcTei6UKikjKdfVL25FvgzM9zQt3JJCWHBQi8OJvd9NA1bC+vq+O7X0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4429 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Pankaj Bansal A Chassis is a base framework used for building SoCs. We can think of Chassis/Soc/Platform(a.k.a Board) in Object model terms. Chassis is base. Soc is based on some Chassis. Platform is based on some Soc. SOCs that are designed around same chassis, reuse most of the components. Therefore, add the package for Chassis2. LS1043A and LS1046A SOCs belong to Chassis2. Signed-off-by: Pankaj Bansal --- Notes: V4: - Fixed line adds whitespace error - Added Uefi.h in Chassis.h - Fixed Typo Borad -> Board in commit description - Fixed license in ChassisLib.inf - Added lines between Copyright and license in ChassisLib.c =20 V3: - in patch description Oops -> Object model - Sorted includes alphabetically - removed direct calls to SwapMmio** APIs and used GetMmioOperations** Silicon/NXP/Chassis2/Chassis2.dec | 22 +++++ Silicon/NXP/NxpQoriqLs.dec | 4 + Silicon/NXP/Chassis2/Chassis2.dsc.inc | 10 ++ Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf | 33 +++++++ Silicon/NXP/Chassis2/Include/Chassis.h | 36 +++++++ Silicon/NXP/Include/Library/ChassisLib.h | 51 ++++++++++ Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c | 98 ++++++++++++++= ++++++ 7 files changed, 254 insertions(+) diff --git a/Silicon/NXP/Chassis2/Chassis2.dec b/Silicon/NXP/Chassis2/Chass= is2.dec new file mode 100644 index 000000000000..d3674cd6dff9 --- /dev/null +++ b/Silicon/NXP/Chassis2/Chassis2.dec @@ -0,0 +1,22 @@ +# @file +# NXP Layerscape processor package. +# +# Copyright 2020 NXP +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# + +[Defines] + DEC_SPECIFICATION =3D 1.27 + PACKAGE_VERSION =3D 0.1 + +##########################################################################= ###### +# +# Include Section - list of Include Paths that are provided by this packag= e. +# Comments are used for Keywords and Module Types. +# +# +##########################################################################= ###### +[Includes.common] + Include # Root include for the package diff --git a/Silicon/NXP/NxpQoriqLs.dec b/Silicon/NXP/NxpQoriqLs.dec index e61592b4fe61..b327e52da139 100644 --- a/Silicon/NXP/NxpQoriqLs.dec +++ b/Silicon/NXP/NxpQoriqLs.dec @@ -14,6 +14,9 @@ Include =20 [LibraryClasses] + ## @libraryclass Provides Chassis specific functions to other modules + ChassisLib|Include/Library/ChassisLib.h + ## @libraryclass Provides services to read/write to I2c devices I2cLib|Include/Library/I2cLib.h =20 @@ -29,3 +32,4 @@ =20 [PcdsFeatureFlag] gNxpQoriqLsTokenSpaceGuid.PcdI2cErratumA009203|FALSE|BOOLEAN|0x00000315 + gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian|FALSE|BOOLEAN|0x00000316 diff --git a/Silicon/NXP/Chassis2/Chassis2.dsc.inc b/Silicon/NXP/Chassis2/C= hassis2.dsc.inc new file mode 100644 index 000000000000..db8e5a92eacb --- /dev/null +++ b/Silicon/NXP/Chassis2/Chassis2.dsc.inc @@ -0,0 +1,10 @@ +# @file +# +# Copyright 2020 NXP +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# + +[LibraryClasses.common] + ChassisLib|Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf diff --git a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf b/Silic= on/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf new file mode 100644 index 000000000000..f5dbd1349dc5 --- /dev/null +++ b/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf @@ -0,0 +1,33 @@ +# @file +# +# Copyright 2020 NXP +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# + +[Defines] + INF_VERSION =3D 1.27 + BASE_NAME =3D Chassis2Lib + FILE_GUID =3D fae0d077-5fc2-494f-b8e1-c51a3023ee3e + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D ChassisLib + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/NXP/Chassis2/Chassis2.dec + Silicon/NXP/NxpQoriqLs.dec + +[LibraryClasses] + IoAccessLib + IoLib + PcdLib + SerialPortLib + +[Sources.common] + ChassisLib.c + +[FeaturePcd] + gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian diff --git a/Silicon/NXP/Chassis2/Include/Chassis.h b/Silicon/NXP/Chassis2/= Include/Chassis.h new file mode 100644 index 000000000000..14e21ef9daf4 --- /dev/null +++ b/Silicon/NXP/Chassis2/Include/Chassis.h @@ -0,0 +1,36 @@ +/** @file + + Copyright 2020 NXP + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef CHASSIS_H__ +#define CHASSIS_H__ + +#include + +#define NXP_LAYERSCAPE_CHASSIS2_DCFG_ADDRESS 0x1EE0000 + +/* SMMU Defintions */ +#define SMMU_BASE_ADDR 0x09000000 +#define SMMU_REG_SCR0 (SMMU_BASE_ADDR + 0x0) +#define SMMU_REG_SACR (SMMU_BASE_ADDR + 0x10) +#define SMMU_REG_NSCR0 (SMMU_BASE_ADDR + 0x400) + +#define SCR0_USFCFG_MASK 0x00000400 +#define SCR0_CLIENTPD_MASK 0x00000001 +#define SACR_PAGESIZE_MASK 0x00010000 + +/** + The Device Configuration Unit provides general purpose configuration and + status for the device. These registers only support 32-bit accesses. +**/ +#pragma pack(1) +typedef struct { + UINT8 Reserved0[0x100 - 0x0]; + UINT32 RcwSr[16]; // Reset Control Word Status Register +} NXP_LAYERSCAPE_CHASSIS2_DEVICE_CONFIG; +#pragma pack() + +#endif // CHASSIS_H__ diff --git a/Silicon/NXP/Include/Library/ChassisLib.h b/Silicon/NXP/Include= /Library/ChassisLib.h new file mode 100644 index 000000000000..89992a4b6fd5 --- /dev/null +++ b/Silicon/NXP/Include/Library/ChassisLib.h @@ -0,0 +1,51 @@ +/** @file + Chassis Lib to provide Chessis specific functionality to all SOCs in + a Chassis. + + Copyright 2020 NXP + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef CHASSIS_LIB_H__ +#define CHASSIS_LIB_H__ + +#include + +/** + Read Dcfg register + + @param Address The MMIO register to read. + + @return The value read. +**/ +UINT32 +EFIAPI +DcfgRead32 ( + IN UINTN Address + ); + +/** + Write Dcfg register + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + + @return Value. +**/ +UINT32 +EFIAPI +DcfgWrite32 ( + IN UINTN Address, + IN UINT32 Value + ); + +/** + Function to initialize Chassis Specific functions + **/ +VOID +ChassisInit ( + VOID + ); + +#endif // CHASSIS_LIB_H__ diff --git a/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c b/Silicon= /NXP/Chassis2/Library/ChassisLib/ChassisLib.c new file mode 100644 index 000000000000..91b19f832f00 --- /dev/null +++ b/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c @@ -0,0 +1,98 @@ +/** @file + Chassis specific functions common to all SOCs based on a specific Chessi= s + + Copyright 2020 NXP + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include + +/** + Read Dcfg register + + @param Address The MMIO register to read. + + @return The value read. +**/ +UINT32 +EFIAPI +DcfgRead32 ( + IN UINTN Address + ) +{ + MMIO_OPERATIONS *DcfgOps; + + DcfgOps =3D GetMmioOperations (FeaturePcdGet (PcdDcfgBigEndian)); + + return DcfgOps->Read32 (Address); +} + +/** + Write Dcfg register + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + + @return Value. +**/ +UINT32 +EFIAPI +DcfgWrite32 ( + IN UINTN Address, + IN UINT32 Value + ) +{ + MMIO_OPERATIONS *DcfgOps; + + DcfgOps =3D GetMmioOperations (FeaturePcdGet (PcdDcfgBigEndian)); + + return DcfgOps->Write32 (Address, Value); +} + +/* + * Setup SMMU in bypass mode + * and also set its pagesize + */ +STATIC +VOID +SmmuInit ( + VOID + ) +{ + UINT32 Value; + + /* set pagesize as 64K and ssmu-500 in bypass mode */ + Value =3D (MmioRead32 ((UINTN)SMMU_REG_SACR) | SACR_PAGESIZE_MASK); + MmioWrite32 ((UINTN)SMMU_REG_SACR, Value); + + Value =3D (MmioRead32 ((UINTN)SMMU_REG_SCR0) | SCR0_CLIENTPD_MASK); + Value &=3D ~SCR0_USFCFG_MASK; + MmioWrite32 ((UINTN)SMMU_REG_SCR0, Value); + + Value =3D (MmioRead32 ((UINTN)SMMU_REG_NSCR0) | SCR0_CLIENTPD_MASK); + Value &=3D ~SCR0_USFCFG_MASK; + MmioWrite32 ((UINTN)SMMU_REG_NSCR0, Value); +} + +/** + Function to initialize Chassis Specific functions + **/ +VOID +ChassisInit ( + VOID + ) +{ + // + // Early init serial Port to get board information. + // + SerialPortInitialize (); + + SmmuInit (); +} --=20 2.17.1