Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7397872rwr; Tue, 2 May 2023 14:12:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zBq82ptPLF++Hy5BA5YhVSjtZc1phd7zvkl3mhCI7SeifP5inK9k5o2NIiGvEG9PjQbjs X-Received: by 2002:a17:902:a50f:b0:19a:9880:175f with SMTP id s15-20020a170902a50f00b0019a9880175fmr17084568plq.51.1683061936826; Tue, 02 May 2023 14:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683061936; cv=none; d=google.com; s=arc-20160816; b=lT28NUH7qTFEvWn9DlelNX93A5Ki/gCATpS6JrdpLW0ZZoWJRItft8msAFe6HT/eS7 CcDPzbi+KOjrP3hnkwHoycwqTAZuSUuVT9UshYyZOaTVOftpGZ8mDnoVQqAXxxFEsS3/ /trZ0OZvQK2hz74q4ectMmDk3D1d6bXXC53gNtkYiSkBBnuZyJ4ZjPY7HN71fwY/LcDi GNK568WIniHr5EuewuA25bKt8ddSrcqHCyBt+ZwLNj4CzqAd1/ZZr6JabB/DrjH7WbCA CSTR1bGbz22HvS+A/y/CWbwZiQuTgrcH6gZNmnjLroqU9PvhPakL1jWI9CEY1bS3/YHe T9qQ== 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=TCKW3GcfxPXY7mkB6iKCrbvfraXmwfBiRi821WTxUyg=; b=lMhqa5NbQN3kEkRvtd512LxKD+QxSJAVgnNlvLSgCQkJkMOGD25zh1KfH9x7Klc7yy 00AWTxg52J8KC3Ci8iTbfE0MDqcH7UvFwUixH+ElhFrmmTK+taobGXthf9hZtIV4rmSh VOQo7iTonZmaij54uy1F+17znd+ku/f7je1vUpIIWVPqYeTCcKfhZNDsuPqN+9oHZTAO vLb+xwkDpSXLaDbmpsvFEaetmHqQpS3rbxPJ+Wo/aCNHWzLUFlaAP6cxUK7D3TwqkxNX sqyBTOEZNJ0OJfp/obYYoM1oBXxYE/hFTUUeykbYrbnvTZZs8t8vrojWicauto8rG17C guGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=J9p1R7S+; 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 y16-20020a170902b49000b0019f359c651esi26558898plr.556.2023.05.02.14.11.55; Tue, 02 May 2023 14:12:16 -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=J9p1R7S+; 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 S229478AbjEBVKS (ORCPT + 99 others); Tue, 2 May 2023 17:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbjEBVKQ (ORCPT ); Tue, 2 May 2023 17:10:16 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E36BC170F; Tue, 2 May 2023 14:10:13 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-50bcae898b2so3966123a12.0; Tue, 02 May 2023 14:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683061812; x=1685653812; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TCKW3GcfxPXY7mkB6iKCrbvfraXmwfBiRi821WTxUyg=; b=J9p1R7S+L42qJOIxO6GBgRityXwTaHOK0sN1u1gr+Y0AFRQSdDM8XEGBb29sCrpCtv WodQ2uzEBRGGliynmStoU8rUIRDAHGJ2+tgeGeQ03q9L5cJT70AKcVoc/cD8rIaTwmYo WEIS9VOCQMNbLyqbcsVkS+9vpEW50W6vpqiov/gH4LozJV2Vs9JlV10ARrXTQHnh0nnj +aoy77JBfPG+93JU57uR8MmEua+aXMrIv+Tb6HrzY0yDdsGXSuvrgFrIbaLRvZcxbvOq LcpWVZ6p0BrG1WOUR+tnnrjsOXN7KCU+sO/dpEoRrojJi9vhppc1Ge/LkJXLEImYzJZF OqTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683061812; x=1685653812; 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=TCKW3GcfxPXY7mkB6iKCrbvfraXmwfBiRi821WTxUyg=; b=BatjHIPan0mtzdEojjtHR4WakwIT4Hl+6HHQs0L7Y/8arYKT2ntB9dqVi8Rk2nXWac ph6YqnyWQljV1TBXhagm4nOFUJXSv5J1XcJDQ7W35RFiGV47ZdpyB1x8tmCPqAZRv/Js tLhIsHaFeqjjxk4lN2bp3npanKJNgJAF4gwa8h84+ggv7AaHLLFdDXbjot1IMc+a2zgO VbbDc3GfjOE7KCPWNkho1n4ldk3NAOTzGvBs9pqVAsQEapkAhC5ZLunQc6k8OWVoivEp NZTpGKmNjx7cR3/A2IUWqNAWbk884jhwaD9c5iXY3dLiFFzDFF++hLi41fUmyHcEY3ki K9Aw== X-Gm-Message-State: AC+VfDwj8UkxJIn1DaHYDzeKrrfSGARCUSOXidgd30gGbpWic+vI83FP AwKDUId4OhK++t14cgGTKjk= X-Received: by 2002:aa7:de11:0:b0:50b:c981:1fc7 with SMTP id h17-20020aa7de11000000b0050bc9811fc7mr5680216edv.19.1683061812116; Tue, 02 May 2023 14:10:12 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id a24-20020a50ff18000000b0050bd19ec39bsm1178620edu.83.2023.05.02.14.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 14:10:11 -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 v3 net 1/2] net: dsa: mt7530: fix corrupt frames using trgmii on 40 MHz XTAL MT7621 Date: Wed, 3 May 2023 00:09:46 +0300 Message-Id: <20230502210947.6815-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 Signed-off-by: Arınç ÜNAL Reviewed-by: Florian Fainelli --- v3: Remove my tested-by tag as Florian pointed out it's implied with my signed-off-by tag. Add Florian's reviewed-by tag. --- 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