Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp830888rwl; Wed, 29 Mar 2023 09:02:03 -0700 (PDT) X-Google-Smtp-Source: AKy350YRVbC232nK38BJu1uiX7SsVfv9K3VVJXHpECp2Qq7Iq+FmyL+QaEEY/aW0hW0vDb9ObT+J X-Received: by 2002:a17:90b:1811:b0:237:b64c:6bb3 with SMTP id lw17-20020a17090b181100b00237b64c6bb3mr22367823pjb.11.1680105723236; Wed, 29 Mar 2023 09:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680105723; cv=none; d=google.com; s=arc-20160816; b=wRNqsr9r2MWahrW5ieWho+jrT2Ju97J5DWbWma+PZGd29lCPpMu+HWaib824GPacQe S7zp94W8KdvZ+bszftT6Arlr73dAhx8tQSpDhVxUFEY594RXi1w7m0oELUgH5UP82Zjq x7EKIh14B9pj6ldvWp3sSGE4DU0w4MYcPR1kVmMgv4F665iqX5fCpFllyO+5CpPlRvpy s3UVk+z50ZBKGI7ZzEeW2rQdC8PSKjdQ2LS5IlVWQhznXHwacX/a/toc0jPcfTGx8LP6 D7hkvS5tdBFEudWVvYB9jH9rLRe9TSeWIJNnWtRUxpr7G5aVWHZvY1AQ9wyCuPuMDzV6 mO2g== 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:cc:to:from:date; bh=FF4fLbskvvxrngKMlYefGzTEqPfnLtcZPTH9/ay67ek=; b=mgE3nohDuOCRysgXys0Xw/00CBRV5RssyhoaR5+16aBw77//z9XHgakQb7ktabMbum zTfin0EcdfwZIcx5sww6qFwVKcAVeYZV/KxL2U/bJm/9qMqZSdoLvi5lPXzaMfs4G6ye v45YucaKXqyW4GrE085PbnDPFm7CJMeUs+TKlBHOBi0AkgpdbtLlUZ1q1GscKLovoDtw MxcgKH73BydbmulzfZAjcfMLkpYvR3HW/cdBhvPCHEdY+zuoPSTn0lm+3K8Eah0CFWlE bgTtPnX5NlEpaYsx0KqJ2QAiXBrfB2P1Hq/Onr21uyyYx2bln2TnYxztThlZtNTDtSNJ TX3Q== ARC-Authentication-Results: i=1; mx.google.com; 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 x13-20020a17090ab00d00b00233f3034302si1686052pjq.46.2023.03.29.09.01.42; Wed, 29 Mar 2023 09:02:03 -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; 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 S231161AbjC2P6x (ORCPT + 99 others); Wed, 29 Mar 2023 11:58:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230034AbjC2P6g (ORCPT ); Wed, 29 Mar 2023 11:58:36 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E06CF5FDC; Wed, 29 Mar 2023 08:58:03 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1phYAh-0003Jq-1t; Wed, 29 Mar 2023 17:57:12 +0200 Date: Wed, 29 Mar 2023 16:57:04 +0100 From: Daniel Golle To: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Sean Wang , Landen Chao , DENG Qingfang , Philipp Zabel Cc: Sam Shih , Lorenzo Bianconi , John Crispin , Felix Fietkau Subject: [RFC PATCH net-next v3 00/15] net: dsa: add support for MT7988 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 MediaTek MT7988 SoC comes with a built-in switch very similar to previous MT7530 and MT7531. However, the switch address space is mapped into the SoCs memory space rather than being connected via MDIO. Using MMIO simplifies register access and also removes the need for a bus lock, and for that reason also makes interrupt handling more light-weight. Note that this is different from previous SoCs like MT7621 and MT7623N which also came with an integrated MT7530-like switch which yet had to be accessed via MDIO. Split-off the part of the driver registering an MDIO driver, then add another module acting as MMIO/platform driver. Changes since v2: * split into many small commits to ease review * introduce helper functions to reduce code duplication * use helpers for locking to make lock-skipping easier and less ugly to implement. * add dt-bindings for mediatek,mt7988-switch Changes since initial RFC: * use regmap for register access and move register access to bus- specific driver * move initialization of MT7531 SGMII PCS to MDIO driver Daniel Golle (15): net: dsa: mt7530: refactor SGMII PCS creation net: dsa: mt7530: use unlocked regmap accessors net: dsa: mt7530: use regmap to access switch register space net: dsa: mt7530: move SGMII PCS creation to mt7530_probe function net: dsa: mt7530: introduce mutex helpers net: dsa: mt7530: move p5_intf_modes() function to mt7530.c net: dsa: mt7530: introduce mt7530_probe_common helper function net: dsa: mt7530: introduce mt7530_remove_common helper function net: dsa: mt7530: split-off common parts from mt7531_setup net: dsa: mt7530: introduce separate MDIO driver net: dsa: mt7530: skip locking if MDIO bus isn't present net: dsa: mt7530: add support for single-chip reset line net: dsa: mt7530: add support for 10G link modes for CPU port net: dsa: mt7530: introduce driver for MT7988 built-in switch dt-bindings: net: dsa: mediatek,mt7530: add mediatek,mt7988-switch .../bindings/net/dsa/mediatek,mt7530.yaml | 26 +- MAINTAINERS | 3 + drivers/net/dsa/Kconfig | 28 +- drivers/net/dsa/Makefile | 4 +- drivers/net/dsa/mt7530-mdio.c | 242 ++++++++ drivers/net/dsa/mt7530-mmio.c | 96 ++++ drivers/net/dsa/mt7530.c | 519 +++++++++--------- drivers/net/dsa/mt7530.h | 38 +- 8 files changed, 653 insertions(+), 303 deletions(-) create mode 100644 drivers/net/dsa/mt7530-mdio.c create mode 100644 drivers/net/dsa/mt7530-mmio.c base-commit: 86e2eca4ddedc07d639c44c990e1c220cac3741e -- 2.39.2