netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Holland <jotihojr@gmail.com>
To: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org
Subject: [Intel-wired-lan] [next] igb: allow setting MAC address on i211 using a device tree blob V5
Date: Thu, 18 Feb 2016 12:10:52 +0100	[thread overview]
Message-ID: <56C5A6BC.6030708@gmail.com> (raw)

Hello,

The Intel i211 LOM PCIe Ethernet controllers' iNVM operates as an OTP
and has no external EEPROM interface [1]. The following allows the
driver to pickup the MAC address from a device tree blob when CONFIG_OF
has been enabled.

[1] 
http://www.intel.com/content/www/us/en/embedded/products/networking/i211-ethernet-controller-datasheet.html

Changes V2
- Restrict searching for compatible devices to current pci device.

Changes V3
- Add device tree binding documentation.

Changes V4
- Rebase patch.

Changes V5
- Use eth_platform_get_mac_address() to resolve MAC specified in a dtb.
- Remove now invalid device tree binding documentation specified in V3
   und V4.

Signed-off-by: John Holland<jotihojr@gmail.com>
---
  drivers/net/ethernet/intel/igb/igb_main.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index a98f418..d3e8228 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -50,6 +50,7 @@
  #include <linux/aer.h>
  #include <linux/prefetch.h>
  #include <linux/pm_runtime.h>
+#include <linux/etherdevice.h>
  #ifdef CONFIG_IGB_DCA
  #include <linux/dca.h>
  #endif
@@ -2507,9 +2508,11 @@ static int igb_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
                 break;
         }

-       /* copy the MAC address out of the NVM */
-       if (hw->mac.ops.read_mac_addr(hw))
-               dev_err(&pdev->dev, "NVM Read Error\n");
+       if (eth_platform_get_mac_address(&pdev->dev, hw->mac.addr)) {
+               /* copy the MAC address out of the NVM */
+               if (hw->mac.ops.read_mac_addr(hw))
+                       dev_err(&pdev->dev, "NVM Read Error\n");
+       }

         memcpy(netdev->dev_addr, hw->mac.addr, netdev->addr_len);

             reply	other threads:[~2016-02-18 11:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 11:10 John Holland [this message]
2016-02-18 13:43 ` [Intel-wired-lan] [next] igb: allow setting MAC address on i211 using a device tree blob V5 John Holland
2016-03-01  2:52 ` Brown, Aaron F
2016-03-01  6:56   ` John Holland
2016-03-01 23:23     ` Brown, Aaron F
2016-03-01 23:55     ` Jeff Kirsher
2016-03-02  3:48       ` John Holland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56C5A6BC.6030708@gmail.com \
    --to=jotihojr@gmail.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).