From: Renaud Barbier <renaud.barbier@ge.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/6] drivers: gianfar: MAC address
Date: Tue, 29 Oct 2013 11:24:31 +0000 [thread overview]
Message-ID: <1383045874-7641-4-git-send-email-renaud.barbier@ge.com> (raw)
In-Reply-To: <1383045874-7641-1-git-send-email-renaud.barbier@ge.com>
A framework is added to pass the board MAC address to the
gianfar driver.
This is in preparation for the introduction of the GEIP DA923RC
board support.
Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
---
arch/ppc/mach-mpc85xx/include/mach/gianfar.h | 2 ++
drivers/net/gianfar.c | 10 +++++++++-
drivers/net/gianfar.h | 2 ++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/arch/ppc/mach-mpc85xx/include/mach/gianfar.h b/arch/ppc/mach-mpc85xx/include/mach/gianfar.h
index 6a7b9e9..c405dd5 100644
--- a/arch/ppc/mach-mpc85xx/include/mach/gianfar.h
+++ b/arch/ppc/mach-mpc85xx/include/mach/gianfar.h
@@ -30,6 +30,8 @@ struct gfar_info_struct {
unsigned int tbiana;
unsigned int tbicr;
unsigned int mdiobus_tbi;
+ int mac_idx;
+ int (*get_mac)(int mac_idx, unsigned char *);
};
int fsl_eth_init(int num, struct gfar_info_struct *gf);
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index f944c6c..eaf2847 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -229,7 +229,13 @@ static int gfar_open(struct eth_device *edev)
static int gfar_get_ethaddr(struct eth_device *edev, unsigned char *mac)
{
- return -ENODEV;
+ struct gfar_private *priv = edev->priv;
+ int (*get_mac)(int, unsigned char *) = priv->get_mac;
+
+ if (get_mac)
+ return get_mac(priv->mac_idx, mac);
+ else
+ return -ENODEV;
}
static int gfar_set_ethaddr(struct eth_device *edev, unsigned char *mac)
@@ -493,6 +499,8 @@ static int gfar_probe(struct device_d *dev)
priv->phyaddr = gfar_info->phyaddr;
priv->tbicr = gfar_info->tbicr;
priv->tbiana = gfar_info->tbiana;
+ priv->get_mac = gfar_info->get_mac;
+ priv->mac_idx = gfar_info->mac_idx;
mdev = get_device_by_name("gfar-mdio0");
if (mdev == NULL) {
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 1aac479..b011445 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -277,6 +277,8 @@ struct gfar_private {
struct phy_info *phyinfo;
volatile struct txbd8 *txbd;
volatile struct rxbd8 *rxbd;
+ int (*get_mac)(int idx, unsigned char *);
+ int mac_idx;
uint txidx;
uint rxidx;
uint phyaddr;
--
1.8.3.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-10-29 11:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-29 11:24 [PATCH 0/6] GEIP DA923RC board support Renaud Barbier
2013-10-29 11:24 ` [PATCH 1/6] ppc: mpc85xx: mpc8544 support Renaud Barbier
2013-10-29 11:24 ` [PATCH 2/6] ppc: mpc85xx: define Ethernet port count Renaud Barbier
2013-10-29 11:24 ` Renaud Barbier [this message]
2013-10-29 13:15 ` [PATCH 3/6] drivers: gianfar: MAC address Jean-Christophe PLAGNIOL-VILLARD
2013-10-29 11:24 ` [PATCH 4/6] ppc: mpc85xx: enable DDR driver Renaud Barbier
2013-10-29 11:24 ` [PATCH 5/6] ppc: DA923RC: add board support Renaud Barbier
2013-10-29 11:24 ` [PATCH 6/6] ppc: mpc85xx: build directives Renaud Barbier
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=1383045874-7641-4-git-send-email-renaud.barbier@ge.com \
--to=renaud.barbier@ge.com \
--cc=barebox@lists.infradead.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