From: Arnd Bergmann <arnd@arndb.de>
To: Greg KH <greg@kroah.com>,
Grant Likely <grant.likely@secretlab.ca>,
devicetree-discuss@lists.ozlabs.org
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Nicolas Pitre <nicolas.pitre@linaro.org>,
andy.green@linaro.org, Linux USB list <linux-usb@vger.kernel.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: RFC: Platform data for onboard USB assets
Date: Thu, 17 Mar 2011 23:33:01 +0100 [thread overview]
Message-ID: <201103172333.01474.arnd@arndb.de> (raw)
In-Reply-To: <20110317214736.GA29014@kroah.com>
On Thursday 17 March 2011 22:47:36 Greg KH wrote:
> > > Patches to fix this, for this specific PandaBoard controller are gladly
> > > accepted. What's odd is this is explicitly a Linux development board,
> > > so you would think that this could have been caught, and fixed, in the
> > > hardware a long time ago, right?
> >
> > The way everyone resolves this stuff is by patching their kernel
> > locally.
>
> Well, that means that the device tree work is going to be useful here,
> right? :)
I like the idea. Let's make this the first use case where a lot of
people will want to have the device tree on ARM. The patch to the
driver to check for a mac-address property is trivial, and we
can probably come up with a decent way of parsing the device
tree for USB devices, after all there is an existing spec for
it (http://playground.sun.com/1275/bindings/usb/usb-1_0.ps).
Arnd
8<------
[PATCH] net/smscx5xx: demonstrate use of device tree for mac address
This takes the MAC address for smsc75xx/smsc95xx USB network devices
from a the device tree. This is required to get a usable persistent
address on the popular beagleboard, whose hardware designers
accidentally forgot that an ethernet device really requires an a
MAC address to be functional.
The smsc75xx and smsc95xx drivers are just two copies of the
same code, so better fix both.
Not tested!
Signed-off-by: Arnd Bergmann <arnd.bergmann@linaro.org>
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 753ee6e..0420209 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -29,6 +29,7 @@
#include <linux/crc32.h>
#include <linux/usb/usbnet.h>
#include <linux/slab.h>
+#include <linux/of_device.h>
#include "smsc75xx.h"
#define SMSC_CHIPNAME "smsc75xx"
@@ -658,6 +659,8 @@ static int smsc75xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
static void smsc75xx_init_mac_address(struct usbnet *dev)
{
+ void *address;
+
/* try reading mac address from EEPROM */
if (smsc75xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
dev->net->dev_addr) == 0) {
@@ -669,6 +672,13 @@ static void smsc75xx_init_mac_address(struct usbnet *dev)
}
}
+ address = of_get_property(dev->udev->dev.of_node,
+ "local-mac-address", NULL);
+ if (address) {
+ memcpy(dev->net->dev_addr, address, ETH_ALEN);
+ return;
+ }
+
/* no eeprom, or eeprom values are invalid. generate random MAC */
random_ether_addr(dev->net->dev_addr);
netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr");
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index bc86f4b..74585fb 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -29,6 +29,7 @@
#include <linux/crc32.h>
#include <linux/usb/usbnet.h>
#include <linux/slab.h>
+#include <linux/of_device.h>
#include "smsc95xx.h"
#define SMSC_CHIPNAME "smsc95xx"
@@ -639,6 +640,8 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
static void smsc95xx_init_mac_address(struct usbnet *dev)
{
+ void *address;
+
/* try reading mac address from EEPROM */
if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
dev->net->dev_addr) == 0) {
@@ -649,6 +652,13 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
}
}
+ address = of_get_property(dev->udev->dev.of_node,
+ "local-mac-address", NULL);
+ if (address) {
+ memcpy(dev->net->dev_addr, address, ETH_ALEN);
+ return;
+ }
+
/* no eeprom, or eeprom values are invalid. generate random MAC */
random_ether_addr(dev->net->dev_addr);
netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr\n");
WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Greg KH <greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>,
Grant Likely
<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Cc: Nicolas Pitre
<nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
lkml <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Mark Brown
<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
Linux USB list
<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
andy.green-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Subject: Re: RFC: Platform data for onboard USB assets
Date: Thu, 17 Mar 2011 23:33:01 +0100 [thread overview]
Message-ID: <201103172333.01474.arnd@arndb.de> (raw)
In-Reply-To: <20110317214736.GA29014-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
On Thursday 17 March 2011 22:47:36 Greg KH wrote:
> > > Patches to fix this, for this specific PandaBoard controller are gladly
> > > accepted. What's odd is this is explicitly a Linux development board,
> > > so you would think that this could have been caught, and fixed, in the
> > > hardware a long time ago, right?
> >
> > The way everyone resolves this stuff is by patching their kernel
> > locally.
>
> Well, that means that the device tree work is going to be useful here,
> right? :)
I like the idea. Let's make this the first use case where a lot of
people will want to have the device tree on ARM. The patch to the
driver to check for a mac-address property is trivial, and we
can probably come up with a decent way of parsing the device
tree for USB devices, after all there is an existing spec for
it (http://playground.sun.com/1275/bindings/usb/usb-1_0.ps).
Arnd
8<------
[PATCH] net/smscx5xx: demonstrate use of device tree for mac address
This takes the MAC address for smsc75xx/smsc95xx USB network devices
from a the device tree. This is required to get a usable persistent
address on the popular beagleboard, whose hardware designers
accidentally forgot that an ethernet device really requires an a
MAC address to be functional.
The smsc75xx and smsc95xx drivers are just two copies of the
same code, so better fix both.
Not tested!
Signed-off-by: Arnd Bergmann <arnd.bergmann-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 753ee6e..0420209 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -29,6 +29,7 @@
#include <linux/crc32.h>
#include <linux/usb/usbnet.h>
#include <linux/slab.h>
+#include <linux/of_device.h>
#include "smsc75xx.h"
#define SMSC_CHIPNAME "smsc75xx"
@@ -658,6 +659,8 @@ static int smsc75xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
static void smsc75xx_init_mac_address(struct usbnet *dev)
{
+ void *address;
+
/* try reading mac address from EEPROM */
if (smsc75xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
dev->net->dev_addr) == 0) {
@@ -669,6 +672,13 @@ static void smsc75xx_init_mac_address(struct usbnet *dev)
}
}
+ address = of_get_property(dev->udev->dev.of_node,
+ "local-mac-address", NULL);
+ if (address) {
+ memcpy(dev->net->dev_addr, address, ETH_ALEN);
+ return;
+ }
+
/* no eeprom, or eeprom values are invalid. generate random MAC */
random_ether_addr(dev->net->dev_addr);
netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr");
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index bc86f4b..74585fb 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -29,6 +29,7 @@
#include <linux/crc32.h>
#include <linux/usb/usbnet.h>
#include <linux/slab.h>
+#include <linux/of_device.h>
#include "smsc95xx.h"
#define SMSC_CHIPNAME "smsc95xx"
@@ -639,6 +640,8 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
static void smsc95xx_init_mac_address(struct usbnet *dev)
{
+ void *address;
+
/* try reading mac address from EEPROM */
if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
dev->net->dev_addr) == 0) {
@@ -649,6 +652,13 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
}
}
+ address = of_get_property(dev->udev->dev.of_node,
+ "local-mac-address", NULL);
+ if (address) {
+ memcpy(dev->net->dev_addr, address, ETH_ALEN);
+ return;
+ }
+
/* no eeprom, or eeprom values are invalid. generate random MAC */
random_ether_addr(dev->net->dev_addr);
netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr\n");
next prev parent reply other threads:[~2011-03-17 22:33 UTC|newest]
Thread overview: 185+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-11 9:50 RFC: Platform data for onboard USB assets Andy Green
2011-03-11 12:31 ` Arnd Bergmann
2011-03-11 12:44 ` Andy Green
2011-03-11 14:42 ` Roger Quadros
2011-03-11 15:12 ` Roger Quadros
2011-03-11 15:22 ` Arnd Bergmann
2011-03-11 15:50 ` Roger Quadros
2011-03-11 15:55 ` Arnd Bergmann
2011-03-11 15:29 ` Mark Brown
2011-03-11 15:54 ` Arnd Bergmann
2011-03-11 16:03 ` Mark Brown
2011-03-11 16:14 ` Greg KH
2011-03-11 16:27 ` Mark Brown
2011-03-11 16:35 ` Greg KH
2011-03-11 16:48 ` Mark Brown
2011-03-11 16:56 ` Greg KH
2011-03-11 17:08 ` Mark Brown
2011-03-11 17:23 ` Greg KH
2011-03-11 17:41 ` Mark Brown
2011-03-17 2:14 ` Nicolas Pitre
2011-03-17 20:13 ` Greg KH
2011-03-17 20:18 ` Mark Brown
2011-03-17 20:26 ` Greg KH
2011-03-17 21:24 ` Mark Brown
2011-03-17 21:31 ` Greg KH
2011-03-17 21:40 ` Mark Brown
2011-03-17 21:47 ` Greg KH
2011-03-17 22:33 ` Arnd Bergmann [this message]
2011-03-17 22:33 ` Arnd Bergmann
2011-03-17 22:53 ` Greg KH
2011-03-17 22:53 ` Greg KH
2011-03-17 23:18 ` Andy Green
2011-03-17 23:18 ` Andy Green
2011-03-17 23:25 ` Greg KH
2011-03-18 7:42 ` Andy Green
2011-03-18 7:42 ` Andy Green
2011-03-18 22:54 ` Benjamin Herrenschmidt
2011-03-18 22:54 ` Benjamin Herrenschmidt
2011-03-18 22:57 ` Andy Green
2011-03-18 22:57 ` Andy Green
2011-03-18 4:54 ` Grant Likely
2011-03-18 4:54 ` Grant Likely
2011-03-18 8:19 ` Arnd Bergmann
2011-03-18 8:19 ` Arnd Bergmann
2011-03-17 23:22 ` Andy Green
2011-03-18 15:00 ` Arnd Bergmann
2011-03-18 15:00 ` Arnd Bergmann
2011-03-18 15:15 ` Mark Brown
2011-03-18 15:15 ` Mark Brown
2011-03-18 17:52 ` Andy Green
2011-03-18 17:52 ` Andy Green
2011-03-18 18:20 ` David Anders
2011-03-18 18:20 ` David Anders
2011-03-18 18:25 ` Mark Brown
2011-03-18 18:25 ` Mark Brown
2011-03-18 20:02 ` Andy Green
2011-03-18 20:02 ` Andy Green
2011-03-18 21:11 ` Arnd Bergmann
2011-03-18 21:17 ` Andy Green
2011-03-18 21:17 ` Andy Green
2011-03-18 20:06 ` Arnd Bergmann
2011-03-18 20:06 ` Arnd Bergmann
2011-03-18 21:33 ` Andy Green
2011-03-18 23:25 ` Mark Brown
2011-03-18 23:25 ` Mark Brown
2011-03-18 23:33 ` Andy Green
2011-03-18 23:33 ` Andy Green
2011-03-18 21:36 ` Grant Likely
2011-03-18 21:36 ` Grant Likely
2011-03-18 22:47 ` Benjamin Herrenschmidt
2011-03-18 22:47 ` Benjamin Herrenschmidt
2011-03-18 21:28 ` Grant Likely
2011-03-18 21:28 ` Grant Likely
2011-03-18 23:04 ` Andy Green
2011-03-18 23:04 ` Andy Green
2011-03-18 22:37 ` Benjamin Herrenschmidt
2011-03-18 22:37 ` Benjamin Herrenschmidt
2011-03-18 22:39 ` Andy Green
2011-03-18 22:39 ` Andy Green
2011-03-17 23:27 ` Grant Likely
2011-03-17 23:27 ` Grant Likely
2011-03-18 7:49 ` Andy Green
2011-03-18 8:25 ` Arnd Bergmann
2011-03-18 8:25 ` Arnd Bergmann
2011-03-18 8:38 ` Andy Green
2011-03-18 8:38 ` Andy Green
2011-03-17 22:11 ` Arnd Bergmann
2011-03-17 22:20 ` Greg KH
2011-03-18 8:42 ` Roger Quadros
2011-03-18 9:01 ` Arnd Bergmann
2011-03-18 9:55 ` Roger Quadros
2011-03-18 10:09 ` Andy Green
2011-03-17 21:03 ` Nicolas Pitre
2011-03-17 21:32 ` Greg KH
2011-03-11 16:26 ` Andy Green
2011-03-11 16:45 ` Alan Stern
2011-03-11 16:51 ` Andy Green
2011-03-11 17:08 ` Greg KH
2011-03-11 18:09 ` Andy Green
2011-03-11 19:12 ` Alan Stern
2011-03-11 20:05 ` Andy Green
2011-03-11 20:21 ` Greg KH
2011-03-11 21:07 ` Andy Green
2011-03-11 21:44 ` Greg KH
2011-03-11 22:24 ` Andy Green
2011-03-12 16:00 ` Alan Stern
2011-03-12 23:02 ` Andy Green
2011-03-11 19:37 ` Greg KH
2011-03-11 16:53 ` Mark Brown
2011-03-11 16:08 ` Greg KH
2011-03-11 16:20 ` Andy Green
2011-03-11 16:36 ` Greg KH
2011-03-11 16:41 ` Andy Green
2011-03-11 22:07 ` Benjamin Herrenschmidt
2011-03-11 21:52 ` Benjamin Herrenschmidt
2011-03-11 22:45 ` Grant Likely
2011-03-11 22:47 ` Andy Green
2011-03-11 23:39 ` Grant Likely
2011-03-14 14:54 ` Arnd Bergmann
2011-03-22 15:05 ` Jaswinder Singh
2011-03-22 16:04 ` Andy Green
2011-03-22 18:19 ` Jaswinder Singh
2011-03-22 18:37 ` Andy Green
2011-03-22 18:59 ` Jaswinder Singh
2011-03-22 19:35 ` Andy Green
[not found] ` <AANLkTim=ezye=1fQP_1a2SWbPnbENP9B+k27Z3AkS=zf@mail.gmail.com>
2011-03-22 15:12 ` Mark Brown
2011-03-22 15:23 ` Jaswinder Singh
2011-03-24 18:56 ` Grant Likely
2011-03-22 21:08 ` Benjamin Herrenschmidt
2011-03-22 22:37 ` Andy Green
2011-03-23 1:03 ` Benjamin Herrenschmidt
2011-03-23 2:26 ` Nicolas Pitre
2011-03-23 3:23 ` Benjamin Herrenschmidt
2011-03-23 4:21 ` Nicolas Pitre
2011-03-23 4:56 ` Greg KH
2011-03-23 5:44 ` Benjamin Herrenschmidt
2011-03-23 9:38 ` Alan Cox
2011-03-23 10:53 ` Mark Brown
2011-03-23 15:04 ` Greg KH
2011-03-23 15:10 ` Mark Brown
2011-03-23 15:24 ` Andy Green
2011-03-23 15:45 ` Arnd Bergmann
2011-03-23 15:38 ` Nicolas Pitre
2011-03-23 9:31 ` Andy Green
2011-03-23 9:47 ` Alan Cox
2011-03-23 10:06 ` Andy Green
2011-03-23 10:32 ` Arnd Bergmann
2011-03-23 10:39 ` Andy Green
2011-03-23 10:56 ` Alan Cox
2011-03-23 11:13 ` Andy Green
2011-03-23 11:34 ` Alan Cox
2011-03-23 12:02 ` Andy Green
2011-03-23 15:08 ` Greg KH
2011-03-23 16:12 ` Arnd Bergmann
2011-03-23 16:22 ` Greg KH
2011-03-23 16:34 ` Andy Green
2011-03-23 16:56 ` [RFC] usbnet: use eth%d name for known ethernet devices Arnd Bergmann
2011-03-23 17:04 ` Andy Green
2011-03-23 17:11 ` Arnd Bergmann
2011-03-24 10:45 ` Andy Green
2011-03-24 10:45 ` Andy Green
2011-03-23 17:13 ` Arnd Bergmann
2011-03-23 17:54 ` David Anders
2011-03-23 18:46 ` Greg KH
2011-03-23 19:35 ` Arnd Bergmann
[not found] ` <AANLkTim7hPfTv3gDYnh+jGxHBg0OvX=r1FKYoHnH7H_o@mail.gmail.com>
2011-03-23 19:57 ` Arnd Bergmann
2011-03-23 19:59 ` Randy Dunlap
2011-03-23 23:17 ` Michal Nazarewicz
2011-03-23 23:19 ` Randy Dunlap
2011-03-23 23:38 ` Steve Calfee
2011-03-24 0:01 ` Ben Hutchings
2011-03-24 13:13 ` Arnd Bergmann
2011-03-24 13:15 ` Arnd Bergmann
2011-03-24 13:44 ` Andy Green
2011-03-24 13:56 ` Alan Stern
2011-03-24 13:56 ` Alan Stern
2011-03-24 17:20 ` Alexey Orishko
2011-03-25 11:57 ` Arnd Bergmann
2011-03-25 16:26 ` Alexey Orishko
2011-03-25 16:43 ` Arnd Bergmann
2011-03-24 19:17 ` RFC: Platform data for onboard USB assets Grant Likely
2011-03-24 20:10 ` Andy Green
2011-03-23 14:55 ` Nicolas Pitre
2011-03-23 10:22 ` Benjamin Herrenschmidt
2011-03-23 15:11 ` Nicolas Pitre
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=201103172333.01474.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=andy.green@linaro.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nicolas.pitre@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.