public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] ARM: rpi_b: query internal MAC address from firmware
Date: Wed, 24 Sep 2014 21:45:41 +0200	[thread overview]
Message-ID: <201409242145.41719.marex@denx.de> (raw)
In-Reply-To: <54231F28.4020402@wwwdotorg.org>

On Wednesday, September 24, 2014 at 09:44:40 PM, Stephen Warren wrote:
> On 09/24/2014 01:27 PM, Jeroen Hofstee wrote:
> > Hello Stephan,
> > 
> > On 24-09-14 05:45, Stephen Warren wrote:
> >> The built-in SMSC 95xx chip doesn't know its own MAC address. Instead,
> >> we must query it from the VC firmware; it's probably encoded in fuses
> >> on the BCM2835.
> >> 
> >> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> >> ---
> >> This depends on "usb: dwc2: Add driver for Synopsis DWC2 USB IP block
> >> from Marek Vasut".
> >> 
> >>   arch/arm/include/asm/arch-bcm2835/mbox.h | 14 ++++++++++++++
> >>   board/raspberrypi/rpi_b/rpi_b.c          | 26
> >> 
> >> ++++++++++++++++++++++++++
> >> 
> >>   include/configs/rpi_b.h                  |  1 +
> >>   3 files changed, 41 insertions(+)
> > 
> > [snip]
> > 
> >> +int misc_init_r(void)
> >> +{
> >> +    ALLOC_ALIGN_BUFFER(struct msg_get_mac_address, msg, 1, 16);
> >> +    int ret;
> >> +
> >> +    BCM2835_MBOX_INIT_HDR(msg);
> >> +    BCM2835_MBOX_INIT_TAG(&msg->get_mac_address, GET_MAC_ADDRESS);
> >> +
> >> +    ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
> >> +    if (ret) {
> >> +        printf("bcm2835: Could not query MAC address\n");
> >> +        /* Ignore error; not critical */
> >> +        return 0;
> >> +    }
> >> +
> >> +    eth_setenv_enetaddr("usbethaddr",
> >> msg->get_mac_address.body.resp.mac);
> >> +
> >> +    return 0;
> >> +}
> >> +
> > 
> > Normally this should be within a check for if (!getenv("usbethaddr")).
> > Any reason to deviate from that?
> 
> That makes sense. I simply wasn't aware of the convention. I'll amend
> the patch.

OK, waiting for V2

Best regards,
Marek Vasut

  reply	other threads:[~2014-09-24 19:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24  3:45 [U-Boot] [PATCH] ARM: rpi_b: query internal MAC address from firmware Stephen Warren
2014-09-24 19:27 ` [U-Boot] " Jeroen Hofstee
2014-09-24 19:44   ` Stephen Warren
2014-09-24 19:45     ` Marek Vasut [this message]
2014-09-25  2:25     ` Stephen Warren
2014-09-25  8:06       ` Marek Vasut

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=201409242145.41719.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /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