Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp434553rdb; Tue, 16 Jan 2024 05:09:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHpw/ExEB+j5xeI49elG43UWwoxXNnyvwbs5W62dWLZPPVGhw30axKuBU0xjyMAElfCJfvf X-Received: by 2002:a05:6402:12cf:b0:559:ba29:418f with SMTP id k15-20020a05640212cf00b00559ba29418fmr236739edx.18.1705410584348; Tue, 16 Jan 2024 05:09:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705410584; cv=none; d=google.com; s=arc-20160816; b=e7zPD21VWl+FxoQNMuOCFxxUKHjJwSurnUctF1K+hLmKTRjLRbVOM74ZkRi0QtQVO7 I9OY4dJM0aOpOy+FjT8MUUWisQyqqP5/qSkIBMc7Fhc3L4D4HXIn9AE3vusi725kFp/I woKKsTOHbvW4sEksazP0oDnimz7lomtctMtFS3f/NRGFcObryuMUyLESD36wma3jtIRd wcqPCJKix9dYnxV93S2kJ6qa7JjT7djbZ6dUPN/wmAbzoE7ypDrjoJOVjXoYQ/oLCD2T enTFnaS4g4cOBH3y2PKO0hX5feBUHPyEKv9xEgzs9lhsbCVFlra2AtupbdlVS9/ktVhE 148A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=3l6hxpsFug+dZMhj61g9EoNgZMZVSBaqnjCk7tOjeaw=; fh=cdpoO0jOaYJ91dOS71goj7xmIokMgSDcZXO/fVWGuB0=; b=Z25oY32A/NvGP5edhg2nflbVAwyq6MpOrqVO4ipABDd3m0mNXSu4MvpDtyNC12DeBT y8Ezxavi7oKMWLT+na3LLh3uPdy3ZMKjbDi+1s9tp+OyFJfwkmWFXdLKEN+FldWPWyIf P1mN8pF3ReywyzLJNfoLv2DpUxUWkyXyuwtS3JMevqSvdc7GvRrOjUwB80f4q6to4gAm F0toO9KoPeouvxQzKlwn73yrEsj3AxmUOThl51BJvlfsUiCeBRlrxwTvVPl8kXkyWNox 3FAOlPVFLV6NsPgHUbzUik2aIrqSa82G/bPjGKu9r6pIV8VBQd44g+oY+9wkBwPEXZ4o +icQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arinc9.com header.s=gm1 header.b="pi/24u2p"; spf=pass (google.com: domain of linux-kernel+bounces-27405-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27405-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arinc9.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fi13-20020a056402550d00b00557a81b7b24si4850682edb.297.2024.01.16.05.09.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 05:09:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27405-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@arinc9.com header.s=gm1 header.b="pi/24u2p"; spf=pass (google.com: domain of linux-kernel+bounces-27405-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27405-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arinc9.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 031DA1F24532 for ; Tue, 16 Jan 2024 13:09:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EDE771BC4E; Tue, 16 Jan 2024 13:09:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arinc9.com header.i=@arinc9.com header.b="pi/24u2p" Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43E191BDC0; Tue, 16 Jan 2024 13:09:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arinc9.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arinc9.com Received: by mail.gandi.net (Postfix) with ESMTPSA id C7F1B60005; Tue, 16 Jan 2024 13:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arinc9.com; s=gm1; t=1705410567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3l6hxpsFug+dZMhj61g9EoNgZMZVSBaqnjCk7tOjeaw=; b=pi/24u2pxzRvb+HE2QJTXSQdGLJDl+SNa4sY6ZwbdftUBQlELzwy0ASmfca4TyL//tWK4p FbAsL6ELKRBOIKhMoMq1uwSp6DTTAhWsq9qcBcZu5Cy5n5Dxc59NWsJbFZSjJeWXp4EBys kE8R+wTEPiz3fTWraQqSFIbbDI6jeHeIUXYhziNx46fgHN8bOlKq31jFlMzOHBels00sSM Y0b9bO/z9PqN++BFVvCQxijTjfMXx95rN5oCxMkjsdu0MD7KwzFJHJRyLwIjUExpxp/U0R jYSMJpOrzY8sipOi5hVX5hpN61LG6RW+iWpgqEp38GffH16AG4gJWoiO5VTR9Q== Message-ID: <7f59d9e6-1653-4a8d-910d-5922452bb9e8@arinc9.com> Date: Tue, 16 Jan 2024 16:09:18 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH net-next 6/8] net: dsa: mt7530: simplify mt7530_setup_port6() and change to void To: Vladimir Oltean Cc: Daniel Golle , Landen Chao , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , mithat.guner@xeront.com, erkin.bozoglu@xeront.com, Luiz Angelo Daros de Luca , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20240113102529.80371-1-arinc.unal@arinc9.com> <20240113102529.80371-7-arinc.unal@arinc9.com> <20240115213720.vxlumsjwrjdkqxsl@skbuf> Content-Language: en-US From: =?UTF-8?B?QXLEsW7DpyDDnE5BTA==?= In-Reply-To: <20240115213720.vxlumsjwrjdkqxsl@skbuf> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: arinc.unal@arinc9.com On 16.01.2024 00:37, Vladimir Oltean wrote: > On Sat, Jan 13, 2024 at 01:25:27PM +0300, Arınç ÜNAL wrote: >> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c >> index 3ce4e0bb04dd..3a02308763ca 100644 >> --- a/drivers/net/dsa/mt7530.c >> +++ b/drivers/net/dsa/mt7530.c >> @@ -414,72 +414,56 @@ mt753x_preferred_default_local_cpu_port(struct dsa_switch *ds) >> } >> >> /* Setup port 6 interface mode and TRGMII TX circuit */ >> -static int >> +static void >> mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface) >> { >> struct mt7530_priv *priv = ds->priv; >> - u32 ncpo1, ssc_delta, trgint, xtal; >> + u32 ncpo1, ssc_delta, xtal; >> >> mt7530_clear(priv, MT7530_MHWTRAP, MHWTRAP_P6_DIS); >> >> + if (interface == PHY_INTERFACE_MODE_RGMII) >> + return; > > It would be good to add a comment here which states that the port comes > out of reset with values good for RGMII. > > Also, there's a built-in assumption in this patch, that dynamically > switching between RGMII and TRGMII is not possible. This is because > phylink mac_config() is not necesarily called only once immediately > after reset, but after each major_config(). > > The fact that the driver sets both PHY_INTERFACE_MODE_RGMII and > PHY_INTERFACE_MODE_TRGMII at once in config->supported_interfaces does > not disprove that dynamic reconfiguration is possible. Normally, > interfaces for which it doesn't make sense to dynamically reconfigure > (they are wired to fixed pinout) have a single bit set in > supported_interfaces. Is this switching something that makes any sense > at all, given that port 6 is internal? It's not something that phylink > knows to do today, but if this is theoretically possible and remotely > useful, someone might end up wanting, in the future, to revert this patch. Do you mean by internal port that the port does not have MII pinout? Port 6 of the MT7530 switch do. It is possible to have an external PHY wired to it. So it would make sense to design mt7530_setup_port6() in the sense that dynamic reconfiguration is possible. I've tested to see that the core operations for TRGMII does not interfere so no need to undo them when the interface changes from TRGMII to RGMII. I'll do below on this patch: if (interface == PHY_INTERFACE_MODE_RGMII) { mt7530_rmw(priv, MT7530_P6ECR, P6_INTF_MODE_MASK, P6_INTF_MODE(0)); return; } Arınç