From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.0.59; helo=eur02-am5-obe.outbound.protection.outlook.com; envelope-from=meenakshi.aggarwal@nxp.com; receiver=edk2-devel@lists.01.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00059.outbound.protection.outlook.com [40.107.0.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6F22E223230CB for ; Fri, 16 Feb 2018 00:48:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4e+Iw70/vmrmR++bROcl9r3Qci1m+Z42nPGVTcIo3bw=; b=G41mkRO8Bcsil5GWq9KhzdalmyQLUOEGMeeXj4lKxTXWbRtI8fbELIQbUdYEZTpY0XtSKZ7q5bCf3l/ncZWpBIgWCVXcRJpbhG+GrP3iQ519T5KL4tuMs0ejJr7ZVExi47J1aVKSmpA+AeAIuODli9VFX5lGJFFmZrBFu3+/3T8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=meenakshi.aggarwal@nxp.com; Received: from idcbfarm.ap.freescale.net (192.88.169.1) by VI1PR04MB1008.eurprd04.prod.outlook.com (2a01:111:e400:5090::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Fri, 16 Feb 2018 08:54:17 +0000 From: Meenakshi To: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, michael.d.kinney@intel.com, edk2-devel@lists.01.org Date: Fri, 16 Feb 2018 14:20:20 +0530 Message-Id: <1518771035-6733-25-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1518771035-6733-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1518771035-6733-1-git-send-email-meenakshi.aggarwal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [192.88.169.1] X-ClientProxiedBy: HK2PR02CA0172.apcprd02.prod.outlook.com (2603:1096:201:1f::32) To VI1PR04MB1008.eurprd04.prod.outlook.com (2a01:111:e400:5090::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 65b6d4c4-a21b-4047-b49a-08d5751ade35 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:VI1PR04MB1008; X-Microsoft-Exchange-Diagnostics: 1; VI1PR04MB1008; 3:un0Om/AuojiE6sK12ZgHrXmtnIIAm7ruOdYfEyBzDsnZv6yhO4B2dl/X0JallogjRh6SNvVQPz553E6cNAPxHKUfx9t2HoY0eJLn3Oyvp7qZvxpotKs96XeHx22BfRkmCkVSNYQM6DjcuEvJ7BH6qBO9ihV/Njlo1M9sh5OWN0AOlH8v5LhsX5KkbM6SEiuN0IPFE+jw/xAmGZFnXFuDMWVgUMfvpXtXjHJtnZO/CwP44Qdgi/TA2kBqZlCJd8rb; 25:p80uReDgQtztEtYW718nWOmRGyW4ZEfNADjQ3yQL/qnGKmrYTtZOXzGLzw78xTKhQlgC5tejL+EOm7jeNrWBfNZyICK1CevqEgWzokGiPRXoFzNF22F3kLNBefizN5X/rEPYN7r+Zwxs3tZMaxGKqb/BfXyupFKum+9MLPQi5uJNL4lLUx0vCHV3KvvRYrFRLY1+022qefm5nSKSPW6ZlpgGHyOZDhVU2+56mvGq6s0OWE6tidGNiCyMyTmPTYogtuWHBnKd3Fs95D5YkkOkIuwXfRKMz+jNb7VQhspq1P6nM2uZQytuILLgUDRxtiIEvPt2KG4G6JAYwi2VFU30lg==; 31:I/yxnwg16zu9cKYdIdm4oCJPdX6x6kAV9IVRNmogvqYO7otj7gdS6UvsmVV4EqWAf5EVpFZJhprwNGwqorZcTEy9GuwV+JdceivGb3zvmEMjqOAgY5VaPaZr1XBAybm3vDkQOcwFul7x2QMEzAgIq4Mgn4vytCOVurgtYeveBQfPrHsFtbJl35vP1vxk957z3u7H0WzQ0kmY9yuVjZW+ubpUSU3G48j9/Vu5rPXPhx4= X-MS-TrafficTypeDiagnostic: VI1PR04MB1008: X-Microsoft-Exchange-Diagnostics: 1; VI1PR04MB1008; 20:nVNx7VaELThmE0nkxScXxi5BvlNZHYfHIso7Q+92tUpmHvYJ9L5LWW1qYcQdzA/EHvbuSiLArlG4JDSx1RKVZv1KFRZLWbvgsez2eagrkmqUNi7lcVSkuw+NKfVjLIecND0pSrzSeu2+h4sr5A86LrICz/5Ux+HEdXQcHAKobZg4IvoCbyHyJjTs/t7qV7U85UkkN4EI0K2ow/P2nVGM7asMcU2lywzqKc5B4vyZigy29s6Rpak0mVBD82SdIAhU6SYxejIuYbWg7u/thwELejx2q7fmJ8Gx9o3eGwg4QUYMwlGBB9aUrcGQC6NuCNlEv4LP75jUqalt/GemvU3Tx6h8mhbu2rEowSeIVJyj26ROaRzldq+LVgJQOsidOnx6vU5z669SRWVo4oes1QDkwkXPcNklchIe7OHskWbYYaVXHW+OIBkcgsJapAHt2aSlnEZSY73WQgXFQyL87CX0XMYqvAxwW2LBNZVxgRafV7Ilp27XVVOSbofacguIVX82; 4:G1v4XHU+P6a1R389oTSyKclVdQrERWk7KHEkzzP/qfbKeGfNsUdAM93WeMgU0B81YHRL7w41qICDEuggQIX/UQjhkxFYS4BInCdxkWHnKz508N465ZTeF1ohl3ldJ1krrP+v9qRx3D6JH8IhTW0OfcYYqSZfH3iFlFcvAo34xSmk7IJ2DcIf4JlizYHGz9FH7vszqLxIRHSWyB2CzKcCqOtAhaMAeeIcNRIRzV3ilU0IreCyJckzjWesxi2d0En9Y5NVcHum/H1l4wXJ5vzskm1M/UFPdhvyXqbGN042wQpfVI706oMWGL0TzyYGVbxP X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231101)(944501161)(6055026)(6041288)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:VI1PR04MB1008; BCL:0; PCL:0; RULEID:; SRVR:VI1PR04MB1008; X-Forefront-PRVS: 0585417D7B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(39380400002)(396003)(39860400002)(366004)(199004)(189003)(86362001)(575784001)(6486002)(8676002)(76176011)(36756003)(53376002)(966005)(4326008)(6116002)(15188155005)(16799955002)(7736002)(386003)(68736007)(186003)(26005)(53936002)(305945005)(16526019)(81156014)(3846002)(6506007)(478600001)(50226002)(16586007)(8936002)(2950100002)(316002)(2906002)(25786009)(97736004)(50466002)(48376002)(105586002)(52116002)(47776003)(81166006)(51416003)(5660300001)(6666003)(106356001)(66066001)(6306002)(6512007)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB1008; H:idcbfarm.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR04MB1008; 23:cJ/VbpRm/DhAa9jd6BKcPodmbkX23nJUj69zZkt8J?= =?us-ascii?Q?AoM9A3GQ8jsHnk+yK6fFP8xowaV9R7dJo1/joJNyTlFOT0vC1IThgIwDGKES?= =?us-ascii?Q?Styl8rWQwkmMTdLQFzSAHjFWB77BVT1ymgH0Ao1QFR9T+vmnMzFzTiLvKiwq?= =?us-ascii?Q?o1REfB7MEjx5vV6dG3RmY+ACHb2gJcyDDsS3We7Lgk2onBk0w0Oja6waNx76?= =?us-ascii?Q?xM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OyivgHEZ91gF9atDdPw4LKiNvFZ3M/jnpL2cJmcp/42zEsG3P8BNfpa2Vyr+cezus6IWnh4aeCHZl7F4K SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2018 08:54:17.0923 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 65b6d4c4-a21b-4047-b49a-08d5751ade35 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB1008 Subject: [PATCH edk2-platforms 24/39] Silicon/NXP:SocLib support for initialization of peripherals X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 08:48:30 -0000 Content-Type: text/plain From: Wasim Khan Added SocInit function that initializes peripherals and print board and soc information for LS2088ARDB Board. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wasim Khan --- Silicon/NXP/Chassis/Chassis.c | 35 ++++++ Silicon/NXP/Chassis/Chassis.h | 17 +++ Silicon/NXP/Chassis/Chassis3/Chassis3.dec | 19 ++++ Silicon/NXP/Chassis/Chassis3/SerDes.h | 91 +++++++++++++++ Silicon/NXP/Chassis/Chassis3/Soc.c | 180 ++++++++++++++++++++++++++++++ Silicon/NXP/Chassis/Chassis3/Soc.h | 150 +++++++++++++++++++++++++ Silicon/NXP/Chassis/LS2088aSocLib.inf | 48 ++++++++ Silicon/NXP/LS2088A/Include/SocSerDes.h | 67 +++++++++++ 8 files changed, 607 insertions(+) create mode 100644 Silicon/NXP/Chassis/Chassis3/Chassis3.dec create mode 100644 Silicon/NXP/Chassis/Chassis3/SerDes.h create mode 100644 Silicon/NXP/Chassis/Chassis3/Soc.c create mode 100644 Silicon/NXP/Chassis/Chassis3/Soc.h create mode 100644 Silicon/NXP/Chassis/LS2088aSocLib.inf create mode 100644 Silicon/NXP/LS2088A/Include/SocSerDes.h diff --git a/Silicon/NXP/Chassis/Chassis.c b/Silicon/NXP/Chassis/Chassis.c index ce07fdc..b63efdc 100644 --- a/Silicon/NXP/Chassis/Chassis.c +++ b/Silicon/NXP/Chassis/Chassis.c @@ -45,6 +45,7 @@ GurRead ( STATIC CPU_TYPE CpuTypeList[] = { CPU_TYPE_ENTRY (LS1043A, LS1043A, 4), CPU_TYPE_ENTRY (LS1046A, LS1046A, 4), + CPU_TYPE_ENTRY (LS2088A, LS2088A, 8), }; /* @@ -142,6 +143,40 @@ CpuNumCores ( } /* + * Return core's cluster + */ +UINT32 +QoriqCoreToCluster ( + IN UINTN Core + ) +{ + CCSR_GUR *GurBase; + UINTN ClusterIndex; + UINTN Count; + UINT32 Cluster; + UINT32 Type; + UINTN InitiatorIndex; + + GurBase = (VOID *)PcdGet64 (PcdGutsBaseAddr); + ClusterIndex = 0; + Count = 0; + do { + Cluster = GurRead ((UINTN)&GurBase->TpCluster[ClusterIndex].Lower); + for (InitiatorIndex = 0; InitiatorIndex < TP_INIT_PER_CLUSTER; InitiatorIndex++) { + Type = InitiatorType (Cluster, InitiatorIndex); + if (Type) { + if (Count == Core) + return ClusterIndex; + Count++; + } + } + ClusterIndex++; + } while (CHECK_CLUSTER (Cluster)); + + return -1; // cannot identify the cluster +} + +/* * Return the type of core i.e. A53, A57 etc of inputted * core number. */ diff --git a/Silicon/NXP/Chassis/Chassis.h b/Silicon/NXP/Chassis/Chassis.h index 0beb44c..974fefb 100644 --- a/Silicon/NXP/Chassis/Chassis.h +++ b/Silicon/NXP/Chassis/Chassis.h @@ -57,6 +57,7 @@ CpuMaskNext ( #define SVR_WO_E 0xFFFFFE #define SVR_LS1043A 0x879200 #define SVR_LS1046A 0x870700 +#define SVR_LS2088A 0x870901 #define SVR_MAJOR(svr) (((svr) >> 4) & 0xf) #define SVR_MINOR(svr) (((svr) >> 0) & 0xf) @@ -142,4 +143,20 @@ CpuNumCores ( VOID ); +/* + * Return the type of initiator for core/hardware accelerator for given core index. + */ +UINT32 +QoriqCoreToType ( + IN UINTN Core + ); + +/* + * Return the cluster of initiator for core/hardware accelerator for given core index. + */ +UINT32 +QoriqCoreToCluster ( + IN UINTN Core + ); + #endif /* __CHASSIS_H__ */ diff --git a/Silicon/NXP/Chassis/Chassis3/Chassis3.dec b/Silicon/NXP/Chassis/Chassis3/Chassis3.dec new file mode 100644 index 0000000..cf41b3c --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis3/Chassis3.dec @@ -0,0 +1,19 @@ +# @file +# +# Copyright 2017 NXP +# +# This program and the accompanying materials are licensed and made available under +# the terms and conditions of the BSD License which accompanies this distribution. +# The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# + +[Defines] + DEC_SPECIFICATION = 0x00010005 + +[Includes] + . diff --git a/Silicon/NXP/Chassis/Chassis3/SerDes.h b/Silicon/NXP/Chassis/Chassis3/SerDes.h new file mode 100644 index 0000000..a77ddd5 --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis3/SerDes.h @@ -0,0 +1,91 @@ +/** SerDes.h + The Header file of SerDes Module for Chassis 3 + + Copyright 2017 NXP + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __SERDES_H__ +#define __SERDES_H__ + +#include + +#define SRDS_MAX_LANES 8 + +// +// SerDes lane protocols/devices +// +typedef enum { + NONE = 0, + PCIE1, + PCIE2, + PCIE3, + PCIE4, + SATA1, + SATA2, + XAUI1, + XAUI2, + XFI1, + XFI2, + XFI3, + XFI4, + XFI5, + XFI6, + XFI7, + XFI8, + SGMII1, + SGMII2, + SGMII3, + SGMII4, + SGMII5, + SGMII6, + SGMII7, + SGMII8, + SGMII9, + SGMII10, + SGMII11, + SGMII12, + SGMII13, + SGMII14, + SGMII15, + SGMII16, + QSGMII_A, + QSGMII_B, + QSGMII_C, + QSGMII_D, + // Number of entries in this enum + SERDES_PRTCL_COUNT +} SERDES_PROTOCOL; + +typedef enum { + SRDS_1 = 0, + SRDS_2, + SRDS_MAX_NUM +} SERDES_NUMBER; + +typedef struct { + UINT16 Protocol; + UINT8 SrdsLane[SRDS_MAX_LANES]; +} SERDES_CONFIG; + +typedef VOID +(*SERDES_PROBE_LANES_CALLBACK) ( + IN SERDES_PROTOCOL LaneProtocol, + IN VOID *Arg + ); + +VOID +SerDesProbeLanes( + IN SERDES_PROBE_LANES_CALLBACK SerDesLaneProbeCallback, + IN VOID *Arg + ); + +#endif /* __SERDES_H */ diff --git a/Silicon/NXP/Chassis/Chassis3/Soc.c b/Silicon/NXP/Chassis/Chassis3/Soc.c new file mode 100644 index 0000000..ed6c3cc --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis3/Soc.c @@ -0,0 +1,180 @@ +/** @Soc.c + SoC specific Library containg functions to initialize various SoC components + + Copyright 2017 NXP + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Soc.h" + +VOID +GetSysInfo ( + OUT SYS_INFO *PtrSysInfo + ) +{ + UINT32 Index; + CCSR_GUR *GurBase; + CCSR_CLT_CTRL *ClkBase; + CCSR_CLK_CLUSTER *ClkGrp[2] = { + (VOID *) (FSL_CLK_GRPA_ADDR), + (VOID *) (FSL_CLK_GRPB_ADDR) + }; + + const UINT8 CoreCplxPll[16] = { + [0] = 0, // CC1 PPL / 1 + [1] = 0, // CC1 PPL / 2 + [2] = 0, // CC1 PPL / 4 + [4] = 1, // CC2 PPL / 1 + [5] = 1, // CC2 PPL / 2 + [6] = 1, // CC2 PPL / 4 + [8] = 2, // CC3 PPL / 1 + [9] = 2, // CC3 PPL / 2 + [10] = 2, // CC3 PPL / 4 + [12] = 3, // CC4 PPL / 1 + [13] = 3, // CC4 PPL / 2 + [14] = 3, // CC4 PPL / 4 + }; + + const UINT8 CoreCplxPllDivisor[16] = { + [0] = 1, // CC1 PPL / 1 + [1] = 2, // CC1 PPL / 2 + [2] = 4, // CC1 PPL / 4 + [4] = 1, // CC2 PPL / 1 + [5] = 2, // CC2 PPL / 2 + [6] = 4, // CC2 PPL / 4 + [8] = 1, // CC3 PPL / 1 + [9] = 2, // CC3 PPL / 2 + [10] = 4, // CC3 PPL / 4 + [12] = 1, // CC4 PPL / 1 + [13] = 2, // CC4 PPL / 2 + [14] = 4, // CC4 PPL / 4 + }; + + INT32 CcGroup[12] = FSL_CLUSTER_CLOCKS; + UINTN PllCount; + UINTN Cluster; + UINTN FreqCPll[NUM_CC_PLLS]; + UINTN PllRatio[NUM_CC_PLLS]; + UINTN SysClk; + UINT32 Cpu; + UINT32 CPllSel; + UINT32 CplxPll; + VOID *Offset; + + SetMem (PtrSysInfo, sizeof (SYS_INFO), 0); + + GurBase = (VOID *)PcdGet64 (PcdGutsBaseAddr); + ClkBase = (VOID *)PcdGet64 (PcdClkBaseAddr); + SysClk = CLK_FREQ; + + PtrSysInfo->FreqSystemBus = SysClk; + PtrSysInfo->FreqDdrBus = PcdGet64 (PcdDdrClk); + PtrSysInfo->FreqDdrBus2 = PcdGet64 (PcdDdrClk); + + // + // selects the platform clock:SYSCLK ratio and calculate + // system frequency + // + PtrSysInfo->FreqSystemBus *= (GurRead ((UINTN)&GurBase->RcwSr[0]) >> + CHASSIS3_RCWSR_0_SYS_PLL_RAT_SHIFT) & + CHASSIS3_RCWSR_0_SYS_PLL_RAT_MASK; + + // + // Platform clock is half of platform PLL + // + PtrSysInfo->FreqSystemBus /= PcdGet32 (PcdPlatformFreqDiv); + + // + // selects the DDR PLL:SYSCLK Ratio and calculate DDR frequency + // + PtrSysInfo->FreqDdrBus *= (GurRead ((UINTN)&GurBase->RcwSr[0]) >> + CHASSIS3_RCWSR_0_MEM_PLL_RAT_SHIFT) & + CHASSIS3_RCWSR_0_MEM_PLL_RAT_MASK; + PtrSysInfo->FreqDdrBus2 *= (GurRead ((UINTN)&GurBase->RcwSr[0]) >> + CHASSIS3_RCWSR_0_MEM2_PLL_RAT_SHIFT) & + CHASSIS3_RCWSR_0_MEM2_PLL_RAT_MASK; + + for (PllCount = 0; PllCount < NUM_CC_PLLS; PllCount++) { + Offset = (VOID *)((UINTN)ClkGrp[PllCount/3] + + __builtin_offsetof (CCSR_CLK_CLUSTER, PllnGsr[PllCount%3].Gsr)); + PllRatio[PllCount] = (GurRead ((UINTN)Offset) >> 1) & 0x3f; + FreqCPll[PllCount] = SysClk * PllRatio[PllCount]; + } + + // + // Calculate Core frequency + // + ForEachCpu (Index, Cpu, CpuNumCores (), CpuMask ()) { + Cluster = QoriqCoreToCluster (Cpu); + ASSERT_EFI_ERROR (Cluster); + CPllSel = (GurRead ((UINTN)&ClkBase->ClkCnCsr[Cluster].Csr) >> 27) & 0xf; + CplxPll = CoreCplxPll[CPllSel]; + CplxPll += CcGroup[Cluster] - 1; + PtrSysInfo->FreqProcessor[Cpu] = FreqCPll[CplxPll] / CoreCplxPllDivisor[CPllSel]; + } + PtrSysInfo->FreqSdhc = PtrSysInfo->FreqSystemBus/PcdGet32 (PcdPlatformFreqDiv); +} + +/** + Perform the early initialization. + This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim + +**/ +VOID +SocInit ( + VOID + ) +{ + CHAR8 Buffer[100]; + UINTN CharCount; + + // + // Initialize SMMU + // + SmmuInit (); + + // + // Initialize the Serial Port. + // Early serial port initialization is required to print RCW, Soc and CPU infomation at + // the begining of UEFI boot. + // + SerialPortInitialize (); + + CharCount = AsciiSPrint (Buffer, sizeof (Buffer), "\nUEFI firmware (version %s built at %a on %a)\n\r", + (CHAR16*)PcdGetPtr (PcdFirmwareVersionString), __TIME__, __DATE__); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + + // + // Print CPU information + // + PrintCpuInfo (); + + // + // Print Reset Controll Word + // + PrintRCW (); + + // + // Print Soc Personality information + // + PrintSoc (); +} + diff --git a/Silicon/NXP/Chassis/Chassis3/Soc.h b/Silicon/NXP/Chassis/Chassis3/Soc.h new file mode 100644 index 0000000..0e892fb --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis3/Soc.h @@ -0,0 +1,150 @@ +/** Soc.h +* Header defining the Base addresses, sizes, flags etc for chassis 1 +* +* Copyright (c) 2017 NXP +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef __SOC_H__ +#define __SOC_H__ + +#define MAX_CPUS 16 +#define FSL_CLK_GRPA_ADDR 0x01300000 +#define FSL_CLK_GRPB_ADDR 0x01310000 +#define NUM_CC_PLLS 6 +#define CLK_FREQ 100000000 + +#define FSL_CLUSTER_CLOCKS { 1, 1, 4, 4 } /* LS208x */ +#define TP_CLUSTER_EOC_MASK 0x80000000 /* Mask for End of clusters */ +#define CHECK_CLUSTER(Cluster) ((Cluster & TP_CLUSTER_EOC_MASK) != TP_CLUSTER_EOC_MASK) + +// RCW SERDES MACRO +#define RCWSR_INDEX 28 +#define RCWSR_SRDS1_PRTCL_MASK 0x00ff0000 +#define RCWSR_SRDS1_PRTCL_SHIFT 16 +#define RCWSR_SRDS2_PRTCL_MASK 0xff000000 +#define RCWSR_SRDS2_PRTCL_SHIFT 24 + +// SMMU Defintions +#define SMMU_BASE_ADDR 0x05000000 +#define SMMU_REG_SCR0 (SMMU_BASE_ADDR + 0x0) +#define SMMU_REG_SACR (SMMU_BASE_ADDR + 0x10) +#define SMMU_REG_IDR1 (SMMU_BASE_ADDR + 0x24) +#define SMMU_REG_NSCR0 (SMMU_BASE_ADDR + 0x400) +#define SMMU_REG_NSACR (SMMU_BASE_ADDR + 0x410) + +#define SACR_PAGESIZE_MASK 0x00010000 +#define SCR0_CLIENTPD_MASK 0x00000001 +#define SCR0_USFCFG_MASK 0x00000400 + +typedef struct { + UINTN FreqProcessor[MAX_CPUS]; + UINTN FreqSystemBus; + UINTN FreqDdrBus; + UINTN FreqDdrBus2; + UINTN FreqLocalBus; + UINTN FreqSdhc; + UINTN FreqFman[1]; + UINTN FreqQman; + UINTN FreqPme; +}SYS_INFO; + +/// +/// Device Configuration and Pin Control +/// +typedef struct { + UINT32 PorSr1; // POR status register 1 + UINT32 PorSr2; // POR status register 2 + UINT8 Res008[0x20-0x8]; + UINT32 GppOrCr1; // General-purpose POR configuration register + UINT32 GppOrCr2; // General-purpose POR configuration register 2 + UINT32 DcfgFuseSr; // Fuse status register */ + UINT32 GppOrCr3; + UINT32 GppOrCr4; + UINT8 Res034[0x70-0x34]; + UINT32 DevDisr; // Device disable control register + UINT32 DevDisr2; // Device disable control register 2 + UINT32 DevDisr3; // Device disable control register 3 + UINT32 DevDisr4; // Device disable control register 4 + UINT32 DevDisr5; // Device disable control register 5 + UINT32 DevDisr6; // Device disable control register 6 + UINT32 DevDisr7; // Device disable control register 7 + UINT8 Res08c[0x90-0x8c]; + UINT32 CoreDisrUpper; // CORE DISR Uppper for support of 64 cores + UINT32 CoreDisrLower; // CORE DISR Lower for support of 64 cores + UINT8 Res098[0xa0-0x98]; + UINT32 Pvr; // Processor version + UINT32 Svr; // System version + UINT32 Mvr; // Manufacturing version + UINT8 Res0ac[0x100-0xac]; + UINT32 RcwSr[32]; // Reset control word status +#define CHASSIS3_RCWSR_0_SYS_PLL_RAT_SHIFT 2 +#define CHASSIS3_RCWSR_0_SYS_PLL_RAT_MASK 0x1f +#define CHASSIS3_RCWSR_0_MEM_PLL_RAT_SHIFT 10 +#define CHASSIS3_RCWSR_0_MEM_PLL_RAT_MASK 0x3f +#define CHASSIS3_RCWSR_0_MEM2_PLL_RAT_SHIFT 18 +#define CHASSIS3_RCWSR_0_MEM2_PLL_RAT_MASK 0x3f + UINT8 Res180[0x200-0x180]; + UINT32 ScratchRw[32]; // Scratch Read/Write + UINT8 Res280[0x300-0x280]; + UINT32 ScratchW1R[4]; // Scratch Read (Write once) + UINT8 Res310[0x400-0x310]; + UINT32 BootLocPtrL; // Low addr : Boot location pointer + UINT32 BootLocPtrH; // High addr : Boot location pointer + UINT8 Res408[0x500-0x408]; + UINT8 Res500[0x740-0x500]; + UINT32 TpItyp[64]; + struct { + UINT32 Upper; + UINT32 Lower; + } TpCluster[3]; + UINT8 Res858[0x1000-0x858]; +} CCSR_GUR; + +/// +/// Clocking +/// +typedef struct { + struct { + UINT32 Csr; // core cluster n clock control status + UINT8 Res04[0x20-0x04]; + } ClkCnCsr[8]; +} CCSR_CLT_CTRL; + +/// +/// Clock Cluster +/// +typedef struct { + struct { + UINT8 Res00[0x10]; + UINT32 Csr; // core cluster n clock control status + UINT8 Res14[0x20-0x14]; + } HwnCsr[3]; + UINT8 Res60[0x80-0x60]; + struct { + UINT32 Gsr; // core cluster n clock general status + UINT8 Res84[0xa0-0x84]; + } PllnGsr[3]; + UINT8 Rese0[0x100-0xe0]; +} CCSR_CLK_CLUSTER; + +VOID +GetSysInfo ( + OUT SYS_INFO * + ); + +UINT32 +EFIAPI +GurRead ( + IN UINTN Address + ); + +#endif /* __SOC_H__ */ diff --git a/Silicon/NXP/Chassis/LS2088aSocLib.inf b/Silicon/NXP/Chassis/LS2088aSocLib.inf new file mode 100644 index 0000000..8a4da50 --- /dev/null +++ b/Silicon/NXP/Chassis/LS2088aSocLib.inf @@ -0,0 +1,48 @@ +# @file +# +# Copyright 2017 NXP +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = SocLib + FILE_GUID = 3b233a6a-0ee1-42a3-a7f7-c285b5ba80dc + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = SocLib + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/NXP/NxpQoriqLs.dec + Silicon/NXP/Chassis/Chassis3/Chassis3.dec + Silicon/NXP/LS2088A/LS2088A.dec + +[LibraryClasses] + BaseLib + BeIoLib + DebugLib + SerialPortLib + +[Sources.common] + Chassis.c + Chassis3/Soc.c + SerDes.c + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString + gNxpQoriqLsTokenSpaceGuid.PcdGutsBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPlatformFreqDiv + gNxpQoriqLsTokenSpaceGuid.PcdSerdes2Enabled + gNxpQoriqLsTokenSpaceGuid.PcdGurBigEndian + gNxpQoriqLsTokenSpaceGuid.PcdClkBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDdrClk diff --git a/Silicon/NXP/LS2088A/Include/SocSerDes.h b/Silicon/NXP/LS2088A/Include/SocSerDes.h new file mode 100644 index 0000000..f631ccb --- /dev/null +++ b/Silicon/NXP/LS2088A/Include/SocSerDes.h @@ -0,0 +1,67 @@ +/** @file + The Header file of SerDes Module for LS2088A + + Copyright 2017 NXP + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __SOC_SERDES_H__ +#define __SOC_SERDES_H__ + +#include + +SERDES_CONFIG SerDes1ConfigTbl[] = { + // SerDes 1 + { 0x03, { PCIE2, PCIE2, PCIE2, PCIE2, PCIE1, PCIE1, PCIE1, PCIE1 } }, + { 0x05, { PCIE2, PCIE2, PCIE2, PCIE2, SGMII4, SGMII3, SGMII2, SGMII1 } }, + { 0x07, { SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, SGMII2, SGMII1 } }, + { 0x09, { SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, SGMII2, SGMII1 } }, + { 0x0A, { SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, SGMII2, SGMII1 } }, + { 0x0C, { SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, SGMII2, SGMII1 } }, + { 0x0E, { SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, SGMII2, SGMII1 } }, + { 0x26, { SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, XFI2, XFI1 } }, + { 0x28, { SGMII8, SGMII7, SGMII6, SGMII5, XFI4, XFI3, XFI2, XFI1 } }, + { 0x2A, { XFI8, XFI7, XFI6, XFI5, XFI4, XFI3, XFI2, XFI1 } }, + { 0x2B, { SGMII8, SGMII7, SGMII6, SGMII5, XAUI1, XAUI1, XAUI1, XAUI1 } }, + { 0x32, { XAUI2, XAUI2, XAUI2, XAUI2, XAUI1, XAUI1, XAUI1, XAUI1 } }, + { 0x33, { PCIE2, PCIE2, PCIE2, PCIE2, QSGMII_D, QSGMII_C, QSGMII_B, QSGMII_A } }, + { 0x35, { QSGMII_D, QSGMII_C, QSGMII_B, PCIE2, XFI4, XFI3, XFI2, XFI1 } }, + {} +}; + +SERDES_CONFIG SerDes2ConfigTbl[] = { + // SerDes 2 + { 0x07, { SGMII9, SGMII10, SGMII11, SGMII12, SGMII13, SGMII14, SGMII15, SGMII16 } }, + { 0x09, { SGMII9, SGMII10, SGMII11, SGMII12, SGMII13, SGMII14, SGMII15, SGMII16 } }, + { 0x0A, { SGMII9, SGMII10, SGMII11, SGMII12, SGMII13, SGMII14, SGMII15, SGMII16 } }, + { 0x0C, { SGMII9, SGMII10, SGMII11, SGMII12, SGMII13, SGMII14, SGMII15, SGMII16 } }, + { 0x0E, { SGMII9, SGMII10, SGMII11, SGMII12, SGMII13, SGMII14, SGMII15, SGMII16 } }, + { 0x3D, { PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3 } }, + { 0x3E, { PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3 } }, + { 0x3F, { PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4 } }, + { 0x40, { PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4 } }, + { 0x41, { PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2 } }, + { 0x42, { PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2 } }, + { 0x43, { PCIE3, PCIE3, PCIE3, PCIE3, NONE, NONE, SATA1, SATA2 } }, + { 0x44, { PCIE3, PCIE3, PCIE3, PCIE3, NONE, NONE, SATA1, SATA2 } }, + { 0x45, { SGMII9, SGMII10, SGMII11, SGMII12, PCIE4, PCIE4, PCIE4, PCIE4 } }, + { 0x47, { PCIE3, SGMII10, SGMII11, SGMII12, PCIE4, SGMII14, SGMII15, SGMII16 } }, + { 0x49, { SGMII9, SGMII10, SGMII11, SGMII12, PCIE4, PCIE4, SATA1, SATA2 } }, + { 0x4A, { SGMII9, SGMII10, SGMII11, SGMII12, PCIE4, PCIE4, SATA1, SATA2 } }, + {} +}; + +SERDES_CONFIG *SerDesConfigTbl[] = { + SerDes1ConfigTbl, + SerDes2ConfigTbl +}; + +#endif /* __SOC_SERDES_H */ -- 1.9.1