Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3230700rwi; Fri, 21 Oct 2022 13:27:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Prc8H+DzD606fvJyrEfEAVMjolUOHbxL2uitXCd11EuRksWzJbJbLBqLZJhFZ+Hi3pH/C X-Received: by 2002:a17:903:4d7:b0:178:8564:f754 with SMTP id jm23-20020a17090304d700b001788564f754mr20900153plb.60.1666384026853; Fri, 21 Oct 2022 13:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384026; cv=none; d=google.com; s=arc-20160816; b=VRyg4o/pV9Fqo+szrss0kQFoK2sSlVs6F6hIB4jo2nJBe4gfXcE5dM+VMf+M1hO15S t05xTjanC87n2kubDGGCiUKT/NthEONrSen5wLQl3LrWFc7eS+WvbmrIGpYv00Emku+1 is7R7+or+PUZRiMEaMxUA/Eevzx44fhH1As92096s6zKbvT0nDfj43JNGmd62qVdrECI dTDUNef4IbsEFSKWKVF3JUm5NMDh6De57/39bcQX0hYlJ8T7qvvDuK8Q+20zAlRfGqDB h55XQlIuS38R1PplAGRQzre2Ilb8o1ho2S6sNOffzTBODZ93P+eb7T118vTeWD+YwU2d xQWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:references:in-reply-to :sensitivity:importance:date:subject:cc:to:from:message-id :mime-version:dkim-signature; bh=aQRiKAwqFHyIsbdWu5bS/JCDbkDqN+HM61cI+r5WCLM=; b=wXrch7vSrgJST45gpxaHJnrkxbPBP7puYifGoAmGH9y6qHBRAH4MbkRycQu5OQZWwU HfiULHZS3pPGOOizh+DS3pmiFN25fNF/taxjwKeYDw9DHpkZX4uv0aOYwpDpoaysVS45 q95Vmal6DlRKyNxMqndRuLLnKYWz1oKaHYhuS1+8+/Iph3wZGmDDEjSPMMlaZQTQSBBJ V5lzHJMzJIn1LR5B6W4sfk4w8d8Jbp0Bj3f4Y0Q/qtsdl2CAyrjX7sRdbwiR44SfgGOg 31ixLpEQQzRj6xby0DvQx+iHbLpCgkwOv5RuR97X9vclpXJoHyaJHEIluIVLXbyY/aOA Cnyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="DOfM/aOA"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y63-20020a638a42000000b004588a5bd0bfsi24288594pgd.569.2022.10.21.13.26.51; Fri, 21 Oct 2022 13:27:06 -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=@gmx.net header.s=badeba3b8450 header.b="DOfM/aOA"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230073AbiJUTxO (ORCPT + 99 others); Fri, 21 Oct 2022 15:53:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbiJUTxK (ORCPT ); Fri, 21 Oct 2022 15:53:10 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C16F245E89; Fri, 21 Oct 2022 12:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1666381956; bh=fpDJO6xw87XOPgLQXGhHqc6UPyXxqjCz+Pv2+8G7LNQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=DOfM/aOA5rhFQoa2yNpJUnGeasmqcLztJOut0Fai5IcTVopHetUf7KcMIy076R1Y6 8+ADyrrehWGuynokU6hS6tlvPJT7ot2a2ZvaW5nWZX/ov0svg4ObEqiCNM5QfcFRdT skhxioRmVcA9M5HmzghCLA88FlDfIgZVFaf8yQMg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [217.61.146.132] ([217.61.146.132]) by web-mail.gmx.net (3c-app-gmx-bap55.server.lan [172.19.172.125]) (via HTTP); Fri, 21 Oct 2022 21:52:36 +0200 MIME-Version: 1.0 Message-ID: From: Frank Wunderlich To: "Russell King (Oracle)" Cc: 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: Aw: Re: Re: [PATCH v2] net: mtk_sgmii: implement mtk_pcs_ops Content-Type: text/plain; charset=UTF-8 Date: Fri, 21 Oct 2022 21:52:36 +0200 Importance: normal Sensitivity: Normal In-Reply-To: References: <20221020144431.126124-1-linux@fw-web.de> <02A54E45-2084-440A-A643-772C0CC9F988@public-files.de> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:wIZ9ALfKQQdEv1eLRnuW6Hp9CdJw3iUykNQveb68jTlztIraIMRnSIAwfe6cuGHeL02Po vVCfMom87gN/ejCrLhe4kXWEtIAoUvwDiRFz52rndCn6cU+b5TwagQOEtNw74bsgSRrMKylWWTga rGfXI+UVmhUd5aVpZfMV/8XgaBlQICusjw813IIN3xNAG7cSeeTrL6Ed4id+WkPFIk3gqfpMOoMp skGf4fiFbEinwJmLxf4PV4vutzA70VYL3PRniwLbVxxx1emVHtvCSbBlHsLCo56+0Q2dsRDEBr+t Zk= X-UI-Out-Filterresults: notjunk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R8gY 43Y6zj8msyMIt3S3SHYCKd8G5pRA5NLrGmapXLqBITCx2XelidyDxbFX8Y9PX3VU5Vf9tyb7V EWEL1PWbiPZwSW8rhJA70qH8XWKBZ/06mjIr/0yQyQ44w34EENJaMGkdn6AB5zkeZoIBAGTfV sGAe0C4wyDkSYoU1CBT2/HkPFJSlgZnUT3sDejt60gD43b7Aum1ac1inVF6sqYPSkIyj+ovMT C3fLMVOghbatiR9tiXH3OYmDJ744AJ13q/kBrr4Cnqb6g2+M5dwCIrEFkqDbHUBPLrmaq/4zr Igoqp2+ou/cQ2XXQT60EcYbVErNVfQ== Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 > Gesendet: Freitag, 21. Oktober 2022 um 20:31 Uhr > Von: "Russell King (Oracle)" > On Fri, Oct 21, 2022 at 07:47:47PM +0200, Frank Wunderlich wrote: > > > Gesendet: Freitag, 21. Oktober 2022 um 11:06 Uhr > > > Von: "Russell King (Oracle)" > > > Looking at SGMSYS_PCS_CONTROL_1, this is actually the standard BMCR = in > > > the low 16 bits, and BMSR in the upper 16 bits, so: > > > > > > At address 4, I'd expect the PHYSID. > > > At address 8, I'd expect the advertisement register in the low 16 bi= ts > > > and the link partner advertisement in the upper 16 bits. > > > > > > Can you try an experiment, and in mtk_sgmii_init() try accessing the > > > regmap at address 0, 4, and 8 and print their contents please? > > > > is this what you want to see? > > [ 1.083359] dev: 0 offset:0 0x840140 > > [ 1.083376] dev: 0 offset:4 0x4d544950 > > [ 1.086955] dev: 0 offset:8 0x1 > > [ 1.090697] dev: 1 offset:0 0x81140 > > [ 1.093866] dev: 1 offset:4 0x4d544950 > > [ 1.097342] dev: 1 offset:8 0x1 > > Thanks. Decoding these... > > dev 0: > BMCR: fixed, full duplex, 1000Mbps, !autoneg > BMSR: link up > Phy ID: 0x4d54 0x4950 > Advertise: 0x0001 (which would correspond with the MAC side of SGMII) > Link partner: 0x0000 (no advertisement received, but we're not using > negotiation.) > > dev 1: > BMCR: autoneg (full duplex, 1000Mbps - both would be ignored) > BMSR: able to do autoneg, no link > Phy ID: 0x4d54 0x4950 > Advertise: 0x0001 (same as above) > Link partner: 0x0000 (no advertisement received due to no link) > > Okay, what would now be interesting is to see how dev 1 behaves when > it has link with a 1000base-X link partner that is advertising > properly. If this changes to 0x01e0 or similar (in the high 16-bits > of offset 8) then we definitely know that this is an IEEE PHY register > set laid out in memory, and we can program the advertisement and read > the link partner's abilities. added register-read on the the new get_state function too on bootup it is now a bit different [ 1.086283] dev: 0 offset:0 0x40140 #was previously 0x840140 [ 1.086301] dev: 0 offset:4 0x4d544950 [ 1.089795] dev: 0 offset:8 0x1 [ 1.093584] dev: 1 offset:0 0x81140 [ 1.096716] dev: 1 offset:4 0x4d544950 [ 1.100191] dev: 1 offset:8 0x1 root@bpi-r3:~# ip link set eth1 up [ 172.037519] mtk_soc_eth 15100000.ethernet eth1: configuring for inband/= 1000base-x link mode root@bpi-r3:~# [ 172.102949] offset:0 0x40140 #still same value [ 172.102964] offset:4 0x4d544950 [ 172.105842] offset:8 0x1 [ 172.108992] mtk_soc_eth 15100000.ethernet eth1: Link is Up - 1Gbps/Unkn= own - flow control off [ 172.120058] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready so no change on link up maybe ethtool-output is interesting root@bpi-r3:~# ethtool -m eth1 Identifier : 0x03 (SFP) Extended identifier : 0x04 (GBIC/SFP defined= by 2-wire interface ID) Connector : 0x07 (LC) Transceiver codes : 0x00 0x00 0x00 0x01 0x= 00 0x00 0x00 0x00 0x00 Transceiver type : Ethernet: 1000BASE-SX Encoding : 0x01 (8B/10B) BR, Nominal : 1300MBd Rate identifier : 0x00 (unspecified) Length (SMF,km) : 0km Length (SMF) : 0m Length (50um) : 550m Length (62.5um) : 270m Length (Copper) : 0m Length (OM3) : 0m Laser wavelength : 850nm Vendor name : OEM Vendor OUI : 00:90:65 Vendor PN : GLC-SX-MMD _ Vendor rev : _e Option values : 0x00 0x1a Option : RX_LOS implemented Option : TX_FAULT implemented Option : TX_DISABLE implemented BR margin, max : 0% BR margin, min : 0% Vendor SN : CSCGE1M14134 Date code : 220120 Optical diagnostics support : Yes Laser bias current : 3.634 mA Laser output power : 0.3181 mW / -4.97 dBm Receiver signal average optical power : 0.3444 mW / -4.63 dBm Module temperature : 35.32 degrees C / 95.5= 8 degrees F Module voltage : 3.3101 V Alarm/warning flags implemented : Yes Laser bias current high alarm : Off Laser bias current low alarm : Off Laser bias current high warning : Off Laser bias current low warning : Off Laser output power high alarm : Off Laser output power low alarm : Off Laser output power high warning : Off Laser output power low warning : Off Module temperature high alarm : Off Module temperature low alarm : Off Module temperature high warning : Off Module temperature low warning : Off Module voltage high alarm : Off Module voltage low alarm : Off Module voltage high warning : Off Module voltage low warning : Off Laser rx power high alarm : Off Laser rx power low alarm : Off Laser rx power high warning : Off Laser rx power low warning : Off Laser bias current high alarm threshold : 100.000 mA Laser bias current low alarm threshold : 0.000 mA Laser bias current high warning threshold : 90.000 mA Laser bias current low warning threshold : 0.100 mA Laser output power high alarm threshold : 1.2589 mW / 1.00 dBm Laser output power low alarm threshold : 0.0501 mW / -13.00 dBm Laser output power high warning threshold : 0.7943 mW / -1.00 dBm Laser output power low warning threshold : 0.0631 mW / -12.00 dBm Module temperature high alarm threshold : 90.00 degrees C / 194.= 00 degrees F Module temperature low alarm threshold : -45.00 degrees C / -49= .00 degrees F Module temperature high warning threshold : 85.00 degrees C / 185.= 00 degrees F Module temperature low warning threshold : -40.00 degrees C / -40= .00 degrees F Module voltage high alarm threshold : 3.8000 V Module voltage low alarm threshold : 2.7000 V Module voltage high warning threshold : 3.7000 V Module voltage low warning threshold : 2.8000 V Laser rx power high alarm threshold : 0.7943 mW / -1.00 dBm Laser rx power low alarm threshold : 0.0079 mW / -21.02 dBm Laser rx power high warning threshold : 0.5012 mW / -3.00 dBm Laser rx power low warning threshold : 0.0126 mW / -19.00 dBm root@bpi-r3:~# ethtool eth1 [ 295.755349] offset:0 0x40140 [ 295.755368] offset:4 0x4d544950 Settings for eth[ 295.758247] offset:8 0x1 1: Supported p[ 295.761551] offset:0 0x40140 [ 295.765446] offset:4 0x4d544950 Supported link modes: 1000baseX/Full Supported pause frame use: Symmetric Receive-only Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 1000baseX/Full Advertised pause frame use: Symmetric Receive-only Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Unknown! (255) Auto-negotiation: on Port: FIBRE PHYAD: 0 Transceiver: internal Current message level: 0x000000ff (255) drv probe link timer ifdown ifup rx_err tx_= err Link detected: yes > At that point, we should try programming the low 16-bits of offset 8 > to see whether that advertisement makes it to the far end of the link. have only my switch on the other side where i imho cannot read out these a= dvertising. and programming to which values at which point (in the get-sta= te callback to be done on link-up)? > It would be well worth trying to work this out, because it will then > vastly improve the knowledge of this hardware, and improve the > driver no end. > > Is this something you could investigate please? regards Frank