From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/2] sunxi: Serial number support, obtained from SID bits
Date: Sun, 29 Mar 2015 14:47:41 +0200 [thread overview]
Message-ID: <5517F46D.3010406@redhat.com> (raw)
In-Reply-To: <1427564136-25861-1-git-send-email-contact@paulk.fr>
Hi,
On 28-03-15 18:35, Paul Kocialkowski wrote:
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Thanks, I'm currently busy merging some more patches, once that
is done this patch should show up in u-boot-sunxi/next, and
it will be included in u-boot/master once the merge window
for v2015.07 opens.
Regards,
Hans
> ---
> board/sunxi/board.c | 33 ++++++++++++++++++++++-----------
> 1 file changed, 22 insertions(+), 11 deletions(-)
>
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 01b654e..79516bf 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -372,20 +372,31 @@ int g_dnl_board_usb_cable_connected(void)
> #ifdef CONFIG_MISC_INIT_R
> int misc_init_r(void)
> {
> + char serial_string[17] = { 0 };
> unsigned int sid[4];
> + uint8_t mac_addr[6];
> + int ret;
> +
> + ret = sunxi_get_sid(sid);
> + if (ret == 0 && sid[0] != 0 && sid[3] != 0) {
> + if (!getenv("ethaddr")) {
> + /* Non OUI / registered MAC address */
> + mac_addr[0] = 0x02;
> + mac_addr[1] = (sid[0] >> 0) & 0xff;
> + mac_addr[2] = (sid[3] >> 24) & 0xff;
> + mac_addr[3] = (sid[3] >> 16) & 0xff;
> + mac_addr[4] = (sid[3] >> 8) & 0xff;
> + mac_addr[5] = (sid[3] >> 0) & 0xff;
> +
> + eth_setenv_enetaddr("ethaddr", mac_addr);
> + }
>
> - if (!getenv("ethaddr") && sunxi_get_sid(sid) == 0 &&
> - sid[0] != 0 && sid[3] != 0) {
> - uint8_t mac_addr[6];
> -
> - mac_addr[0] = 0x02; /* Non OUI / registered MAC address */
> - mac_addr[1] = (sid[0] >> 0) & 0xff;
> - mac_addr[2] = (sid[3] >> 24) & 0xff;
> - mac_addr[3] = (sid[3] >> 16) & 0xff;
> - mac_addr[4] = (sid[3] >> 8) & 0xff;
> - mac_addr[5] = (sid[3] >> 0) & 0xff;
> + if (!getenv("serial#")) {
> + snprintf(serial_string, sizeof(serial_string),
> + "%08x%08x", sid[0], sid[3]);
>
> - eth_setenv_enetaddr("ethaddr", mac_addr);
> + setenv("serial#", serial_string);
> + }
> }
>
> #if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET)
>
prev parent reply other threads:[~2015-03-29 12:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-28 17:35 [U-Boot] [PATCH v4 1/2] sunxi: Serial number support, obtained from SID bits Paul Kocialkowski
2015-03-28 17:35 ` [U-Boot] [PATCH v4 2/2] sunxi: Pass serial number through ATAG Paul Kocialkowski
2015-03-29 12:49 ` Hans de Goede
2015-03-29 12:47 ` Hans de Goede [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=5517F46D.3010406@redhat.com \
--to=hdegoede@redhat.com \
--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 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.