Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2013748ybl; Sat, 1 Feb 2020 11:22:18 -0800 (PST) X-Google-Smtp-Source: APXvYqwyqPC+6CDlERdb0Ey/H1zJgvhjF4k+64UDRQGYPqkJUAmgj2Vp+PzcSQsK1R99C0/hSsPR X-Received: by 2002:a05:6808:48e:: with SMTP id z14mr10287331oid.26.1580584938637; Sat, 01 Feb 2020 11:22:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580584938; cv=none; d=google.com; s=arc-20160816; b=jUU4Vx+pVr+wXCLbRRkUquy/522p4k2jAqHDx4cyB8uUe+8TbRZ3+B2TaxlUY82rhJ vD4xCAJGd6LIdL6Yszw0So4V6KWwibvWngfioMtZv99WKjiZ+69SqdFw674lo9N9HUfx +qMOB4MxKbfS6lu4Uog7rhZRCRLOhK0rVFfu5oN/Y1iECEd+YBBLB+lDktr9+fSrpk2z nLOR9iNaa4/OBxndkqmsR1BLk9Z7L/C8Z8a0/HJl7+eI1ivCuPvBYo0YWfFAGJHgwLEo vU3qLumP/xFijFuU7IzYCkUV7Op50h2InjUgXx4MOT9iywnuVJqPHNOAYU1SMLDg3FwY AlKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=EW/k+ix67cUEflZGNnsZ29JhfLeIQdczg9L4q+UwQNU=; b=aq4Fq8MHExLHdIshuOr5zQmrsfwxBVT6ifwyfRxHEyyjyrBbC05QQqwlcLwxloEyrX BJVsMee2qvzg7tZvalBhuFewgAl4mELb531lROhP3OLfyO/ZFJdypUiyIFZR+CCPB9cU aftw3beDwY575r6h+qeIo4dIgVwXMKlkPLmvOtJZ3xN+WXfQO8twc5vMmFxJ249UoE2f GCXipyiNB0iLc+hMIenGX6co72BR08motbi565PCO4Ifr8wFgOisgEbzWqJTZ3t15Yn4 24jk23TqIcV8WYZ0L8UnGr+VyVQwMBUX5XyEAKYtrvfB3OLpJj+JRp3q78EuW8w/zxAn WGWw== 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 k10si6887240otn.323.2020.02.01.11.22.06; Sat, 01 Feb 2020 11:22:18 -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; 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 S1726869AbgBATUR (ORCPT + 99 others); Sat, 1 Feb 2020 14:20:17 -0500 Received: from foss.arm.com ([217.140.110.172]:43454 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726443AbgBATUR (ORCPT ); Sat, 1 Feb 2020 14:20:17 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 46ECAFEC; Sat, 1 Feb 2020 11:20:16 -0800 (PST) Received: from [192.168.122.164] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 313983F68E; Sat, 1 Feb 2020 11:20:15 -0800 (PST) Subject: Re: [PATCH 5/6] net: bcmgenet: Fetch MAC address from the adapter To: Andrew Lunn Cc: netdev@vger.kernel.org, opendmb@gmail.com, f.fainelli@gmail.com, davem@davemloft.net, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, wahrenst@gmx.net, hkallweit1@gmail.com References: <20200201074625.8698-1-jeremy.linton@arm.com> <20200201074625.8698-6-jeremy.linton@arm.com> <20200201153709.GK9639@lunn.ch> From: Jeremy Linton Message-ID: <99353ae3-4ad5-b2b3-1303-4b9867eb213d@arm.com> Date: Sat, 1 Feb 2020 13:20:14 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200201153709.GK9639@lunn.ch> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2/1/20 9:37 AM, Andrew Lunn wrote: >> @@ -3601,6 +3605,23 @@ static int bcmgenet_probe(struct platform_device *pdev) >> !strcasecmp(phy_mode_str, "internal")) >> bcmgenet_power_up(priv, GENET_POWER_PASSIVE); >> >> + if (dn) >> + macaddr = of_get_mac_address(dn); >> + else if (pd) >> + macaddr = pd->mac_address; >> + >> + if (IS_ERR_OR_NULL(macaddr) || !is_valid_ether_addr(macaddr)) { >> + if (has_acpi_companion(&pdev->dev)) >> + bcmgenet_get_hw_addr(priv, dev->dev_addr); >> + >> + if (!is_valid_ether_addr(dev->dev_addr)) { >> + dev_warn(&pdev->dev, "using random Ethernet MAC\n"); >> + eth_hw_addr_random(dev); >> + } >> + } else { >> + ether_addr_copy(dev->dev_addr, macaddr); >> + } >> + > > Could you also maybe put in here somewhere a call to > device_get_mac_address(), to support getting the MAC address out of > ACPI? I had that here until right before I posted it, mostly because I was trying to consolidate the DT/ACPI paths. I pulled it out because it wasn't making the code any clearer, and as I mentioned in my response to the general _DSD properties I would rather entirely depend on non DSD properties if possible. I will put it back in, but IMHO we shouldn't be finding firmware using it. Since the discussion a few years back, its become clearer to me its not usually needed. As in this example, the addresses can usually be picked off the adapter if the firmware bothers to set them up.