From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: mxs: fix mac address of second interface
Date: Sun, 23 Aug 2015 17:38:05 +0200 [thread overview]
Message-ID: <55D9E8DD.4020903@denx.de> (raw)
In-Reply-To: <1439676981-16599-1-git-send-email-mhei@heimpold.de>
Hi Michael,
On 16/08/2015 00:16, Michael Heimpold wrote:
> In the rare case that an overflow occurs, propagate it.
>
> Signed-off-by: Michael Heimpold <mhei@heimpold.de>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Marek Vasut <marex@denx.de>
> CC: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> arch/arm/cpu/arm926ejs/mxs/mxs.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> index b1d8721..42057ad 100644
> --- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
> +++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> @@ -238,11 +238,19 @@ int cpu_eth_init(bd_t *bis)
>
> __weak void mx28_adjust_mac(int dev_id, unsigned char *mac)
> {
> + uint32_t data;
> +
> mac[0] = 0x00;
> mac[1] = 0x04; /* Use FSL vendor MAC address by default */
>
> - if (dev_id == 1) /* Let MAC1 be MAC0 + 1 by default */
> - mac[5] += 1;
> + if (dev_id == 1) { /* Let MAC1 be MAC0 + 1 by default */
> + data = (mac[3] << 16) | (mac[4] << 8) | mac[5];
> + data++;
> +
> + mac[3] = (data >> 16) & 0xff;
> + mac[4] = (data >> 8) & 0xff;
> + mac[5] = data & 0xff;
> + }
> }
>
Even if on a theoretical point of view this is correct, I guess there is
something fundamentally wrong.
We cannot set any MAC address we want. MAC addresses must be bought,
even by the manufacturer (Freescale) if it wants to deliver SOC with
preinstalled MAC addresses. In most cases but not all, the user of the
SOC wants to have his Vendor-id, and he buys a range of addresses. If
the target has two ethernet, he will reserve two addresses for each
board and it is common practise to have two consecutive addresses,
without any roll up - this is avoided by the logistic assigning a even
number of addresses to the board.
The case you want to fix should never happen - not due to the code, but
how addresses are managed in practise. And delivering a board with two
very different addresses, as in case of an overflow, can be also seen
weird by the customer.
Is this a real case ?
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
next prev parent reply other threads:[~2015-08-23 15:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-15 22:16 [U-Boot] [PATCH] arm: mxs: fix mac address of second interface Michael Heimpold
2015-08-15 22:49 ` Marek Vasut
2015-08-17 18:51 ` Michael Heimpold
2015-08-17 20:55 ` Marek Vasut
2015-08-23 15:38 ` Stefano Babic [this message]
2015-08-23 20:24 ` Michael Heimpold
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=55D9E8DD.4020903@denx.de \
--to=sbabic@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