From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A53EC2D0F0 for ; Wed, 1 Apr 2020 14:11:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4A87206F8 for ; Wed, 1 Apr 2020 14:11:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="IoLPirKS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732984AbgDAOL3 (ORCPT ); Wed, 1 Apr 2020 10:11:29 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:43110 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732876AbgDAOL2 (ORCPT ); Wed, 1 Apr 2020 10:11:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=//y7rTWB++mIyon6G1H8Ntxa7+4WAlVqnKhGsqIfAvQ=; b=IoLPirKSmbYazMEMzq/kFwrf9q uU3i/jBhcEpDS63PhX/bwJkjPqvfyUy/dCL2rcQn3skbQG75H+0nt3iEnCv+MicI7Kw0Q0yfcvxxc Q6SboNmTaj35lrGrWJHANouCHfNY8fkhuWWcsLJbRTtFObMXPGBiP5gtSM1vZV346I4M=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jJe5J-000Qte-Ev; Wed, 01 Apr 2020 16:11:13 +0200 Date: Wed, 1 Apr 2020 16:11:13 +0200 From: Andrew Lunn To: Florinel Iordache Cc: "davem@davemloft.net" , "netdev@vger.kernel.org" , "f.fainelli@gmail.com" , "hkallweit1@gmail.com" , "linux@armlinux.org.uk" , "devicetree@vger.kernel.org" , "linux-doc@vger.kernel.org" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "kuba@kernel.org" , "corbet@lwn.net" , "shawnguo@kernel.org" , Leo Li , "Madalin Bucur (OSS)" , Ioana Ciornei , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH net-next 6/9] net: phy: add backplane kr driver support Message-ID: <20200401141113.GC62290@lunn.ch> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > > > + val = phy_read_mmd(bpphy, MDIO_MMD_AN, bp_phy- > > >bp_dev.mdio.an_status); > > > + val = phy_read_mmd(bpphy, MDIO_MMD_AN, > > > + bp_phy->bp_dev.mdio.an_status); > > > > Why not just > > > > val = phy_read_mmd(bpphy, MDIO_MMD_AN, MDIO_CTRL1); > > > > Or is your hardware not actually conformant to the standard? > > > > There has also been a lot of discussion of reading the status twice is correct or > > not. Don't you care the link has briefly gone down and up again? > > > > Andrew > > This could be changed to use directly the MDIO_STAT1 in order to read > AN status (and use MDIO_CTRL1 for writing the control register) but this > is more flexible and more readable Less readale. MDIO_STAT1 is well known. What does bp_dev.mdio.an_status mean? In general, core code should be KISS, and assume everything follows the standard. We don't want to scatter workarounds for non-conformant hardware in core code. Such workarounds should be in the drivers where they are hidden away. > + bpkr->mdio.an_control = MDIO_CTRL1; > + bpkr->mdio.an_status = MDIO_STAT1; > + bpkr->mdio.an_ad_ability_0 = MDIO_PMA_EXTABLE_10GBKR; > + bpkr->mdio.an_ad_ability_1 = MDIO_PMA_EXTABLE_10GBKR + 1; > + bpkr->mdio.an_lp_base_page_ability_1 = MDIO_PMA_EXTABLE_10GBKR + 4; Please drop this, and use the #defines directly. Andrew