Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp494869iog; Fri, 24 Jun 2022 08:02:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tiVT9f/iUYbia+x8d41Qsfuo6HCrwrailgzThP7ZcHxRkHGyjy6LxYtqMVSIsOyLEFYYJf X-Received: by 2002:a05:6402:2948:b0:42a:ae0c:2f26 with SMTP id ed8-20020a056402294800b0042aae0c2f26mr18159336edb.425.1656082978906; Fri, 24 Jun 2022 08:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656082978; cv=none; d=google.com; s=arc-20160816; b=uH6xqP3xz8HrPrZgHqXZz3QFZBW/VQDZt/JYkETn4drPn5Pru10TY96Xldpa5TYlAB uHMKPpxLO9TwnQAjsZd8jJjghmNhUO6pe1BIhEj54/AMSkapf1lv8sPuHPoI4FYQUs4q 0MzPbmS0lh6kYLi/C/qKPPChK13t5mtmhHDk/deK856TG8wVBBebvB7abfxbaR7VzuIT vQ34p/X8jIvxWkuejtNV0eaKoGSV3DoQv2jzdkXvj8Fmj71fwoWE4CKICSpMYuGCMcLJ WDfBzHQGflBnQgqqYqTVNRgHJkvZR+cnyCLcUAWlrjz1Y1wEfHipixGqPoe/Magf6byp r9Ig== 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=m9VUnPmey1EW3PlxwufpVuRcBXj7WqcXOePoquITgbY=; b=C9pDB4ylHadBd9v5zpGEfmYJCz2uLbdGvJwAhulrFikPVluPn0HEMRbJKJQJc4GORR IOdSKPcWO01KBzl6iOLFpCaodysuJW4OK9Px67I1p/WmWJ7m8h7dIKCN1Kk+77osVyTT Z29Gw86UDzxvbKzYxWzaxqhmCPi8qiFwuLkzUm9jL0j5mQhhGXXUqtwIWnVWo963sQJm SeVGjhVAX2Od4wq/+GkT1gOfZNIF+lcvwgjyyDeJdY55BKyig9gI1f/oCcMW5mQM1iJG z3szOpE49NylWe0nE7BQsYqxjU8r/cwECbl8YoeJaD5V8z1mCiL6vGij/j2Z9YPMWVDc sy+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=f26t62yJ; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd10-20020a1709069b8a00b00722ec5b1693si3053691ejc.163.2022.06.24.08.02.24; Fri, 24 Jun 2022 08:02:58 -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=@bootlin.com header.s=gm1 header.b=f26t62yJ; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233129AbiFXOlc (ORCPT + 99 others); Fri, 24 Jun 2022 10:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231916AbiFXOl3 (ORCPT ); Fri, 24 Jun 2022 10:41:29 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B241E64796; Fri, 24 Jun 2022 07:41:27 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 1A703E0002; Fri, 24 Jun 2022 14:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1656081686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m9VUnPmey1EW3PlxwufpVuRcBXj7WqcXOePoquITgbY=; b=f26t62yJa4myIehQUKbczIFXeSlDXNWR2044wOkaZ5x052xBkOsk5bVQOV32z8wUtW6w3b qO9T5Cfr6Guk2Ys5SRmtx1ntQVZAxZ/TPYfiepiSTTADI0I1Y3nGWEamZ+EDUUDPu8vCOS F3uWGrgY1rBHCcj0J0nW2+OuFoCvC34JasW+S8ItICVnOIRu2UiWeZq7fzKYGBITWc3uK1 uirbGQqG1XwyGQjs+XUbHsr8r9Pd516W0gu7XSibucitviboHbdWdYfsVjw3liYA3R8n/B Paw56iw/XXt4STtKtjweblWhu2u86NJbwYMgA8e6GRlxtumqeYwu3+TMvjuPkQ== From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Geert Uytterhoeven , Magnus Damm , Heiner Kallweit , Russell King , Alexandre Torgue , Giuseppe Cavallaro , Jose Abreu Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Thomas Petazzoni , Herve Codina , =?UTF-8?q?Miqu=C3=A8l=20Raynal?= , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v9 00/16] add support for Renesas RZ/N1 ethernet subsystem devices Date: Fri, 24 Jun 2022 16:39:45 +0200 Message-Id: <20220624144001.95518-1-clement.leger@bootlin.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 The Renesas RZ/N1 SoCs features an ethernet subsystem which contains (most notably) a switch, two GMACs, and a MII converter [1]. This series adds support for the switch and the MII converter. The MII converter present on this SoC has been represented as a PCS which sit between the MACs and the PHY. This PCS driver is probed from the device-tree since it requires to be configured. Indeed the MII converter also contains the registers that are handling the muxing of ports (Switch, MAC, HSR, RTOS, etc) internally to the SoC. The switch driver is based on DSA and exposes 4 ports + 1 CPU management port. It include basic bridging support as well as FDB and statistics support. Link: [1] https://www.renesas.com/us/en/document/mah/rzn1d-group-rzn1s-group-rzn1l-group-users-manual-r-engine-and-ethernet-peripherals ----- Changes in V9: - Cover letter: - Remove comment about RZN1 patches that are now in the master branch. - Commits: - Add Vladimir Oltean Reviewed-by - PCS: - Add "Depends on OF" for PCS_RZN1_MIIC due to error found by intel kernel test robot . - Check return value of of_property_read_u32() for "renesas,miic-switch-portin" property before setting conf. - Return miic_parse_dt() return value in miic_probe() on error - Switch: - Add "Depends on OF" for NET_DSA_RZN1_A5PSW due to errors found by intel kernel test robot . - DT: - Add spaces between switch port and '{' Changes in V8: - Commits: - Reorder Acked-By and Rewieved-by chronologically and add Florian Fainelli Reviewed-By. - PCS: - Fix of node leaks - MAINTAINERS: - Reorder L: before S: Resent V7 due to messed up cover letter. Changes in V7: - Commits: - Add Rob Herring Acked-by for commit "dt-bindings: net: snps,dwmac: add "power-domains" property" - Rebased on net-next/master - MAINTAINERS: - Add renesas-soc and netdev mailing lists Changes in V6: - Commits: - Add commit which enable ethernet switch on RZ/N1D-DB board - Add commit which adds "renesas,rzn1-gmac" compatible t "snps,dwmac" bindings - Fix mutex change being done in FDB feature commit - Add commit which adds"power-domains" to "snps,dwmac" bindings - Bindings and DT - Add clock-names to MII converter and make it required - Added Reviewed-by Geert on MII converter binding - Added "power-domains" to switch bindings and to switch description - Use new compatible "renesas,rzn1-gmac" for GMAC2 - Describe all switch ports in ethernet switch node - Add phy-mode = "internal" to cpu port - PCS: - use phy_interface_mode_is_rgmii() instead of open coded check - Add device_link_add() call in miic_create() - Switch: - Fix missing of_node_put(port) in case of loop break. - Fix comment alignment for statistics defines - Move lk_lock mutex locking outside of the fdb_dump loop Changes in V5: - MAINTAINERS: - Add Florian Fainelli Reviewed-by - Switch: - Switch Lookup table lock to a mutex instead of a spinlock - Only handle "ethernet-ports" property for switch ports - Handle RGMII_ID/RXID/TXID - Add check for pdata to be non null in remove - Add missing of_node_put() for mdio and ports - Applied Florian Fainelli patch which makes stats description shorter - Add Kconfig dependency on ARCH_RZN1 to avoid Kconfig "unmet direct dependency" - PCS: - Handle RGMII_ID/RXID/TXID - Use value instead of BIT() for speed/mode - Tag driver: - Add Florian Fainelli Reviewed-by Changes in V4: - Add ETH_P_DSA_A5PSW in uapi/linux/if_ether.h - PCS: - Use devm_pm_runtime_enable() instead of pm_runtime_enable() - Switch: - Return -EOPNOTSUPP and set extack when multiple bridges are created - Remove error messages in fdb_del if entry does not exists - Add compatibility with "ethernet-ports" device-tree property - Tag driver: - Use ETH_ZLEN as padding len Changes in V3: - PCS: - Fixed reverse christmas tree declaration - Remove spurious pr_err - Use pm_runtime functions - Tag driver: - Remove packed attribute from the tag struct - Switch: - Fix missing spin_unlock in fdb_dump in case of error - Add static qualifier to dsa_switch_ops - Add missing documentation for hclk and clk members of struct a5psw - Changed types of fdb_entry to u16 to discard GCC note on char packed bitfields and add reserved field - Added Reviewed-by tag from Florian Fainelli Changes in V2: - PCS: - Fix Reverse Christmas tree declaration - Removed stray newline - Add PCS remove function and disable clocks in them - Fix miic_validate function to return correct values - Split PCS CONV_MODE definition - Reordered phylink_pcs_ops in definition order - Remove interface setting in miic_link_up - Remove useless checks for invalid interface/speed and error prints - Replace phylink_pcs_to_miic_port macro by a static function - Add comment in miic_probe about platform_set_drvdata - Bindings: - Fix wrong path for mdio.yaml $ref - Fix yamllint errors - Tag driver: - Squashed commit that added tag value with tag driver - Add BUILD_BUG_ON for tag size - Split control_data2 in 2 16bits values - Switch: - Use .phylink_get_caps instead of .phylink_validate and fill supported_interface correctly - Use fixed size (ETH_GSTRING_LEN) string for stats and use memcpy - Remove stats access locking since RTNL lock is used in upper layers - Check for non C45 addresses in mdio_read/write and return -EOPNOTSUPP - Add get_eth_mac_stats, get_eth_mac_ctrl_stat, get_rmon_stats - Fix a few indentation problems - Remove reset callback from MDIO bus operation - Add phy/mac/rmon stats - Add get_rmon_stat to dsa_ops Clément Léger (16): net: dsa: allow port_bridge_join() to override extack message net: dsa: add support for ethtool get_rmon_stats() net: dsa: add Renesas RZ/N1 switch tag driver dt-bindings: net: pcs: add bindings for Renesas RZ/N1 MII converter net: pcs: add Renesas MII converter driver dt-bindings: net: dsa: add bindings for Renesas RZ/N1 Advanced 5 port switch net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver net: dsa: rzn1-a5psw: add statistics support net: dsa: rzn1-a5psw: add FDB support dt-bindings: net: snps,dwmac: add "power-domains" property dt-bindings: net: snps,dwmac: add "renesas,rzn1" compatible ARM: dts: r9a06g032: describe MII converter ARM: dts: r9a06g032: describe GMAC2 ARM: dts: r9a06g032: describe switch ARM: dts: r9a06g032-rzn1d400-db: add switch description MAINTAINERS: add Renesas RZ/N1 switch related driver entry .../bindings/net/dsa/renesas,rzn1-a5psw.yaml | 134 +++ .../bindings/net/pcs/renesas,rzn1-miic.yaml | 171 +++ .../devicetree/bindings/net/snps,dwmac.yaml | 5 + MAINTAINERS | 13 + arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts | 117 ++ arch/arm/boot/dts/r9a06g032.dtsi | 108 ++ drivers/net/dsa/Kconfig | 9 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/rzn1_a5psw.c | 1062 +++++++++++++++++ drivers/net/dsa/rzn1_a5psw.h | 259 ++++ drivers/net/pcs/Kconfig | 8 + drivers/net/pcs/Makefile | 1 + drivers/net/pcs/pcs-rzn1-miic.c | 520 ++++++++ include/dt-bindings/net/pcs-rzn1-miic.h | 33 + include/linux/pcs-rzn1-miic.h | 18 + include/net/dsa.h | 5 + include/uapi/linux/if_ether.h | 1 + net/dsa/Kconfig | 7 + net/dsa/Makefile | 1 + net/dsa/slave.c | 18 +- net/dsa/tag_rzn1_a5psw.c | 113 ++ 21 files changed, 2602 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml create mode 100644 Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml create mode 100644 drivers/net/dsa/rzn1_a5psw.c create mode 100644 drivers/net/dsa/rzn1_a5psw.h create mode 100644 drivers/net/pcs/pcs-rzn1-miic.c create mode 100644 include/dt-bindings/net/pcs-rzn1-miic.h create mode 100644 include/linux/pcs-rzn1-miic.h create mode 100644 net/dsa/tag_rzn1_a5psw.c -- 2.36.1