summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@gmail.com>2016-01-26 11:57:03 -0600
committerMichal Simek <michal.simek@xilinx.com>2016-04-04 20:27:54 +0200
commita509a1d40264516821d0ba2d1d6a6ab2e1a2acbd (patch)
treeaff88d2bad79e4b7a346d6c8f7a5c84612ae097b /drivers
parentb7b3efe75a46c3d6bff43b7b314d1fff90ca65ec (diff)
downloadtalos-obmc-uboot-a509a1d40264516821d0ba2d1d6a6ab2e1a2acbd.tar.gz
talos-obmc-uboot-a509a1d40264516821d0ba2d1d6a6ab2e1a2acbd.zip
net: gem: Allow to set the MAC from an EEPROM
Provide board specific option how to read MAC address from ROM. Do it in generic way to be reusable by differnet boards. If this is not enough board specific functions can be created. Signed-off-by: Joe Hershberger <joe.hershberger@gmail.com> # driver part Signed-off-by: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/zynq_gem.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 4049e1cb94..103ed6169c 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -571,6 +571,23 @@ static void zynq_gem_halt(struct udevice *dev)
ZYNQ_GEM_NWCTRL_TXEN_MASK, 0);
}
+__weak int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
+{
+ return -ENOSYS;
+}
+
+static int zynq_gem_read_rom_mac(struct udevice *dev)
+{
+ int retval;
+ struct eth_pdata *pdata = dev_get_platdata(dev);
+
+ retval = zynq_board_read_rom_ethaddr(pdata->enetaddr);
+ if (retval == -ENOSYS)
+ retval = 0;
+
+ return retval;
+}
+
static int zynq_gem_miiphy_read(struct mii_dev *bus, int addr,
int devad, int reg)
{
@@ -644,6 +661,7 @@ static const struct eth_ops zynq_gem_ops = {
.free_pkt = zynq_gem_free_pkt,
.stop = zynq_gem_halt,
.write_hwaddr = zynq_gem_setup_mac,
+ .read_rom_hwaddr = zynq_gem_read_rom_mac,
};
static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
OpenPOWER on IntegriCloud