From: LW@KARO-electronics.de (Lothar Waßmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: mxs: TX28: Setup MAC addresses for both FEC MACs from OTP fuses.
Date: Tue, 22 Mar 2011 15:35:21 +0100 [thread overview]
Message-ID: <19848.45993.589141.542159@ipc1.ka-ro> (raw)
In-Reply-To: <20110322141446.GI28098@S2100-06.ap.freescale.net>
Hi,
Shawn Guo writes:
> On Mon, Mar 21, 2011 at 05:48:06PM +0100, Lothar Wa?mann wrote:
> > Signed-off-by: Lothar Wa?mann <LW@KARO-electronics.de>
> > ---
> > arch/arm/mach-mxs/module-tx28.c | 39 +++++++++++++++++++++++++++++++++++++++
> > 1 files changed, 39 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/mach-mxs/module-tx28.c b/arch/arm/mach-mxs/module-tx28.c
> > index 7d44936..7a9e7b6 100644
> > --- a/arch/arm/mach-mxs/module-tx28.c
> > +++ b/arch/arm/mach-mxs/module-tx28.c
> > @@ -74,6 +74,43 @@ static struct fec_platform_data tx28_fec1_data = {
> > .phy = PHY_INTERFACE_MODE_RMII,
> > };
> >
> > +#define HW_OCOTP_CUST0 0x20
> > +#define HW_OCOTP_CUST(n) (HW_OCOTP_CUST0 + (n) * 0x10)
> > +#define HW_OCOTP_CTRL 0x00
> > +#define HW_OCOTP_CTRL_SET (HW_OCOTP_CTRL + 4)
> > +#define HW_OCOTP_CTRL_CLR (HW_OCOTP_CTRL + 8)
> > +
> > +#define BM_OCOTP_CTRL_BUSY (1 << 8)
> > +#define BM_OCOTP_CTRL_RD_BANK_OPEN (1 << 12)
> > +
> > +static int __init tx28_set_mac(int id, unsigned char mac[])
> > +{
> > + int i;
> > + void __iomem *ocotp_base = ioremap(MX28_OCOTP_BASE_ADDR, SZ_4K);
> > + u32 reg = 0;
> > + long timeout = 1000;
> > +
> > + if (ocotp_base == NULL)
> > + return -ENOMEM;
> > +
> > + /* set this bit to open the OTP banks for reading */
> > + writel(BM_OCOTP_CTRL_RD_BANK_OPEN, ocotp_base + HW_OCOTP_CTRL_SET);
> > +
> > + while (readl(ocotp_base + HW_OCOTP_CTRL) & BM_OCOTP_CTRL_BUSY) {
> > + if (timeout-- < 0)
> > + return -ETIMEDOUT;
> > + udelay(100);
> > + }
> > +
> > + for (i = 0; i < ETH_ALEN; i++) {
> > + if (i % 4 == 0)
> > + reg = readl(ocotp_base + HW_OCOTP_CUST(id * 2 + i / 4));
> > + mac[i] = reg >> (24 - ((i % 4) * 8));
> > + }
> > + iounmap(ocotp_base);
> > + return 0;
> > +}
> > +
>
> Why don't you use mxs_get_ocotp() to read otp?
>
Good question... I'll change it.
Lothar Wa?mann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
prev parent reply other threads:[~2011-03-22 14:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-21 16:48 [PATCH 1/2] ARM: mxs: configure and register the second FEC device on TX28/STK5-V4 Lothar Waßmann
2011-03-21 16:48 ` [PATCH 2/2] ARM: mxs: TX28: Setup MAC addresses for both FEC MACs from OTP fuses Lothar Waßmann
2011-03-22 14:14 ` Shawn Guo
2011-03-22 14:35 ` Lothar Waßmann [this message]
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=19848.45993.589141.542159@ipc1.ka-ro \
--to=lw@karo-electronics.de \
--cc=linux-arm-kernel@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