From patchwork Tue Nov 8 15:54:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olliver Schinagl X-Patchwork-Id: 692368 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 3tCw2j6cJFz9t2b for ; Wed, 9 Nov 2016 03:37:33 +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="pwmc4jcM"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A8A9FB38C3; Tue, 8 Nov 2016 17:37:12 +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 drH2FFOirvRS; Tue, 8 Nov 2016 17:37:12 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 684EFB3861; Tue, 8 Nov 2016 17:36:50 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0CE63A75CD for ; Tue, 8 Nov 2016 17:02:18 +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 3nChoHobHMLY for ; Tue, 8 Nov 2016 17:02:17 +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 C807FA7594 for ; Tue, 8 Nov 2016 17:02:13 +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 7638F5747FD; Tue, 8 Nov 2016 16:54:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=schinagl.nl; s=7of9; t=1478620492; bh=R962X4233Re+aRiLpKWiJzvr+ZAClhzbSyQjEU0OV9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pwmc4jcMPY9I46tf7pjLToSpce2Qr/8VWUjUoYhhcRfS1it2+NwO3b1LuUMIWrZEa dWlV4gsiHNwR97VyVFahBBl0zem8ZDO+m/dKMzrfQQ0eGWFwz5tw1gZY5z5DpbR7kA ocFYr3kBTY/c9ABHzvY2J8f+bAhHPZ3TmQAG4dFQ= From: Olliver Schinagl To: Ian Campbell , Hans De Goede , Albert Aribaud , Iain Paton , FUKAUMI Naoki , Joe Hershberger , Olliver Schinagl , Simon Glass , Jeffy Chen , Michal Simek , =?UTF-8?q?Stefan=20Br=C3=BCns?= , Nathan Rossi , =?UTF-8?q?Andreas=20Bie=C3=9Fmann?= , Stefano Babic , Stefan Roese , Maxime Ripard Date: Tue, 8 Nov 2016 16:54:27 +0100 Message-Id: <20161108155437.1085-2-oliver@schinagl.nl> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161108155437.1085-1-oliver@schinagl.nl> References: <[PATCH v2 0/5] Retrieve MAC address from EEPROM> <20161108155437.1085-1-oliver@schinagl.nl> X-Mailman-Approved-At: Tue, 08 Nov 2016 17:36:37 +0100 Cc: dev@linux-sunxi.org, u-boot@lists.denx.de Subject: [U-Boot] [PATCH 01/11] 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 Acked-by: Joe Hershberger --- drivers/net/designware.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 9e6d726..aa87f30 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -230,6 +230,23 @@ 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) +{ + return -ENOSYS; +} + +static int designware_eth_read_rom_hwaddr(struct udevice *dev) +{ + int retval; + struct eth_pdata *pdata = dev_get_platdata(dev); + + retval = dw_board_read_rom_hwaddr(pdata->enetaddr); + if (retval == -ENOSYS) + return 0; + + return retval; +} + static void dw_adjust_link(struct eth_mac_regs *mac_p, struct phy_device *phydev) { @@ -685,6 +702,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)