From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::244; helo=mail-wm0-x244.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 76E00210F16D9 for ; Mon, 18 Jun 2018 09:44:48 -0700 (PDT) Received: by mail-wm0-x244.google.com with SMTP id r15-v6so15196014wmc.1 for ; Mon, 18 Jun 2018 09:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=22BOFaxGQJ5NwAePsB3vodvUUa6YicRGtb0VVoDzYks=; b=g7N+w4uGx1hcmZ0aE7f5bzoHs7Z/sYlYdgC1MyvlJHHPdkcHF4P5EmYLVfINmSyycR +Lngww83RC3vo4FGyoEPx1mxiPNcObrYStWwNhfGqzP65O7vNTR3NVluyjizJ4dzcMbG BZKgZOids+PIfqngMmPmmXarN9K06MmILnpCE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=22BOFaxGQJ5NwAePsB3vodvUUa6YicRGtb0VVoDzYks=; b=Lp2DcYtQSL8SjHUNchpENHPXaDRriMdYvuikcYHzjEjBsl3T6wPx3bUVhgLSlQy1rz Acl6VC5kUml4kq3FBDsu3OrChwIToETZpljiiMdp4iRDtkmUgu+hkco2EiVYJx8iYK/O sepNvkBN/H4WrU1mrPZRwWGYAjjO0otnOLkSdwrKQbzSktTxoPg2Hol15zMdDBETQNVU 1F4ERSSDolK+NjvI1JfkFjkjdycAV6wP9hBTBq8sAFy+fcHnU6ka3YymzKoEynk6rkta 7EzvqD7pP9jygPA2Bno3qWSufPwkHFztGeFGoec3LiKPgZe5LBWbydVG3M91IJ5LoDL4 xhaw== X-Gm-Message-State: APt69E1ynhYvYBm2wSQAnKhm0yG4e0Kk+BMLoGKW0/HeKAcUwHDR4ImN FGqQmtXdqUobz2ViNA8xxjIHvQ== X-Google-Smtp-Source: ADUXVKKC6zmaKrqZnJr59t/Sl3Zt5gBYjyGQTOQ1TPFqjRNHi9OAJYoNaxjV78DSX5ty8TUhu5+X2w== X-Received: by 2002:a1c:4a06:: with SMTP id x6-v6mr4719141wma.89.1529340286625; Mon, 18 Jun 2018 09:44:46 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id f17-v6sm8709096wmc.2.2018.06.18.09.44.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 09:44:45 -0700 (PDT) Date: Mon, 18 Jun 2018 17:44:44 +0100 From: Leif Lindholm To: Marcin Wojtas Cc: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, jinghua@marvell.com, jsd@semihalf.com, jaz@semihalf.com Message-ID: <20180618164444.5q2sr3rfzpocbfh3@bivouac.eciton.net> References: <1529266325-18371-1-git-send-email-mw@semihalf.com> <1529266325-18371-20-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1529266325-18371-20-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [platforms: PATCH v2 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 16:44:48 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jun 17, 2018 at 10:11:59PM +0200, Marcin Wojtas wrote: > 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 >