Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5390112rwr; Mon, 1 May 2023 05:16:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6m7n6pZfYLSO3PO/r6WMDNgkwIy2tn+fRvLPd/UeJIRxqbhyTiaPwyvD/dtzeYtKhBKj/t X-Received: by 2002:a05:6a00:1913:b0:63d:3d2b:a7ee with SMTP id y19-20020a056a00191300b0063d3d2ba7eemr20020800pfi.18.1682943405221; Mon, 01 May 2023 05:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682943405; cv=none; d=google.com; s=arc-20160816; b=olxrbGxJ+H5yrOlZv8+Ea+o+FjlVfNCqAZSzlzfOS7klHhLtB4+G9WRQG7/WwqvQfA 9fJARWarAYonVMfQCXw6mBNTQKqwyhPgizdqodAr6NaV5rJGk2s3cJIxKyxicknIrcKR rAPCja6fVLaHYElivmeuRdJin1HwpZtWEkob3BA8tkHKIQ4X4g4HWQkbz35IplyNah4c u6Jf+x1MGYGPjWuUAr1NrIcpQDPdtaB4Rwb6Bu6Ewnwu3YvcnvknyLWsaczNeq+SaGwO TYXhUnfnQNCoFxTH7JiPb5mHQKtLcCRrqnetfKx+uXi4+rXcnXg6zF4oNwUbMHNy5CE5 zfNQ== 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=qI1N6Zt1ichZ6d+bawiKp7X6Hia786Ixe1XzJA/8a1M=; b=qYCDIDD6necqgXb22S//IG8IfKkgm49Y70n4ZyEmUH2oC/FO120528ZXEoQbr/+yYU pAeB3SIzq/qCNQBdxXS71pBcO6JZMt+qgDqbXgZbk/6t0QCGNre4pvTTefmIAUzFNMvK IDbGImlGZZlmOpLHYSKSI1oCH+qAFy8QsG+gQcS0XuqUcf9iw/0kuXV8fd6XoUi34Q8T qZEXNMK3sbkGI8MFM+x32PUR+KtN01QfBHL3QPibl1DSod6HkY7pFkc0vRh6say8aSA5 FiTV27ep4ifBU4JpJ2WqA6SG665hiHshzEqDT2Yhb1XY+Iv5F94SydGFMzhlMQpEtEWi AzvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=YOy1OVoD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x30-20020aa79a5e000000b0063d4614b52asi28029905pfj.63.2023.05.01.05.16.33; Mon, 01 May 2023 05:16:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=YOy1OVoD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232334AbjEAMQN (ORCPT + 99 others); Mon, 1 May 2023 08:16:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231779AbjEAMQM (ORCPT ); Mon, 1 May 2023 08:16:12 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B305191; Mon, 1 May 2023 05:16:11 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-50bc040c7b8so2516553a12.2; Mon, 01 May 2023 05:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682943370; x=1685535370; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qI1N6Zt1ichZ6d+bawiKp7X6Hia786Ixe1XzJA/8a1M=; b=YOy1OVoDmGMAcGUMIcWF2hdmky++kfkclWbsQbcd5HvhRPG2ka/PUqk4aTMOWZOStm drsyktoUYykaTyW+2h57sj2Nz+oD9IlI0nxg9/vfkbbMZOVHc+at5L6clRiJj/bW8vzk 66jIrEwk6Ad1lV1ZTNKDJNrTDh3yXazf45BvOmHXJcjo5gbs5hb7qZyYQjTd9Uq5qE11 c6DgLBrGeVDzA1TjfJdsW6hTIzx7gjomxyB4M3Tu02EXXJVU8yLki8FQJ7TwhXo7g1ni UTJvnpyKo65OMy2ObU5qG7AbT78WhRXm9MSrq4ahp1xYY1X/PPEpiVjEAE5boULh7QuP cImQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682943370; x=1685535370; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qI1N6Zt1ichZ6d+bawiKp7X6Hia786Ixe1XzJA/8a1M=; b=ZawjRt9JNrhgIjKPLdC2+5OEcZE3XpeUE7ssqY+JFa1zSCGsXqldY5aFzax3x3yJkj 7YoLOxfzMOsWqj0CwnoYIcl6tJZXx7mzXFzTaG2CD5apJapScbiLmVvDLYwSqj+xRas3 3HAvDdlqH/9YvVRn1LVWCfNIC2yw0qwmCqEFBLVIppKRodSwuKJZQKLeEuG/DnVEwVji wyvW5d3szyft0akxX4Q8qyjd6j/6jl1El4IdNd31Z9D3PySaHzagoVt9AzQuUvP/jxyU pGsja8aBLlqWCYjT3sAUA843i+pfbQQ2rSIONEaPhr8df1G7mVMEBifjRYP66NaaYG6g fvOA== X-Gm-Message-State: AC+VfDx6ze+9LJxDQQ215GM+lwi1Gsxn51ZamA1QMISj7WWZ6JRPmgCd erQd9Z1fxfMbU37LdxsmUYU= X-Received: by 2002:a17:906:58c5:b0:94e:626e:c108 with SMTP id e5-20020a17090658c500b0094e626ec108mr12965230ejs.50.1682943369686; Mon, 01 May 2023 05:16:09 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id t20-20020a1709060c5400b0094ebc041e20sm14597000ejf.46.2023.05.01.05.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 05:16:09 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Daniel Golle , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= Cc: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , Bartel Eerdekens , Richard van Schagen , Richard van Schagen , Frank Wunderlich , mithat.guner@xeront.com, erkin.bozoglu@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net 1/2] net: dsa: mt7530: fix corrupt frames using trgmii on 40 MHz XTAL MT7621 Date: Mon, 1 May 2023 15:15:37 +0300 Message-Id: <20230501121538.57968-1-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arınç ÜNAL The multi-chip module MT7530 switch with a 40 MHz oscillator on the MT7621AT, MT7621DAT, and MT7621ST SoCs forwards corrupt frames using trgmii. This is caused by the assumption that MT7621 SoCs have got 150 MHz PLL, hence using the ncpo1 value, 0x0780. My testing shows this value works on Unielec U7621-06, Bartel's testing shows it won't work on Hi-Link HLK-MT7621A and Netgear WAC104. All devices tested have got 40 MHz oscillators. Using the value for 125 MHz PLL, 0x0640, works on all boards at hand. The definitions for 125 MHz PLL exist on the Banana Pi BPI-R2 BSP source code whilst 150 MHz PLL don't. Forwarding frames using trgmii on the MCM MT7530 switch with a 25 MHz oscillator on the said MT7621 SoCs works fine because the ncpo1 value defined for it is for 125 MHz PLL. Change the 150 MHz PLL comment to 125 MHz PLL, and use the 125 MHz PLL ncpo1 values for both oscillator frequencies. Link: https://github.com/BPI-SINOVOIP/BPI-R2-bsp/blob/81d24bbce7d99524d0771a8bdb2d6663e4eb4faa/u-boot-mt/drivers/net/rt2880_eth.c#L2195 Fixes: 7ef6f6f8d237 ("net: dsa: mt7530: Add MT7621 TRGMII mode support") Tested-by: Bartel Eerdekens Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index c680873819b0..7d9f9563dbda 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -426,9 +426,9 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface) else ssc_delta = 0x87; if (priv->id == ID_MT7621) { - /* PLL frequency: 150MHz: 1.2GBit */ + /* PLL frequency: 125MHz: 1.0GBit */ if (xtal == HWTRAP_XTAL_40MHZ) - ncpo1 = 0x0780; + ncpo1 = 0x0640; if (xtal == HWTRAP_XTAL_25MHZ) ncpo1 = 0x0a00; } else { /* PLL frequency: 250MHz: 2.0Gbit */ -- 2.39.2