From patchwork Thu Jun 1 14:14:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 10166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp368712vqr; Thu, 1 Jun 2023 07:22:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7UdHMCxPu5nP/a07pQsxfGZ+mzs16kKFrrdb0DpMqkt7fCAR29jGksgVcc9EWe0Opxf8HH X-Received: by 2002:a05:6a20:c1a7:b0:111:997d:d224 with SMTP id bg39-20020a056a20c1a700b00111997dd224mr8118893pzb.19.1685629342701; Thu, 01 Jun 2023 07:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685629342; cv=none; d=google.com; s=arc-20160816; b=iCjr92bqD7UJpEXYfevKZpVJvgTsK19nDXvMy4qjyNRCEV6wPSZkOxSP4J4deDtOQo DU0o9Nc2lkhx0ZyJx/nJ8hQ89lpQfsIa1mXD9vjsd2uOkLtEsaLVtE0H8ZMpavvH6Uh0 afAzpdRhwY3C6wJbuDITgVQ85kAj2WiBG/n/S8pbcedOmU4B9wMdIaZ+dPwDpP1qX5mT scnSoUdhZ+rTuUIlRyqOD8dmdIjvBYCd2E92dB2R9s+No4V3twgdbUcEom6EkyHXBUnU KbRUvv6QBJK7HY9CL1/q6pKGQuoviBHsQSYcUbbymQLVrimO9hvR9CpnWxmDFfX8qTat kwTg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 125-20020a620683000000b0064d5e926241si2658421pfg.149.2023.06.01.07.22.07; Thu, 01 Jun 2023 07:22:22 -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 S233335AbjFAOPU (ORCPT + 99 others); Thu, 1 Jun 2023 10:15:20 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767510473218808136?= X-GMAIL-MSGID: =?utf-8?q?1767510473218808136?= 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