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::241; helo=mail-lf0-x241.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) (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 AD44A2110A3C4 for ; Mon, 18 Jun 2018 15:59:25 -0700 (PDT) Received: by mail-lf0-x241.google.com with SMTP id v84-v6so4003954lfa.1 for ; Mon, 18 Jun 2018 15:59:25 -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=e4oz/LVphMrgpG7kOr3kzkP1Z6zzpTSWmZepUbAKxeU=; b=xk9rpOhT5YJfa5v8yUTNGwNEC++egyA4le3ELr5rH0+VKFd1ruod9JljOdV4xuSpAD 03oPNm0yzQ85vfWvjhTweZFbK44Y5utZMBf6nnl9dDc2iOszq1S+W1luvlNOYqKRBZOF QsOTL4rRMqe0VyWc2L7HV0QHpQZNrHyz5oRXW1ZssT0P87okhI8RyakuGzh5phflaVwc RRInlgxGpB4J1jm2QbdHQDECCp1MtM/b4mx4+8668R49Q4EXJOzyjxYUfJHVH1NaYNfZ w3QIYnwkHICmroPakvVxsjq94J7g2A1Q/9fGXVtYtOlVNIQIEFYZag/POkD/nkRkywgu SwBQ== 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=e4oz/LVphMrgpG7kOr3kzkP1Z6zzpTSWmZepUbAKxeU=; b=fww1BD+H+KBzUq7vQ1QeXRsR6oBkyOCLw5cT3ZqI61vDqVkrZSqfXZqOslrFfiphVB p14E2+dnv9yEJNDtw2g4PA5EOdptqIYJLnlE8jdGEhUu6uxxMzqb8/ljGWodhZOmZcLo bKZcDupPThflFe+2J7TfN6M2DwnvW/++eAURfRRpFIYRKWzNMz+ItGEacfoejSxkbvd8 bTrOQJx4A8yHMyqiOWc2yJQHxsdjjIIGXYW643txntR4Qj5vjuqXvp8lPbKuB2zhVkqY 7iHQqkMo66OvmGX1lUUpTnP30xG57ggrRJ435RmD+d3ywXMd/jLZuj9iRNZkm+p1EbxA q2Ig== X-Gm-Message-State: APt69E1JyAkgXL3OVAgi53mfja20XtrzJZ308SB/x+u+Jk+WXYgi08Yv 5ba2Le99SluZMtkCr8V7F8f/IVlGQls= X-Google-Smtp-Source: ADUXVKJOOnhXPaxkQGxg2ar3ohdRk0XFDWiE0Cja2gw0ZNM5gwxWzSPO2Bfv61IU7pTrvE7zmKvRBw== X-Received: by 2002:a2e:420e:: with SMTP id p14-v6mr9978308lja.26.1529362763736; Mon, 18 Jun 2018 15:59:23 -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 h136-v6sm3020754lfe.23.2018.06.18.15.59.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jun 2018 15:59:23 -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: Tue, 19 Jun 2018 00:58:38 +0200 Message-Id: <1529362724-9244-20-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529362724-9244-1-git-send-email-mw@semihalf.com> References: <1529362724-9244-1-git-send-email-mw@semihalf.com> Subject: [platforms: PATCH v3 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: Mon, 18 Jun 2018 22:59:26 -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: Leif Lindholm --- Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 8 +++++ Silicon/Marvell/Include/Protocol/BoardDesc.h | 8 +++++ Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 36 ++++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h index 32bd915..b11fa9d 100644 --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h @@ -25,6 +25,14 @@ typedef struct { } MV_BOARD_COMPHY_DESC; // +// MDIO devices per-board description +// +typedef struct { + MV_SOC_MDIO_DESC *SoC; + UINTN 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 b6dac75..55297f5 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 @@ -92,6 +99,7 @@ VOID struct _MARVELL_BOARD_DESC_PROTOCOL { MV_BOARD_DESC_AHCI_GET BoardDescAhciGet; MV_BOARD_DESC_COMPHY_GET BoardDescComPhyGet; + MV_BOARD_DESC_MDIO_GET BoardDescMdioGet; MV_BOARD_DESC_PP2_GET BoardDescPp2Get; MV_BOARD_DESC_SDMMC_GET BoardDescSdMmcGet; MV_BOARD_DESC_UTMI_GET BoardDescUtmiGet; diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c index 6bbe40b..5dfc559 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c @@ -100,6 +100,41 @@ 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; + UINTN MdioCount, Index; + EFI_STATUS Status; + + /* 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 @@ -456,6 +491,7 @@ MvBoardDescInitProtocol ( { BoardDescProtocol->BoardDescAhciGet = MvBoardDescAhciGet; BoardDescProtocol->BoardDescComPhyGet = MvBoardDescComPhyGet; + BoardDescProtocol->BoardDescMdioGet = MvBoardDescMdioGet; BoardDescProtocol->BoardDescPp2Get = MvBoardDescPp2Get; BoardDescProtocol->BoardDescSdMmcGet = MvBoardDescSdMmcGet; BoardDescProtocol->BoardDescUtmiGet = MvBoardDescUtmiGet; -- 2.7.4