]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net: w5100-spi: add support to specify MAC address by device tree
authorAkinobu Mita <akinobu.mita@gmail.com>
Sat, 14 May 2016 05:55:50 +0000 (14:55 +0900)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 May 2016 17:55:49 +0000 (13:55 -0400)
This adds support to specify the MAC address by 'mac-address' or
'local-mac-address' properties in the device tree.  These are common
properties for the Ethernet controller.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Mike Sinkovsky <msink@permonline.ru>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/wiznet/w5100-spi.c
drivers/net/ethernet/wiznet/w5100.c
drivers/net/ethernet/wiznet/w5100.h

index b868e458d0b5dc7929ac44f38ae5d140b9727d66..93a2d3c07303e6eee13f8e3f083b213a4b753609 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
+#include <linux/of_net.h>
 #include <linux/spi/spi.h>
 
 #include "w5100.h"
@@ -414,6 +415,7 @@ static int w5100_spi_probe(struct spi_device *spi)
        const struct spi_device_id *id = spi_get_device_id(spi);
        const struct w5100_ops *ops;
        int priv_size;
+       const void *mac = of_get_mac_address(spi->dev.of_node);
 
        switch (id->driver_data) {
        case W5100:
@@ -432,7 +434,7 @@ static int w5100_spi_probe(struct spi_device *spi)
                return -EINVAL;
        }
 
-       return w5100_probe(&spi->dev, ops, priv_size, NULL, spi->irq, -EINVAL);
+       return w5100_probe(&spi->dev, ops, priv_size, mac, spi->irq, -EINVAL);
 }
 
 static int w5100_spi_remove(struct spi_device *spi)
index 21bef2ca2ac04d5230666c980688a349557015d2..4f6255cf62ce9f7e29d59dec6e01927d2a51721b 100644 (file)
@@ -1052,7 +1052,7 @@ static const struct net_device_ops w5100_netdev_ops = {
 static int w5100_mmio_probe(struct platform_device *pdev)
 {
        struct wiznet_platform_data *data = dev_get_platdata(&pdev->dev);
-       u8 *mac_addr = NULL;
+       const void *mac_addr = NULL;
        struct resource *mem;
        const struct w5100_ops *ops;
        int irq;
@@ -1087,7 +1087,8 @@ void *w5100_ops_priv(const struct net_device *ndev)
 EXPORT_SYMBOL_GPL(w5100_ops_priv);
 
 int w5100_probe(struct device *dev, const struct w5100_ops *ops,
-               int sizeof_ops_priv, u8 *mac_addr, int irq, int link_gpio)
+               int sizeof_ops_priv, const void *mac_addr, int irq,
+               int link_gpio)
 {
        struct w5100_priv *priv;
        struct net_device *ndev;
index f8a16fad807b4884c76c9c893282e763287b4cad..17983a3b8d6c6ad4339ed654249d436ce7c08669 100644 (file)
@@ -30,7 +30,8 @@ struct w5100_ops {
 void *w5100_ops_priv(const struct net_device *ndev);
 
 int w5100_probe(struct device *dev, const struct w5100_ops *ops,
-               int sizeof_ops_priv, u8 *mac_addr, int irq, int link_gpio);
+               int sizeof_ops_priv, const void *mac_addr, int irq,
+               int link_gpio);
 int w5100_remove(struct device *dev);
 
 extern const struct dev_pm_ops w5100_pm_ops;