[U-Boot] [PATCH 1/6] net: gem: Add support for reading MAC from I2C EEPROM
Michal Simek
monstr at monstr.eu
Sat Feb 13 11:39:37 CET 2016
Add support for reading MAC address from I2C EEPROM.
Signed-off-by: Michal Simek <monstr at monstr.eu>
---
drivers/net/zynq_gem.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index b3821c31a91d..ace60c901cb5 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -627,6 +627,21 @@ static int zynq_gem_remove(struct udevice *dev)
return 0;
}
+static int zynq_gem_read_rom_hwaddr(struct udevice *dev)
+{
+#if defined(CONFIG_ZYNQ_GEM_EEPROM_ADDR) && \
+ defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET)
+ struct eth_pdata *pdata = dev_get_platdata(dev);
+
+ if (eeprom_read(CONFIG_ZYNQ_GEM_EEPROM_ADDR,
+ CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET,
+ pdata->enetaddr, ARRAY_SIZE(pdata->enetaddr)))
+ printf("EEPROM MAC address read failed\n");
+#endif
+ return 0;
+}
+
+
static const struct eth_ops zynq_gem_ops = {
.start = zynq_gem_init,
.send = zynq_gem_send,
@@ -634,6 +649,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_hwaddr,
};
static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
--
1.9.1
More information about the U-Boot
mailing list