Received: by 10.223.185.116 with SMTP id b49csp1065220wrg; Sat, 3 Mar 2018 14:33:04 -0800 (PST) X-Google-Smtp-Source: AG47ELvvdmxZTDCS3lJ9CFRUWJCqCaWblIyE5grGWvvYtF0uREw56dgDagY7FsCnMFHayIX7VIdH X-Received: by 2002:a17:902:424:: with SMTP id 33-v6mr9002881ple.433.1520116383884; Sat, 03 Mar 2018 14:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520116383; cv=none; d=google.com; s=arc-20160816; b=jJpT6EpbQx8zxFMV6Qmg7KYSrtpWjuQ/qu7RKmKMMtuNa862MQpdZWvaW8nm6VTJ/L 4OKyVaXxfGByQerlQbN3CK+dAWJiF2KjsEUprWfPLb/cX0OZKC19NSaaY03rKcBPNz9d mdnXLfwD6lCVKfF832bopEJ2khfmxnqxeDJsrTGzIIFEt5rVl3uv6pS7ntD8y9tTy5JE YmwWTZq6CJ5+8OyFNCv/6FYyFnAAzdkWotGS1UqSS+Y/3ou0EMRzjTwxwz1NUgyM7iNj +Dp8J+shupYCsYGHIaujeLMC+FzbZQPkoSn5draZ09tPX22GCVNTraGYqqS47cwZH+Z8 P76Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=XKm2fxsZCFyGxt/BwmLMXZFolO6n3Ube9kA23RPhdrI=; b=GcjvKfMSQIWFHlAjPYChEY2eW3C+FDnGHXLi3q5RxuvxHO5KW5xPKsFbg6t1OQfiYZ oCn5V+BWi2AZj6iKcaahGr59Guh8nn2/aZmV+0OSKe0X2SYwJHHeMTSUYsMxqBhKQ9GE 2gNQElUIogGq9SsdusCnRxfRH72glN+YBcoCQyutyjdAfcivPbFlCWzi45Ho6DfhwtCu G/bIjYqYO3pGenM8F86PZ15sKB8kuYPHpQh7/WOC0c2Oldglmi1PInpkROK4fI4OgDGq mHWaQxsaLZ+04WV3o8xSzjtZlHyw/4nWIlrmTrFeUYDZLPEYC6i2uvbzDtkAohe4gz+b 51hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Z/7g6z8B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si7442286pfl.5.2018.03.03.14.32.49; Sat, 03 Mar 2018 14:33:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Z/7g6z8B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933801AbeCCWcK (ORCPT + 99 others); Sat, 3 Mar 2018 17:32:10 -0500 Received: from mail-co1nam03on0109.outbound.protection.outlook.com ([104.47.40.109]:6764 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933465AbeCCWcD (ORCPT ); Sat, 3 Mar 2018 17:32:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XKm2fxsZCFyGxt/BwmLMXZFolO6n3Ube9kA23RPhdrI=; b=Z/7g6z8BLrFzETGZiX80hx2tqFyG/PsZETaL8iNCiU0kbug3bbKrRaN4llVzvJMquoTP1gLlNQ7Qe07yi3l1OTOk+4y77whm2YPsNvv49uiiPz96sOEk/F+bBeKoXjmVUO8PvCWXn7LDlCAly+V/XDl79sCcwP85I8fDE7gY90A= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1083.namprd21.prod.outlook.com (52.132.149.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.1; Sat, 3 Mar 2018 22:32:01 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:32:01 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Steve Lin , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 039/219] net: ethernet: bgmac: Allow MAC address to be specified in DTB Thread-Topic: [PATCH AUTOSEL for 4.9 039/219] net: ethernet: bgmac: Allow MAC address to be specified in DTB Thread-Index: AQHTsz7tQclT7p7PFUycPori/b2SIQ== Date: Sat, 3 Mar 2018 22:28:18 +0000 Message-ID: <20180303222716.26640-39-alexander.levin@microsoft.com> References: <20180303222716.26640-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222716.26640-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB1083;6:FwyXglfAJ0SwRTXYlnDAuckxEHxD8B4Q28HOsbT07t7rOC0WwHh8Awe9xXGgSgPA4PC8G8cIKO40DesRoVDZogJYBAL4xMVF/hJg0G7FET2ZZIYbSqoZOBw34wEFaqJ0qRwT4t3annEcU+LMNoLNTJ3PIWo3eOF+Tmf1flsTlDqPVjkHwmDMMb77gZ6dsKQNy5S2WLwdiGYbVpniyX92lsonzApkI0TnaC2mwk9XTavn+YvxsYpVCwpEoCyX2nUgQPd3pu7h+BD8crALleD054drlyRCG67CDuKCEpCekshr2Dj/GrT4KIighOD69/Po3YgXEFZ9KqvFk+XWSa+wXuhDy8qXv/GnN8YdiUQNTSUj3QSF8+ERCYSSZJjBlIW5;5:wZzTYqsz2EjkcX0lmzTNNlLja/ZEdBxEZcyUWSaKmy0BoGUagtQRMA3DSwOHikzHsiJGpN/oGJ4ng9cXlOho9lMHmiGr0r2pLQWExznwQ8QkwuMU2SRn7d4guGyjHWi9DdweyR5oS2vv4d1h5Dt4ulHsHL4FGs+ASUWjo5AtW+A=;24:PyTMcOq3x6s1QNvc6XAbqgTpl1zSln5UupJYOoseMwXfuD04ax27ewgBNSAHpdVNNlWxOp2pPQzsEUcU6mfCxRmT3NH+MfuOKhNoNVlvcEY=;7:FblFFG9rUrZH06IA3zrwNdMubJwL75EYReLrptyL6S8AJfxVozVkNRwZkWpz7LR9fZxBsXw/IOHUZYhQ0vUJWgvLZgJ8iqKyl2yKD+WvN9VL50DqPJuTI1BXgIEz6FJAzckXZSgFj2pNKDUE6O3dhQKVwNIbDiqUugsgFRfvTRn1HTdHmm0mov6gALR2Oh1geylJF5gQAIAkyJXoUSoPURKZ//OIkwXI4xIEBzwiuw55hqmE4XFqn804XnU57ZtK x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: cbd162e2-e9f8-4025-4487-08d581569524 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7193020);SRVR:MW2PR2101MB1083; x-ms-traffictypediagnostic: MW2PR2101MB1083: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB1083;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1083; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(39860400002)(39380400002)(396003)(346002)(366004)(189003)(199004)(106356001)(53936002)(316002)(305945005)(7736002)(3280700002)(107886003)(2906002)(6512007)(6436002)(97736004)(3660700001)(6486002)(99286004)(81166006)(8936002)(81156014)(76176011)(8676002)(25786009)(2950100002)(6506007)(4326008)(110136005)(5250100002)(54906003)(36756003)(575784001)(105586002)(6116002)(6666003)(22452003)(86612001)(10090500001)(186003)(68736007)(26005)(2900100001)(86362001)(66066001)(102836004)(3846002)(14454004)(478600001)(72206003)(10290500003)(5660300001)(1076002)(2501003)(22906009)(217873001)(473944003);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1083;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: UITUat9q98W4JXD5mlKjSZGoaaRFfkp30pgtCrRXWYdyDn2fqTeL5DXrpl/x8aJt1QlVy84GOxzrKA88NKtvCLy/7tkBrnG2C5yqM6KA6XUY9OVL9w2gz65EI4n1YTpSg9wJ4PI/tlp/WEYRef94pUT8l6twR7bn9o2gl1g3Klg= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbd162e2-e9f8-4025-4487-08d581569524 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:28:18.2756 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1083 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steve Lin [ Upstream commit 2f771399a3a2c371c140ff33544a583c6fbc5fd9 ] Allows the BCMA version of the bgmac driver to obtain MAC address from the device tree. If no MAC address is specified there, then the previous behavior (obtaining MAC address from SPROM) is used. Signed-off-by: Steve Lin Reviewed-by: Florian Fainelli Acked-by: Jon Mason Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bgmac-bcma.c | 39 ++++++++++++++++++--------= ---- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c b/drivers/net/ether= net/broadcom/bgmac-bcma.c index c16ec3a51876..1ee11b600645 100644 --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "bgmac.h" =20 static inline bool bgmac_is_bcm4707_family(struct bcma_device *core) @@ -96,7 +97,7 @@ static int bgmac_probe(struct bcma_device *core) struct ssb_sprom *sprom =3D &core->bus->sprom; struct mii_bus *mii_bus; struct bgmac *bgmac; - u8 *mac; + const u8 *mac =3D NULL; int err; =20 bgmac =3D kzalloc(sizeof(*bgmac), GFP_KERNEL); @@ -110,21 +111,27 @@ static int bgmac_probe(struct bcma_device *core) =20 bcma_set_drvdata(core, bgmac); =20 - switch (core->core_unit) { - case 0: - mac =3D sprom->et0mac; - break; - case 1: - mac =3D sprom->et1mac; - break; - case 2: - mac =3D sprom->et2mac; - break; - default: - dev_err(bgmac->dev, "Unsupported core_unit %d\n", - core->core_unit); - err =3D -ENOTSUPP; - goto err; + if (bgmac->dev->of_node) + mac =3D of_get_mac_address(bgmac->dev->of_node); + + /* If no MAC address assigned via device tree, check SPROM */ + if (!mac) { + switch (core->core_unit) { + case 0: + mac =3D sprom->et0mac; + break; + case 1: + mac =3D sprom->et1mac; + break; + case 2: + mac =3D sprom->et2mac; + break; + default: + dev_err(bgmac->dev, "Unsupported core_unit %d\n", + core->core_unit); + err =3D -ENOTSUPP; + goto err; + } } =20 ether_addr_copy(bgmac->mac_addr, mac); --=20 2.14.1