From patchwork Fri Nov 25 15:38:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olliver Schinagl X-Patchwork-Id: 699294 X-Patchwork-Delegate: joe.hershberger@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3tQKxz51vzz9t3N for ; Sat, 26 Nov 2016 02:39:35 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=schinagl.nl header.i=@schinagl.nl header.b="v3Nqjn+H"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ED841B385C; Fri, 25 Nov 2016 16:39:16 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RLfGo7WoDht9; Fri, 25 Nov 2016 16:39:16 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 49D414BA29; Fri, 25 Nov 2016 16:39:06 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 363354BA35 for ; Fri, 25 Nov 2016 16:38:55 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zay2GLXV6G6c for ; Fri, 25 Nov 2016 16:38:55 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from 7of9.schinagl.nl (7of9.schinagl.nl [88.159.158.68]) by theia.denx.de (Postfix) with ESMTPS id 5311AB3837 for ; Fri, 25 Nov 2016 16:38:51 +0100 (CET) Received: from localhost.localdomain (static-98-101-100-159.thenetworkfactory.nl [159.100.101.98]) by 7of9.schinagl.nl (Postfix) with ESMTPA id E31C053BC7; Fri, 25 Nov 2016 16:38:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=schinagl.nl; s=7of9; t=1480088331; bh=82CEtCPkm6vBNTszFDL2S+Q9FymMoYEZXOVX/CyYZ40=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=v3Nqjn+HmEpw7r9uaW5pnWuv3VT13SCFFO8bEHU/hf/pSXxQXu0QiMxXoBIqzRHKr IDZnUOmjK+Z0s0OkY5vO1EF3zA6VjwQjBewR0xWbU+lpUrWUizEddvH0g2jZL95KI5 LDn++StFDRMCgVPk5rzOn9Ky3lQ8xFpxv/Mg3DeY= From: Olliver Schinagl To: Joe Hershberger , Hans De Goede Date: Fri, 25 Nov 2016 16:38:33 +0100 Message-Id: <20161125153838.15366-2-oliver@schinagl.nl> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161125153838.15366-1-oliver@schinagl.nl> References: <20161125153838.15366-1-oliver@schinagl.nl> Cc: u-boot@lists.denx.de, dev@linux-sunxi.org, Maxime Ripard , Ian Campbell , Olliver Schinagl Subject: [U-Boot] [PATCH 1/6] net: dw: Add read_rom_hwaddr net_op hook X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add the read_rom_hwaddr net_op hook so that it can be called from boards to read the mac from a ROM chip. Signed-off-by: Olliver Schinagl --- drivers/net/designware.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 9e6d726..3f2f67c 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -230,6 +230,21 @@ static int _dw_write_hwaddr(struct dw_eth_dev *priv, u8 *mac_id) return 0; } +__weak int dw_board_read_rom_hwaddr(unsigned char *enetaddr, int id) +{ + return -ENOSYS; +} + +static int designware_eth_read_rom_hwaddr(struct udevice *dev) +{ + struct eth_pdata *pdata = dev_get_platdata(dev); + + if (!dev) + return -ENOSYS; + + return dw_board_read_rom_hwaddr(pdata->enetaddr, dev->seq); +} + static void dw_adjust_link(struct eth_mac_regs *mac_p, struct phy_device *phydev) { @@ -685,6 +700,7 @@ static const struct eth_ops designware_eth_ops = { .free_pkt = designware_eth_free_pkt, .stop = designware_eth_stop, .write_hwaddr = designware_eth_write_hwaddr, + .read_rom_hwaddr = designware_eth_read_rom_hwaddr, }; static int designware_eth_ofdata_to_platdata(struct udevice *dev)