All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next] igb: allow setting MAC address on i211 using a device tree blob
Date: Tue, 09 Feb 2016 12:02:24 +0100	[thread overview]
Message-ID: <1455015744.3592.46.camel@intel.com> (raw)
In-Reply-To: <56ABE3A8.4010602@gmail.com>

On Fri, 2016-01-29 at 23:11 +0100, John Holland wrote:
> The Intel i211 LOM pcie ethernet controllers' iNVM operates as an
> OTP?
> and has no externel 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/i
> 211-ethernet-controller-datasheet.html
> 
> Signed-off-by: John Holland <jotihojr@gmail.com>
> ---
> ? drivers/net/ethernet/intel/igb/igb_main.c | 30?
> ++++++++++++++++++++++++++++++
> ? 1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c?
> b/drivers/net/ethernet/intel/igb/igb_main.c
> index 31e5f39..9c92443 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -56,6 +56,11 @@
> ? #include <linux/i2c.h>
> ? #include "igb.h"
> 
> +#ifdef defined(CONFIG_OF)
> +#include <linux/of_net.h>
> +#include <linux/etherdevice.h>
> +#endif
> +
> ? #define MAJ 5
> ? #define MIN 3
> ? #define BUILD 0
> @@ -2217,6 +2222,26 @@ static s32 igb_init_i2c(struct igb_adapter
> *adapter)
> ? }
> 
> ? /**
> + *??igb_read_mac_addr_dts - Read mac addres from the device tree
> blob.

Address is mis-spelled above

> + *??@hw: pointer to the e1000 hardware structure
> + **/
> +#ifdef defined(CONFIG_OF)

Minor nitpick, you should have the function comment header wrapped in
the #ifdef as well.

> +static void igb_read_mac_addr_dts(struct e1000_hw *hw)
> +{
> +???????const u8 *mac;
> +???????struct device_node *dn;
> +
> +???????dn = of_find_compatible_node(NULL, NULL, "intel,i211");
> +???????if (!dn)
> +???????????????return;
> +
> +???????mac = of_get_mac_address(dn);
> +???????if (mac)
> +???????????????ether_addr_copy(hw->mac.addr, mac);
> +}
> +#endif
> +
> +/**
> ???*??igb_probe - Device Initialization Routine
> ???*??@pdev: PCI device information struct
> ???*??@ent: entry in igb_pci_tbl
> @@ -2420,6 +2445,11 @@ static int igb_probe(struct pci_dev *pdev,
> const?
> struct pci_device_id *ent)
> ?????????if (hw->mac.ops.read_mac_addr(hw))
> ?????????????????dev_err(&pdev->dev, "NVM Read Error\n");
> 
> +#ifdef defined(CONFIG_OF)
> +???????if (!is_valid_ether_addr(hw->mac.addr))
> +???????????????igb_read_mac_addr_dts(hw);
> +#endif
> +
> ?????????memcpy(netdev->dev_addr, hw->mac.addr, netdev->addr_len);
> 
> ?????????if (!is_valid_ether_addr(netdev->dev_addr)) {
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan at lists.osuosl.org
> http://lists.osuosl.org/mailman/listinfo/intel-wired-lan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20160209/9680d9a7/attachment.asc>

WARNING: multiple messages have this Message-ID (diff)
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: John Holland <jotihojr@gmail.com>,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org
Subject: Re: [Intel-wired-lan] [next] igb: allow setting MAC address on i211 using a device tree blob
Date: Tue, 09 Feb 2016 12:02:24 +0100	[thread overview]
Message-ID: <1455015744.3592.46.camel@intel.com> (raw)
In-Reply-To: <56ABE3A8.4010602@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2889 bytes --]

On Fri, 2016-01-29 at 23:11 +0100, John Holland wrote:
> The Intel i211 LOM pcie ethernet controllers' iNVM operates as an
> OTP 
> and has no externel 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/i
> 211-ethernet-controller-datasheet.html
> 
> Signed-off-by: John Holland <jotihojr@gmail.com>
> ---
>   drivers/net/ethernet/intel/igb/igb_main.c | 30 
> ++++++++++++++++++++++++++++++
>   1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
> b/drivers/net/ethernet/intel/igb/igb_main.c
> index 31e5f39..9c92443 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -56,6 +56,11 @@
>   #include <linux/i2c.h>
>   #include "igb.h"
> 
> +#ifdef defined(CONFIG_OF)
> +#include <linux/of_net.h>
> +#include <linux/etherdevice.h>
> +#endif
> +
>   #define MAJ 5
>   #define MIN 3
>   #define BUILD 0
> @@ -2217,6 +2222,26 @@ static s32 igb_init_i2c(struct igb_adapter
> *adapter)
>   }
> 
>   /**
> + *  igb_read_mac_addr_dts - Read mac addres from the device tree
> blob.

Address is mis-spelled above

> + *  @hw: pointer to the e1000 hardware structure
> + **/
> +#ifdef defined(CONFIG_OF)

Minor nitpick, you should have the function comment header wrapped in
the #ifdef as well.

> +static void igb_read_mac_addr_dts(struct e1000_hw *hw)
> +{
> +       const u8 *mac;
> +       struct device_node *dn;
> +
> +       dn = of_find_compatible_node(NULL, NULL, "intel,i211");
> +       if (!dn)
> +               return;
> +
> +       mac = of_get_mac_address(dn);
> +       if (mac)
> +               ether_addr_copy(hw->mac.addr, mac);
> +}
> +#endif
> +
> +/**
>    *  igb_probe - Device Initialization Routine
>    *  @pdev: PCI device information struct
>    *  @ent: entry in igb_pci_tbl
> @@ -2420,6 +2445,11 @@ static int igb_probe(struct pci_dev *pdev,
> const 
> struct pci_device_id *ent)
>          if (hw->mac.ops.read_mac_addr(hw))
>                  dev_err(&pdev->dev, "NVM Read Error\n");
> 
> +#ifdef defined(CONFIG_OF)
> +       if (!is_valid_ether_addr(hw->mac.addr))
> +               igb_read_mac_addr_dts(hw);
> +#endif
> +
>          memcpy(netdev->dev_addr, hw->mac.addr, netdev->addr_len);
> 
>          if (!is_valid_ether_addr(netdev->dev_addr)) {
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@lists.osuosl.org
> http://lists.osuosl.org/mailman/listinfo/intel-wired-lan

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 22:11 [Intel-wired-lan] [next] igb: allow setting MAC address on i211 using a device tree blob John Holland
2016-01-29 22:11 ` John Holland
2016-02-09 11:02 ` Jeff Kirsher [this message]
2016-02-09 11:02   ` Jeff Kirsher
2016-02-09 11:54   ` Andrew Lunn
2016-02-09 11:54     ` Andrew Lunn
2016-02-10  9:13     ` John Holland
2016-02-10  9:13       ` John Holland
2016-02-10 16:59       ` Andrew Lunn
2016-02-10 16:59         ` Andrew Lunn
2016-02-09 11:59   ` Andrew Lunn
2016-02-09 11:59     ` Andrew Lunn
2016-02-09 17:42     ` Shannon Nelson
2016-02-09 17:42       ` Shannon Nelson
2016-02-09 22:10       ` David Miller
2016-02-09 22:10         ` David Miller
2016-02-10  8:50       ` John Holland
2016-02-10  8:50         ` John Holland
2016-02-10  9:16     ` John Holland
2016-02-10  9:16       ` John Holland
2016-02-10  8:52   ` John Holland
2016-02-10  8:52     ` 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=1455015744.3592.46.camel@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=intel-wired-lan@osuosl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.