summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTrent Piepho <tpiepho@kymetacorp.com>2015-10-21 19:38:16 +0000
committerSascha Hauer <s.hauer@pengutronix.de>2015-10-22 09:07:52 +0200
commita5c51acab4a9ec7f6cd0a4565e9f46fe579192bf (patch)
tree3c08ca89a4b41714ee96d7a6d79d93f1320db866 /net
parentcb32b33aaf3f76bb21f7aae12c3c3ec6d3d9998b (diff)
downloadbarebox-a5c51acab4a9ec7f6cd0a4565e9f46fe579192bf.tar.gz
barebox-a5c51acab4a9ec7f6cd0a4565e9f46fe579192bf.tar.xz
net: eth: Fixup OF tree with registered MAC addresses too
The eth code registers an OF tree fixup that looks for any nodes in the Linux oftree that match eth devices loaded in barebox and sets the mac-address property in those nodes. The purpose is to pass MAC addresses to the Linux kernel for drivers that expect the MAC address to be in the device tree. If barebox does not have a driver for the network device, either because it has been disabled or because one does not exist, then the OF tree will not be fixed up to include a MAC address. The eth code also has a list of MAC addresses which board code has registered, usually done when it reads the address from an EEPROM or on-chip memory. If an eth device is created later in the boot, it will look here for an address. The registered MAC address list is not used for the OF tree fix up, and this patch changes that. This way barebox can place a MAC address in the device-tree without needing a driver for the network device. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net')
-rw-r--r--net/eth.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/eth.c b/net/eth.c
index befa8d8d01..8bfb6b10a7 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -323,12 +323,20 @@ static void eth_of_fixup_node(struct device_node *root,
static int eth_of_fixup(struct device_node *root, void *unused)
{
+ struct eth_ethaddr *addr;
struct eth_device *edev;
/*
- * Add the mac-address property for each network device we
- * find a nodepath for and which has a valid mac address.
+ * Add the mac-address property for each ethaddr and then each network
+ * device we find a node path for and which has a valid mac address.
+ * This will find both network devices barebox was told about as well as
+ * addresses registered by boards but for which no network device was
+ * ever loaded.
*/
+ list_for_each_entry(addr, &ethaddr_list, list)
+ eth_of_fixup_node(root, addr->node ? addr->node->full_name : NULL,
+ addr->ethid, addr->ethaddr);
+
list_for_each_entry(edev, &netdev_list, list)
eth_of_fixup_node(root, edev->nodepath, edev->dev.id, edev->ethaddr);