Received: by 10.213.65.68 with SMTP id h4csp2360940imn; Thu, 5 Apr 2018 13:37:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx49utuAUPcJrjof9lzWCaxeoFvZCnbXWxwa6TCI/6i/u7cUKTn2WACKYuBNKWXX4J2zTn04q X-Received: by 2002:a17:902:ba87:: with SMTP id k7-v6mr24707424pls.124.1522960628410; Thu, 05 Apr 2018 13:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522960628; cv=none; d=google.com; s=arc-20160816; b=iVFR/pIT7pWUI3YKhPZMLm4qsyfxoyGLAg9CywILVtSFuO/fgHiO/oaD97bCQDP++w JgpDJipakCahuRew77Fpbz9+fhvR/k5qJP4+MidO0/f79exFSgw9xBQfg6xwHcRtxD7d evq1nefEhUjb+jupm8yQ2Uo7GYHnWo8lYmu5b8cAqGvsMICanQeHDN5Ennlu558wXM9Y +9z/vbAybAMAR+P2jsepy+lDaI1TTQ2KFXt3M1XXRsTMumv2nQ7MzsEjVpa5XpUDgwu1 1Ft4oSLyyGGmBgrspJ0sSUztrKx32eDDQJNHHHDMvu3vdyeQ5JGL2v1fFGQWk1K4Ped2 XKzA== 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:message-id :in-reply-to:date:references:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=7wNbPxfeTINdVb41/P6GK24n6QdNJHh1+beaCNhtKuI=; b=pIwVKasBHlE3wf0C4YMx1veIqAFWBv+8WXTXAXvCxnsRIUdJEAHGElIqBxzUOQ26zA 9b16Usn3z9jOTu80+YqIARzOR10Se4JqfGuvLHk5zrTxhfm367jIS+0iwukJriP4aOH8 FdbAFe1Ng9vzrJlb3bqornZEHfuripalBotS7MB2sy1TVOaR5ZMS/lS64YNwws3p5Psa vmL3YdjBkcy2G+/+fbwEwCfyCk6lkNxqrUmEPYr6Y6Pl0lCdm3uLQqut0HrECFUYlwBs qMwzJnIo7TXCws143eEYg/VOJym+91HhC5eD2c9zfbNcSm6aSZ/4Qu2h+bEZYvfE1nRe LZHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@haabendal.dk header.s=20140924 header.b=Xz5+erpv; 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 a12si153860pgd.102.2018.04.05.13.36.54; Thu, 05 Apr 2018 13:37:08 -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=@haabendal.dk header.s=20140924 header.b=Xz5+erpv; 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 S1753669AbeDEUfD (ORCPT + 99 others); Thu, 5 Apr 2018 16:35:03 -0400 Received: from mailrelay2-3.pub.mailoutpod1-cph3.one.com ([46.30.212.11]:14577 "EHLO mailrelay2-3.pub.mailoutpod1-cph3.one.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753391AbeDEUfC (ORCPT ); Thu, 5 Apr 2018 16:35:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haabendal.dk; s=20140924; h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to: references; bh=IzODDtSxdc9hxz4T+EbuoVm3pbLVVvRIlv/n4S+UEZg=; b=Xz5+erpvqXErXZh8FQdZ/vpex1e6iAfBFi9FUFQYwhe3XoY8JUTkqoafu2PwTM725jQ1cYARVGnSE Z5jo3erBzj9FW20gDvjdqsLjQfQQLMKiG1HrVeftjxmOUvXMFo2hlP5jAutR5Zaa4AKTXJX0OYQFaG 0KFD11/rfmfVn8fU= X-HalOne-Cookie: 19a17deb6af7882b0e130400a84ee0213d86c1c1 X-HalOne-ID: 911c3cbc-390e-11e8-bb6c-d0431ea8a290 Received: from localhost (unknown [87.57.30.174]) by mailrelay2.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 911c3cbc-390e-11e8-bb6c-d0431ea8a290; Thu, 05 Apr 2018 20:18:56 +0000 (UTC) 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 References: <20180405114424.8519-1-esben.haabendal@gmail.com> <49448b00-e3fd-25df-580e-c02428f1bfe6@gmail.com> Date: Thu, 05 Apr 2018 22:18:55 +0200 In-Reply-To: <49448b00-e3fd-25df-580e-c02428f1bfe6@gmail.com> (Florian Fainelli's message of "Thu, 5 Apr 2018 09:00:13 -0700") Message-ID: <87h8opjtjk.fsf@haabendal.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) 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