
On Fri, Nov 25, 2016 at 9:38 AM, Olliver Schinagl oliver@schinagl.nl wrote:
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 oliver@schinagl.nl
drivers/net/sunxi_emac.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/drivers/net/sunxi_emac.c b/drivers/net/sunxi_emac.c index bba8630..7d45f8b 100644 --- a/drivers/net/sunxi_emac.c +++ b/drivers/net/sunxi_emac.c @@ -565,6 +565,21 @@ static int sunxi_emac_eth_write_hwaddr(struct udevice *dev) return _sunxi_write_hwaddr(priv, pdata->enetaddr); }
+__weak int sunxi_emac_board_read_rom_hwaddr(unsigned char *enetaddr, int id) +{
return -ENOSYS;
+}
+static int sunxi_emac_eth_read_rom_hwaddr(struct udevice *dev) +{
struct eth_pdata *pdata = dev_get_platdata(dev);
if (!dev)
return -ENOSYS;
return sunxi_emac_board_read_rom_hwaddr(pdata->enetaddr, dev->seq);
+}
static int sunxi_emac_eth_probe(struct udevice *dev) { struct eth_pdata *pdata = dev_get_platdata(dev); @@ -582,6 +597,7 @@ static const struct eth_ops sunxi_emac_eth_ops = { .recv = sunxi_emac_eth_recv, .stop = sunxi_emac_eth_stop, .write_hwaddr = sunxi_emac_eth_write_hwaddr,
.read_rom_hwaddr = sunxi_emac_eth_read_rom_hwaddr,
};
I think we are already on the same page, but the solution would look like this, but the ops themselves would be redefined in a separate board-specific driver and would only have a read_rom_hwaddr op in that driver, not this one. Then the board specific "sunxi_emac_eth_read_rom_hwaddr()" would simply be in that driver, not a weak reference to it.
static int sunxi_emac_eth_ofdata_to_platdata(struct udevice *dev)
2.10.2
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot