Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp261834rdb; Thu, 25 Jan 2024 14:45:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgjoZw3iNCi80b1ljLoHSF7XzS2BesgyL0pwfJhyt7phOhP89orLAUERJYtKq1xPlMEE/x X-Received: by 2002:a05:6870:d623:b0:214:dfca:f714 with SMTP id a35-20020a056870d62300b00214dfcaf714mr391036oaq.110.1706222715609; Thu, 25 Jan 2024 14:45:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706222715; cv=pass; d=google.com; s=arc-20160816; b=az3l1hNbU2Pw9xt3fQygeMJXBUYsEOJm1ZS5CnGTNrqJRb+nOtTz2eQbhHf6z5aXYo ybk8j9+J/Vi6SIh2wfyT/OmyriTw6Xsns7B3qvuA5FJgrN3Rz19BHOWxXSVBL/m2qEy+ eLKNiRuvX0BMPz+MivtrTqlCE3emqrHRAZV5JqaVLd+PhxzpuPXmqIWdGkObDIVyzxjx 0ZQt9vWeUEffGQrG1oKbxKrmWxij29IchFpzz7tTnN/osPjLPdT4YvUfjUZcdAaUk9/C 99WcM2VAQ1NDeetT0CDM9XtO4+5k0ZWHDFMj4SQ4Jja+azauuQ+pIUrXgP71DzSn78M9 lXug== ARC-Message-Signature: i=2; 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=/wfCo1mRfWcIdpnT9reav4j0aC7oEhRFsNtNutPWFwI=; fh=rPbKoLRyOt6UtAih11dDXCEToO0bIIJGP11RAXCx8gA=; b=iMxUeEdBK1AmeHY2PUYcQLxhmbtm/M2dJF58ZFa2ZjlXB/vCgUKubG6xp0oc7S4Jww clgtWB2PK1x+EuEK2/XvginO+82RbMkcjTzprJDcdCY4hXxo6h59PJxQgacKNl8YIn0M 6lDTvjmwc719vtVRZteA+iZ3cUH5nmTKnX0d751uMDI/sEqool4H377k1pkl81UXRoD/ GMZ4n9WCqg2pZmfaaXiaCS+Qm9WkQky3GkCcFk9oaa+UlPU2Im3zz7g03SAQCuC43lC9 nVa72zFWZoN44WUlLb8Am/iubxvgQYKgNFBErZCKS9ATpCOgp+0+KNfhez/kNiOHy3nA FK4w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arinc9.com header.s=gm1 header.b=jiln+mWM; arc=pass (i=1 spf=pass spfdomain=arinc9.com dkim=pass dkdomain=arinc9.com dmarc=pass fromdomain=arinc9.com); spf=pass (google.com: domain of linux-kernel+bounces-39372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39372-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arinc9.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k9-20020a63ba09000000b005cee179d5c4si15562pgf.230.2024.01.25.14.45.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 14:45:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@arinc9.com header.s=gm1 header.b=jiln+mWM; arc=pass (i=1 spf=pass spfdomain=arinc9.com dkim=pass dkdomain=arinc9.com dmarc=pass fromdomain=arinc9.com); spf=pass (google.com: domain of linux-kernel+bounces-39372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39372-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3EA2A28F197 for ; Thu, 25 Jan 2024 22:45:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A7B311731; Thu, 25 Jan 2024 22:45:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arinc9.com header.i=@arinc9.com header.b="jiln+mWM" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 672F711CB1; Thu, 25 Jan 2024 22:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706222709; cv=none; b=jea2sUqiIdRBzPgA/O8aH7AXLyUwZ3GVNKEoalFnxQcojagMF3/ZXbet3e0/MYU1puFdSQn8emN2vZ9308VoJUZf80koj2qpzLZmnmSLhViLkz58jEj8hppdYYYPfd54Nn8mOZk5SXKMZGk+SbU0Bua0Eaa+0u4SuUvFE5fXmKo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706222709; c=relaxed/simple; bh=8UHUgio5bcGdOCke7+Q8iL/iKM1UTq80mrwqMurYWVg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JKzWmmPDQCNaQbqq6QLqxo7UT4fyq0hwLhVdKHZq+RbCpOxdLERpgDEOqoayV/IDthPNj3Yx+6NMRdvtVYKiEtN8ecOL5JtDu7s2ygoIzLlvqZPQm8AGWiwuLr3EclxEq5+N2DSrjrsNHwMoCwod1dzDJlUcWESI5IoWyiycqlg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arinc9.com; spf=pass smtp.mailfrom=arinc9.com; dkim=pass (2048-bit key) header.d=arinc9.com header.i=@arinc9.com header.b=jiln+mWM; arc=none smtp.client-ip=217.70.183.201 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 7AC621BF204; Thu, 25 Jan 2024 22:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arinc9.com; s=gm1; t=1706222704; 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=/wfCo1mRfWcIdpnT9reav4j0aC7oEhRFsNtNutPWFwI=; b=jiln+mWMiPebOcn9uW9BmCuY9qLY2XvRvbb9ncjNF/Cx2PjQjCgIyT/oeNmPnCJ1I13y86 coEVjjk2+lsBiiaXa0EkztIz9t2ZrMrRXCznqqGerkMj9V7WFFmAX1ynB6uuVJVUhCJm/p qrA5brRtgGWpRuXVona3kstZ0u6s7JkrHzozhJ64Z79mD2ZgHtWKtq2s3tMhPOAt63cFzF uDZDp8kiSlUAanWHXuxLaxen69N2J+nUYmnjlQdeuC0bT34DYM/fZqHlnVynuTr7ACqMYt dkia8tFNa/42GWIx2avBW8dnp9VoyQRCo4kwaD+nWE7FTEzr3SCOIosNN57IRw== Message-ID: <99a038f3-18d2-44ca-8135-1faf7a37892a@arinc9.com> Date: Fri, 26 Jan 2024 01:44:57 +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: [PATCH net] net: dsa: mt7530: fix 10M/100M speed on MT7988 switch To: Daniel Golle Cc: DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, John Crispin References: Content-Language: en-US From: =?UTF-8?B?QXLEsW7DpyDDnE5BTA==?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: arinc.unal@arinc9.com On 25.01.2024 19:18, Daniel Golle wrote: > On Thu, Jan 25, 2024 at 12:49:19PM +0300, Arınç ÜNAL wrote: >> On 24/01/2024 08:17, Daniel Golle wrote: >>> Setup PMCR port register for actual speed and duplex on internally >>> connected PHYs of the MT7988 built-in switch. This fixes links with >>> speeds other than 1000M. >>> >>> Fixes: ("110c18bfed414 net: dsa: mt7530: introduce driver for MT7988 built-in switch") >>> Signed-off-by: Daniel Golle >> >> Acked-by: Arınç ÜNAL >> >> I'm wondering why we manually set speed and duplex for these interface >> modes in the first place. I don't how it works for >> PHY_INTERFACE_MODE_INTERNAL but, at least for PHY_INTERFACE_MODE_TRGMII and >> 802.3z interfaces, phylink should already supply proper speed and duplex. > > It's true that duplex should always be set to full-duplex already by > phylink. However, speed could be 2500MBit/s (2500Base-X) or 2000MBit/s > (?, TRGMII) and we yet need to program the PCR like if it was > 1000MBit/s. > > Regarding the INTERNAL case: it was added by mistake. In case of > MT7988, all ports of the switch are connected via INTERNAL links, > however, the PHYs still need adjustment of the PCR register just like > on all other MT753x switches and the CPU port is setup elsewhere > anyway. It's not necessarily PHYs needing adjustment of the port MAC control register. After reset, speed, duplex mode, etc. will be determined by polling the PHY connected to the switch MAC. We're forcing these properties on the PMCR because we're also configuring switch MACs that are not connected to PHYs, meaning the switch cannot determine these properties by polling a PHY. From what I understand, this code block is for overriding the speed and duplex variables to make the operations on the PMCR below work. It seems that this is actually only useful for PHY_INTERFACE_MODE_2500BASEX. PHY_INTERFACE_MODE_TRGMII is given SPEED_1000 by drivers/net/phy/phylink.c:phylink_interface_max_speed(). PHY_INTERFACE_MODE_2500BASEX is given SPEED_2500. Overriding the duplex variable looks unnecessary. Your patch here doesn't affect CPU ports because MT7531 and MT7988 PMCRs are configured with cpu_port_config before mt753x_phylink_mac_link_up(), and PHY_INTERFACE_MODE_INTERNAL is not used for MT7530 which, for MT7530, PMCRs will be set only on mt753x_phylink_mac_link_up(). PMCR_FORCE_SPEED_1000 is set on cpu_port_config. If someone were to get rid of cpu_port_config because of its utter uselessness, PMCR_FORCE_SPEED_1000 would not be set, causing the link between port 6 MAC and SoC MAC to break. In conclusion, I will add "case SPEED_10000:" to the operations where the speed and EEE bits are set on my patch for getting rid of cpu_port_config. Arınç