Received: by 10.213.65.68 with SMTP id h4csp1778508imn; Mon, 19 Mar 2018 13:02:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELsPRmLtAyXQvn9iHCKRqmrvraJYebbYD2/11gQxs5W2Z6iZcX+OTjI28FGdHoqK3x8EruXo X-Received: by 2002:a17:902:66e6:: with SMTP id e93-v6mr13846350plk.312.1521489720232; Mon, 19 Mar 2018 13:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521489720; cv=none; d=google.com; s=arc-20160816; b=myUkYK7nawa+srRM02zrYZCKYbIghrpAX7M+ZZ8xzh4QGMZZAOz2i2BFPZ1BV/AhJj 9YDmTyrx7Gmmt/wXR630KPChS2yqbT1Ihb75Ltt8ZmLb9n6UWbOqzCrHKBCxLuUxAFYr TPu+3edDmtbNjEdrMn1VE8C+vk2HxDuVzeqJ+pHOjeQTop5+mdgMSyEyA6lhWFaEGaJQ +QwK3i8BJ1CLBaNGiYqYW1S/9vyQOLY6f2oyCeP6pl2bnTzhjLI3V/MpQbam7dfHp4LU pjbZYIo0WZTiwyLlepi8zu3M2xiMcOAGjsCcXj3OBSfD6T5ygthVETSLnlZmu2GtH41z z5wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=zngn5PEDMBwMFwV8lN5+l9qVqM994fmJ8WahoXuh8Mg=; b=zimL/6YMD8hTpULd2jDr9XF6q2zk+HpuZB+sJO53vXnmhshRwKWa4d8MT/jrnBqQ/E q/zJCDd07V8W8hoVK8eTzRTS8pa5qgBPRLHenZP2pP+I4qug/hBEmHOMHgphiMsN5ijl BmVsfC2l/8ge5hpo5gQ1GYuH2DGTP6eY+xSOVBoKo3Xn+MNo7LuXIjZotv8hksLF7Alg 5cnPDPgzUNyfumfwrIPp/ucS8TyXbuk1mQm3MYmSxkjsPAlxiTxsSUinPYeiSnb3jhgF ahRDUbOoft0qgd+zkS/qPbnHsXs7yVLHPmblF0jReWefsIye3A8bizd0ADrSjF5Kiux4 qzWA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si432355pgr.708.2018.03.19.13.01.16; Mon, 19 Mar 2018 13:02:00 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S971018AbeCSTy3 (ORCPT + 99 others); Mon, 19 Mar 2018 15:54:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47232 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967261AbeCSST2 (ORCPT ); Mon, 19 Mar 2018 14:19:28 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 834DB1110; Mon, 19 Mar 2018 18:19:27 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steve Lin , Florian Fainelli , Jon Mason , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 037/241] net: ethernet: bgmac: Allow MAC address to be specified in DTB Date: Mon, 19 Mar 2018 19:05:02 +0100 Message-Id: <20180319180752.730334921@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bgmac-bcma.c | 39 +++++++++++++++++------------ 1 file changed, 23 insertions(+), 16 deletions(-) --- 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" static inline bool bgmac_is_bcm4707_family(struct bcma_device *core) @@ -96,7 +97,7 @@ static int bgmac_probe(struct bcma_devic struct ssb_sprom *sprom = &core->bus->sprom; struct mii_bus *mii_bus; struct bgmac *bgmac; - u8 *mac; + const u8 *mac = NULL; int err; bgmac = kzalloc(sizeof(*bgmac), GFP_KERNEL); @@ -110,21 +111,27 @@ static int bgmac_probe(struct bcma_devic bcma_set_drvdata(core, bgmac); - switch (core->core_unit) { - case 0: - mac = sprom->et0mac; - break; - case 1: - mac = sprom->et1mac; - break; - case 2: - mac = sprom->et2mac; - break; - default: - dev_err(bgmac->dev, "Unsupported core_unit %d\n", - core->core_unit); - err = -ENOTSUPP; - goto err; + if (bgmac->dev->of_node) + mac = 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 = sprom->et0mac; + break; + case 1: + mac = sprom->et1mac; + break; + case 2: + mac = sprom->et2mac; + break; + default: + dev_err(bgmac->dev, "Unsupported core_unit %d\n", + core->core_unit); + err = -ENOTSUPP; + goto err; + } } ether_addr_copy(bgmac->mac_addr, mac);