From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.70]) by mx.groups.io with SMTP id smtpd.web12.34598.1591635037488166238 for ; Mon, 08 Jun 2020 09:50:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nxp1.onmicrosoft.com header.s=selector2-nxp1-onmicrosoft-com header.b=arn2Fmht; spf=pass (domain: oss.nxp.com, ip: 40.107.22.70, mailfrom: wasim.khan@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MdVC4dqZzvhNV5UMCJDGDoNeNeYQOAgxzqekd7B51pxAyr4wLLEwdmv1QbOplMJCwt7thnoDLPnyDWdcfK8H2sgKb9VwdCabdShUEZSqAVtXXLw73SduK4+mHGyOZAnEXKVtsAx0PO/U3WaGG8A3i2U6VaTbNj4dPJFkqbOnY2+GbVx8faW4gtk025GLotsTKE6bS9IXwbg+ZIn9tx0677lHuNo5N4R64tNvEnZyVg44goe5egHZ5Hv4LJzJYOX0HEyYAAq9D7y7GYuTiP5JZau4ZVc5jsjNJ/ekS0CuVgzSf+Rc4P9LvzlD36V93ZIMICpcFgvG4omYhY+I0UwT/w== 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=KQ/kuHpuIeoECJUbb5flkO4IXWXifY7j9acR1ePDl5Q=; b=m0zTmCQgzEr6b6hRA5D5tgMcp70dkjtrk8v1go+RyytEA873hAHxVwnQ0MrJBTVVS23TH88KAbC48KajXVY1iAOHqQInrYMRl7tld110MX8wUzk+tMbTJI40ne7PGyTAe2EWhcyWh62WKNp+LnIpAaGKE+Zy6Nu37vcJ8ZFhsv5VWR4bzrer95IpJQaE2Op6NEE/kJgDFyU7rAI15LfGegoavfn+yNuAQCK1wODustdxMFdxvjB85mF6OTjE7xI0+qqa5un4z3fLxo4zsDfP6OPC6frERl9Mge2LNBaY4DKihAXJuejWIfIly/9FIyLjDJYH6iFYMwHXFg7q+dumgA== 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=KQ/kuHpuIeoECJUbb5flkO4IXWXifY7j9acR1ePDl5Q=; b=arn2Fmht29Kf7WDRTHMyB0rn9JoXf7BpE36DbWsA0y4e6piLN9jGWC3EgEdidkNCI66swqHH3Y3QrhnkZysCDs+/AEFJjsZrsZwpBm+EEZ0fNN18y8gUU+41zqf0FnCpA9je4vJyvpll5OQTHNd0uvGlCwK8zTQuR3rB9BAJm8Q= Received: from VE1PR04MB6702.eurprd04.prod.outlook.com (2603:10a6:803:123::13) by VE1PR04MB6525.eurprd04.prod.outlook.com (2603:10a6:803:120::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20; Mon, 8 Jun 2020 16:50:35 +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.3066.023; Mon, 8 Jun 2020 16:50:35 +0000 From: "Wasim Khan (OSS)" To: Leif Lindholm , "Wasim Khan (OSS)" CC: "devel@edk2.groups.io" , Meenakshi Aggarwal , Varun Sethi , "ard.biesheuvel@arm.com" Subject: Re: [PATCH edk2-platforms v2 2/3] Silicon/NXP: LS1043A: Add SerDes Support Thread-Topic: [PATCH edk2-platforms v2 2/3] Silicon/NXP: LS1043A: Add SerDes Support Thread-Index: AQHWPM3PlY7WqkeMD0CIfJiZzbfJJKjO2dQAgAAWY0A= Date: Mon, 8 Jun 2020 16:50:34 +0000 Message-ID: References: <1591535750-15743-1-git-send-email-wasim.khan@oss.nxp.com> <1591535750-15743-3-git-send-email-wasim.khan@oss.nxp.com> <20200608153020.GQ28566@vanye> In-Reply-To: <20200608153020.GQ28566@vanye> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=oss.nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [157.37.216.249] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 910dbda8-6f06-4a5d-d88b-08d80bcc107c x-ms-traffictypediagnostic: VE1PR04MB6525: x-ms-exchange-sharedmailbox-routingagent-processed: True x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 042857DBB5 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xWEfU8bd3lgJBRtMDRvTEXBteQ7h3Czdch012lkXM7Qp8fjJmmsxUocsR3UHJnTjOR/SR5pG1LNNhXOgGt4oZaW/En6FJPuc5DdsxV2zksXe5er7jrurfeCsCqDECvpQfk6lZhSKyfVOmH9x/MGdXgcritehSX/bAwfEYoEzRNNU69tuR64rvrQ4bXmrZ+/RGo5oDVAmZQ/QTtZuvw3nFRuIm7L0seJOax2qTfNzy3w/qScZlLuKAvjsokqfJHBNctOKBt9Suqf8GtsVClxFTCNaQwMxPHh2ImPDLcbooPjHtdKKJNQ5BKe6kx+8btTgAA4zym6xVu3UJ6E7t9IwwA== 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)(346002)(39860400002)(396003)(376002)(366004)(136003)(186003)(26005)(8936002)(8676002)(52536014)(4326008)(83380400001)(86362001)(478600001)(5660300002)(66946007)(76116006)(66556008)(66446008)(71200400001)(110136005)(316002)(9686003)(66476007)(64756008)(19627235002)(54906003)(55016002)(7696005)(53546011)(6506007)(33656002)(2906002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: jmeSUQTIYottebcRZk6Y5I4goWaM/a/nHa++EM5cvWq2m8onUsO2/k7eojEFz6HQaKds4ZuOBx5DbCqH2msUD4iULLZNWUZU3eUfZgb8ep+4hn0dzXFDYsAZ62XjKhGMWQShaigz9gyNA1h+bZfpk6tUGsAOjHeVlTT5xmKaflYULmBJz+oSZUmUXxvkxgdkuKYPpa+Lgn//muRxlsORQPEholo3X4IHOquSRQochX+T6yks/fEQfax/dGeqXV4MJSLG1SC5tmfiw26FLbLImqrO2qgxwO0l4rhPul/xwMaWiNHXmvXpyUpqrpPOsdLDXPITsgISySO3x2qY7tt+mHRLXmzm47WRopppUwTUA27ZuDEu1qPM6MmvRkUXDJlERNaDQTXzn+ukCeE8bcrua+F66k+FM8xN/AA/VrqhdTkdiByDbKC4kQflglHax+cFRzB7oLvda1vewAC2dPsTUput4ieb/8aQgth8TAkoaEZ5HeXrYTH8GaantiqoUoqf MIME-Version: 1.0 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 910dbda8-6f06-4a5d-d88b-08d80bcc107c X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2020 16:50:34.9097 (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: WbnXDaUMcwB2J8W1vk9VCEuvNW36+YbxVBTqOOkMjVwimwi8rhhGkDhTM/qRo2mnR/fldNUNteExhq8hmDwHbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6525 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Leif Lindholm > Sent: Monday, June 8, 2020 9:00 PM > To: Wasim Khan (OSS) > Cc: devel@edk2.groups.io; Meenakshi Aggarwal > ; Varun Sethi ; > ard.biesheuvel@arm.com; Wasim Khan > Subject: Re: [PATCH edk2-platforms v2 2/3] Silicon/NXP: LS1043A: Add SerD= es > Support >=20 > On Sun, Jun 07, 2020 at 18:45:49 +0530, Wasim Khan wrote: > > 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 > > --- > > > > Notes: > > Changes in V2: > > - Addressed review comments for structure, variable and function na= mes > > - Removed SocSerDes.h and moved data definitions to SerDes.c > > > > 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/Library/SocLib/SerDes.c | 132 ++++++++++++++++++= ++ > > 4 files changed, 168 insertions(+) > > > > diff --git a/Silicon/NXP/LS1043A/LS1043A.dsc.inc > > b/Silicon/NXP/LS1043A/LS1043A.dsc.inc > > index e023bfbc7c04..1ac7c6da7092 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 > > > > > > > ################################################################# > ##### > > ########## > > # > > @@ -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/LS1043A/Library/SocLib/SocLib.inf > > index 3d0f988e1c67..728e8f0c8ee1 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 > > > > [Sources.common] > > + SerDes.c > > SocLib.c > > + > > +[FixedPcd] > > + gNxpQoriqLsTokenSpaceGuid.PcdSerDesLanes > > diff --git a/Silicon/NXP/Include/Library/SerDes.h > > b/Silicon/NXP/Include/Library/SerDes.h > > new file mode 100644 > > index 000000000000..f015b40403c5 > > --- /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 > > +GetSerDesProtocolMap ( > > + OUT UINT64 *SerDesProtocolMap > > + ); > > + > > +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/Library/SocLib/SerDes.c > > b/Silicon/NXP/LS1043A/Library/SocLib/SerDes.c > > new file mode 100644 > > index 000000000000..90fa7146faa7 > > --- /dev/null > > +++ b/Silicon/NXP/LS1043A/Library/SocLib/SerDes.c > > @@ -0,0 +1,132 @@ > > +/** SerDes.c > > + Provides SoC specific SerDes interface > > + > > + Copyright 2017-2020 NXP > > + > > + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +// SerDes1 Protocol Mask in Reset Configuration Word (RCW) Status Regi= ster > > +#define SERDES1_PROTOCOL_MASK 0xffff0000 > > + > > +// SerDes1 Protocol Shift in Reset Configuration Word (RCW) Status Reg= ister > > +#define SERDES1_PROTOCOL_SHIFT 16 > > + > > +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_PROTOCOL_COUNT > > +} SERDES_PROTOCOL; >=20 > Thanks for moving the static structs over here. > The typedef was fine in the .h though - are you not going to need it ther= e at > some point? Yes, we may need it later . Thanks for catching this. >=20 > > + > > +SERDES_CONFIG gSerDes1ConfigTable[] =3D { > > + {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_FM1_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, SGMII_FM1_DTSEC6 } }, > > + {0x2533, {SGMII_2500_FM1_DTSEC9, PCIE1, SGMII_FM1_DTSEC5, > > +SGMII_FM1_DTSEC6 } }, > > + {} > > +}; > > + > > +SERDES_CONFIG *gSerDesConfig[] =3D { > > + gSerDes1ConfigTable > > +}; > > + > > +/** > > + Probe all SerDes for lane protocol and execute provided callback fun= ction. > > + > > + @param SerDesLaneProbeCallback Pointer Callback function to be call= ed > for Lane protocol > > + @param Arg Pointer to Arguments to be passed to= callback > function. > > + > > +**/ > > +VOID > > +SerDesProbeLanes ( > > + IN SERDES_PROBE_LANES_CALLBACK SerDesLaneProbeCallback, > > + IN VOID *Arg > > + ) > > +{ > > + UINT32 SerDesProtocol; > > + LS1043A_DEVICE_CONFIG *DeviceConfig; > > + > > + DeviceConfig =3D (LS1043A_DEVICE_CONFIG *)LS1043A_DCFG_ADDRESS; > > + SerDesProtocol =3D DcfgRead32 ((UINTN)&DeviceConfig->RcwSr[4]) & > > + SERDES1_PROTOCOL_MASK; SerDesProtocol >>=3D > SERDES1_PROTOCOL_SHIFT; > > + > > + SerDesInstanceProbeLanes (SERDES_1, SerDesProtocol, > > + FixedPcdGet8 (PcdSerDesLanes), > > + SERDES_PROTOCOL_COUNT, > > + gSerDesConfig[SERDES_1], > > + SerDesLaneProbeCallback, > > + Arg); >=20 > And this indentation is a bit funky. >=20 > > +} > > + > > +/** > > + Function to return SerDes protocol map for all SerDes available on b= oard. > > + > > + @param SerDesProtocolMap Pointer to SerDes protocl map. > > + > > +**/ > > +VOID > > +GetSerDesProtocolMap ( > > + OUT UINT64 *SerDesProtocolMap > > + ) > > +{ > > + UINT32 SerDesProtocol; > > + LS1043A_DEVICE_CONFIG *DeviceConfig; > > + EFI_STATUS Status; > > + > > + *SerDesProtocolMap =3D 0; > > + DeviceConfig =3D (LS1043A_DEVICE_CONFIG *)LS1043A_DCFG_ADDRESS; > > + SerDesProtocol =3D DcfgRead32 ((UINTN)&DeviceConfig->RcwSr[4]) & > > + SERDES1_PROTOCOL_MASK; SerDesProtocol >>=3D > SERDES1_PROTOCOL_SHIFT; > > + > > + Status =3D GetSerDesMap (SERDES_1, SerDesProtocol, FixedPcdGet8 > (PcdSerDesLanes), > > + SERDES_PROTOCOL_COUNT, gSerDesConfig[SERDES_= 1], > > + SerDesProtocolMap); >=20 > As is this one, in a different way to the one above. >=20 > / > Leif >=20 > > + > > + if (Status !=3D EFI_SUCCESS) { > > + DEBUG ((DEBUG_ERROR, "%a: failed for SerDes1 \n",__FUNCTION__)); > > + *SerDesProtocolMap =3D 0; > > + } > > +} > > -- > > 2.7.4 > >