Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp868765rwd; Thu, 1 Jun 2023 07:34:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4CBKrhU6y7iAQHclGHXnWMXxz9PNmKQ1WvYVwNu9dD8qSST2HV0FGzycGA3yS3K9fkiGJv X-Received: by 2002:a05:6a00:1a11:b0:63d:3981:313d with SMTP id g17-20020a056a001a1100b0063d3981313dmr7990339pfv.10.1685630068770; Thu, 01 Jun 2023 07:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685630068; cv=none; d=google.com; s=arc-20160816; b=0/NHumU1ne0uphlP3YC0vWjJ8gRgi3jLVFHXsgmjwdoiNIRJ2/pmz5GeYz8hmh0Tbe AKzkiJKhXA6ozpTTvpR0yz/v5ovxmjmhmZ67+JF0EmgwcvBMy410Wd9iILHEx6UMTLUe 0iJbAMpVgvxyGE4a1r7o2EjrNIUmmG+zbX2cbBeu4aEQ7+B0vY+4HS6HLJNo/k45wDW+ VAN9JpA5XBrAa9/4cxZ2tkM+2zEQ7Fe8G6TiYFMHBDkesFDRCgt+mTAos2ed5ValC+10 RtybeEXh6LjXOrB0IhUPGbiT3NfRipKtohAZTLRPd/oGl7SoTeWhpQWsolTiJrFJ21ek Sgpw== 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=GSKLVXScyIF80afcNDZ6IMVCbvZLfc7MWeR4l9bPXxU=; b=lFlm0tqVMAuwPrs5QODU7arpQ1A66r0J9UVy82UtPWifx0Shl7csGdpmTiXXJfzHHd CAS1/INbebQyJha0c2DGCzH2kzfMh3nhsUcr9zpf3H7SzZZZVQndWPpL21cEBWVYiZNg if1RqyVe7PNYpPtoJatRFHH49iheYy0mTM4We4HOXvCo+5mvDNyZjyIXR1isdgDcyAKI wvB3tWajd+g2WEAwjxinmbLTYHUQStPujeEIQEeE7EZGoleQQi9eJHNCHy9Ig4VXwSZ1 WP5yTy0yNSu0J1ot+xsQ13+jjyI1itiaMGMUiDU53Fb5diYJIQ+OEhUuZJe7GnbsEAF6 64hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=mnFKeur3; 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 f10-20020a63de0a000000b0053febd41e7esi1735449pgg.380.2023.06.01.07.34.16; Thu, 01 Jun 2023 07:34:28 -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=mnFKeur3; 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 S234122AbjFAOPT (ORCPT + 99 others); Thu, 1 Jun 2023 10:15:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234178AbjFAOPH (ORCPT ); Thu, 1 Jun 2023 10:15:07 -0400 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1435E186; Thu, 1 Jun 2023 07:15:03 -0700 (PDT) X-GND-Sasl: maxime.chevallier@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1685628902; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GSKLVXScyIF80afcNDZ6IMVCbvZLfc7MWeR4l9bPXxU=; b=mnFKeur3xvzXNWe+lohQggL53A5bU6z/ZYAUAhvbL0gAHMssf0rrMoxwiDw1jXWBh201qN qKNCEwltHUbaIMLwubDM+Bzi+kZBo4ZbAcd37YLuZuSPEYouIH3X9svIG2VCRBfB8M/lVv ow2Kq5fY4/yMVrLgVPXfK0lrBAcnzw54zOWiagHKb7gD0UArUb1Mfp3txaoPLYR9F1eWYc yH4vRcW0ds3uqdAjboRXpFfJ+IFB1XSNSZsPDmbMErdR/Xtm9LURg/cI9DrZotzHBhffXW rtxNuiALfAdN4iLIM4fyF1ux7TQngMSm5d7NFsZmexBomO1Ss44Gi5UdZGQQhw== X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 926642000C; Thu, 1 Jun 2023 14:14:55 +0000 (UTC) From: Maxime Chevallier To: Mark Brown , davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, alexis.lothore@bootlin.com, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Florian Fainelli , Heiner Kallweit , Russell King , Vladimir Oltean , Ioana Ciornei , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Maxime Coquelin , Jose Abreu , Alexandre Torgue , Giuseppe Cavallaro , Simon Horman Subject: [PATCH net-next v4 0/4] net: add a regmap-based mdio driver and drop TSE PCS Date: Thu, 1 Jun 2023 16:14:50 +0200 Message-Id: <20230601141454.67858-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 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,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 Hello everyone, This is the V4 of a series that follows-up on the work [1] aiming to drop the altera TSE PCS driver, as it turns out to be a version of the Lynx PCS exposed as a memory-mapped block, instead of living on an MDIO bus. One step of this removal involved creating a regmap-based mdio driver that translates MDIO accesses into the actual underlying bus that exposes the register. The register layout must of course match the standard MDIO layout, but we can now account for differences in stride with recent work on the regmap subsystem [2]. Sorry for repeating this, but I didn't hear anything on this matter in previous iterations, Mark, Net maintainers, this series depends on the patch e12ff2876493 that was recently merged into the regmap tree [3]. For this series to be usable in net-next, this patch must be applied beforehand. Should Mark create a tag that would then be merged into net-next ? Or should we just wait for the next release to merge this into net-next ? This series introduces a new MDIO driver, and uses it to convert Altera TSE from the actual TSE PCS driver to Lynx PCS. Since it turns out dwmac_socfpga also uses a TSE PCS block, port that driver to Lynx as well. Changes in V4 : - Use new pcs_lynx_create/destroy helpers added by Russell - Rework the cleanup sequence to avoid leaking data - Rework a bit KConfig to properly select dependencies - Fix a few hiccups with misplaced hunks in 2 commits Changes in V3 : - Use a dedicated struct for the mii bus's priv data, to avoid duplicating the whole struct mdio_regmap_config, from which 2 fields only are necessary after init, as suggested by Russell - Use ~0 instead of ~0UL for the no-scan bitmask, following Simon's review. Changes in V2 : - Use phy_mask to avoid unnecessarily scanning the whole mdio bus - Go one step further and completely disable scanning if users set the .autoscan flag to false, in case the mdiodevice isn't an actual PHY (a PCS for example). Thanks, Maxime [1] : https://lore.kernel.org/all/20230324093644.464704-1-maxime.chevallier@bootlin.com/ [2] : https://lore.kernel.org/all/20230407152604.105467-1-maxime.chevallier@bootlin.com/#t [3] : https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git/commit/?id=e12ff28764937dd58c8613f16065da60da149048 Maxime Chevallier (4): net: mdio: Introduce a regmap-based mdio driver net: ethernet: altera-tse: Convert to mdio-regmap and use PCS Lynx net: pcs: Drop the TSE PCS driver net: stmmac: dwmac-sogfpga: use the lynx pcs driver MAINTAINERS | 14 +- drivers/net/ethernet/altera/Kconfig | 2 + drivers/net/ethernet/altera/altera_tse_main.c | 57 +++- drivers/net/ethernet/stmicro/stmmac/Kconfig | 3 + drivers/net/ethernet/stmicro/stmmac/Makefile | 2 +- .../ethernet/stmicro/stmmac/altr_tse_pcs.c | 257 ------------------ .../ethernet/stmicro/stmmac/altr_tse_pcs.h | 29 -- drivers/net/ethernet/stmicro/stmmac/common.h | 2 + .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 91 +++++-- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 12 +- .../net/ethernet/stmicro/stmmac/stmmac_mdio.c | 3 + drivers/net/mdio/Kconfig | 11 + drivers/net/mdio/Makefile | 1 + drivers/net/mdio/mdio-regmap.c | 93 +++++++ drivers/net/pcs/Kconfig | 6 - drivers/net/pcs/Makefile | 1 - drivers/net/pcs/pcs-altera-tse.c | 160 ----------- include/linux/mdio/mdio-regmap.h | 26 ++ include/linux/pcs-altera-tse.h | 17 -- 19 files changed, 271 insertions(+), 516 deletions(-) delete mode 100644 drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c delete mode 100644 drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h create mode 100644 drivers/net/mdio/mdio-regmap.c delete mode 100644 drivers/net/pcs/pcs-altera-tse.c create mode 100644 include/linux/mdio/mdio-regmap.h delete mode 100644 include/linux/pcs-altera-tse.h -- 2.40.1