From nobody Thu Dec 26 01:32:11 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 15072758821108.113035517506773; Fri, 6 Oct 2017 00:44:42 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 47F1821EA15DF; Fri, 6 Oct 2017 00:41:13 -0700 (PDT) Received: from mail-lf0-x231.google.com (mail-lf0-x231.google.com [IPv6:2a00:1450:4010:c07::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3F9332095B061 for ; Fri, 6 Oct 2017 00:41:11 -0700 (PDT) Received: by mail-lf0-x231.google.com with SMTP id g70so3850322lfl.3 for ; Fri, 06 Oct 2017 00:44:34 -0700 (PDT) Received: from enkidu.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id v29sm194155ljv.27.2017.10.06.00.44.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Oct 2017 00:44:31 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4010:c07::231; helo=mail-lf0-x231.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zOFX++VRIU2IkVAQVtxDRPEmf/tmo+f5JhtLwqZ7Vzc=; b=oBIjO9KXJ8mC9YM0CBfNPyfd/naYfAhD679/hB9cracdQ8PcSKOQyc0H2VWZUryuMA AXdK/5uQ53MBidlikHuS8oE03t4/cPJGLqQ5Xsx/1zspyw/Xj9Eezk40IJW0slfSljN3 V4hJsTn6AtL9ehHhH3LuREaDyVioR2/fN6oXOPCYtAdDz4rHlXvkkMVTKn0gCUsR7Sep 7tF3HUzYLEUZaa7UlFOkPzS2GfpI5Vl2s/GCzJaY4/ND/dX47S+lZo80BSj5dyg2k+jT k16VUJXSszL3CJS5dR/T2+9BkojAdFu22nyFHzN8FuYMtl0OVaQKoJHp6pmdGgEFOYzi +ppg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zOFX++VRIU2IkVAQVtxDRPEmf/tmo+f5JhtLwqZ7Vzc=; b=IJ6Io17DpWmedQxCJhyYEOCNvDY+x/zpdhUgxhOy1GyxSPZlx1sIorhd3FdDvzZpB6 /Ma+QWKcAAczHJIOLDTXxgiyNvOwWwlIQsJ6teHtntcnlEpSSFWacZ6+Wc0brBnWsMVA Kj5qG8WStg0TVOxUbJ4HG9tpOttZiLG5IOxvGLN/AuNB9Mckodoq9ACoMe1gJBaTR1Yq P1zgJy+hrHZpA/x90Gg9ZlTs2r2BQI+Ce5fQCVZB35Uq50GxcSIMFeH4NS1pXx1+oLHg 0o47pcx5DtENM2lqMNa+JM8zITJ5fVcMiILKhuWtVaK1MwBsFndoJvSTNOFTNSis7CYp /aYQ== X-Gm-Message-State: AMCzsaVEAHH3iPAPtRdp1wFmrppqxiebEJdXjFF6qwpOW3831GvMiV9t QRbTFtzueSz3zxs+Bo4okJuAsY++p5E= X-Google-Smtp-Source: AOwi7QBuWOgcbeyEZL0EENZhyc6DfFCNGrbs6SDEXzRX4O/6PsS1pZZ3g/Ibqh6XrprmyJ6ZUd3PdA== X-Received: by 10.25.213.194 with SMTP id m185mr212412lfg.175.1507275872205; Fri, 06 Oct 2017 00:44:32 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Date: Fri, 6 Oct 2017 09:51:17 +0200 Message-Id: <1507276278-3608-5-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1507276278-3608-1-git-send-email-mw@semihalf.com> References: <1507276278-3608-1-git-send-email-mw@semihalf.com> Subject: [edk2] [platforms: PATCH 4/5] Marvell/Drivers: Pp2Dxe: Rework PHY handling X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jinghua@marvell.com, ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Hitherto PHY handling in Pp2Dxe was not flexible. It allowed for using only single MDIO controller, which may not be true on Armada 80x0 SoCs. For this purpose introduce the MDIO description, using the new structures and template in MvHwDescLib. This change enables addition of multiple CP110 hardware blocks with MDIO controllers. This change required different PHY handling and obtaining data over desired MDIO bus. Now given Pp2 port is matched with the PHY via its index in gMarvellTokenSpaceGuid.PcdPhyDeviceIds. The PHY itself is mapped to the MDIO controller, using gMarvellTokenSpaceGuid.PcdPhy2MdioController. Also obtaining SMI addresses was moved to the PHY initialization routine. All above allow for much cleaner and logical PHY description in the .dsc file. Update PortingGuide documentation accordingly and Armada 70x0 DB NIC/PHY description. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada/Armada70x0.dsc | 8 +- Platform/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.c | 35 ++++-- Platform/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf | 3 - Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c | 122 ++++++++++++-= ------- Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h | 2 - Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.inf | 4 +- Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 16 +-- Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.h | 2 +- Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.inf | 4 +- Platform/Marvell/Include/Library/MvHwDescLib.h | 23 ++++ Platform/Marvell/Include/Protocol/Mdio.h | 6 + Platform/Marvell/Include/Protocol/MvPhy.h | 1 + Platform/Marvell/Marvell.dec | 8 +- Silicon/Marvell/Documentation/PortingGuide.txt | 50 ++++---- 14 files changed, 179 insertions(+), 105 deletions(-) diff --git a/Platform/Marvell/Armada/Armada70x0.dsc b/Platform/Marvell/Arma= da/Armada70x0.dsc index 04bdf7c..3b75381 100644 --- a/Platform/Marvell/Armada/Armada70x0.dsc +++ b/Platform/Marvell/Armada/Armada70x0.dsc @@ -115,18 +115,20 @@ gMarvellTokenSpaceGuid.PcdUtmiPortType|{ 0x0, 0x1 } =20 #MDIO - gMarvellTokenSpaceGuid.PcdMdioBaseAddress|0xF212A200 + gMarvellTokenSpaceGuid.PcdMdioControllers|{ 0x1, 0x0 } =20 #PHY - gMarvellTokenSpaceGuid.PcdPhyConnectionTypes|{ 0x8, 0x4, 0x0 } + gMarvellTokenSpaceGuid.PcdPhy2MdioController|{ 0x0, 0x0 } gMarvellTokenSpaceGuid.PcdPhyDeviceIds|{ 0x0, 0x0 } + gMarvellTokenSpaceGuid.PcdPhySmiAddresses|{ 0x0, 0x1 } gMarvellTokenSpaceGuid.PcdPhyStartupAutoneg|FALSE =20 #NET - gMarvellTokenSpaceGuid.PcdPhySmiAddresses|{ 0xff, 0x0, 0x1 } gMarvellTokenSpaceGuid.PcdPp2GopIndexes|{ 0x0, 0x2, 0x3 } gMarvellTokenSpaceGuid.PcdPp2InterfaceAlwaysUp|{ 0x0, 0x0, 0x0 } gMarvellTokenSpaceGuid.PcdPp2InterfaceSpeed|{ 0x5, 0x3, 0x3 } + gMarvellTokenSpaceGuid.PcdPp2PhyConnectionTypes|{ 0x8, 0x4, 0x0 } + gMarvellTokenSpaceGuid.PcdPp2PhyIndexes|{ 0xFF, 0x0, 0x1 } gMarvellTokenSpaceGuid.PcdPp2Port2Controller|{ 0x0, 0x0, 0x0 } gMarvellTokenSpaceGuid.PcdPp2PortIds|{ 0x0, 0x1, 0x2 } gMarvellTokenSpaceGuid.PcdPp2Controllers|{ 0x1 } diff --git a/Platform/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.c b/Platform/= Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.c index ae466d7..12aabad 100644 --- a/Platform/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.c +++ b/Platform/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.c @@ -46,7 +46,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA= GE. =20 #include "MvMdioDxe.h" =20 -UINT64 MdioBase =3D 0; +DECLARE_A7K8K_MDIO_TEMPLATE; =20 STATIC EFI_STATUS @@ -70,7 +70,7 @@ MdioCheckParam ( STATIC EFI_STATUS MdioWaitReady ( - VOID + UINT32 MdioBase ) { UINT32 Timeout =3D MVEBU_SMI_TIMEOUT; @@ -92,7 +92,7 @@ MdioWaitReady ( STATIC EFI_STATUS MdioWaitValid ( - VOID + UINT32 MdioBase ) { UINT32 Timeout =3D MVEBU_SMI_TIMEOUT; @@ -116,11 +116,13 @@ EFI_STATUS MdioOperation ( IN CONST MARVELL_MDIO_PROTOCOL *This, IN UINT32 PhyAddr, + IN UINT32 MdioIndex, IN UINT32 RegOff, IN BOOLEAN Write, IN OUT UINT32 *Data ) { + UINT32 MdioBase =3D This->BaseAddresses[MdioIndex]; UINT32 MdioReg; EFI_STATUS Status; =20 @@ -131,7 +133,7 @@ MdioOperation ( } =20 /* wait till the SMI is not busy */ - Status =3D MdioWaitReady (); + Status =3D MdioWaitReady (MdioBase); if (EFI_ERROR(Status)) { DEBUG((DEBUG_ERROR, "MdioDxe: MdioWaitReady error\n")); return Status; @@ -151,7 +153,7 @@ MdioOperation ( MdioRegWrite32 (MdioReg, MdioBase); =20 /* make sure that the write transaction is over */ - Status =3D Write ? MdioWaitReady () : MdioWaitValid (); + Status =3D Write ? MdioWaitReady (MdioBase) : MdioWaitValid (MdioBase); if (EFI_ERROR(Status)) { DEBUG((DEBUG_ERROR, "MdioDxe: MdioWaitReady error\n")); return Status; @@ -169,6 +171,7 @@ EFI_STATUS MvMdioRead ( IN CONST MARVELL_MDIO_PROTOCOL *This, IN UINT32 PhyAddr, + IN UINT32 MdioIndex, IN UINT32 RegOff, IN UINT32 *Data ) @@ -178,6 +181,7 @@ MvMdioRead ( Status =3D MdioOperation ( This, PhyAddr, + MdioIndex, RegOff, FALSE, Data @@ -190,6 +194,7 @@ EFI_STATUS MvMdioWrite ( IN CONST MARVELL_MDIO_PROTOCOL *This, IN UINT32 PhyAddr, + IN UINT32 MdioIndex, IN UINT32 RegOff, IN UINT32 Data ) @@ -197,6 +202,7 @@ MvMdioWrite ( return MdioOperation ( This, PhyAddr, + MdioIndex, RegOff, TRUE, &Data @@ -210,18 +216,27 @@ MvMdioDxeInitialise ( IN EFI_SYSTEM_TABLE *SystemTable ) { + MVHW_MDIO_DESC *Desc =3D &mA7k8kMdioDescTemplate; + UINT8 Index; MARVELL_MDIO_PROTOCOL *Mdio; EFI_STATUS Status; EFI_HANDLE Handle =3D NULL; =20 Mdio =3D AllocateZeroPool (sizeof (MARVELL_MDIO_PROTOCOL)); + if (Mdio =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "MdioDxe: Protocol allocation failed\n")); + return EFI_OUT_OF_RESOURCES; + } + + /* Obtain base addresses of all possible controllers */ + for (Index =3D 0; Index < Desc->MdioDevCount; Index++) { + Mdio->BaseAddresses[Index] =3D Desc->MdioBaseAddresses[Index]; + } + + Mdio->ControllerCount =3D Desc->MdioDevCount; Mdio->Read =3D MvMdioRead; Mdio->Write =3D MvMdioWrite; - MdioBase =3D PcdGet64 (PcdMdioBaseAddress); - if (MdioBase =3D=3D 0) { - DEBUG((DEBUG_ERROR, "MdioDxe: PcdMdioBaseAddress not set\n")); - return EFI_INVALID_PARAMETER; - } + Status =3D gBS->InstallMultipleProtocolInterfaces ( &Handle, &gMarvellMdioProtocolGuid, Mdio, diff --git a/Platform/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf b/Platfor= m/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf index faab1f7..d9878eb 100644 --- a/Platform/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf +++ b/Platform/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf @@ -62,8 +62,5 @@ [Protocols] gMarvellMdioProtocolGuid =20 -[Pcd] - gMarvellTokenSpaceGuid.PcdMdioBaseAddress - [Depex] TRUE diff --git a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c b/Platfor= m/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c index aeb6f7a..5821885 100644 --- a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c +++ b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.c @@ -41,6 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA= GE. #include #include #include +#include #include #include #include @@ -51,6 +52,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAM= AGE. =20 STATIC MARVELL_MDIO_PROTOCOL *Mdio; =20 +// +// Table with available Mdio controllers +// +STATIC UINT8 * CONST MdioDeviceTable =3D PcdGetPtr (PcdMdioControllers); +// +// Table with PHY to Mdio controller mappings +// +STATIC UINT8 * CONST Phy2MdioController =3D PcdGetPtr (PcdPhy2MdioControll= er); +// +// Table with PHYs' SMI addresses +// +STATIC UINT8 * CONST PhySmiAddresses =3D PcdGetPtr (PcdPhySmiAddresses); + STATIC MV_PHY_DEVICE MvPhyDevices[] =3D { { MV_PHY_DEVICE_1512, MvPhyInit1512 }, { 0, NULL } @@ -64,18 +78,18 @@ MvPhyStatus ( =20 EFI_STATUS MvPhyReset ( - IN UINT32 PhyAddr + IN PHY_DEVICE *PhyDev ) { UINT32 Reg =3D 0; INTN timeout =3D TIMEOUT; =20 - Mdio->Read(Mdio, PhyAddr, MII_BMCR, &Reg); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MII_BMCR, &Reg); Reg |=3D BMCR_RESET; - Mdio->Write(Mdio, PhyAddr, MII_BMCR, Reg); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MII_BMCR, Reg); =20 while ((Reg & BMCR_RESET) && timeout--) { - Mdio->Read(Mdio, PhyAddr, MII_BMCR, &Reg); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MII_BMCR, &Reg); gBS->Stall(1000); } =20 @@ -99,7 +113,7 @@ MvPhyM88e1111sConfig ( (PhyDev->Connection =3D=3D PHY_CONNECTION_RGMII_ID) || (PhyDev->Connection =3D=3D PHY_CONNECTION_RGMII_RXID) || (PhyDev->Connection =3D=3D PHY_CONNECTION_RGMII_TXID)) { - Mdio->Read(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_CR, &Reg); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_EX= T_CR, &Reg); =20 if ((PhyDev->Connection =3D=3D PHY_CONNECTION_RGMII) || (PhyDev->Connection =3D=3D PHY_CONNECTION_RGMII_ID)) { @@ -112,9 +126,9 @@ MvPhyM88e1111sConfig ( Reg |=3D MIIM_88E1111_TX_DELAY; } =20 - Mdio->Write(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_CR, Reg); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_E= XT_CR, Reg); =20 - Mdio->Read(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_SR, &Reg); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_EX= T_SR, &Reg); =20 Reg &=3D ~(MIIM_88E1111_HWCFG_MODE_MASK); =20 @@ -123,50 +137,50 @@ MvPhyM88e1111sConfig ( else Reg |=3D MIIM_88E1111_HWCFG_MODE_COPPER_RGMII; =20 - Mdio->Write(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_SR, Reg); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_E= XT_SR, Reg); } =20 if (PhyDev->Connection =3D=3D PHY_CONNECTION_SGMII) { - Mdio->Read(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_SR, &Reg); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_EX= T_SR, &Reg); =20 Reg &=3D ~(MIIM_88E1111_HWCFG_MODE_MASK); Reg |=3D MIIM_88E1111_HWCFG_MODE_SGMII_NO_CLK; Reg |=3D MIIM_88E1111_HWCFG_FIBER_COPPER_AUTO; =20 - Mdio->Write(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_SR, Reg); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_E= XT_SR, Reg); } =20 if (PhyDev->Connection =3D=3D PHY_CONNECTION_RTBI) { - Mdio->Read(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_CR, &Reg); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_EX= T_CR, &Reg); Reg |=3D (MIIM_88E1111_RX_DELAY | MIIM_88E1111_TX_DELAY); - Mdio->Write(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_CR, Reg); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_E= XT_CR, Reg); =20 - Mdio->Read(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_SR, &Reg); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_EX= T_SR, &Reg); Reg &=3D ~(MIIM_88E1111_HWCFG_MODE_MASK | MIIM_88E1111_HWCFG_FIBER_COPPER_RES); Reg |=3D 0x7 | MIIM_88E1111_HWCFG_FIBER_COPPER_AUTO; - Mdio->Write(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_SR, Reg); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_E= XT_SR, Reg); =20 /* Soft reset */ - MvPhyReset(PhyDev->Addr); + MvPhyReset (PhyDev); =20 - Mdio->Read(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_SR, &Reg); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_EX= T_SR, &Reg); Reg &=3D ~(MIIM_88E1111_HWCFG_MODE_MASK | MIIM_88E1111_HWCFG_FIBER_COPPER_RES); Reg |=3D MIIM_88E1111_HWCFG_MODE_COPPER_RTBI | MIIM_88E1111_HWCFG_FIBER_COPPER_AUTO; - Mdio->Write(Mdio, PhyDev->Addr, MIIM_88E1111_PHY_EXT_SR, Reg); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1111_PHY_E= XT_SR, Reg); } =20 - Mdio->Read(Mdio, PhyDev->Addr, MII_BMCR, &Reg); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MII_BMCR, &Reg); Reg |=3D (BMCR_ANENABLE | BMCR_ANRESTART); Reg &=3D ~BMCR_ISOLATE; - Mdio->Write(Mdio, PhyDev->Addr, MII_BMCR, Reg); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MII_BMCR, Reg); =20 /* Soft reset */ - MvPhyReset(PhyDev->Addr); + MvPhyReset (PhyDev); =20 - MvPhyReset(PhyDev->Addr); + MvPhyReset (PhyDev); =20 return EFI_SUCCESS; } @@ -179,7 +193,7 @@ MvPhyParseStatus ( UINT32 Data; UINT32 Speed; =20 - Mdio->Read(Mdio, PhyDev->Addr, MIIM_88E1xxx_PHY_STATUS, &Data); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1xxx_PHY_STAT= US, &Data); =20 if ((Data & MIIM_88E1xxx_PHYSTAT_LINK) && !(Data & MIIM_88E1xxx_PHYSTAT_SPDDONE)) { @@ -196,7 +210,7 @@ MvPhyParseStatus ( if ((i++ % 1000) =3D=3D 0) DEBUG((DEBUG_ERROR, ".")); gBS->Stall(1000); - Mdio->Read(Mdio, PhyDev->Addr, MIIM_88E1xxx_PHY_STATUS, &Data); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MIIM_88E1xxx_PHY_= STATUS, &Data); } DEBUG((DEBUG_ERROR," done\n")); gBS->Stall(500000); @@ -241,7 +255,7 @@ MvPhyParseStatus ( STATIC VOID MvPhy1512WriteBits ( - IN UINT32 PhyAddr, + IN PHY_DEVICE *PhyDev, IN UINT8 RegNum, IN UINT16 Offset, IN UINT16 Len, @@ -254,19 +268,18 @@ MvPhy1512WriteBits ( else Mask =3D (1 << (Len + Offset)) - (1 << Offset); =20 - Mdio->Read(Mdio, PhyAddr, RegNum, &Reg); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, RegNum, &Reg); =20 Reg &=3D ~Mask; Reg |=3D Data << Offset; =20 - Mdio->Write(Mdio, PhyAddr, RegNum, Reg); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, RegNum, Reg); } =20 STATIC EFI_STATUS MvPhyInit1512 ( IN CONST MARVELL_PHY_PROTOCOL *Snp, - IN UINT32 PhyAddr, IN OUT PHY_DEVICE *PhyDev ) { @@ -278,28 +291,28 @@ MvPhyInit1512 ( * Marvell Release Notes - Alaska 88E1510/88E1518/88E1512 Rev A0, * Errata Section 3.1 - needed in SGMII mode. */ - Mdio->Write(Mdio, PhyAddr, 22, 0x00ff); - Mdio->Write(Mdio, PhyAddr, 17, 0x214B); - Mdio->Write(Mdio, PhyAddr, 16, 0x2144); - Mdio->Write(Mdio, PhyAddr, 17, 0x0C28); - Mdio->Write(Mdio, PhyAddr, 16, 0x2146); - Mdio->Write(Mdio, PhyAddr, 17, 0xB233); - Mdio->Write(Mdio, PhyAddr, 16, 0x214D); - Mdio->Write(Mdio, PhyAddr, 17, 0xCC0C); - Mdio->Write(Mdio, PhyAddr, 16, 0x2159); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 22, 0x00ff); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 17, 0x214B); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 16, 0x2144); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 17, 0x0C28); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 16, 0x2146); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 17, 0xB233); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 16, 0x214D); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 17, 0xCC0C); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 16, 0x2159); =20 /* Reset page selection and select page 0x12 */ - Mdio->Write(Mdio, PhyAddr, 22, 0x0000); - Mdio->Write(Mdio, PhyAddr, 22, 0x0012); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 22, 0x0000); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 22, 0x0012); =20 /* Write HWCFG_MODE =3D SGMII to Copper */ - MvPhy1512WriteBits(PhyAddr, 20, 0, 3, 1); + MvPhy1512WriteBits(PhyDev, 20, 0, 3, 1); =20 /* Phy reset - necessary after changing mode */ - MvPhy1512WriteBits(PhyAddr, 20, 15, 1, 1); + MvPhy1512WriteBits(PhyDev, 20, 15, 1, 1); =20 /* Reset page selection */ - Mdio->Write(Mdio, PhyAddr, 22, 0x0000); + Mdio->Write (Mdio, PhyDev->Addr, PhyDev->MdioIndex, 22, 0x0000); gBS->Stall(100); } =20 @@ -309,7 +322,7 @@ MvPhyInit1512 ( if (!PcdGetBool (PcdPhyStartupAutoneg)) return EFI_SUCCESS; =20 - Mdio->Read(Mdio, PhyAddr, MII_BMSR, &Data); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MII_BMSR, &Data); =20 if ((Data & BMSR_ANEGCAPABLE) && !(Data & BMSR_ANEGCOMPLETE)) { =20 @@ -322,12 +335,12 @@ MvPhyInit1512 ( } =20 gBS->Stall(1000); /* 1 ms */ - Mdio->Read(Mdio, PhyAddr, MII_BMSR, &Data); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MII_BMSR, &Data); } PhyDev->LinkUp =3D TRUE; DEBUG((DEBUG_INFO, "MvPhyDxe: link up\n")); } else { - Mdio->Read(Mdio, PhyAddr, MII_BMSR, &Data); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MII_BMSR, &Data); =20 if (Data & BMSR_LSTATUS) { PhyDev->LinkUp =3D TRUE; @@ -345,7 +358,7 @@ MvPhyInit1512 ( EFI_STATUS MvPhyInit ( IN CONST MARVELL_PHY_PROTOCOL *Snp, - IN UINT32 PhyAddr, + IN UINT32 PhyIndex, IN PHY_CONNECTION PhyConnection, IN OUT PHY_DEVICE **OutPhyDev ) @@ -353,6 +366,7 @@ MvPhyInit ( EFI_STATUS Status; PHY_DEVICE *PhyDev; UINT8 *DeviceIds; + UINT8 MdioIndex; INTN i; =20 Status =3D gBS->LocateProtocol ( @@ -363,12 +377,20 @@ MvPhyInit ( if (EFI_ERROR(Status)) return Status; =20 + MdioIndex =3D Phy2MdioController[PhyIndex]; + + /* Verify correctness of PHY <-> MDIO assignment */ + if (!MVHW_DEV_ENABLED (Mdio, MdioIndex) || MdioIndex >=3D Mdio->Controll= erCount) { + DEBUG ((DEBUG_ERROR, "MvPhyDxe: Incorrect Mdio controller assignment f= or PHY#%d", PhyIndex)); + return EFI_INVALID_PARAMETER; + } + /* perform setup common for all PHYs */ PhyDev =3D AllocateZeroPool (sizeof (PHY_DEVICE)); - PhyDev->Addr =3D PhyAddr; + PhyDev->Addr =3D PhySmiAddresses[PhyIndex]; PhyDev->Connection =3D PhyConnection; DEBUG((DEBUG_INFO, "MvPhyDxe: PhyAddr is %d, connection %d\n", - PhyAddr, PhyConnection)); + PhyDev->Addr, PhyConnection)); *OutPhyDev =3D PhyDev; =20 DeviceIds =3D PcdGetPtr (PcdPhyDeviceIds); @@ -377,7 +399,7 @@ MvPhyInit ( if (MvPhyDevices[i].DevId =3D=3D DeviceIds[i]) { ASSERT (MvPhyDevices[i].DevInit !=3D NULL); /* proceed with PHY-specific initialization */ - return MvPhyDevices[i].DevInit(Snp, PhyAddr, PhyDev); + return MvPhyDevices[i].DevInit (Snp, PhyDev); } } =20 @@ -395,8 +417,8 @@ MvPhyStatus ( { UINT32 Data; =20 - Mdio->Read(Mdio, PhyDev->Addr, MII_BMSR, &Data); - Mdio->Read(Mdio, PhyDev->Addr, MII_BMSR, &Data); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MII_BMSR, &Data); + Mdio->Read (Mdio, PhyDev->Addr, PhyDev->MdioIndex, MII_BMSR, &Data); =20 if ((Data & BMSR_LSTATUS) =3D=3D 0) { PhyDev->LinkUp =3D FALSE; diff --git a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h b/Platfor= m/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h index 6bd06c5..0c3d935 100644 --- a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h +++ b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.h @@ -174,7 +174,6 @@ typedef EFI_STATUS (*MV_PHY_DEVICE_INIT) ( IN CONST MARVELL_PHY_PROTOCOL *Snp, - IN UINT32 PhyAddr, IN OUT PHY_DEVICE *PhyDev ); =20 @@ -187,7 +186,6 @@ STATIC EFI_STATUS MvPhyInit1512 ( IN CONST MARVELL_PHY_PROTOCOL *Snp, - IN UINT32 PhyAddr, IN OUT PHY_DEVICE *PhyDev ); =20 diff --git a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.inf b/Platf= orm/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.inf index c262ce4..f96cf35 100644 --- a/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.inf +++ b/Platform/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.inf @@ -63,8 +63,10 @@ gMarvellPhyProtocolGuid =20 [Pcd] - gMarvellTokenSpaceGuid.PcdPhyConnectionTypes + gMarvellTokenSpaceGuid.PcdMdioControllers + gMarvellTokenSpaceGuid.PcdPhy2MdioController gMarvellTokenSpaceGuid.PcdPhyDeviceIds + gMarvellTokenSpaceGuid.PcdPhySmiAddresses gMarvellTokenSpaceGuid.PcdPhyStartupAutoneg =20 [Depex] diff --git a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c b/Platform/Marvel= l/Drivers/Net/Pp2Dxe/Pp2Dxe.c index 620bd5c..2827976 100644 --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c @@ -519,14 +519,14 @@ Pp2DxePhyInitialize ( return Status; } =20 - if (Pp2Context->Port.PhyAddr =3D=3D 0xff) { + if (Pp2Context->Port.PhyIndex =3D=3D 0xff) { /* PHY iniitalization not required */ return EFI_SUCCESS; } =20 Status =3D Pp2Context->Phy->Init( Pp2Context->Phy, - Pp2Context->Port.PhyAddr, + Pp2Context->Port.PhyIndex, Pp2Context->Port.PhyInterface, &Pp2Context->PhyDev ); @@ -1147,25 +1147,25 @@ Pp2DxeParsePortPcd ( IN INTN Index ) { - UINT8 *PortIds, *GopIndexes, *PhyConnectionTypes, *AlwaysUp, *Speed, *Ph= yAddresses; + UINT8 *PortIds, *GopIndexes, *PhyConnectionTypes, *AlwaysUp, *Speed, *Ph= yIndexes; =20 PortIds =3D PcdGetPtr (PcdPp2PortIds); GopIndexes =3D PcdGetPtr (PcdPp2GopIndexes); - PhyConnectionTypes =3D PcdGetPtr (PcdPhyConnectionTypes); - PhyAddresses =3D PcdGetPtr (PcdPhySmiAddresses); + PhyConnectionTypes =3D PcdGetPtr (PcdPp2PhyConnectionTypes); + PhyIndexes =3D PcdGetPtr (PcdPp2PhyIndexes); AlwaysUp =3D PcdGetPtr (PcdPp2InterfaceAlwaysUp); Speed =3D PcdGetPtr (PcdPp2InterfaceSpeed); =20 ASSERT (PcdGetSize (PcdPp2GopIndexes) =3D=3D PcdGetSize (PcdPp2PortIds)); - ASSERT (PcdGetSize (PcdPhyConnectionTypes) =3D=3D PcdGetSize (PcdPp2Port= Ids)); + ASSERT (PcdGetSize (PcdPp2PhyConnectionTypes) =3D=3D PcdGetSize (PcdPp2P= ortIds)); ASSERT (PcdGetSize (PcdPp2InterfaceAlwaysUp) =3D=3D PcdGetSize (PcdPp2Po= rtIds)); ASSERT (PcdGetSize (PcdPp2InterfaceSpeed) =3D=3D PcdGetSize (PcdPp2PortI= ds)); - ASSERT (PcdGetSize (PcdPhySmiAddresses) =3D=3D PcdGetSize (PcdPp2PortIds= )); + ASSERT (PcdGetSize (PcdPp2PhyIndexes) =3D=3D PcdGetSize (PcdPp2PortIds)); =20 Pp2Context->Port.Id =3D PortIds[Index]; Pp2Context->Port.GopIndex =3D GopIndexes[Index]; Pp2Context->Port.PhyInterface =3D PhyConnectionTypes[Index]; - Pp2Context->Port.PhyAddr =3D PhyAddresses[Index]; + Pp2Context->Port.PhyIndex =3D PhyIndexes[Index]; Pp2Context->Port.AlwaysUp =3D AlwaysUp[Index]; Pp2Context->Port.Speed =3D Speed[Index]; } diff --git a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.h b/Platform/Marvel= l/Drivers/Net/Pp2Dxe/Pp2Dxe.h index cde2995..60f40be 100644 --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.h +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.h @@ -327,7 +327,7 @@ struct Pp2DxePort { UINT16 RxRingSize; =20 INT32 PhyInterface; - UINTN PhyAddr; + UINT32 PhyIndex; BOOLEAN Link; BOOLEAN Duplex; BOOLEAN AlwaysUp; diff --git a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.inf b/Platform/Marv= ell/Drivers/Net/Pp2Dxe/Pp2Dxe.inf index 752fcc0..b4568d8 100644 --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.inf +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.inf @@ -71,12 +71,12 @@ gMarvellPhyProtocolGuid =20 [Pcd] - gMarvellTokenSpaceGuid.PcdPhyConnectionTypes - gMarvellTokenSpaceGuid.PcdPhySmiAddresses gMarvellTokenSpaceGuid.PcdPp2Controllers gMarvellTokenSpaceGuid.PcdPp2GopIndexes gMarvellTokenSpaceGuid.PcdPp2InterfaceAlwaysUp gMarvellTokenSpaceGuid.PcdPp2InterfaceSpeed + gMarvellTokenSpaceGuid.PcdPp2PhyConnectionTypes + gMarvellTokenSpaceGuid.PcdPp2PhyIndexes gMarvellTokenSpaceGuid.PcdPp2Port2Controller gMarvellTokenSpaceGuid.PcdPp2PortIds =20 diff --git a/Platform/Marvell/Include/Library/MvHwDescLib.h b/Platform/Marv= ell/Include/Library/MvHwDescLib.h index 6ad1bc2..9ae03d0 100644 --- a/Platform/Marvell/Include/Library/MvHwDescLib.h +++ b/Platform/Marvell/Include/Library/MvHwDescLib.h @@ -70,6 +70,16 @@ typedef struct { } MVHW_I2C_DESC; =20 // +// MDIO devices description template definition +// +#define MVHW_MAX_MDIO_DEVS 2 + +typedef struct { + UINT8 MdioDevCount; + UINTN MdioBaseAddresses[MVHW_MAX_MDIO_DEVS]; +} MVHW_MDIO_DESC; + +// // NonDiscoverable devices description template definition // #define MVHW_MAX_XHCI_DEVS 4 @@ -168,6 +178,19 @@ MVHW_I2C_DESC mA7k8kI2cDescTemplate =3D {\ } =20 // +// Platform description of MDIO devices +// +#define MVHW_CP0_MDIO_BASE 0xF212A200 +#define MVHW_CP1_MDIO_BASE 0xF412A200 + +#define DECLARE_A7K8K_MDIO_TEMPLATE \ +STATIC \ +MVHW_MDIO_DESC mA7k8kMdioDescTemplate =3D {\ + 2,\ + { MVHW_CP0_MDIO_BASE, MVHW_CP1_MDIO_BASE }\ +} + +// // Platform description of NonDiscoverable devices // #define MVHW_CP0_XHCI0_BASE 0xF2500000 diff --git a/Platform/Marvell/Include/Protocol/Mdio.h b/Platform/Marvell/In= clude/Protocol/Mdio.h index 10acad4..d077a8f 100644 --- a/Platform/Marvell/Include/Protocol/Mdio.h +++ b/Platform/Marvell/Include/Protocol/Mdio.h @@ -35,6 +35,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA= GE. #ifndef __MDIO_H__ #define __MDIO_H__ =20 +#include + #define MARVELL_MDIO_PROTOCOL_GUID { 0x40010b03, 0x5f08, 0x496a, { 0xa2, 0= x64, 0x10, 0x5e, 0x72, 0xd3, 0x71, 0xaa }} =20 typedef struct _MARVELL_MDIO_PROTOCOL MARVELL_MDIO_PROTOCOL; @@ -44,6 +46,7 @@ EFI_STATUS (EFIAPI *MARVELL_MDIO_READ) ( IN CONST MARVELL_MDIO_PROTOCOL *This, IN UINT32 PhyAddr, + IN UINT32 MdioIndex, IN UINT32 RegOff, IN UINT32 *Data ); @@ -53,6 +56,7 @@ EFI_STATUS (EFIAPI *MARVELL_MDIO_WRITE) ( IN CONST MARVELL_MDIO_PROTOCOL *This, IN UINT32 PhyAddr, + IN UINT32 MdioIndex, IN UINT32 RegOff, IN UINT32 Data ); @@ -60,6 +64,8 @@ EFI_STATUS struct _MARVELL_MDIO_PROTOCOL { MARVELL_MDIO_READ Read; MARVELL_MDIO_WRITE Write; + UINTN BaseAddresses[MVHW_MAX_MDIO_DEVS]; + UINTN ControllerCount; }; =20 extern EFI_GUID gMarvellMdioProtocolGuid; diff --git a/Platform/Marvell/Include/Protocol/MvPhy.h b/Platform/Marvell/I= nclude/Protocol/MvPhy.h index a91759a..99c75b3 100644 --- a/Platform/Marvell/Include/Protocol/MvPhy.h +++ b/Platform/Marvell/Include/Protocol/MvPhy.h @@ -62,6 +62,7 @@ typedef enum { =20 typedef struct { UINT32 Addr; + UINT8 MdioIndex; BOOLEAN LinkUp; BOOLEAN FullDuplex; BOOLEAN AutoNegotiation; diff --git a/Platform/Marvell/Marvell.dec b/Platform/Marvell/Marvell.dec index 00d99fa..cd2f3ad 100644 --- a/Platform/Marvell/Marvell.dec +++ b/Platform/Marvell/Marvell.dec @@ -160,19 +160,21 @@ gMarvellTokenSpaceGuid.PcdUtmiPortType|{ 0x0 }|VOID*|0x30000207 =20 #MDIO - gMarvellTokenSpaceGuid.PcdMdioBaseAddress|0|UINT64|0x3000043 + gMarvellTokenSpaceGuid.PcdMdioControllers|{ 0x0 }|VOID*|0x3000043 =20 #PHY - gMarvellTokenSpaceGuid.PcdPhyConnectionTypes|{ 0x0 }|VOID*|0x3000044 + gMarvellTokenSpaceGuid.PcdPhy2MdioController|{ 0x0 }|VOID*|0x3000027 gMarvellTokenSpaceGuid.PcdPhyDeviceIds|{ 0x0 }|VOID*|0x3000095 + gMarvellTokenSpaceGuid.PcdPhySmiAddresses|{ 0x0 }|VOID*|0x3000024 gMarvellTokenSpaceGuid.PcdPhyStartupAutoneg|FALSE|BOOLEAN|0x3000070 =20 #NET - gMarvellTokenSpaceGuid.PcdPhySmiAddresses|{ 0x0 }|VOID*|0x3000024 gMarvellTokenSpaceGuid.PcdPp2Controllers|{ 0x0 }|VOID*|0x3000028 gMarvellTokenSpaceGuid.PcdPp2GopIndexes|{ 0x0 }|VOID*|0x3000029 gMarvellTokenSpaceGuid.PcdPp2InterfaceAlwaysUp|{ 0x0 }|VOID*|0x300002A gMarvellTokenSpaceGuid.PcdPp2InterfaceSpeed|{ 0x0 }|VOID*|0x300002B + gMarvellTokenSpaceGuid.PcdPp2PhyConnectionTypes|{ 0x0 }|VOID*|0x3000044 + gMarvellTokenSpaceGuid.PcdPp2PhyIndexes|{ 0x0 }|VOID*|0x3000045 gMarvellTokenSpaceGuid.PcdPp2Port2Controller|{ 0x0 }|VOID*|0x300002D gMarvellTokenSpaceGuid.PcdPp2PortIds|{ 0x0 }|VOID*|0x300002C =20 diff --git a/Silicon/Marvell/Documentation/PortingGuide.txt b/Silicon/Marve= ll/Documentation/PortingGuide.txt index 8a9f603..52968ae 100644 --- a/Silicon/Marvell/Documentation/PortingGuide.txt +++ b/Silicon/Marvell/Documentation/PortingGuide.txt @@ -125,25 +125,15 @@ PHY Driver configuration MvPhyDxe provides basic initialization and status routines for Marvell PHY= s. Currently only 1518 series PHYs are supported. Following PCDs are required: =20 - - gMarvellTokenSpaceGuid.PcdPhyConnectionTypes - (list of values corresponding to PHY_CONNECTION enum) - gMarvellTokenSpaceGuid.PcdPhyStartupAutoneg (boolean - if true, driver waits for autonegotiation on startup) - gMarvellTokenSpaceGuid.PcdPhyDeviceIds (list of values corresponding to MV_PHY_DEVICE_ID enum) + - gMarvellTokenSpaceGuid.PcdPhySmiAddresses + (addresses of PHY devices) + - gMarvellTokenSpaceGuid.PcdPhy2MdioController + (Array specifying, which Mdio controller the PHY is attached to) =20 -PHY_CONNECTION enum type is defined as follows: - - typedef enum { - 0 PHY_CONNECTION_RGMII, - 1 PHY_CONNECTION_RGMII_ID, - 2 PHY_CONNECTION_RGMII_TXID, - 3 PHY_CONNECTION_RGMII_RXID, - 4 PHY_CONNECTION_SGMII, - 5 PHY_CONNECTION_RTBI, - 6 PHY_CONNECTION_XAUI, - 7 PHY_CONNECTION_RXAUI - } PHY_CONNECTION; =20 MV_PHY_DEVICE_ID: =20 @@ -152,11 +142,8 @@ MV_PHY_DEVICE_ID: } MV_PHY_DEVICE_ID; =20 It should be extended when adding support for other PHY models. -Thus in order to set RGMII for 1st PHY and SGMII for 2nd, PCD should be: - - gMarvellTokenSpaceGuid.PcdPhyConnectionTypes|{ 0x0, 0x4 } =20 -with disabled autonegotiation: +Disable autonegotiation: =20 gMarvellTokenSpaceGuid.PcdPhyStartupAutoneg|FALSE =20 @@ -170,8 +157,9 @@ MDIO configuration MDIO driver provides access to network PHYs' registers via EFI_MDIO_READ a= nd EFI_MDIO_WRITE functions (EFI_MDIO_PROTOCOL). Following PCD is required: =20 - - gMarvellTokenSpaceGuid.PcdMdioBaseAddress - (base address of SMI management register) + - gMarvellTokenSpaceGuid.PcdMdioControllers + (Array with used controllers + Set to 0x1 for enabled, 0x0 for disabled) =20 =20 I2C configuration @@ -248,8 +236,26 @@ are required to operate: - gMarvellTokenSpaceGuid.PcdPp2Port2Controller (Array specifying, to which controller the port belongs to) =20 - - gMarvellTokenSpaceGuid.PcdPhySmiAddresses - (Addresses of PHY devices) + - gMarvellTokenSpaceGuid.PcdPp2PhyConnectionTypes + (List of values corresponding to PHY_CONNECTION enum, which + is defined as follows: + + typedef enum { + 0 PHY_CONNECTION_RGMII, + 1 PHY_CONNECTION_RGMII_ID, + 2 PHY_CONNECTION_RGMII_TXID, + 3 PHY_CONNECTION_RGMII_RXID, + 4 PHY_CONNECTION_SGMII, + 5 PHY_CONNECTION_RTBI, + 6 PHY_CONNECTION_XAUI, + 7 PHY_CONNECTION_RXAUI + } PHY_CONNECTION; ) + + - gMarvellTokenSpaceGuid.PcdPp2PhyIndexes + (Array specifying, to which PHY from + gMarvellTokenSpaceGuid.PcdPhyDeviceIds is used. If none, + e.g. in 10G SFI in-band link detection, 0xFF value must + be specified) =20 - gMarvellTokenSpaceGuid.PcdPp2PortIds (Identificators of PP2 ports) --=20 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel