From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (EUR03-VE1-obe.outbound.protection.outlook.com [40.107.5.44]) by mx.groups.io with SMTP id smtpd.web11.9743.1586866535885024152 for ; Tue, 14 Apr 2020 05:15:36 -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=JOTlnx15; spf=pass (domain: oss.nxp.com, ip: 40.107.5.44, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hwf+kNePXYney4Mia3GmvptTp2X6kbiiiuKk6KcJUhhwM82NNnmnCVBicvai9RvSmy4y69Ek2gHHhMO73XzcRH5TH0h9pP6JRh5hFUdRvYbAkSggpR5gSZbNGGMksie9Mhv9wq95oTLEoycKx+3xTQ9k2LkNcWwRLX0WIrzYRTq45gEqJWnzTz1bweq7DVS6B36v++VJh/P0Sbs7Rg5yT6MlivF7XqENdPPDDuYs8FkQMs/KNTbQKQrYYR1pyeenGrS2YcMszIUvYJ8jAQpy0BYVUX4pCc0rSb7IeTOHui1tDQiVXklVkCBlvahsMAqOzgSvK0ANOGwxoN6ChLLHcg== 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=gLzddGWbviEccd03BIJyEfjUPqEBC2QHOCx5csLQWUU=; b=Iy912Piw+o2QHIknrL9eaKDg/2SPfv9PZMK4AYXwsKpiK0MOT/cY7E5biwgZlHoK7GwzkNjfat34eS27TwCuFKzVwC6vyZPWzeBds0WpOjCQdCsy3iH70ug/exPPXAZFooBB1dIxNZdRCL4Jch5yQZ5kPlZtRsBSsFKqC6OV2xFtuZOpV9mVYVLPaHnL+kb7Q0q4UbALpDXGvlY2jC99zHZ9c8ryY4IZs6VEf7ZU7/hNssFJWkzuLq2dkLvM0HLKBiqWvmPQWmVUw0tGbhLUcgarsqGwhjJUFvzgwRtTDsPrcn8jaih1bm5+FFIlH7+XBH4W34lTZJvlwR4hPLBvog== 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=gLzddGWbviEccd03BIJyEfjUPqEBC2QHOCx5csLQWUU=; b=JOTlnx15xmku4y4m7SFT7ynlt7J499YF7nSrJh7/Y1+vXmoxoWZ4YiwyPh0kNEOjwT3dLN7LX2GmFNca2aZ9X2p46su21k1RM65QSQ1HZPUFx7L9m4dbGGI6liVCHfw/58HvVWnh3N06UwW6eCSAmMlp2KoLTzETTqSWIH19/bE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@oss.nxp.com; Received: from VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) by VI1PR04MB4461.eurprd04.prod.outlook.com (2603:10a6:803:70::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.28; Tue, 14 Apr 2020 12:15:33 +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.2900.028; Tue, 14 Apr 2020 12:15:33 +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 v3 16/24] Silicon/NXP: Add Chassis2 Package Date: Wed, 15 Apr 2020 17:43:34 +0530 Message-ID: <20200415121342.9246-17-pankaj.bansal@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200415121342.9246-1-pankaj.bansal@oss.nxp.com> References: <20200415121342.9246-1-pankaj.bansal@oss.nxp.com> X-ClientProxiedBy: SG2PR01CA0092.apcprd01.prod.exchangelabs.com (2603:1096:3:15::18) 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 SG2PR01CA0092.apcprd01.prod.exchangelabs.com (2603:1096:3:15::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15 via Frontend Transport; Tue, 14 Apr 2020 12:15:30 +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: b0b48ea6-7337-4768-615c-08d7e06d87c8 X-MS-TrafficTypeDiagnostic: VI1PR04MB4461:|VI1PR04MB4461: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0373D94D15 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:(10009020)(4636009)(376002)(366004)(346002)(136003)(39850400004)(396003)(1076003)(186003)(8936002)(16526019)(86362001)(110136005)(26005)(478600001)(81156014)(8676002)(6512007)(66946007)(316002)(44832011)(66476007)(66556008)(52116002)(5660300002)(2906002)(6486002)(6506007)(956004)(19627235002)(2616005);DIR:OUT;SFP:1101; Received-SPF: None (protection.outlook.com: oss.nxp.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0p+N+EONuf2tpXuZ7ljfB0mo4gvMxQNMAjSciGfcfP6ZUjZGVlcwYaRYBqNjCL4flJpj7prwlQuzLSjmTNEBuuw6Mo9Ikiqyq/8j6uMin8VDgfWjBzIlYXPhtNR++/0K7wDzKPzuhbiP0jMUy3f8ULJeb0Zz+5ZSsbJ8jGVNk8oPjKU21pM9NT76JXPn38Yf7q6ELkOTuAv0YymBwJB6ya3DWS15VECq62KQaglYvHHz1YC/biSDmU64CMLGZDW8814UO8JcmLHYMBVKP6tHJOWu0dZvLOk+wKSBKC+O24YotLZnF2zFVwDRn/UlLcq6B4S6yv0oPgiXjm7kQtuP1ASEh4eI3ufauj8F32vRWFWm1/4h+dvHMisI109YuZMfI713JK3ZKuC1vyxFKALUp0/1560sk1SGbu7uGoL03uAQiBSbMu9PqlPRwTDVOoEo X-MS-Exchange-AntiSpam-MessageData: BQ0AboKTAm9Y/sw9eBlX8aEZASW9LaE4Jh3ZMa2bk7onmx1Ajw0OBuq5NJ6lQnolRkXrnW2S+G83+nBtEDH6+6I/b1taR4huicFusa0dI8/0LimSUA18//kuYl+fjxwOQnpQ2HhPjftJxVmcCHyFHQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0b48ea6-7337-4768-615c-08d7e06d87c8 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2020 12:15:33.2816 (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: u50CNUxucBI9FlEH2/5XGNkCBHfrq/t9tzt+IgkvUqZVSSPYoWukuEey6L0L+TCNMStpBF4ajWJxqmNC5Q7cKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4461 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 Borad) 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: - in patch description Oops -> Object model - Sorted includes alphabetically - removed direct calls to SwapMmio** APIs and used GetMmioOperations** Silicon/NXP/Chassis2/Chassis2.dec | 23 +++++ Silicon/NXP/NxpQoriqLs.dec | 4 + Silicon/NXP/Chassis2/Chassis2.dsc.inc | 10 ++ Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf | 34 +++++++ Silicon/NXP/Chassis2/Include/Chassis.h | 34 +++++++ Silicon/NXP/Include/Library/ChassisLib.h | 51 ++++++++++ Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c | 97 ++++++++++++++= ++++++ 7 files changed, 253 insertions(+) diff --git a/Silicon/NXP/Chassis2/Chassis2.dec b/Silicon/NXP/Chassis2/Chass= is2.dec new file mode 100644 index 000000000000..a0048bd784ea --- /dev/null +++ b/Silicon/NXP/Chassis2/Chassis2.dec @@ -0,0 +1,23 @@ +# @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 2ac047a89274..3e79f502c127 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,4 +32,5 @@ =20 [PcdsFeatureFlag] gNxpQoriqLsTokenSpaceGuid.PcdI2cErratumA009203|FALSE|BOOLEAN|0x00000315 + gNxpQoriqLsTokenSpaceGuid.PcdDcfgBigEndian|FALSE|BOOLEAN|0x00000316 =20 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..2bb16af53134 --- /dev/null +++ b/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.inf @@ -0,0 +1,34 @@ +# @file +# +# Copyright 2020 NXP +# +# SPDX-License-Identifier: BSD-2-Clause +# +# + +[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..72bd97efd004 --- /dev/null +++ b/Silicon/NXP/Chassis2/Include/Chassis.h @@ -0,0 +1,34 @@ +/** @file + + Copyright 2020 NXP + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef CHASSIS_H__ +#define CHASSIS_H__ + +#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..b3bb25029dd2 --- /dev/null +++ b/Silicon/NXP/Chassis2/Library/ChassisLib/ChassisLib.c @@ -0,0 +1,97 @@ +/** @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_32 *DcfgOps; + + DcfgOps =3D GetMmioOperations32 (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_32 *DcfgOps; + + DcfgOps =3D GetMmioOperations32 (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