From: Sascha Hauer <s.hauer@pengutronix.de>
To: Baruch Siach <baruch@tkos.co.il>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 5/5] fec: add support for IIM stored mac address
Date: Mon, 16 Aug 2010 11:02:35 +0200 [thread overview]
Message-ID: <20100816090235.GL27749@pengutronix.de> (raw)
In-Reply-To: <20100816085253.GB1664@jasper.tkos.co.il>
On Mon, Aug 16, 2010 at 11:52:54AM +0300, Baruch Siach wrote:
> Hi Sascha,
>
> On Mon, Aug 16, 2010 at 10:45:06AM +0200, Sascha Hauer wrote:
> > On Sun, Aug 15, 2010 at 04:39:28PM +0300, Baruch Siach wrote:
> > > This patch adds support for i.MX25 only, because that's what I have. Extending
> > > this to other i.MX chip should be trivial, given the right IIM_MAC_ADDR define.
> >
> > This needs to be ifdeffed because this define is not present for
> > !i.MX25.
>
> OK. I hoped we can avoid the ugly ifdef, but, obviously, this is not possible
> here.
Well, we could. You could provide platform data to the iim device,
telling the iim driver where to find the mac address and a
imx_iim_get_mac() function. This function returns -EINVAL when the
platform data is missing.
Sascha
>
> baruch
>
> > > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> > > ---
> > > arch/arm/mach-imx/include/mach/imx25-regs.h | 1 +
> > > drivers/net/fec_imx.c | 11 +++++++++++
> > > 2 files changed, 12 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/arch/arm/mach-imx/include/mach/imx25-regs.h b/arch/arm/mach-imx/include/mach/imx25-regs.h
> > > index f8908f2..ddd3e04 100644
> > > --- a/arch/arm/mach-imx/include/mach/imx25-regs.h
> > > +++ b/arch/arm/mach-imx/include/mach/imx25-regs.h
> > > @@ -142,6 +142,7 @@
> > >
> > > /* IIM fuse definitions */
> > > #define IIM_UID 0x820
> > > +#define IIM_MAC_ADDR 0x868
> > >
> > > #define IIM_BANK_SIZE 32 /* excluding alignment padding for each row */
> > > #define IIM_BANK0_BASE (IMX_IIM_BASE + 0x800)
> > > diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> > > index 40a7543..c29119c 100644
> > > --- a/drivers/net/fec_imx.c
> > > +++ b/drivers/net/fec_imx.c
> > > @@ -32,6 +32,7 @@
> > > #include <mach/imx-regs.h>
> > > #include <clock.h>
> > > #include <mach/clock.h>
> > > +#include <mach/generic.h>
> > > #include <xfuncs.h>
> > >
> > > #include "fec_imx.h"
> > > @@ -235,6 +236,16 @@ static void fec_rbd_clean(int last, struct buffer_descriptor *pRbd)
> > >
> > > static int fec_get_hwaddr(struct eth_device *dev, unsigned char *mac)
> > > {
> > > + int i;
> > > +
> > > + if (cpu_is_mx25()) {
> > > + /* get MAC address from the IMM fusebox */
> > > + for (i = 0; i < 6; i++)
> > > + mac[i] = readb(IMX_IIM_BASE + IIM_MAC_ADDR + i*4);
> > > +
> > > + return 0;
> > > + }
> > > +
> > > /* no eeprom */
> > > return -1;
> > > }
>
> --
> ~. .~ Tk Open Systems
> =}------------------------------------------------ooO--U--Ooo------------{=
> - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2010-08-16 9:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-15 13:39 [PATCH 0/5] imx: support for the IIM fusebox Baruch Siach
2010-08-15 13:39 ` [PATCH 1/5] imx: move IIM registers to their own header Baruch Siach
2010-08-15 13:39 ` [PATCH 2/5] imx: driver for the IIM fusebox Baruch Siach
2010-08-15 13:39 ` [PATCH 3/5] imx25: add chip specific IIM fusebox defines Baruch Siach
2010-08-15 13:39 ` [PATCH 4/5] imx25 3ds: add support for the iim fusebox driver Baruch Siach
2010-08-15 13:39 ` [PATCH 5/5] fec: add support for IIM stored mac address Baruch Siach
2010-08-16 8:45 ` Sascha Hauer
2010-08-16 8:52 ` Baruch Siach
2010-08-16 9:02 ` Sascha Hauer [this message]
2010-08-16 8:33 ` [PATCH 0/5] imx: support for the IIM fusebox Sascha Hauer
2010-08-16 8:47 ` Baruch Siach
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=20100816090235.GL27749@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=baruch@tkos.co.il \
/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