Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp659172pxf; Wed, 24 Mar 2021 12:39:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8WL92RTqNhtfLuFx4po3Jt0L/rokanNywiKVHjJGCvHCDT87uUO/2Iy4ZCa2dP3AK1uBP X-Received: by 2002:a05:6402:c0f:: with SMTP id co15mr5147730edb.373.1616614768332; Wed, 24 Mar 2021 12:39:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616614768; cv=none; d=google.com; s=arc-20160816; b=YHtyuCSpLPerNlUirJbo9xkZ9KiBLPAIDZRcLBtU5epWZzGKxiKXb9p+FnvQSNm8Lk Zb6Ndk8aTsfRIAN71Slt3yDAA0AAAu7eRmBsiJb74v5d5LtMPB+Tg7TsjiVgVnf5s5TR 2pLptJmkfp+S13lhqaVPG9v/enaLhwEKApjV/K8GmnB8egWWduf/ev1Jh7YTMhkHanst nZAOBzFsUSwiw/9T8+7eJU7mzAwrOS2Cqlsj9O7LRYbS0hefcbKT8jHM5lI69rnzeNM0 ZCfiKggWN/i+1Cp2/kwYoMV06bjzMkf2Yv9+PQ7i2ubbs/kJeajYpZso4w7AMffHk2xK zxvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=gWw8pr/c6qQDp74PKwcrUz7UHUPDPno5aG6deS6EemM=; b=Jkk0zxlQeg8GBymmFY3E5606T6arQK0YsT4vRs4/9Ybhn1fbmDdUYKlbpzRbpr/5ii sg6O5HCjMCTavqe5y9sHq1TQ9zIs8fSUOmD8YJZuFwbHBhRhWPLWyq2RLIznBLAL0quf 20TE889eE4Y/YaeXcAf7wam8NFzpEKUde7gFbu4lPIuVeKt5yOj4DpKiGbxRUklaL4d1 C5mYBO9AJtmiDnYIgwkjW5vdbVpRw4Whfg1N0J4duxEd+T+KxIZnlQp7zVRH1yyOiXAm 3FUjYwV/8Rvo2KPytm2tb7tP7/x6UgCVL1BZa5eXPXWoGcDhemp5PC8pkB5J7Pe7BYNf Ldbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=XprtAHT2; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fx21si2377865ejb.91.2021.03.24.12.39.04; Wed, 24 Mar 2021 12:39:28 -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; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=XprtAHT2; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237825AbhCXThB (ORCPT + 99 others); Wed, 24 Mar 2021 15:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237659AbhCXTge (ORCPT ); Wed, 24 Mar 2021 15:36:34 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCC95C061763; Wed, 24 Mar 2021 12:36:33 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id v11so25613835wro.7; Wed, 24 Mar 2021 12:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gWw8pr/c6qQDp74PKwcrUz7UHUPDPno5aG6deS6EemM=; b=XprtAHT2IgD43tNdUTswa8Xa+723tWR3QDEneZ6XeqjON5u3wyLvGkD1bLZDbXGceh BE8i4ZLnO3v0I3cZfku+kWF/gXEpJJbd20+wUnIi1Gb3T0htNxSalzMIcOLBCTL0zYKE kT4U02CMc9eMNRvvuWOBt3iY2DmUHV8evM5HMJr4QB3qdVMwVDvP+3I1F8fOlHaTir3s 82uY9PuXTD+FGFUjAXzeWFciBBptLgauW5yrpuhRGmNMgR1rkuAnsKuLVD0NeJYViS22 ChCNfUJO+VcA9ShcsV3qEBFVX6gyFYo4ll++8E68Sarnk8hjLmh0T+i7mp1q0dz72VDW TgIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gWw8pr/c6qQDp74PKwcrUz7UHUPDPno5aG6deS6EemM=; b=JG+jLE3a5jt5/rAjhZ/B3tC+uWVv2chYNE5Kr6qeLZZa/TmN4/6m5nsASObVngpOBA oe/O1SrctJG9pCoYiL5O30OEILsfADFJ2GRS17iyHtNNommwShzKU+u0HValrshE5jSv tycw+gQfQPvMi6XA2JxslCXcnf4XTgt2y3PkecvBv2KPWOcVQAyFL9ZtsACRv7phcg1J 1Yhj1LPv6eDu05hMVmC8OOpXw3T6jqdcoytSIOzJRBQHLSj1IpqRoJn1uOv7kMH9U/hw 86NwxSgsh5gdZK+RBYtckNir+Rg0VQ646puvKqlBTroJIcXrwbByJYEbAXlR893XmUKR 1xeA== X-Gm-Message-State: AOAM533PJ5UU5XvOgmZT4vgzzRwyiX4ujvwbd3SMnKHGRCvLf99aSei0 3+Yez8rFCawlr12/bNvtYsw= X-Received: by 2002:a5d:6dcc:: with SMTP id d12mr5023301wrz.136.1616614592535; Wed, 24 Mar 2021 12:36:32 -0700 (PDT) Received: from localhost.localdomain (p200300f137001200428d5cfffeb99db8.dip0.t-ipconnect.de. [2003:f1:3700:1200:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id n3sm3573277wmi.7.2021.03.24.12.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 12:36:31 -0700 (PDT) From: Martin Blumenstingl To: hauke@hauke-m.de, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, kuba@kernel.org, Martin Blumenstingl Subject: [PATCH net] net: dsa: lantiq_gswip: Let GSWIP automatically set the xMII clock Date: Wed, 24 Mar 2021 20:36:04 +0100 Message-Id: <20210324193604.1433230-1-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The xMII interface clock depends on the PHY interface (MII, RMII, RGMII) as well as the current link speed. Explicitly configure the GSWIP to automatically select the appropriate xMII interface clock. This fixes an issue seen by some users where ports using an external RMII or RGMII PHY were deaf (no RX or TX traffic could be seen). Most likely this is due to an "invalid" xMII clock being selected either by the bootloader or hardware-defaults. Fixes: 14fceff4771e51 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200") Signed-off-by: Martin Blumenstingl --- It would be great to have this fix backported to Linux 5.4 and 5.10 to get rid of one more blocker which prevents OpenWrt from switching to this new in-tree driver. drivers/net/dsa/lantiq_gswip.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c index 52e865a3912c..809dfa3be6bb 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -799,10 +799,15 @@ static int gswip_setup(struct dsa_switch *ds) /* Configure the MDIO Clock 2.5 MHz */ gswip_mdio_mask(priv, 0xff, 0x09, GSWIP_MDIO_MDC_CFG1); - /* Disable the xMII link */ - for (i = 0; i < priv->hw_info->max_ports; i++) + for (i = 0; i < priv->hw_info->max_ports; i++) { + /* Disable the xMII link */ gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, i); + /* Automatically select the xMII interface clock */ + gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_RATE_MASK, + GSWIP_MII_CFG_RATE_AUTO, i); + } + /* enable special tag insertion on cpu port */ gswip_switch_mask(priv, 0, GSWIP_FDMA_PCTRL_STEN, GSWIP_FDMA_PCTRLp(cpu_port)); -- 2.31.0