From patchwork Mon Sep 18 22:26:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 14172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2996455vqi; Mon, 18 Sep 2023 15:38:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGd/7sWaQsSneEwnyuRy29w0i/T+L3EwoAVFkDD4BNqnludvFDFXBIfzf/7ca1PwolJhPcD X-Received: by 2002:a05:6870:418e:b0:1a9:caa6:1337 with SMTP id y14-20020a056870418e00b001a9caa61337mr13324855oac.23.1695076702326; Mon, 18 Sep 2023 15:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695076702; cv=none; d=google.com; s=arc-20160816; b=LtQgzk7PYpya+GfTRnodSjPguNxqXyRVO3RIy/0TJakbb8qeZzsERp6qEC9hRZE4qr qgWj66fe9wmCCQkF9w+HJAsC3QMHbFnS7W2LrIrA2ihuRrG/G8iQZWOHxDjxu0MwNrSL nL5LUkbHsPTfGjv2MdjiCH/JxIwpkqVOFtusygS9Ur5rqlrrGWGYpeiBeRVRXZ+9XGiI HMT/fXjqHYrSqw+6VKhNXOf89uXyh3EeIIL5AXlqQaa9NshcNIU+Ou51bywSuhT1ki2U BBjMX31Gb48Vjcbg5/SwPe9JwMLsQoE9HyqcaKXZy9CgAVj2zLZIg3lUsTXTQQXYLY9d IyTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date; bh=en2tF9VelHIj+TkvKeo+ZmnM8j5icWjtj14byNflA1o=; fh=z6SMc47/fbKHWC0EF4m++RWwRv0itRNRAk3FMus4c04=; b=olkzpJZTFz7+YkHlUXJ8MoXBLXTc/lryvb8/hTdtl782gvh+z5w7/0zpU+7/obeuAb 5mHNSuYNEpFLkHPeHTADjEfNLTrOVz/XF2CTxVqsYbbUCofaIFDfHiAPIVLNsuWpKcxM UsXsTSzWygxw2vRzcf125S0dNrxs/Aht5eC2GTZBEZWrLVrOf1IvZ0w3hfTVHJssRrWG AHZNy/eqgfdgqQyY2kv/50drVNdeFVzRff2SMH+2TvoheheCWjbrUwKuBo9MEeupt4K5 ejdsxZ5QNSxk3Bv0pUR+eJBo3BgmPoeiRG6g3F5NiEqRU99R9eUvsYNpx9yrB7VAQngA Va1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id k127-20020a632485000000b00563da8d8416si8609876pgk.355.2023.09.18.15.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 15:38:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7F53780F4E0D; Mon, 18 Sep 2023 15:26:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229777AbjIRW0n (ORCPT + 25 others); Mon, 18 Sep 2023 18:26:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjIRW0m (ORCPT ); Mon, 18 Sep 2023 18:26:42 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 992E38F; Mon, 18 Sep 2023 15:26:36 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1qiMhA-0002wG-1F; Mon, 18 Sep 2023 22:26:20 +0000 Date: Mon, 18 Sep 2023 23:26:01 +0100 From: Daniel Golle To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next v2 0/2] net: ethernet: mtk_eth_soc: add paths and SerDes modes Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 18 Sep 2023 15:26:51 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777416748263399126 X-GMAIL-MSGID: 1777416748263399126 The series brings support for SerDes interface modes up to 10 Gb/s for the MediaTek MT7988 SoC. As the Ethernet driver now requires a few more phandles in device tree referencing various other parts of the SoC also add corresponding dt-binding changes. It may be argued that instead of referencing those units as syscon and access them as regmap one may want to implement propper clk or reset drivers. However, only a single register write is require to the otherwise completely undocumented pextp_pll unit which will not make a nice clk driver... The toprgu/watchdog reset controller is used to synchronously assert/deassert multiple resets as the same time which is not supported by Linux reset controller API which always asserts/deasserts resets sequentially. It is not known whether asserting/deasserting pextp, sgmii, xfi and usxgii resets simultanously is stricly required for the hardware to work reliably, however, it's what the vendor implementation is doing as well and there are no other drivers needing to access the toprgu reset controller. This series has been tested with the MT7988 reference board as well as pre-mass-production BananaPi BPi-R4 board also featuring MT7988. Various SFP(+) modules have been successfully tested on both boards and also the on-board AQR133 10GE PHY found on the MT7988 reference board works nicely. To make sure no existing older SoCs have been broken run-time tests have also been carried out on various MT7981, MT7986, MT7622 and MT7623 boards. The patch is also present in OpenWrt for some months now already and hence supposedly hundreds of users also on older MT7621 systems should have tested it while I didn't hear about any complaints so far. For the interfaces modes covered by the existing LynxI PCS driver (Cisco SGMII, 1000Base-X, 2500Base-X) to work on MT7988 this series depends on commit 90308679c297f ("net: pcs: lynxi: implement pcs_disable op"). Changes since v1: * add missing macro defines (v1 didn't build for that reason) * add dt-bindings changes Daniel Golle (2): dt-bindings: net: mediatek,net: add phandles for SerDes on MT7988 net: ethernet: mtk_eth_soc: add paths and SerDes modes for MT7988 .../devicetree/bindings/net/mediatek,net.yaml | 28 + drivers/net/ethernet/mediatek/Kconfig | 16 + drivers/net/ethernet/mediatek/Makefile | 1 + drivers/net/ethernet/mediatek/mtk_eth_path.c | 123 ++- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 182 ++++- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 237 +++++- drivers/net/ethernet/mediatek/mtk_usxgmii.c | 698 ++++++++++++++++++ 7 files changed, 1254 insertions(+), 31 deletions(-) create mode 100644 drivers/net/ethernet/mediatek/mtk_usxgmii.c