netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Büsch" <m@bues.ch>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: davem@davemloft.net, mcarlson@broadcom.com, mchan@broadcom.com,
	nsujir@broadcom.com, netdev@vger.kernel.org
Subject: Re: [PATCH v2 1/4] ssb: get mac address from sprom struct for gige driver
Date: Wed, 6 Feb 2013 19:21:34 +0100	[thread overview]
Message-ID: <20130206192134.4bbb4bbb@milhouse> (raw)
In-Reply-To: <1360170854-32029-2-git-send-email-hauke@hauke-m.de>

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

On Wed,  6 Feb 2013 18:14:11 +0100
Hauke Mehrtens <hauke@hauke-m.de> wrote:

> The mac address is already stored in the sprom structure by the
> platform code of the SoC this Ethernet core is found on, it just has to
> be fetched from this structure instead of accessing the nvram here.
> This patch also adds a return value to indicate if a mac address could
> be fetched from the sprom structure.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

Acked-by: Michael Buesch <m@bues.ch>

> ---
> 
> This patch could cause merge problems with the mips tree. This version, 
> removing the usage of nvram_getenv and nvram_parse_macaddr, should be 
> used.
> 
>  include/linux/ssb/ssb_driver_gige.h |   19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
> index 6b05dcd..912af3c 100644
> --- a/include/linux/ssb/ssb_driver_gige.h
> +++ b/include/linux/ssb/ssb_driver_gige.h
> @@ -97,21 +97,16 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_BCM47XX
> -#include <asm/mach-bcm47xx/nvram.h>
>  /* Get the device MAC address */
> -static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
> -{
> -	char buf[20];
> -	if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)
> -		return;
> -	nvram_parse_macaddr(buf, macaddr);
> -}
> -#else
> -static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
> +static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
>  {
> +	struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
> +	if (!dev)
> +		return -ENODEV;
> +
> +	memcpy(macaddr, dev->dev->bus->sprom.et0mac, 6);
> +	return 0;
>  }
> -#endif
>  
>  extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
>  					  struct pci_dev *pdev);



-- 
Greetings, Michael.

PGP: 908D8B0E

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-02-06 18:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06 17:14 [PATCH v2 0/4] tg3: add support for Ethernet core in BCM4785 Hauke Mehrtens
2013-02-06 17:14 ` [PATCH v2 1/4] ssb: get mac address from sprom struct for gige driver Hauke Mehrtens
2013-02-06 18:21   ` Michael Büsch [this message]
2013-02-06 17:14 ` [PATCH v2 2/4] ssb: add missing method ssb_gige_get_macaddr Hauke Mehrtens
2013-02-06 17:14 ` [PATCH v2 3/4] tg3: make it possible to provide phy_id in ioctl Hauke Mehrtens
2013-02-06 17:14 ` [PATCH v2 4/4] tg3: add support for Ethernet core in bcm4785 Hauke Mehrtens
2013-02-06 20:01 ` [PATCH v2 0/4] tg3: add support for Ethernet core in BCM4785 David Miller

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=20130206192134.4bbb4bbb@milhouse \
    --to=m@bues.ch \
    --cc=davem@davemloft.net \
    --cc=hauke@hauke-m.de \
    --cc=mcarlson@broadcom.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=nsujir@broadcom.com \
    /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).