Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp100542ybx; Wed, 30 Oct 2019 11:59:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjw6zHP4OPuyAjDBnoZ5aP5CIgrQ1c+pN2vNgp0o38nfxt/AtyUuS45S5bbJVZ7W8RaqSC X-Received: by 2002:a17:906:1505:: with SMTP id b5mr1101647ejd.195.1572461973359; Wed, 30 Oct 2019 11:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572461973; cv=none; d=google.com; s=arc-20160816; b=s9Wn0gTpyCBg1OaKb0PlboU8YFK7aPk7E7ylbYIF/monCoFvzCE/HGizWsccPKOxG/ XNJk/Vi5W1BZQesY6leX4kCtz5ZqE+/QpleEqHHmPp9sNAVoCoVk09iFgQ/O0BMWHfk+ K36TOG4W6Mjc2pk6kOhCn+rw+8AHqyfh2qNyK+SVeuLJUCGaV85n5v7PGAzNVTg574nP QLui8em4f5wOLRgR9wfRwm/nigCscMzcgsoPPgVzFXC3N4mTFSKzUK27+2npIwGD1oW7 SXsbdlgYymvvoq+Enwx3nVsSUtjhtFz71TdQ7BQSRNS57fKCds1lqZYsCBxms91LbqD2 4EBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SZUx4NVeGGOnxDClBHA9DgqzCOffD4hhcgm5wwv6WUs=; b=gAXoNkwPS9H1F//TWj//aswKZJzXaQFX7dMWAoUeycUWYdzu7LCBdDXk3nmxr3GnJq TvTafnZIFcJXnnXvaai013gSQTKE/PKQ7gH+k085gVWwg0OsKIvtTtkhQe19lM9MlJ01 CnyQS4EbBfnH2RcoQ+2o6WTNftmIfUuFTHSB6UNSxvocfbmgm7bIZgPkCDU4cHL7T6rN uCjCvzWrPI/dv8turjLhoLFxdDpsZV+U07x5fSIDn6+aBd9Swmoa8Tik/dHqSr3m4UjE wk/v/UwPBUw+3js/sIlqs/QyRiyS8/qCRjgOSJIvhhLc1A9OBWs/qmOLxx91p62D0jYp jeTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=gtK4LzEN; 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 t1si1833142eju.132.2019.10.30.11.59.10; Wed, 30 Oct 2019 11:59:33 -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=gtK4LzEN; 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 S1727643AbfJ3Q2d (ORCPT + 99 others); Wed, 30 Oct 2019 12:28:33 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:42098 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726261AbfJ3Q2d (ORCPT ); Wed, 30 Oct 2019 12:28:33 -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=SZUx4NVeGGOnxDClBHA9DgqzCOffD4hhcgm5wwv6WUs=; b=gtK4LzENJNZ3IfWDlksuD6F6Mk +X7v8aAddo+Y3EA2Wk14qoXStLAhyN7omwt1LGMfId8PsMuvDF6vgFXxhVaFq4/anphnNaJlQJB01 /A8XrrdjOyaF3fZg3cGRF73XE25jsx06xJbg9e2o5hhopEgdBvPla7jPVCTBv0nkxouI=; Received: from andrew by vps0.lunn.ch with local (Exim 4.92.2) (envelope-from ) id 1iPqph-0003cy-GH; Wed, 30 Oct 2019 17:28:29 +0100 Date: Wed, 30 Oct 2019 17:28:29 +0100 From: Andrew Lunn To: Jose Abreu Cc: netdev@vger.kernel.org, Joao Pinto , Alexandre Torgue , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , Giuseppe Cavallaro , "David S. Miller" , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH net-next 2/3] net: stmmac: xgmac: Add C45 PHY support in the MDIO callbacks Message-ID: <20191030162829.GC10555@lunn.ch> References: <444208cef341686bcf35f8361f409467f539c73b.1572449009.git.Jose.Abreu@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <444208cef341686bcf35f8361f409467f539c73b.1572449009.git.Jose.Abreu@synopsys.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 30, 2019 at 04:28:49PM +0100, Jose Abreu wrote: > Add the support for C45 PHYs in the MDIO callbacks for XGMAC. This was > tested using Synopsys DesignWare XPCS. > > Signed-off-by: Jose Abreu > > --- > Cc: Giuseppe Cavallaro > Cc: Alexandre Torgue > Cc: Jose Abreu > Cc: "David S. Miller" > Cc: Maxime Coquelin > Cc: netdev@vger.kernel.org > Cc: linux-stm32@st-md-mailman.stormreply.com > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 47 +++++++++++++++++++++-- > 1 file changed, 43 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c > index 40c42637ad75..143bffd28acf 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c > @@ -41,6 +41,29 @@ > #define MII_XGMAC_BUSY BIT(22) > #define MII_XGMAC_MAX_C22ADDR 3 > #define MII_XGMAC_C22P_MASK GENMASK(MII_XGMAC_MAX_C22ADDR, 0) > +#define MII_XGMAC_PA_SHIFT 16 > +#define MII_XGMAC_DA_SHIFT 21 > + > +static int stmmac_xgmac2_c45_format(struct stmmac_priv *priv, int phyaddr, > + int phyreg, u32 *hw_addr) > +{ > + unsigned int mii_data = priv->hw->mii.data; > + u32 tmp; > + > + /* Wait until any existing MII operation is complete */ > + if (readl_poll_timeout(priv->ioaddr + mii_data, tmp, > + !(tmp & MII_XGMAC_BUSY), 100, 10000)) > + return -EBUSY; Hi Jose The stmmac_xgmac2_c22_format function does the same. Maybe the call can be pulled out into stmmac_xgmac2_mdio_write() and stmmac_xgmac2_mdio_read()? Andrew