Received: by 10.213.65.68 with SMTP id h4csp2361397imn; Thu, 5 Apr 2018 13:37:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx49CRoxl5/SBUwSstWFqJnqB+C+tZhBAKJYhrMs/uINeD/HwuzxzZdGQUR6f9PrwCzsgoRmb X-Received: by 10.98.189.14 with SMTP id a14mr11698674pff.30.1522960662136; Thu, 05 Apr 2018 13:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522960662; cv=none; d=google.com; s=arc-20160816; b=fG84YmF893mYawvIVSl9nnxNV2D2oYY2tR5tBxqLYZZnbLcHztH1y8YDaOjs6ZavW+ CZw1EhzwFq+vgI3D0wE71551yyIWKM4SM8Di3B3JVFnE9RXX9vNqWiSiXxSuOraat6Mv MbqvxkKWuO92o4iXvQoMkGoLxKqkEONpAol74tM+y+so6v/iBE56xXa9Kr2oqtcZgT/J yUBzXh3JHpxtetYJT6yk1upOxD9Gr1JQofS/EZjEKuHVCmRzWgmPd8aTYNOImvzt27yQ GKeYaDwUsE6iOEbaSuXc681NSX4Z+BBurscxzAlZVeYqAUXETacKYiqzf5d93QTaGlpG s8HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=7wNbPxfeTINdVb41/P6GK24n6QdNJHh1+beaCNhtKuI=; b=Yfd4Sfnq+gyvaTkfeyP3JxtUHiJh6Mdv5sfL3T8B6OmteI3KveVN1DZ2r2k/INNkr2 zf9bw0o4zUY7pzWPa8e11jK6d4RP4fQRBvnz+h1XRAxBsgYa3VhiEh2CAFzKyQaiciie 44c2rZ6/6Lc2h6PrCmilSZdvyBMHSBJ2EDTsakyGLtcnR1XBp0uqnKdkoHGnC/mwMYyh tGPDP/MrIPbEnlpKG9+PEwZGdgY+FsODJjzI7RJGMmn3tJmOqMh45tbhjWHl7l72AbQu PwTEAvYhHNjkAVGrtel9+xOL6KkUm/D9pAB8pfBVukStHV26cgOBX4TRz2XK5zRPaZYu k/Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=WsIsMXN9; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4si6635746pfb.284.2018.04.05.13.37.27; Thu, 05 Apr 2018 13:37:42 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=WsIsMXN9; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753507AbeDEUe1 (ORCPT + 99 others); Thu, 5 Apr 2018 16:34:27 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:52626 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751454AbeDEUeW (ORCPT ); Thu, 5 Apr 2018 16:34:22 -0400 Received: by mail-wm0-f67.google.com with SMTP id g8so8882173wmd.2; Thu, 05 Apr 2018 13:34:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=7wNbPxfeTINdVb41/P6GK24n6QdNJHh1+beaCNhtKuI=; b=WsIsMXN9FK1PEn+d7aOz3oK2ZWU4u6Rv2zGTQFz44xNDtzrrnMUFu23orLK2AGylvD 7eWFJp0DXI/3IPT6IWJTRGTkoK0Q7v18N4v9vVdIMpnF/a0OKnfkjaMwdeo2/pSHkKwY sFrU8tUrrDGxQNW2tiCiXU7OBy6I1EPBOECRZ6jjhodmvbXdRj/I4LF/BoJrJBkv9PMx 2OQdOCLoUsw1Op8J6QJxE1t3YgEw3vaHxkoUmXyBNZc1T+xaE736MEip4XpwYvYqU2az aBTtomPIb6TkH+qRv3kIJqcepyxXb4mcT0JMkk+xjS/6tPDp4MuWCO99x4QrvJ7vqe2O QElQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=7wNbPxfeTINdVb41/P6GK24n6QdNJHh1+beaCNhtKuI=; b=X5VSCUZrqdPbuU6ecgvhPMQCbjTFqUjyLPQAp9B6jdM7ruIRZIlSEcKe/3KUzMlEDV 5PbjNjRof6TBRA/7kNT8ve+VB7ptCQ6OCUQPUWuHm1bMBB2PtYAo+P+uvhOVRpHMF3i5 +UQBy7XQIL5wuv967I9hTaCF74MmSzm/+JanZTPMR667zKdKzikUgRS17Lf/GgyIJ/ph l+hHXPpc4ZA7rgeJsuwWUh4eTpQzJqbJ3qPnnLv9Ixzl8dcrJOZoKzAVl9Bnl0c9kmgn s+JKMguqqPlgjeGHr51317MyMdzMVS242I6oHWxeX3dFHDcO36qEJQ/tRuQR1b05IAnP cCXg== X-Gm-Message-State: ALQs6tB/E9Rlv83dCTzFutGmbLp3229phCc7cIJmzLwi7mhaFdqCv56H QzlVxGM4bh3FMJJiiL9U2Ew= X-Received: by 10.46.128.139 with SMTP id i11mr12742054ljg.97.1522960460746; Thu, 05 Apr 2018 13:34:20 -0700 (PDT) Received: from localhost (87-57-30-174-static.dk.customer.tdc.net. [87.57.30.174]) by smtp.gmail.com with ESMTPSA id h28-v6sm1701227lfb.8.2018.04.05.13.34.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Apr 2018 13:34:20 -0700 (PDT) From: Esben Haabendal To: Florian Fainelli Cc: Andrew Lunn , "open list\:ETHERNET PHY LIBRARY" , open list , Rasmus Villemoes Subject: Re: [PATCH 1/2] net: phy: Helper function for reading strapped configuration values In-Reply-To: <49448b00-e3fd-25df-580e-c02428f1bfe6@gmail.com> (Florian Fainelli's message of "Thu, 5 Apr 2018 09:00:13 -0700") References: <20180405114424.8519-1-esben.haabendal@gmail.com> <49448b00-e3fd-25df-580e-c02428f1bfe6@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Date: Thu, 05 Apr 2018 22:34:18 +0200 Message-ID: <87a7uhjstx.fsf@haabendal.dk> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Florian Fainelli writes: > On 04/05/2018 04:44 AM, esben.haabendal@gmail.com wrote: >> From: Esben Haabendal >> >> Add a function for use in PHY driver probe functions, reading current >> autoneg, speed and duplex configuration from BMCR register. >> >> Useful for PHY that supports hardware strapped configuration, enabling >> Linux to respect that configuration (i.e. strapped non-autoneg >> configuration). >> >> Signed-off-by: Esben Haabendal >> Cc: Rasmus Villemoes >> --- >> drivers/net/phy/phy_device.c | 41 +++++++++++++++++++++++++++++++++++++++++ >> include/linux/phy.h | 1 + >> 2 files changed, 42 insertions(+) >> >> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c >> index 74664a6c0cdc..cc52ff2a2344 100644 >> --- a/drivers/net/phy/phy_device.c >> +++ b/drivers/net/phy/phy_device.c >> @@ -1673,6 +1673,47 @@ int genphy_config_init(struct phy_device *phydev) >> } >> EXPORT_SYMBOL(genphy_config_init); >> >> +/** >> + * genphy_read_config - read configuration from PHY >> + * @phydev: target phy_device struct >> + * >> + * Description: Reads MII_BMCR and sets phydev autoneg, speed and duplex >> + * accordingly. For use in driver probe functions, to respect strapped >> + * configuration settings. >> + */ >> +int genphy_read_config(struct phy_device *phydev) > > This duplicates what already exists, in part at least within > genphy_read_status() can you find a way to use that? Make a small static function for updating duplex and speed fields from a BMCR value. It will not be big re-use, but it would make sense. I will do that in next patch version. /Esben