Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp646628ybb; Wed, 1 Apr 2020 07:12:16 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv8JA4X3X62/fbe1Edx5MwJVpUDeVClArhLKY/MdjKf3U78am2lalc48MnwdtwzBmUrJdg6 X-Received: by 2002:a05:6830:19ee:: with SMTP id t14mr18058989ott.287.1585750336270; Wed, 01 Apr 2020 07:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585750336; cv=none; d=google.com; s=arc-20160816; b=NEreCXgADTU+v1PBOTbxZHNePO/vHwEUAd1pXMg9kV6jyrAaHm2agdif4nFoTlcn+W 92b8CMfR6iIWDHoDnSNJ/Z8wVhhtnswdJQbtanxDqjeUlx2BiDk6HRwRGWhMHXHM6nKd 1ibjwsU4F6ApHM2cJnCc9ZhRiYU4TwF2ivyisaVcmYbQtDWo3Hs9bcaQIhqqaOCOyNUJ wuwV84qMm2BUL04PCOvXA6cY+5W7YiWXbzy4qO8QgPZrDLQClzD0O38dzggeMH455X61 XryVhumK7nNHlQA/WBczaIq2zmqeOqg7rcq5/m0QlOt7zmE567mgTto4JGQ8TUlWrv9h xZRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=//y7rTWB++mIyon6G1H8Ntxa7+4WAlVqnKhGsqIfAvQ=; b=Ie7fcrzQyTFUf312b+TeIFwRra6Bytj86b5DFfivF9fiYTdur+tMJwD5I6NXpRiFux 2IFlexdHN8WLmKAqrlND1FnuBBJxbvp+ZYNW1SO+wrnoE1Mcvfm7d6QhfSKZn/+X2c0Z oxHFUrJ2tZkyx8kn8nmCdpR9DLivY2Y036wH2H5P7u5lNLb27vzEPU5j66UqZZBTN7k+ EY8/AVPiw417nhbhDwFQ/dVa9AzQMg56jTsQM6zfA6If81SWfJTliT5rYfaMwiqoD6Us rY9qCYPxtykpGwB3etceUFji4k3H/+B38SoK12GcQH7/W8VnfjKm9n1q/KKAbWfh76pe PWUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=IoLPirKS; 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 l22si887667otd.53.2020.04.01.07.12.02; Wed, 01 Apr 2020 07:12:16 -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=@lunn.ch header.s=20171124 header.b=IoLPirKS; 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 S1732983AbgDAOL3 (ORCPT + 99 others); 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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