From: Khem Raj <raj.khem@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: Re: [PATCH] linux-omap-2.6.36rc -- Consistent MAC address for BeagleBoard xM
Date: Wed, 27 Oct 2010 21:50:32 -0700 [thread overview]
Message-ID: <20101028045032.GA31542@gmail.com> (raw)
In-Reply-To: <1288237150-6284-2-git-send-email-johnso87@crhc.illinois.edu>
On (27/10/10 22:39), Matt Johnson wrote:
> Adding a patch to linux-omap-2.6.36rc for beagleboard. Patch is adapted
> from one submitted by Mark Crichton to the Beagleboard Google Group
> (see http://groups.google.com/group/beagleboard/browse_thread/thread/92d41bb344f8939b?fwc=1).
> BeagleBoard xM now uses the OMAP's die ID as a MAC instead of generating a random one
> (since it doesn't have an EEPROM to store it), so you have a consistent MAC across boots.
>
> Signed-off-by: Matt Johnson <johnso87@crhc.illinois.edu>
Thank you for your contribution. Your patch looks good however you need to
bump the PR for the recipe. Please resend the patch with PR update included
Thanks
-Khem
>
> ---
> ...e-beagleboard-xm-a-consistent-MAC-address.patch | 82 ++++++++++++++++++++
> recipes/linux/linux-omap_2.6.36rc.bb | 1 +
> 2 files changed, 83 insertions(+), 0 deletions(-)
> create mode 100644 recipes/linux/linux-omap-2.6.36rc/0008-give-the-beagleboard-xm-a-consistent-MAC-address.patch
>
> diff --git a/recipes/linux/linux-omap-2.6.36rc/0008-give-the-beagleboard-xm-a-consistent-MAC-address.patch b/recipes/linux/linux-omap-2.6.36rc/0008-give-the-beagleboard-xm-a-consistent-MAC-address.patch
> new file mode 100644
> index 0000000..0526e0d
> --- /dev/null
> +++ b/recipes/linux/linux-omap-2.6.36rc/0008-give-the-beagleboard-xm-a-consistent-MAC-address.patch
> @@ -0,0 +1,82 @@
> +From 60ec781c775e8413ef8ca521b63a07ba9ed2f4aa Mon Sep 17 00:00:00 2001
> +From: Matt Johnson <johnso87@crhc.illinois.edu>
> +Date: Wed, 27 Oct 2010 22:17:36 -0500
> +Subject: [PATCH] Give BeagleBoard xM a consistent MAC address
> +
> + Adapting the patch submitted by Mark Crichton to the Beagleboard Google Group
> + (see http://groups.google.com/group/beagleboard/browse_thread/thread/92d41bb344f8939b?fwc=1)
> + The Beagleboard xM includes an smsc95xx ethernet interface attached to the DM3730 via USB.
> + The Beagleboard lacks an EEPROM to store the MAC address, so the driver generates a random
> + MAC address on every boot. This patch instead uses the OMAP's die ID as the MAC address
> + (modifying a couple bits to make it a valid MAC), so that the MAC is consistent across boots.
> + A consistent MAC is important if the Beagleboard is to be used on a network with MAC filtering
> + and/or static IP addresses.
> +
> + Signed-off-by: Matt Johnson <johnso87@crhc.illinois.edu>
> +
> +---
> + drivers/net/usb/smsc95xx.c | 36 +++++++++++++++++++++++++++++++++++-
> + 1 files changed, 35 insertions(+), 1 deletions(-)
> +
> +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
> +index 12a3c88..1219bb6 100644
> +--- a/drivers/net/usb/smsc95xx.c
> ++++ b/drivers/net/usb/smsc95xx.c
> +@@ -29,6 +29,9 @@
> + #include <linux/crc32.h>
> + #include <linux/usb/usbnet.h>
> + #include <linux/slab.h>
> ++#if defined (CONFIG_MACH_OMAP_BEAGLE)
> ++#include <mach/id.h>
> ++#endif
> + #include "smsc95xx.h"
> +
> + #define SMSC_CHIPNAME "smsc95xx"
> +@@ -639,6 +642,14 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
> +
> + static void smsc95xx_init_mac_address(struct usbnet *dev)
> + {
> ++#if defined (CONFIG_MACH_OMAP3_BEAGLE)
> ++ u32 i;
> ++ struct omap_die_id odi;
> ++ union {
> ++ u32 idi[2];
> ++ u8 id[8];
> ++ } cpu;
> ++#endif
> + /* try reading mac address from EEPROM */
> + if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
> + dev->net->dev_addr) == 0) {
> +@@ -648,7 +659,30 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
> + return;
> + }
> + }
> +-
> ++#if defined (CONFIG_MACH_OMAP3_BEAGLE)
> ++ /* The BeagleBoard xM has a smsm95xx, but no EEPROM. */
> ++ /* Rather than just come up with a random MAC address, we'll */
> ++ /* Use a hash of our DM3730's die ID, so at least it's consistent */
> ++ /* between boots. */
> ++
> ++ /* Look at section 1.5.2 of DM3730 documentation */
> ++ omap_get_die_id(&odi);
> ++ cpu.idi[0] = odi.id_0;
> ++ cpu.idi[1] = odi.id_1;
> ++ /* Now interpret the die id as a MAC address */
> ++ /* We need to clear the multicast bit */
> ++ cpu.id[0] &= 0xfe;
> ++ /* Set local assignment bit (IEEE802) */
> ++ cpu.id[1] |= 0x02;
> ++
> ++ for(i = 0; i < ETH_ALEN; i++) {
> ++ dev->net->dev_addr[i] = cpu.id[i];
> ++ }
> ++ //TODO: Do error checking, etc. on die_id.
> ++ //TODO: Allow the user to set MAC after boot.
> ++ //TODO: Allow user to select whether they want this behavior or not */
> ++ return;
> ++#endif
> + /* 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");
> +--
> +1.6.3.3
> +
> diff --git a/recipes/linux/linux-omap_2.6.36rc.bb b/recipes/linux/linux-omap_2.6.36rc.bb
> index 64200e1..c79ffa9 100644
> --- a/recipes/linux/linux-omap_2.6.36rc.bb
> +++ b/recipes/linux/linux-omap_2.6.36rc.bb
> @@ -25,6 +25,7 @@ SRC_URI_append = " \
> file://0005-mmc-don-t-display-single-block-read-console-messages.patch \
> file://0006-MTD-silence-ecc-errors-on-mtdblock0.patch \
> file://0007-OMAP-DSS2-OMAPFB-use-phys_to_virt-for-RAM-mappings.patch \
> + file://0008-give-the-beagleboard-xm-a-consistent-MAC-address.patch \
> "
>
> SRC_URI_append_beagleboard = " file://logo_linux_clut224.ppm \
> --
> 1.6.3.3
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
prev parent reply other threads:[~2010-10-28 4:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-28 3:39 Consistent MAC address for Beagleboard xM Matt Johnson
2010-10-28 3:39 ` [PATCH] linux-omap-2.6.36rc -- Consistent MAC address for BeagleBoard xM Matt Johnson
2010-10-28 4:50 ` Khem Raj [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=20101028045032.GA31542@gmail.com \
--to=raj.khem@gmail.com \
--cc=openembedded-devel@lists.openembedded.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.