From patchwork Sun Jun 26 11:54:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 640659 X-Patchwork-Delegate: hdegoede@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3rcr900wyQz9s9N for ; Sun, 26 Jun 2016 21:54:59 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1F6CBA7548; Sun, 26 Jun 2016 13:54:54 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IvIZwvWXzFuc; Sun, 26 Jun 2016 13:54:53 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8D6D8A74DA; Sun, 26 Jun 2016 13:54:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 75FC4A74DA for ; Sun, 26 Jun 2016 13:54:50 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A5ImfAXMVbYo for ; Sun, 26 Jun 2016 13:54:50 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by theia.denx.de (Postfix) with ESMTPS id 241F0A74D6 for ; Sun, 26 Jun 2016 13:54:46 +0200 (CEST) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CABED3B71F; Sun, 26 Jun 2016 11:54:43 +0000 (UTC) Received: from shalem.localdomain.com (vpn1-4-182.ams2.redhat.com [10.36.4.182]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5QBseNw002033; Sun, 26 Jun 2016 07:54:41 -0400 From: Hans de Goede To: Ian Campbell Date: Sun, 26 Jun 2016 13:54:37 +0200 Message-Id: <1466942077-7423-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sun, 26 Jun 2016 11:54:44 +0000 (UTC) Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] sunxi: Add support for eth1addr X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Currently we will already fill ethaddr with a fixed unique address based on the SoCs serial (from the sid) to make sure that boards which use the integrated emac / gmac get a fixed mac rather then a random one. On some boards (observed on 2 tablets using sdio rtl8703as wifi chips) the wifi does not come with a fixed mac either, so also set eth1addr, so that dts files can set an ethernet1 alias to get mac-address and local-mac-address filled for dt nodes describing the wifi controller. Signed-off-by: Hans de Goede --- board/sunxi/board.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index b5a50f4..41d796c 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -641,6 +641,18 @@ int misc_init_r(void) eth_setenv_enetaddr("ethaddr", mac_addr); } + if (!getenv("eth1addr")) { + /* Non OUI / registered MAC address */ + mac_addr[0] = 0x12; + 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("eth1addr", mac_addr); + } + if (!getenv("serial#")) { snprintf(serial_string, sizeof(serial_string), "%08x%08x", sid[0], sid[3]);