From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4010:c07::243; helo=mail-lf0-x243.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) (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 120672110A010 for ; Fri, 8 Jun 2018 08:35:07 -0700 (PDT) Received: by mail-lf0-x243.google.com with SMTP id g21-v6so18730719lfb.4 for ; Fri, 08 Jun 2018 08:35:06 -0700 (PDT) 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=8Bru4zQ5E215rh2xwI0ek5og5uVeogcGXpCsJXvJYdY=; b=xQRnKhP/SENKDnCZ1Nfgtk5636g9fR+mvK6CBNmbg/M1rGm4D4pWzdcy1/tqqSz3rP mzFStkknU37A/7H8A4nKMz0TE42S3JgN9aW/NyRWr1kuG3bvxl6fp3aN0Cr8zV4UnpWZ kwBLUoT8kK/QCSvBu4dMKHulpZLws0xtfOWaBUn6Ya8nKvWXyG7nfNff6V4+DmzZESEX knZRNKmSck3hEtUqpZGl2X7jchvgoKCkHarLU4G1aG2mWcRzjRYEe/t3f17pKihghj+X Sb6ohIiksD/T2jgcgo7J5poTeM/LPQ8EAJozyEQw/f5rl9H4HETFhIfWvK7aeYr/jCGE jWVw== 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=8Bru4zQ5E215rh2xwI0ek5og5uVeogcGXpCsJXvJYdY=; b=Qg5ZboF3fx7/vTtmXsKhu6eBuArjHn/kPOdiEMCyU7HK9IIA6UxU2yDzU8d1+gxoYT +gFhnUKa+5ooxd2n8Glrhbg/J+uDuEzOoh+f64sCdhxz7mqdP18AC72LXgHfFzuMKc93 GuSmPmB+yU2Cv/NwJvnueI4R8Nqec48nPKTB87qlen/SZTFqqy61OePRRl0B2oP4kO9W i8tOrWa/liDsJXiDJRg7Fqu68z1D12se4qYhzXhTGkCtq+uPMEvOMtFuigaOEkMJuxmS dlu5f59+69g9xLpxy5J86uJhlTDNIadEnW3r7usnz4awLnTZOT1Vh1putMgTlV9dg6B2 KEeg== X-Gm-Message-State: APt69E1fkt9a7usHe3QyTHBOI7w6KIktYwU0IEA5gLcxxwfP9r9a92RN ivoii2nsa1smDoyfy1cw6GrIfnzw9SU= X-Google-Smtp-Source: ADUXVKIGaGz2oyRXApzyQ9piiYpWN+E247bQk8L3OjOKUb3XXnoXZEu26Jk9c8bawrXRjN46x47nbg== X-Received: by 2002:a2e:302:: with SMTP id 2-v6mr4872877ljd.9.1528472105123; Fri, 08 Jun 2018 08:35:05 -0700 (PDT) Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id v79-v6sm7355396lfd.32.2018.06.08.08.35.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jun 2018 08:35:04 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, jinghua@marvell.com, mw@semihalf.com, jsd@semihalf.com, jaz@semihalf.com Date: Fri, 8 Jun 2018 17:34:17 +0200 Message-Id: <1528472063-1660-20-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528472063-1660-1-git-send-email-mw@semihalf.com> References: <1528472063-1660-1-git-send-email-mw@semihalf.com> Subject: [platforms PATCH 19/25] Marvell/Drivers: MvBoardDesc: Extend protocol with MDIO support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2018 15:35:07 -0000 Introduce new callback that can provide information about MDIO controllers to the Mdio driver. Extend ArmadaBoardDescLib with new structure MV_BOARD_MDIO_DESC, for holding board specific data. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Hua Jing --- Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 37 ++++++++++++++++++++ Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 8 +++++ Silicon/Marvell/Include/Protocol/BoardDesc.h | 8 +++++ 3 files changed, 53 insertions(+) diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c index d580319..8f3bdfa 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c @@ -96,6 +96,42 @@ MvBoardDescComPhyGet ( STATIC EFI_STATUS +MvBoardDescMdioGet ( + IN MARVELL_BOARD_DESC_PROTOCOL *This, + IN OUT MV_BOARD_MDIO_DESC **MdioDesc + ) +{ + MV_BOARD_MDIO_DESC *BoardDesc; + MV_SOC_MDIO_DESC *SoCDesc; + EFI_STATUS Status; + UINT8 MdioCount; + UINTN Index; + + /* Get SoC data about all available MDIO controllers */ + Status = ArmadaSoCDescMdioGet (&SoCDesc, &MdioCount); + if (EFI_ERROR (Status)) { + return Status; + } + + /* Allocate and fill board description */ + BoardDesc = AllocateZeroPool (MdioCount * sizeof (MV_BOARD_MDIO_DESC)); + if (BoardDesc == NULL) { + DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); + return EFI_OUT_OF_RESOURCES; + } + + for (Index = 0; Index < MdioCount; Index++) { + BoardDesc[Index].SoC = &SoCDesc[Index]; + } + + BoardDesc->MdioDevCount = MdioCount; + *MdioDesc = BoardDesc; + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS MvBoardDescAhciGet ( IN MARVELL_BOARD_DESC_PROTOCOL *This, IN OUT MV_BOARD_AHCI_DESC **AhciDesc @@ -434,6 +470,7 @@ MvBoardDescInitProtocol ( ) { BoardDescProtocol->BoardDescComPhyGet = MvBoardDescComPhyGet; + BoardDescProtocol->BoardDescMdioGet = MvBoardDescMdioGet; BoardDescProtocol->BoardDescAhciGet = MvBoardDescAhciGet; BoardDescProtocol->BoardDescSdMmcGet = MvBoardDescSdMmcGet; BoardDescProtocol->BoardDescXhciGet = MvBoardDescXhciGet; diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h index 1b56316..5379679 100644 --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h @@ -28,6 +28,14 @@ typedef struct { } MV_BOARD_COMPHY_DESC; // +// MDIO devices per-board description +// +typedef struct { + MV_SOC_MDIO_DESC *SoC; + UINT8 MdioDevCount; +} MV_BOARD_MDIO_DESC; + +// // NonDiscoverableDevices per-board description // diff --git a/Silicon/Marvell/Include/Protocol/BoardDesc.h b/Silicon/Marvell/Include/Protocol/BoardDesc.h index 27250db..cff802a 100644 --- a/Silicon/Marvell/Include/Protocol/BoardDesc.h +++ b/Silicon/Marvell/Include/Protocol/BoardDesc.h @@ -50,6 +50,13 @@ EFI_STATUS typedef EFI_STATUS +(EFIAPI *MV_BOARD_DESC_MDIO_GET) ( + IN MARVELL_BOARD_DESC_PROTOCOL *This, + IN OUT MV_BOARD_MDIO_DESC **MdioDesc + ); + +typedef +EFI_STATUS (EFIAPI *MV_BOARD_DESC_AHCI_GET) ( IN MARVELL_BOARD_DESC_PROTOCOL *This, IN OUT MV_BOARD_AHCI_DESC **AhciDesc @@ -91,6 +98,7 @@ VOID struct _MARVELL_BOARD_DESC_PROTOCOL { MV_BOARD_DESC_COMPHY_GET BoardDescComPhyGet; + MV_BOARD_DESC_MDIO_GET BoardDescMdioGet; MV_BOARD_DESC_AHCI_GET BoardDescAhciGet; MV_BOARD_DESC_SDMMC_GET BoardDescSdMmcGet; MV_BOARD_DESC_XHCI_GET BoardDescXhciGet; -- 2.7.4