Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3195718pxa; Tue, 18 Aug 2020 08:57:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcZICS30oSQ09KBtOLsp1dRC8jfh5jbbKZ2Xr5VLJmhIVf1KPTFezcTcALCJdo2nUIIJOK X-Received: by 2002:a50:e0cf:: with SMTP id j15mr21039988edl.285.1597766241988; Tue, 18 Aug 2020 08:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597766241; cv=none; d=google.com; s=arc-20160816; b=H3EqhNA7Ls0STmRcvJEv41UxhpOEVuZfCEWdK4kc3R1+EQL9Y4wCjzdEOB69Ty2cQz u+oyPGFMctsAA5UXq6Q/yKWFzbjSLNQ+gheUELAAQAFZtQvgUMcoKNx0IA01l2bAGJM5 0w8PL9X3WawTmYdydXGJdnq3uGpAq6e7w9daV3PZisSEsHJqaITFdb3j3+Jp+FWQQyEQ sILc0BfNTeHLpp6LIZf2+QgfFNT/QWM+hxgkEyZa4E530s1zdd6ACThNkoZFYJjToYEi Q0w0S7tv/diMbCLx/yknNBLA+0TP3DynDW2T66X/lCu454IrEhpYohZ1ji/ObNXXM8Kt i13A== 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; bh=bVoeSA7n+XKbqfuVAZwWA5LkkYr5aiQfj7tyDJ6a4pk=; b=lhP2LLRd8Ab6MSU/fLjXeZQ2n+XXggJ+eXmceBucDcy+otM6ZAubnvtruMoY2UCeOc fqtHy5b0PRqV3KIpDy+ffC+UjjTJTR53rOkO1cWocjc/vAvItyvZH/Kskw7rwYlXh0lL 3RUMUzm49UlrZqnWRUgi1jaOteUy1hn4aoCJNxqSpu9qyTrGdNXTM2LLWTJGdNpApEey v1UoIfbJgvpWZnaL189l79Jpm6Bux3LBL61xLKbJ9fCBQrCfyJe7ZIPSeXlxG0JXc+Gh Zb0RsRGQG7FJkZuHaAK6EHNTV8A5B7FgzhvXWvyTiFiMl9mwwrp5J4ZbwN2npeA0/dAo f0mQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c3si13921866ejm.314.2020.08.18.08.56.58; Tue, 18 Aug 2020 08:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728385AbgHRP4a (ORCPT + 99 others); Tue, 18 Aug 2020 11:56:30 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:59294 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728378AbgHRP40 (ORCPT ); Tue, 18 Aug 2020 11:56:26 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1k83yH-009vuo-8G; Tue, 18 Aug 2020 17:56:21 +0200 Date: Tue, 18 Aug 2020 17:56:21 +0200 From: Andrew Lunn To: Landen Chao Cc: f.fainelli@gmail.com, vivien.didelot@savoirfairelinux.com, matthias.bgg@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, davem@davemloft.net, sean.wang@mediatek.com, opensource@vdorst.com, frank-w@public-files.de, dqfext@gmail.com Subject: Re: [PATCH net-next v2 3/7] net: dsa: mt7530: Extend device data ready for adding a new hardware Message-ID: <20200818155621.GE2330298@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 On Tue, Aug 18, 2020 at 03:14:08PM +0800, Landen Chao wrote: > Add a structure holding required operations for each device such as device > initialization, PHY port read or write, a checker whether PHY interface is > supported on a certain port, MAC port setup for either bus pad or a > specific PHY interface. > > The patch is done for ready adding a new hardware MT7531. > > Signed-off-by: Landen Chao > Signed-off-by: Sean Wang > --- > drivers/net/dsa/mt7530.c | 272 +++++++++++++++++++++++++++++---------- > drivers/net/dsa/mt7530.h | 37 +++++- > 2 files changed, 240 insertions(+), 69 deletions(-) > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > index 0fd50798aa42..d30b41725b4d 100644 > --- a/drivers/net/dsa/mt7530.c > +++ b/drivers/net/dsa/mt7530.c > @@ -372,8 +372,9 @@ mt7530_fdb_write(struct mt7530_priv *priv, u16 vid, > mt7530_write(priv, MT7530_ATA1 + (i * 4), reg[i]); > } > > +/* Setup TX circuit incluing relevant PAD and driving */ > static int > -mt7530_pad_clk_setup(struct dsa_switch *ds, int mode) > +mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface) > { > struct mt7530_priv *priv = ds->priv; > u32 ncpo1, ssc_delta, trgint, i, xtal; > @@ -387,7 +388,7 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, int mode) > return -EINVAL; > } > > - switch (mode) { > + switch (interface) { > case PHY_INTERFACE_MODE_RGMII: > trgint = 0; > /* PLL frequency: 125MHz */ Do you actually need to support all 4 RGMII modes? ... + goto unsupported; > + break; > + case 6: /* 1st cpu port */ > + if (state->interface != PHY_INTERFACE_MODE_RGMII && > + state->interface != PHY_INTERFACE_MODE_TRGMII) phy_interface_mode_is_rgmii()? Andrew