Received: by 10.213.65.68 with SMTP id h4csp2102918imn; Thu, 5 Apr 2018 09:01:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx48IP5SWPy3F02Lp8WJcSlE1cuBLNPb3N9Ss2mwLJ1sxJBY5ywV0HldGWcAJb0KKcwy/f8Sk X-Received: by 10.101.78.131 with SMTP id b3mr15330102pgs.8.1522944109224; Thu, 05 Apr 2018 09:01:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522944108; cv=none; d=google.com; s=arc-20160816; b=AuVZWnxKSN0Q8Vezfe5Kd6PvrufAbs96mb+3C1m1of7a4ZsO3cqPOGLi0g7ELLJHST LM246FEUu3XyNS9IR9Kn+DfqK/B7BD8KYh0RpNeTVCgbRUhJYUfs8pua36WiFdYlhoFS PS8/CV96JwT3rTNHhD/Qo3eXohpln+yFVkE7gCWP9edgODGWUW9JNgBSH4lsDdqcS83c mjwEle7NOKwCIILD2S7CqUWhGH/8tFIx/BDPlCGXKcieC++tl1G3gojXAx2ehSgKRvpC t8yXMxYazFFbFvar3bIU9KXhjy93EwNlIGK/6bfnuEQ1zKdqLGshdRrB9098XLI/Cxht BuHQ== 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:dkim-signature :arc-authentication-results; bh=qqTi2KibQ0dYHOsDH9N/+DLwsCd2mzJ3DFpzNVnL+Ko=; b=rnqbU2+wN/1eFY0vxQmcZXlbqaUWMbymCjknU0xXhhMM6xOczCeTGtqdezCV6OZw95 o9D7XOGsIxmYERGgjJ2xbXxhf2FMDRzjTMxrpFGEol3g1FUwGNDJcc3h47aog1zYX+Ra 5OdhiVHyY0rG7QMd/hBa5MigOs5mlM8Qw9ZJi6FiiE3D17/fabXZyF3k+oBdO+mJdQhI ACpu/ua109Aypwv5RvvxdrmxDVEMa/K2cNBL+ynivuXQ6t9Nfjoz7g02J5+jtV4ZLfxb cX+cSQ2QAAfrJ1RqNoYZlm0cabmmlxVrgkK2hm6C5KeFdlt2knFocmhwQYBoER8NHzUc 2PFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=apcd00RZ; 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=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 x3si5713991pge.733.2018.04.05.09.01.32; Thu, 05 Apr 2018 09:01:48 -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=pass header.i=@gmail.com header.s=20161025 header.b=apcd00RZ; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751447AbeDEQAT (ORCPT + 99 others); Thu, 5 Apr 2018 12:00:19 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:45460 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751284AbeDEQAR (ORCPT ); Thu, 5 Apr 2018 12:00:17 -0400 Received: by mail-ot0-f193.google.com with SMTP id h26-v6so27710201otj.12; Thu, 05 Apr 2018 09:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=qqTi2KibQ0dYHOsDH9N/+DLwsCd2mzJ3DFpzNVnL+Ko=; b=apcd00RZ7sIu47J5vTAEJvLLW9QQ1LxuXPIl1eHSJ05nwr7dmYrFuX6XnzVXIod6UV L/zcIr0Uo688ETmBju7h37ZTkhwcZj8IO2szl7wJFsU2kEKdQXDoNxKoPKMgE3Okn8S5 oz7kIiNDElrNB81MO/en7u2gojJqE8qGI7U9L2OmytiX7l3jXvh7kKJcMALAPdhHwZNh hwyUxykWoHX/LCUS2B52+l/Svu2g8uWFLhV8g/o8+wDc7x5Ww9peXqcjOj6Xvi72UmEl +3A7oBO6bKMiYqepHpkEGoHXupZdUaXlTOaCYUvAseC1oDhOz6QIR3s67KW4dpCDXVgP 7R2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qqTi2KibQ0dYHOsDH9N/+DLwsCd2mzJ3DFpzNVnL+Ko=; b=Eo4IAGQ7m+sCy9smPbGx36UjDwXH7KnzUVBMFbqLA9PNxC5VbltXHjlCfsbhuRqFNp 8FnAvVhOd4iV+uAsG3tRdCUavTRioNX1oDII/bktzCvESkNFPxv9Zcq5P2btseFe9qE6 n1qbybG4egxa5KthxWeIcCgUlo3GVspzMXKBJmz3RcA+HHjWCnezyzVpVOc2zA1+IR+Z q02s5XJ2Bzk8VnNPPOoscxRi/mU82BgZ4LQ+lGhmR3fil1S79p3floe+P2RIUkvl7z3P 8Ozh2vi6NKm9T2KdOYfSl0Y4HzM+lbu08/Lu+79otweo/Ftpwa14GSObEW2i6nTIz+mS 5u3Q== X-Gm-Message-State: ALQs6tAhMvXyPX8o9YmRds+L4FYzW1qnKxF7P7Mf/yO7teNBUW8g4g58 OlVY24B6dkqsF+YPNNUiaYw/qyzE X-Received: by 2002:a9d:9b7:: with SMTP id q52-v6mr14843739otd.197.1522944016771; Thu, 05 Apr 2018 09:00:16 -0700 (PDT) Received: from [192.168.1.3] (ip68-109-195-31.pv.oc.cox.net. [68.109.195.31]) by smtp.gmail.com with ESMTPSA id n204-v6sm3035634oia.3.2018.04.05.09.00.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Apr 2018 09:00:15 -0700 (PDT) Subject: Re: [PATCH 1/2] net: phy: Helper function for reading strapped configuration values To: esben.haabendal@gmail.com, Andrew Lunn , "open list:ETHERNET PHY LIBRARY" , open list Cc: Esben Haabendal , Rasmus Villemoes References: <20180405114424.8519-1-esben.haabendal@gmail.com> From: Florian Fainelli Message-ID: <49448b00-e3fd-25df-580e-c02428f1bfe6@gmail.com> Date: Thu, 5 Apr 2018 09:00:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180405114424.8519-1-esben.haabendal@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? I really wonder how this is going to work though because an user can decide to force the PHY to have auto-negotiation disabled just like a MAC could actually attempt to do that while connecting to the PHY... more comments in patch 2. -- Florian