From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6635FC54EBE for ; Mon, 16 Jan 2023 19:16:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kpMMSU/YjoRdTh8iRj7ek68j9SfG4qmR1Hiu4FwdJvA=; b=ViOU16FctURPSO y9qKjfHW0DhT7uLA79JYmPHxYxRqjiDTFGnt+rs7cI1FmtmACjNWFAgCkqj9g7JKCQJnCyFOP937J fsZAmymtqtdAwSSa70xXG/Kx8Upgvzc3vgMpS11FG0QDuxQFMehvWl94QNE2kt1nT4EgIFndXyVjT s/5qfYVHqvuEcj6FWwpWbR60gO98GDqImzZx/dTyrgP2D6z0VAth5q6YYpltDkBv9r6pi8u0mfVuO FBvDK+9l2AHNhjmkcDgCzkcqulueiKETTvezH8RU7Wr4CFrNthd+Qfvsjs90eObkGotCW1NQgpxPo D1X3/1P+CpwiMogiWfNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHUwz-00Bq06-4K; Mon, 16 Jan 2023 19:15:21 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHUwu-00Bpxm-MM; Mon, 16 Jan 2023 19:15:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hkNFVtbzzp0XpZsfx3emQeVOO5FVZGr7hZw/Jma4LVA=; b=UupanAH6GT+TSgnVN/G70/Kw+B jPITqiNGkh1JrRh4mlCwzBvLRsti1vU9cmXyJwxNBF6EbMEIaedOKbOf5aXZyJDsqzmkpMfvc18bl 8hRllSvXxKlcUQMjMA0GqDTdHEauQuSd7+Q0vPKWYL/ZAaMVaTUKwmZj5F6tMVh5UQVW5Si47khOP D8HQcYo1QZAI0HVfnrpxtKXyWSt48mw3gp6ZHPKDTzQvP2OwOTqL8aFQ//OfBy5osBf0GYWPClAXX Mtxn6D6nH3BEvK5dwzHfSQICxaXXLSBafF1KyzaFFy3Pf9AGmpBag8BDGPNkJrPhHv5ISf8I/8uIO unUC1hPg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:36150) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pHUwp-0005k4-0o; Mon, 16 Jan 2023 19:15:10 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pHUwl-0006Gj-Bh; Mon, 16 Jan 2023 19:15:07 +0000 Date: Mon, 16 Jan 2023 19:15:07 +0000 From: "Russell King (Oracle)" To: =?iso-8859-1?Q?Bj=F8rn?= Mork Cc: Frank Wunderlich , Frank Wunderlich , linux-mediatek@lists.infradead.org, Alexander Couzens , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] net: mtk_sgmii: implement mtk_pcs_ops Message-ID: References: <87bkmy33ph.fsf@miraculix.mork.no> <875yd630cu.fsf@miraculix.mork.no> <871qnu2ztz.fsf@miraculix.mork.no> <87pmbe1hu0.fsf@miraculix.mork.no> <87lem21hkq.fsf@miraculix.mork.no> <87a62i1ge4.fsf@miraculix.mork.no> <875yd61fg3.fsf@miraculix.mork.no> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <875yd61fg3.fsf@miraculix.mork.no> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230116_111516_748987_1E262A9F X-CRM114-Status: GOOD ( 17.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jan 16, 2023 at 07:50:52PM +0100, Bj=F8rn Mork wrote: > Made things fail with 2.5G, as expected I guess. But this actually works > with 1G! > = > Except for an unexpected packet drop. But at least there are packets > coming through at 1G now. This is the remote end of the link: > = > ns-enp3s0# ethtool -s enp3s0 autoneg off speed 1000 duplex full > ns-enp3s0# ping 192.168.0.1 > PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. > 64 bytes from 192.168.0.1: icmp_seq=3D1 ttl=3D64 time=3D0.544 ms > 64 bytes from 192.168.0.1: icmp_seq=3D3 ttl=3D64 time=3D0.283 ms > 64 bytes from 192.168.0.1: icmp_seq=3D4 ttl=3D64 time=3D0.261 ms > 64 bytes from 192.168.0.1: icmp_seq=3D5 ttl=3D64 time=3D0.295 ms > 64 bytes from 192.168.0.1: icmp_seq=3D6 ttl=3D64 time=3D0.273 ms > 64 bytes from 192.168.0.1: icmp_seq=3D7 ttl=3D64 time=3D0.290 ms > 64 bytes from 192.168.0.1: icmp_seq=3D8 ttl=3D64 time=3D0.266 ms > 64 bytes from 192.168.0.1: icmp_seq=3D9 ttl=3D64 time=3D0.269 ms > 64 bytes from 192.168.0.1: icmp_seq=3D10 ttl=3D64 time=3D0.270 ms > 64 bytes from 192.168.0.1: icmp_seq=3D11 ttl=3D64 time=3D0.261 ms > 64 bytes from 192.168.0.1: icmp_seq=3D12 ttl=3D64 time=3D0.261 ms > 64 bytes from 192.168.0.1: icmp_seq=3D13 ttl=3D64 time=3D0.266 ms > ^C > --- 192.168.0.1 ping statistics --- > 13 packets transmitted, 12 received, 7.69231% packet loss, time 12282ms > rtt min/avg/max/mdev =3D 0.261/0.294/0.544/0.075 ms > ns-enp3s0# ethtool enp3s0 > Settings for enp3s0: > Supported ports: [ TP ] > Supported link modes: 100baseT/Full > 1000baseT/Full > 10000baseT/Full > 2500baseT/Full > 5000baseT/Full > Supported pause frame use: Symmetric Receive-only > Supports auto-negotiation: Yes > Supported FEC modes: Not reported > Advertised link modes: 1000baseT/Full > Advertised pause frame use: Symmetric > Advertised auto-negotiation: No > Advertised FEC modes: Not reported > Speed: 1000Mb/s > Duplex: Full > Auto-negotiation: off > Port: Twisted Pair > PHYAD: 0 > Transceiver: internal > MDI-X: Unknown > Supports Wake-on: pg > Wake-on: g > Current message level: 0x00000005 (5) > drv link > Link detected: yes > . > = > The MT7986 end looks like this: > = > root@OpenWrt:/# [ 55.659413] mtk_pcs_get_state: bm=3D0x81140, adv=3D0x1= a0 > [ 55.664380] mtk_pcs_get_state: bm=3D0x81140, adv=3D0x1a0 > [ 58.779924] mtk_pcs_get_state: bm=3D0x81140, adv=3D0x1a0 > [ 58.784884] mtk_pcs_get_state: bm=3D0x81140, adv=3D0x1a0 > [ 58.789841] mtk_sgmii_select_pcs: id=3D1 > [ 58.793581] mtk_pcs_config: interface=3D4 > [ 58.797399] offset:0 0x81140 > [ 58.797401] offset:4 0x4d544950 > [ 58.800273] offset:8 0x1a0 > [ 58.803397] offset:0x20 0x31120118 This looks like it's configured for 1000base-X at this point. > [ 58.806089] forcing AN > [ 58.811826] mtk_pcs_config: rgc3=3D0x0, advertise=3D0x1 (changed), lin= k_timer=3D1600000, sgm_mode=3D0x103, bmcr=3D0x1200, use_an=3D1 > [ 58.822759] mtk_pcs_restart_an > [ 58.825800] mtk_pcs_get_state: bm=3D0x81140, adv=3D0xda014001 > [ 58.831184] mtk_pcs_get_state: bm=3D0x2c1140, adv=3D0xda014001 > [ 58.836649] mtk_pcs_link_up: interface=3D4 > [ 58.840559] offset:0 0xac1140 > [ 58.840561] offset:4 0x4d544950 > [ 58.843512] offset:8 0xda014001 > [ 58.846636] offset:0x20 0x3112011b and here we've reconfigured it for SGMII mode - and we can see the Mediatek PCS has set the ACK bit (bit 14) in its advertisement register as one would expect. > Now, if we only could figure out what the difference is between this and > what we configure when the mode is changed from 2500base-x to sgmii. Maybe there is something missing which we need to do on the Mediatek side to properly switch between 2500base-X and SGMII. It has a feel of a problem changing the underlying link speed between 3.125 and 1.25Gbps, which is done by the ANA_RGC3 register. Hmm, maybe the PCS needs to be powered down to change the speed, in other words, SGMII_PHYA_PWD needs to be set before the write to the ANA_RGC3 register? -- = RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel