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.89; 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-eopbgr00089.outbound.protection.outlook.com [40.107.0.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A1A2E223230CE for ; Fri, 16 Feb 2018 00:47:27 -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=NO8oz9brJKZXh/nQ05Q2cPAdNXbZ8iM39AfeAG9yqxM=; b=PVs5WTsmJsWpVdjW78fuBVV0Gz4hYz6sPA2JXq/To667PgrPGBwjpoCndwHAuD+hDPzJSCCit+kB1+JXBmnInVHSTQbXtxLdHtluVTs3zMfw4vAD6P7y2rA8osragzf3mFt7iCaIHchAl18MbQBYZYijaf/jMhz6dZCgW5WBAn0= 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:53:15 +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:08 +0530 Message-Id: <1518771035-6733-13-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: 7c264c7a-42ef-434e-b822-08d5751ab956 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:Jpmo4AXAK/oZW9qH7AgQ1CapoHU380mgxe2H6n52+PY4uLSAHOjuNqG0uACBGnjRTRomJmL3lmd/G8Cu5oDsb84y+FANE5IYQJzo0eCmMKfk1Z4umMW63oQPsv0Ceb728Kv93y/G4ELsh+lpyxM5wb5616yZCPskh8Ltz7KoIHGEWUhAsNYgRei/9MLnhX7Dq8Ijdh7grhqw+pi/qUWtUDsNFclejZFtI0pUDP/kZjiOGYz64inn/B5+6yMQ0n1e; 25:fOcFXcG0/D8pmJ1d3X53IEdFU+IfUX0nIlRdfDWFcW2G6XzmU8VfYtQ0qI+A0VVYqsp4QNM97q7rOAes8BfhReV1meO0vaBmtbHhaE8S8zf2lWoPlET5PGJ4uNCj+/hqzv27JpCdv01iAwklj1XXSJ+SUq3xJsAR4e6+KkKlQh+bO46OaxLCXmrqGIQJpdLsehJnDPf0x4MMo6OmTwJr8Jfxme9I+a257JIQFazaWp1rq3v6+2+dabPhRDz8MOKj+rXwxMmwvPzOYT2Nsefjl7WiY4iG3mujdn4X4nN8hV2MMqPeEhHcaKHixFvnch3PcT6QFVLG3kWK60K6Aza4Vg==; 31:IWNejJoFluMu1VQhOLiNN/WHq3cZFwl/r2IVNvPeGiBz7ElB8Ms61hRm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Wrxrv1ul 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)(59450400001)(25786009)(97736004)(50466002)(48376002)(105586002)(52116002)(47776003)(81166006)(51416003)(5660300001)(6666003)(106356001)(66066001)(6306002)(6512007); 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:we67ug4l6I4sBmIO5WhPnKDkdpX8noRpjFAQOjB+q?= =?us-ascii?Q?m8eTh87RTdyIZ20v1YjKEBJb3UnzKbbFlzMlCc5qumhSg1yLLN67qtIkDzqv?= =?us-ascii?Q?MYphKeB0fM1eWIgH1kBgedxMVgiPXUCjehc2YXhRX1FjlF+o/jDxKmGoeMef?= =?us-ascii?Q?p2B3j130RmgGb1f9OYi5yi72xCCCCUE9TtxK904/A16krhikF7AN2Cg9Euf4?= =?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B4knqnvLR9fpRoq1wiWBSHshOzQzIeXppaMG2hdVOZ2E4XAVO7DCNs5iHp3w82yHX/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2018 08:53:15.2798 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c264c7a-42ef-434e-b822-08d5751ab956 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 12/39] Silicon/NXP : Add support of IfcLib 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:47:28 -0000 Content-Type: text/plain From: Meenakshi Aggarwal Add support of IfcLib, it will be used to perform any operation on IFC controller. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Silicon/NXP/Include/Library/IfcLib.h | 23 +++++ Silicon/NXP/Library/IfcLib/IfcLib.c | 155 ++++++++++++++++++++++++++++ Silicon/NXP/Library/IfcLib/IfcLib.h | 184 ++++++++++++++++++++++++++++++++++ Silicon/NXP/Library/IfcLib/IfcLib.inf | 38 +++++++ Silicon/NXP/NxpQoriqLs.dec | 1 + 5 files changed, 401 insertions(+) create mode 100644 Silicon/NXP/Include/Library/IfcLib.h create mode 100644 Silicon/NXP/Library/IfcLib/IfcLib.c create mode 100644 Silicon/NXP/Library/IfcLib/IfcLib.h create mode 100644 Silicon/NXP/Library/IfcLib/IfcLib.inf diff --git a/Silicon/NXP/Include/Library/IfcLib.h b/Silicon/NXP/Include/Library/IfcLib.h new file mode 100644 index 0000000..f350d33 --- /dev/null +++ b/Silicon/NXP/Include/Library/IfcLib.h @@ -0,0 +1,23 @@ +/** @IfcLib.h + + Copyright 2018 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 __IFC_LIB_H__ +#define __IFC_LIB_H__ + +VOID +IfcInit ( + VOID + ); + +#endif //__IFC_LIB_H__ diff --git a/Silicon/NXP/Library/IfcLib/IfcLib.c b/Silicon/NXP/Library/IfcLib/IfcLib.c new file mode 100644 index 0000000..97a6591 --- /dev/null +++ b/Silicon/NXP/Library/IfcLib/IfcLib.c @@ -0,0 +1,155 @@ +/** @IfcLib.c + + Copyright 2018 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 "IfcLib.h" + +UINT8 mNandCS; +UINT8 mNorCS; +UINT8 mFpgaCS; + +UINT32 +EFIAPI +IfcWrite ( + IN UINTN Address, + IN UINT32 Value + ) +{ + if (FixedPcdGetBool(PcdIfcBigEndian)) { + return BeMmioWrite32 (Address, Value); + } else { + return MmioWrite32 (Address, Value); + } +} + +VOID +SetTimings ( + IN UINT8 CS, + IN IFC_TIMINGS IfcTimings + ) +{ + IFC_REGS* IfcRegs; + + IfcRegs = (IFC_REGS*) PcdGet64 (PcdIfcBaseAddr); + + // Configure Extended chip select property registers + IfcWrite ((UINTN)&IfcRegs->CsprCs[CS].CsprExt, IfcTimings.CsprExt); + + // Configure Fpga timing registers + IfcWrite ((UINTN)&IfcRegs->FtimCs[CS].Ftim[IFC_FTIM0], IfcTimings.Ftim[0]); + IfcWrite ((UINTN)&IfcRegs->FtimCs[CS].Ftim[IFC_FTIM1], IfcTimings.Ftim[1]); + IfcWrite ((UINTN)&IfcRegs->FtimCs[CS].Ftim[IFC_FTIM2], IfcTimings.Ftim[2]); + IfcWrite ((UINTN)&IfcRegs->FtimCs[CS].Ftim[IFC_FTIM3], IfcTimings.Ftim[3]); + + // Configure chip select option registers + IfcWrite ((UINTN)&IfcRegs->CsprCs[CS].Cspr, IfcTimings.Cspr); + + // Configure address mask registers + IfcWrite ((UINTN)&IfcRegs->AmaskCs[CS].Amask, IfcTimings.Amask); + + // Configure chip select property registers + IfcWrite ((UINTN)&IfcRegs->CsorCs[CS].Csor, IfcTimings.Csor); + + return; +} + +VOID +NandInit( + VOID + ) +{ + IFC_REGS* IfcRegs; + IFC_TIMINGS NandIfcTimings; + + IfcRegs = (IFC_REGS*) PcdGet64 (PcdIfcBaseAddr); + + // Get Nand Flash Timings + GetIfcNandFlashTimings (&NandIfcTimings); + + // Validate chip select + if (NandIfcTimings.CS < IFC_CS_MAX) { + mNandCS = NandIfcTimings.CS; + + // clear event registers + IfcWrite ((UINTN)&IfcRegs->IfcNand.PgrdcmplEvtStat, ~0U); + + IfcWrite ((UINTN)&IfcRegs->IfcNand.NandEvterStat, ~0U); + + // Enable error and event for any detected errors + IfcWrite ((UINTN)&IfcRegs->IfcNand.NandEvterEn, + IFC_NAND_EVTER_EN_OPC_EN | + IFC_NAND_EVTER_EN_PGRDCMPL_EN | + IFC_NAND_EVTER_EN_FTOER_EN | + IFC_NAND_EVTER_EN_WPER_EN); + IfcWrite ((UINTN)&IfcRegs->IfcNand.Ncfgr, 0x0); + + SetTimings (mNandCS, NandIfcTimings); + } + + return; +} + +VOID +FpgaInit ( + VOID + ) +{ + IFC_TIMINGS FpgaIfcTimings; + + // Get Fpga Flash Timings + GetIfcFpgaTimings (&FpgaIfcTimings); + + // Validate chip select + if (FpgaIfcTimings.CS < IFC_CS_MAX) { + mFpgaCS = FpgaIfcTimings.CS; + SetTimings (mFpgaCS, FpgaIfcTimings); + } + + return; +} + +VOID +NorInit ( + VOID + ) +{ + IFC_TIMINGS NorIfcTimings; + + // Get NOR Flash Timings + GetIfcNorFlashTimings (&NorIfcTimings); + + // Validate chip select + if (NorIfcTimings.CS < IFC_CS_MAX) { + mNorCS = NorIfcTimings.CS; + SetTimings (mNorCS, NorIfcTimings); + } + + return; +} + +// +// IFC has NOR , NAND and FPGA +// +VOID +IfcInit ( + VOID + ) +{ + NorInit(); + NandInit(); + FpgaInit(); + + return; +} diff --git a/Silicon/NXP/Library/IfcLib/IfcLib.h b/Silicon/NXP/Library/IfcLib/IfcLib.h new file mode 100644 index 0000000..9f52576 --- /dev/null +++ b/Silicon/NXP/Library/IfcLib/IfcLib.h @@ -0,0 +1,184 @@ +/** @IfcLib.h + + 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. + +**/ + +#ifndef __IFC_LIB_H__ +#define __IFC_LIB_H__ + +#include +#include + +#define IFC_NAND_RESERVED_SIZE FixedPcdGet32 (PcdIfcNandReservedSize) + +typedef enum { + IFC_FTIM0 = 0, + IFC_FTIM1, + IFC_FTIM2, + IFC_FTIM3, +} IFC_FTIMS; + +typedef struct { + UINT32 CsprExt; + UINT32 Cspr; + UINT32 Res; +} IFC_CSPR; + +typedef struct { + UINT32 Amask; + UINT32 Res[0x2]; +} IFC_AMASK; + +typedef struct { + UINT32 Csor; + UINT32 CsorExt; + UINT32 Res; +} IFC_CSOR; + +typedef struct { + UINT32 Ftim[4]; + UINT32 Res[0x8]; +}IFC_FTIM ; + +typedef struct { + UINT32 Ncfgr; + UINT32 Res1[0x4]; + UINT32 NandFcr0; + UINT32 NandFcr1; + UINT32 Res2[0x8]; + UINT32 Row0; + UINT32 Res3; + UINT32 Col0; + UINT32 Res4; + UINT32 Row1; + UINT32 Res5; + UINT32 Col1; + UINT32 Res6; + UINT32 Row2; + UINT32 Res7; + UINT32 Col2; + UINT32 Res8; + UINT32 Row3; + UINT32 Res9; + UINT32 Col3; + UINT32 Res10[0x24]; + UINT32 NandFbcr; + UINT32 Res11; + UINT32 NandFir0; + UINT32 NandFir1; + UINT32 nandFir2; + UINT32 Res12[0x10]; + UINT32 NandCsel; + UINT32 Res13; + UINT32 NandSeqStrt; + UINT32 Res14; + UINT32 NandEvterStat; + UINT32 Res15; + UINT32 PgrdcmplEvtStat; + UINT32 Res16[0x2]; + UINT32 NandEvterEn; + UINT32 Res17[0x2]; + UINT32 NandEvterIntrEn; + UINT32 Res18[0x2]; + UINT32 NandErattr0; + UINT32 NandErattr1; + UINT32 Res19[0x10]; + UINT32 NandFsr; + UINT32 Res20; + UINT32 NandEccstat[4]; + UINT32 Res21[0x20]; + UINT32 NanNdcr; + UINT32 Res22[0x2]; + UINT32 NandAutobootTrgr; + UINT32 Res23; + UINT32 NandMdr; + UINT32 Res24[0x5C]; +} IFC_NAND; + +/* + * IFC controller NOR Machine registers + */ +typedef struct { + UINT32 NorEvterStat; + UINT32 Res1[0x2]; + UINT32 NorEvterEn; + UINT32 Res2[0x2]; + UINT32 NorEvterIntrEn; + UINT32 Res3[0x2]; + UINT32 NorErattr0; + UINT32 NorErattr1; + UINT32 NorErattr2; + UINT32 Res4[0x4]; + UINT32 NorCr; + UINT32 Res5[0xEF]; +} IFC_NOR; + +/* + * IFC controller GPCM Machine registers + */ +typedef struct { + UINT32 GpcmEvterStat; + UINT32 Res1[0x2]; + UINT32 GpcmEvterEn; + UINT32 Res2[0x2]; + UINT32 gpcmEvterIntrEn; + UINT32 Res3[0x2]; + UINT32 GpcmErattr0; + UINT32 GpcmErattr1; + UINT32 GcmErattr2; + UINT32 GpcmStat; +} IFC_GPCM; + +/* + * IFC Controller Registers + */ +typedef struct { + UINT32 IfcRev; + UINT32 Res1[0x2]; + IFC_CSPR CsprCs[IFC_BANK_COUNT]; + UINT8 Res2[IFC_CSPR_REG_LEN - IFC_CSPR_USED_LEN]; + IFC_AMASK AmaskCs[IFC_BANK_COUNT]; + UINT8 Res3[IFC_AMASK_REG_LEN - IFC_AMASK_USED_LEN]; + IFC_CSOR CsorCs[IFC_BANK_COUNT]; + UINT8 Res4[IFC_CSOR_REG_LEN - IFC_CSOR_USED_LEN]; + IFC_FTIM FtimCs[IFC_BANK_COUNT]; + UINT8 Res5[IFC_FTIM_REG_LEN - IFC_FTIM_USED_LEN]; + UINT32 RbStat; + UINT32 RbMap; + UINT32 WpMap; + UINT32 IfcGcr; + UINT32 Res7[0x2]; + UINT32 CmEvter_stat; + UINT32 Res8[0x2]; + UINT32 CmEvterEn; + UINT32 Res9[0x2]; + UINT32 CmEvterIntrEn; + UINT32 Res10[0x2]; + UINT32 CmErattr0; + UINT32 CmErattr1; + UINT32 Res11[0x2]; + UINT32 IfcCcr; + UINT32 IfcCsr; + UINT32 DdrCcrLow; + UINT32 Res12[IFC_NAND_RESERVED_SIZE]; + IFC_NAND IfcNand; + IFC_NOR IfcNor; + IFC_GPCM IfcGpcm; +} IFC_REGS; + +extern VOID GetIfcNorFlashTimings (IFC_TIMINGS * NorIfcTimings); + +extern VOID GetIfcFpgaTimings (IFC_TIMINGS *FpgaIfcTimings); + +extern VOID GetIfcNandFlashTimings (IFC_TIMINGS * NandIfcTimings); + +#endif //__IFC_LIB_H__ diff --git a/Silicon/NXP/Library/IfcLib/IfcLib.inf b/Silicon/NXP/Library/IfcLib/IfcLib.inf new file mode 100644 index 0000000..170ed38 --- /dev/null +++ b/Silicon/NXP/Library/IfcLib/IfcLib.inf @@ -0,0 +1,38 @@ +# IfcLib.inf +# +# Component description file for IFC Library +# +# Copyright 2018 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 = IfcLib + FILE_GUID = a465d76c-0785-4ee7-bd72-767983d575a2 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = IfcLib + +[Sources.common] + IfcLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/NXP/NxpQoriqLs.dec + +[LibraryClasses] + BoardLib + BeIoLib + +[FixedPcd] + gNxpQoriqLsTokenSpaceGuid.PcdIfcBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdIfcBigEndian + gNxpQoriqLsTokenSpaceGuid.PcdIfcNandReservedSize diff --git a/Silicon/NXP/NxpQoriqLs.dec b/Silicon/NXP/NxpQoriqLs.dec index a73e9d5..43d0a71 100644 --- a/Silicon/NXP/NxpQoriqLs.dec +++ b/Silicon/NXP/NxpQoriqLs.dec @@ -77,6 +77,7 @@ gNxpQoriqLsTokenSpaceGuid.PcdCcsrBaseAddr|0x0|UINT64|0x00000128 gNxpQoriqLsTokenSpaceGuid.PcdCcsrSize|0x0|UINT64|0x00000129 gNxpQoriqLsTokenSpaceGuid.PcdDramMemSize|0x0|UINT64|0x0000012A + gNxpQoriqLsTokenSpaceGuid.PcdIfcBaseAddr|0x0|UINT64|0x0000012B # # IFC PCDs -- 1.9.1