From: Laurent Pinchart <laurentp@cse-semaphore.com>
To: Ben Dooks <ben-linux@fluff.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] dm9000: Support MAC address setting through platform data.
Date: Fri, 25 Jul 2008 11:23:01 +0200 [thread overview]
Message-ID: <200807251123.04405.laurentp@cse-semaphore.com> (raw)
In-Reply-To: <20080725090530.GA4318@fluff.org.uk>
[-- Attachment #1: Type: text/plain, Size: 3364 bytes --]
On Friday 25 July 2008, Ben Dooks wrote:
> On Wed, Jul 23, 2008 at 05:41:52PM +0200, Laurent Pinchart wrote:
> > The dm9000 driver reads the chip's MAC address from the attached EEPROM.
> > When no EEPROM is present, or when the MAC address is invalid, it falls
> > back to reading the address from the chip.
> >
> > This patch lets platform code set the desired MAC address through platform
> > data.
>
> I belive we've had discussions about this before on the subject
> as this is generally down to broken boot-loader behaviour.
>
> Would people have objections to passing the mac address in on the
> command line and having the driver initialise it from there? Are
> there any other ethernet drivers out there with the same problem?
That wouldn't really help here. I should have provided more background information, let's fix this.
The system I'm working on has an ISA-like bus on which users can plug extension boards. One of those board has a DM9000 chip connected directly to the bus. Having several DM9000-based extension boards in a system is a common situation.
The extension boards have a serial EEPROM connected to the bus, but no EEPROM connected to the DM9000. The EEPROM stores, among other information, the MAC address. The platform driver I wrote for the extension board reads the EEPROM content, and needs to pass the MAC address when it registers a DM9000 device.
I don't think the boot loader is the right place to fix the issue. It would involve scanning all boards on the extension bus and configuring the DM9000, which isn't really practical. Beside, the bus can be reset at runtime without involving a full system reset, in which case Linux will have to reprogram the DM9000 with a MAC address anyway.
> I've added some notes on the patch anyway.
>
> > Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
> > ---
> > drivers/net/dm9000.c | 3 +++
> > include/linux/dm9000.h | 1 +
> > 2 files changed, 4 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
> > index 864295e..6bc8924 100644
> > --- a/drivers/net/dm9000.c
> > +++ b/drivers/net/dm9000.c
> > @@ -716,6 +716,11 @@ dm9000_probe(struct platform_device *pdev)
> > for (i = 0; i < 6; i += 2)
> > dm9000_read_eeprom(db, i / 2, ndev->dev_addr+i);
> >
> > + if (!is_valid_ether_addr(ndev->dev_addr) && pdata != NULL) {
> > + mac_src = "platform data";
> > + memcpy(ndev->dev_addr, pdata->dev_addr, 6);
> > + }
> > +
> > if (!is_valid_ether_addr(ndev->dev_addr)) {
> > /* try reading from mac */
> >
> > diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h
> > index a375046..4fb49a4 100644
> > --- a/include/linux/dm9000.h
> > +++ b/include/linux/dm9000.h
> > @@ -26,6 +26,7 @@
> >
> > struct dm9000_plat_data {
> > unsigned int flags;
> > + unsigned char dev_addr[6];
>
> how about unsigned char *mac_addr, so that you can detect
> if the address has not been passed in easily. dev_addr is
> not really descriptive enough as a name.
mac_addr is indeed a better name. Using an unsigned char * involves extra storage. What about a DM9000_PLATF_MAC_ADDR flag instead ?
--
Laurent Pinchart
CSE Semaphore Belgium
Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium
T +32 (2) 387 42 59
F +32 (2) 387 42 75
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2008-07-25 9:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-23 15:41 [PATCH] dm9000: Support MAC address setting through platform data Laurent Pinchart
2008-07-25 9:05 ` Ben Dooks
2008-07-25 9:23 ` Laurent Pinchart [this message]
2008-08-07 6:24 ` Jeff Garzik
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=200807251123.04405.laurentp@cse-semaphore.com \
--to=laurentp@cse-semaphore.com \
--cc=ben-linux@fluff.org \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).