Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3208173pxa; Tue, 18 Aug 2020 09:12:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlUsnaiYHL1rNbTeP0PsaM5o9IJ4sCYEBvRzIm7+GIH2QbnwmXLR71HvVnDNRb0tDXo+/w X-Received: by 2002:a05:6402:304b:: with SMTP id bu11mr20243158edb.106.1597767154652; Tue, 18 Aug 2020 09:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597767154; cv=none; d=google.com; s=arc-20160816; b=AD2oB/7VA2dBp5yGVX86JGqIRqwpbkC0zHPc6UR+30hvTDvwlk0O+2//6VLKJ4WQ+n arrwdvn11XZoTDlwNe5WzUas1Y3JxdSVm21HbqE34q8pdhgSwlW0QqiURHAPK/txaIFF Jcm7aoLrYjCPO3YXGZsGJYfL3SxZa7GAcoCHASzz5/oHjKwdHuY0PHj3x4wsXmias7pT 9aYg+Nr0FrarQiR2nbpQvm9COR/eTJLgmBDzGfiUvdhcvZv7R0JOZMwR5Not9h4kS6G+ f7RvX8fPfR/eOOUuEHqiYQf3wcKN5xx0qmlxSWEbVqY9fZUoX5ut59Wckr9yKn0M4JrJ 6zIA== 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=nHg++n5a3UHz+xIJTLM5m+8B6qHMOlyJlXSHszeYx08=; b=ZOhxvcqnSVaX04KAfyfr/WSPjxUc3RNJALFXeRorTiXB5hUOg9OdIbI4XXKYGvzg/m LumCZDAJz9SnEEHKLUXhEpS/tbJrj/adL3ingF4dtT5M18Qx3JjC8rr6xyrsNlZx/NgM qQuKjAQ5UUKLy38o5kzVvmeSrztDvY6vOdcd/JDUAdo0GYlCcdcBgD2y+CVBOoz234B9 o+hGvWBJAwemEco7RQWS14ARKpXDAzPyLHIjjdUkyMdp0pJgcsm06g6bOFwKZrQN91/q I8tmW0V1uXY+k0bmNUZRnmC8XaVJixU3YkA3s1NtHiHmrSZYaQ2G7SXRNA4VviJpyCWW LGTw== 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 c38si14494007edf.153.2020.08.18.09.12.08; Tue, 18 Aug 2020 09:12:34 -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 S1726910AbgHRQJP (ORCPT + 99 others); Tue, 18 Aug 2020 12:09:15 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:59334 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726779AbgHRQJH (ORCPT ); Tue, 18 Aug 2020 12:09:07 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1k84AX-009vyk-Nw; Tue, 18 Aug 2020 18:09:01 +0200 Date: Tue, 18 Aug 2020 18:09:01 +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 5/7] net: dsa: mt7530: Add the support of MT7531 switch Message-ID: <20200818160901.GF2330298@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:10PM +0800, Landen Chao wrote: > Add new support for MT7531: > > MT7531 is the next generation of MT7530. It is also a 7-ports switch with > 5 giga embedded phys, 2 cpu ports, and the same MAC logic of MT7530. Cpu > port 6 only supports SGMII interface. Cpu port 5 supports either RGMII > or SGMII in different HW sku. Due to SGMII interface support, pll, and > pad setting are different from MT7530. This patch adds different initial > setting, and SGMII phylink handlers of MT7531. > > MT7531 SGMII interface can be configured in following mode: > - 'SGMII AN mode' with in-band negotiation capability > which is compatible with PHY_INTERFACE_MODE_SGMII. > - 'SGMII force mode' without in-bnad negotiation band > which is compatible with 10B/8B encoding of > PHY_INTERFACE_MODE_1000BASEX with fixed full-duplex and fixed pause. > - 2.5 times faster clocked 'SGMII force mode' without in-bnad negotiation band > +static int mt7531_rgmii_setup(struct mt7530_priv *priv, u32 port, > + phy_interface_t interface) > +{ > + u32 val; > + > + if (!mt7531_is_rgmii_port(priv, port)) { > + dev_err(priv->dev, "RGMII mode is not available for port %d\n", > + port); > + return -EINVAL; > + } > + > + val = mt7530_read(priv, MT7531_CLKGEN_CTRL); > + val |= GP_CLK_EN; > + val &= ~GP_MODE_MASK; > + val |= GP_MODE(MT7531_GP_MODE_RGMII); > + val &= ~(TXCLK_NO_REVERSE | RXCLK_NO_DELAY); > + switch (interface) { > + case PHY_INTERFACE_MODE_RGMII: > + val |= TXCLK_NO_REVERSE; > + val |= RXCLK_NO_DELAY; > + break; > + case PHY_INTERFACE_MODE_RGMII_RXID: > + val |= TXCLK_NO_REVERSE; > + break; > + case PHY_INTERFACE_MODE_RGMII_TXID: > + val |= RXCLK_NO_DELAY; > + break; > + case PHY_INTERFACE_MODE_RGMII_ID: > + break; > + default: > + return -EINVAL; > + } You need to be careful here. If the MAC is doing the RGMII delays, you need to ensure the PHY is not. What interface mode is passed to the PHY? Andrew