From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (EUR01-HE1-obe.outbound.protection.outlook.com [40.107.13.74]) by mx.groups.io with SMTP id smtpd.web12.45545.1591039688163257212 for ; Mon, 01 Jun 2020 12:28:08 -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=FR+6m984; spf=pass (domain: oss.nxp.com, ip: 40.107.13.74, mailfrom: wasim.khan@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ByRjuxV8oC6WgVeorxr8shJCWnY83YTZiTuBdrahTybiBA81r7DohIcrkntCmz/mCjfMOGkAiJAuQPvIbzvh/PMJl5HryBy8cEGCQ58iVmxMPn+vUbNnPiBJtVdOl5KQOamj6eyOjcfqke59+5tjs8bifyHHJxY6DaJAgIRQNMsUin9jvPyxQi4b4czMV62d/ldyzd+LDHH/bMjeD+JFh/fTz++oMg3romugVxVqAVpgKxXZMefCjC3jNThze//Fa7N6e1FEDxxDpr+x4IxcWTK4RzCohs5yeKWxuB9HdI3xWkrzFxN72gKFXt89zBzFJUYVBtcJaK2YS8k6WTF0NQ== 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=lMmCFXU1LnMusmlGjSjSYMt3u3voceqkgJW4RcWRIj8=; b=hQ85Qro3HLHzvuVxCccESrVe28lKS2e4L6FYL9a0tLQx7352CVHjDTNuYraPrneJL+zI/lwXE6fb+E+XYqVl3Cd/sCbaOVxIl0dQo4800iICD8+uhYQIHUytrQ62SRRwiuLJCho4GT+460PvCfEpE8rSXuG53EJVyIgSHRZrV9fUwR2NN6FSkW2VkpmZVD711SUJqkvZJcVYbL2MKogvIS9NGk1dJJsfezUjnU1aumLv5KpGvOsdRG4XYxtf/vOJnugFQkzQ1QLHzBFE3hFh4E03o6gG7GMYXmzy1iZCZFA2PIsJmNmyu+I9QnfFEbFEzSpWPrsYqf2syd2jNrQpdg== 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=lMmCFXU1LnMusmlGjSjSYMt3u3voceqkgJW4RcWRIj8=; b=FR+6m98488V/ags/CxUhSa8mAArdg6Pyh/O+wtri8suTMqI1kD3Jwc3KkhnwEYc0pU6X0pT9UUGnJA9U/0lpQDNnL3zsOnfTrXKk6tDkC+HB5X9nniEDdjUKhRT1s3ev5Rj1zZqBSTmr6U61RzlyEApBV3G9jVCJgA52jd3EhZo= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB6702.eurprd04.prod.outlook.com (2603:10a6:803:123::13) by VE1PR04MB6768.eurprd04.prod.outlook.com (2603:10a6:803:129::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.22; Mon, 1 Jun 2020 19:28:05 +0000 Received: from VE1PR04MB6702.eurprd04.prod.outlook.com ([fe80::81c4:97a6:7592:f225]) by VE1PR04MB6702.eurprd04.prod.outlook.com ([fe80::81c4:97a6:7592:f225%7]) with mapi id 15.20.3045.024; Mon, 1 Jun 2020 19:28:05 +0000 From: Wasim Khan To: devel@edk2.groups.io, meenakshi.aggarwal@nxp.com, V.Sethi@nxp.com, ard.biesheuvel@arm.com, leif@nuviainc.com CC: Wasim Khan Subject: [PATCH edk2-platforms 2/3] Silicon/NXP: LS1043A: Add Serdes Support Date: Tue, 2 Jun 2020 00:57:37 +0530 Message-ID: <1591039658-18541-3-git-send-email-wasim.khan@oss.nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1591039658-18541-1-git-send-email-wasim.khan@oss.nxp.com> References: <1591039658-18541-1-git-send-email-wasim.khan@oss.nxp.com> X-ClientProxiedBy: PN1PR01CA0082.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::22) To VE1PR04MB6702.eurprd04.prod.outlook.com (2603:10a6:803:123::13) Return-Path: wasim.khan@oss.nxp.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wasimk-VirtualBox.nxp.com (157.37.140.9) by PN1PR01CA0082.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3045.18 via Frontend Transport; Mon, 1 Jun 2020 19:28:03 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [157.37.140.9] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c8dafbd8-f784-45d1-cad2-08d80661e876 X-MS-TrafficTypeDiagnostic: VE1PR04MB6768: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 0421BF7135 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wllkwe5CUASoDSfONZu+X2pRo+LfAsxKNCuD6eTS7GaCp9nYdq/xXRKd+3OZkA/h4fNMGChemMowuH9xlhP0dou+5ft10K3NtFUfkOSneyB5VNt6Ptv9zveEXigo3gYPqatlQO9+1Ze3CAJTXrUkNQM0YDGdXXtanVapIK44wIanIS9wVTJOjCp3v9+8dTqpkPTXi+rmUcMf5CBX9X4iKcE9C0y5Js1ZQf6VZABrkNXH+ycclBb8b0rLu1a5WpWe492rtNs11wXHIj/keIHVrwKmQphCcQbZyYWCOXrytm6s/M/pRBWx1ylV+QxOVkkPp90XZc/T+1tra3D3Gqiq1Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6702.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(39860400002)(376002)(366004)(136003)(346002)(83380400001)(6512007)(19627235002)(6486002)(66946007)(66556008)(8676002)(2616005)(44832011)(66476007)(26005)(186003)(16526019)(956004)(2906002)(6506007)(86362001)(316002)(52116002)(6666004)(478600001)(4326008)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: LOmVYkaXkJ6q2szjeiu71e+/yqCT6fB6SjCWMpZlKBC7Eef4kbxuY4NgpalcQ/12MeTo/TnAdRPergUIKPQAgjwJHfhfQPbyMlomJVVYuBs9q/pRzxaP7Ca7jZFf/haMc4F7V+RzS5m9IQFsjulApL4UV4v8XH0vjQe8HbBnsM/b0faQiUAECqVixMRldaRo658Yhp9WI5wZU+GzjT6m6U6pG+gz2ye4QoIXxFX1IORxFM0nbURDPsvLKr1hUdwyKcgGanYq+TQm8XAzYVBvlQw2x+RDES982Asd2IOQ/HbASnrh0Ov+hq5342dcOePAoekjPNfstdWPG/GCp6gAJpdqDHcYaEuUYr2f1XQWrHx9P8HZK5/x4eGxcE6cGh/04UaN/o968a9XQjM2Ne4wQaOqVCtR0Mj3w4djfDDSwfaKZLGtYAudH44qMJLGFiqPoJKx3M3uQdxOxmHnkMU0ejCW3t2LYvZomLN0HwUYOO4= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8dafbd8-f784-45d1-cad2-08d80661e876 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2020 19:28:05.7407 (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: i0tEOI22l4jnJ2he2TBz/sZnHdVOjWA5ueUUfQKE6b+WseA1pnC94PobMrwIt1GZUrMKTn0zRP67kHw4L3/Zjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6768 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Wasim Khan Based on serdes protocol value in reset configuration word (RCW) different IP blocks gets enabled in HW. Add SoC specific serdes configuration for LS1043A, which can be used by different IPs to know the enabled interfaces and perform the required initialization. Signed-off-by: Wasim Khan --- Silicon/NXP/LS1043A/LS1043A.dsc.inc | 2 + Silicon/NXP/LS1043A/Library/SocLib/SocLib.inf | 6 ++ Silicon/NXP/Include/Library/SerDes.h | 28 ++++++++ Silicon/NXP/LS1043A/Include/SocSerDes.h | 68 ++++++++++++++++++ Silicon/NXP/LS1043A/Library/SocLib/SerDes.c | 75 ++++++++++++++++++++ 5 files changed, 179 insertions(+) diff --git a/Silicon/NXP/LS1043A/LS1043A.dsc.inc b/Silicon/NXP/LS1043A/LS10= 43A.dsc.inc index e023bfbc7c04..b598b5790b65 100644 --- a/Silicon/NXP/LS1043A/LS1043A.dsc.inc +++ b/Silicon/NXP/LS1043A/LS1043A.dsc.inc @@ -12,6 +12,7 @@ [LibraryClasses.common] SocLib|Silicon/NXP/LS1043A/Library/SocLib/SocLib.inf SerialPortLib|Silicon/NXP/Library/DUartPortLib/DUartPortLib.inf + SerDesHelperLib|Silicon/NXP/Library/SerDesHelperLib/SerDesHelperLib.inf =20 ##########################################################################= ###### # @@ -37,4 +38,5 @@ [PcdsFixedAtBuild.common] gNxpQoriqLsTokenSpaceGuid.PcdNumPciController|3 gNxpQoriqLsTokenSpaceGuid.PcdPcieLutBase|0x10000 gNxpQoriqLsTokenSpaceGuid.PcdPcieLutDbg|0x7FC + gNxpQoriqLsTokenSpaceGuid.PcdSerdesLanes|0x4 ## diff --git a/Silicon/NXP/LS1043A/Library/SocLib/SocLib.inf b/Silicon/NXP/LS= 1043A/Library/SocLib/SocLib.inf index 3d0f988e1c67..4731bea8b92e 100644 --- a/Silicon/NXP/LS1043A/Library/SocLib/SocLib.inf +++ b/Silicon/NXP/LS1043A/Library/SocLib/SocLib.inf @@ -22,6 +22,12 @@ [Packages] [LibraryClasses] ChassisLib DebugLib + PcdLib + SerDesHelperLib =20 [Sources.common] SocLib.c + SerDes.c + +[FixedPcd] + gNxpQoriqLsTokenSpaceGuid.PcdSerdesLanes diff --git a/Silicon/NXP/Include/Library/SerDes.h b/Silicon/NXP/Include/Lib= rary/SerDes.h new file mode 100644 index 000000000000..d846589401c6 --- /dev/null +++ b/Silicon/NXP/Include/Library/SerDes.h @@ -0,0 +1,28 @@ +/** SerDes.h + Header file for SoC specific Serdes routines + + Copyright 2017-2020 NXP + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef SERDES_H +#define SERDES_H + +VOID +GetSerdesProtocolMaps ( + OUT UINT64 *SerDesPrtclMap + ); + +typedef VOID +(*SERDES_PROBE_LANES_CALLBACK) ( + IN UINT32 LaneProtocol, + IN VOID *Arg + ); + +VOID +SerDesProbeLanes ( + IN SERDES_PROBE_LANES_CALLBACK SerDesLaneProbeCallback, + IN VOID *Arg + ); +#endif diff --git a/Silicon/NXP/LS1043A/Include/SocSerDes.h b/Silicon/NXP/LS1043A/= Include/SocSerDes.h new file mode 100644 index 000000000000..5bf93cb32df6 --- /dev/null +++ b/Silicon/NXP/LS1043A/Include/SocSerDes.h @@ -0,0 +1,68 @@ +/** @file + SoC Specific header file for Serdes mapping + + Copyright 2017-2020 NXP + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SOC_SERDES_H +#define SOC_SERDES_H + +typedef enum { + NONE =3D 0, + PCIE1, + PCIE2, + PCIE3, + SATA, + SGMII_FM1_DTSEC1, + SGMII_FM1_DTSEC2, + SGMII_FM1_DTSEC5, + SGMII_FM1_DTSEC6, + SGMII_FM1_DTSEC9, + SGMII_FM1_DTSEC10, + QSGMII_FM1_A, + XFI_FM1_MAC9, + XFI_FM1_MAC10, + SGMII_2500_FM1_DTSEC2, + SGMII_2500_FM1_DTSEC5, + SGMII_2500_FM1_DTSEC9, + SGMII_2500_FM1_DTSEC10, + SERDES_PRTCL_COUNT +} SERDES_PROTOCOL; + +SERDES_CONFIG SerDes1ConfigTbl[] =3D { + /* SerDes 1 */ + {0x1555, {XFI_FM1_MAC9, PCIE1, PCIE2, PCIE3 } }, + {0x2555, {SGMII_2500_FM1_DTSEC9, PCIE1, PCIE2, PCIE3 } }, + {0x4555, {QSGMII_FM1_A, PCIE1, PCIE2, PCIE3 } }, + {0x4558, {QSGMII_FM1_A, PCIE1, PCIE2, SATA } }, + {0x1355, {XFI_FM1_MAC9, SGMII_FM1_DTSEC2, PCIE2, PCIE3 } }, + {0x2355, {SGMII_2500_FM1_DTSEC9, SGMII_FM1_DTSEC2, PCIE2, PCIE3 } }, + {0x3335, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, SGMII_FM1_DTSEC5, PCIE3 } = }, + {0x3355, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, PCIE2, PCIE3 } }, + {0x3358, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, PCIE2, SATA } }, + {0x3555, {SGMII_FM1_DTSEC9, PCIE1, PCIE2, PCIE3 } }, + {0x3558, {SGMII_FM1_DTSEC9, PCIE1, PCIE2, SATA } }, + {0x7000, {PCIE1, PCIE1, PCIE1, PCIE1 } }, + {0x9998, {PCIE1, PCIE2, PCIE3, SATA } }, + {0x6058, {PCIE1, PCIE1, PCIE2, SATA } }, + {0x1455, {XFI_FM1_MAC9, QSGMII_FM1_A, PCIE2, PCIE3 } }, + {0x2455, {SGMII_2500_FM1_DTSEC9, QSGMII_FM1_A, PCIE2, PCIE3 } }, + {0x2255, {SGMII_2500_FM1_DTSEC9, SGMII_2500_FM1_DTSEC2, PCIE2, PCIE3 } }= , + {0x3333, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, SGMII_FM1_DTSEC5, SGMII_FM= 1_DTSEC6 } }, + {0x1460, {XFI_FM1_MAC9, QSGMII_FM1_A, PCIE3, PCIE3 } }, + {0x2460, {SGMII_2500_FM1_DTSEC9, QSGMII_FM1_A, PCIE3, PCIE3 } }, + {0x3460, {SGMII_FM1_DTSEC9, QSGMII_FM1_A, PCIE3, PCIE3 } }, + {0x3455, {SGMII_FM1_DTSEC9, QSGMII_FM1_A, PCIE2, PCIE3 } }, + {0x9960, {PCIE1, PCIE2, PCIE3, PCIE3 } }, + {0x2233, {SGMII_2500_FM1_DTSEC9, SGMII_FM1_DTSEC2, SGMII_FM1_DTSEC5, SGM= II_FM1_DTSEC6 } }, + {0x2533, {SGMII_2500_FM1_DTSEC9, PCIE1, SGMII_FM1_DTSEC5, SGMII_FM1_DTSE= C6 } }, + {} +}; + +SERDES_CONFIG *SerDesConfigTbl[] =3D { + SerDes1ConfigTbl +}; +#endif diff --git a/Silicon/NXP/LS1043A/Library/SocLib/SerDes.c b/Silicon/NXP/LS10= 43A/Library/SocLib/SerDes.c new file mode 100644 index 000000000000..c27367621168 --- /dev/null +++ b/Silicon/NXP/LS1043A/Library/SocLib/SerDes.c @@ -0,0 +1,75 @@ +/** SerDes.c + Provides SoC specific serdes interface + + Copyright 2017-2020 NXP + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include + +#define RCWSR_SRDS1_PRTCL_MASK 0xffff0000 +#define RCWSR_SRDS1_PRTCL_SHIFT 16 + +/** + Probe all serdes lanes for lane protocol and execute provided callback f= unction. + + @param SerDesLaneProbeCallback Pointer Callback function to be called f= or Lane protocol + @param Arg Pointer to Arguments to be passed to cal= lback function. + +**/ +VOID +SerDesProbeLanes ( + IN SERDES_PROBE_LANES_CALLBACK SerDesLaneProbeCallback, + IN VOID *Arg + ) +{ + UINT32 SrdsProt; + LS1043A_DEVICE_CONFIG *Dcfg; + + Dcfg =3D (LS1043A_DEVICE_CONFIG *)LS1043A_DCFG_ADDRESS; + SrdsProt =3D DcfgRead32 ((UINTN)&Dcfg->RcwSr[4]) & RCWSR_SRDS1_PRTCL_MAS= K; + SrdsProt >>=3D RCWSR_SRDS1_PRTCL_SHIFT; + + SerDesInstanceProbeLanes (SRDS_1, SrdsProt, + FixedPcdGet8 (PcdSerdesLanes), + SERDES_PRTCL_COUNT, + SerDesConfigTbl[SRDS_1], + SerDesLaneProbeCallback, + Arg); +} + +/** + Function to return Serdes protocol map for all serdes available on board= . + + @param SerDesPrtclMap Pointer to Serdes protocl map. + +**/ +VOID +GetSerdesProtocolMaps ( + OUT UINT64 *SerDesPrtclMap + ) +{ + UINT32 SrdsProt; + LS1043A_DEVICE_CONFIG *Dcfg; + EFI_STATUS Status; + + *SerDesPrtclMap =3D 0x0; + Dcfg =3D (LS1043A_DEVICE_CONFIG *)LS1043A_DCFG_ADDRESS; + SrdsProt =3D DcfgRead32 ((UINTN)&Dcfg->RcwSr[4]) & RCWSR_SRDS1_PRTCL_MAS= K; + SrdsProt >>=3D RCWSR_SRDS1_PRTCL_SHIFT; + + Status =3D GetSerDesMap (SRDS_1, SrdsProt, FixedPcdGet8 (PcdSerdesLanes)= , + SERDES_PRTCL_COUNT, SerDesConfigTbl[SRDS_1], + SerDesPrtclMap); + + if (Status !=3D EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR, "%a: failed for Serdes1 \n",__FUNCTION__)); + *SerDesPrtclMap =3D 0x0; + } +} --=20 2.7.4