From patchwork Wed Aug 14 22:18:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jitendra Vegiraju X-Patchwork-Id: 13764203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CB053C3DA4A for ; Wed, 14 Aug 2024 22:19:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=WSAeiMK7iVk/o7omGTIGztwCyVG1BlXXvK4I6yLOYAY=; b=StUWeCJ6NlRGMGBEhviq+z2VyZ tb5k9ur1wxYZ5F5ZRa45SJofq++wOmQcqAgKUXv9xeoE93ymgDpQ3LTeVCGnv9i69BQJIctwqZHNA nfU+dch1/iEpC3Rjt84TigVtLWjfmMLhrukmmbmwdTuGcTZGt3N7+hk2nMpKK9nLlf8wG/8NDkJrh iOWa7Cr4E2rfauFEieapiNxzgz0imMELBeJOs0su+z11g8O+/TO3oNMAjUFj4wmvSebRkdpWuU9xJ n3mQq5hSUgPp3nZ5w1fDN2XCUIFlXtCU+gfUjD+YILtadQQ7HOmYF2DfCEvpD5l4szfk5SVdRhB58 ZcpjDIww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seMKi-00000008QSb-1Dop; Wed, 14 Aug 2024 22:19:08 +0000 Received: from relay.smtp-ext.broadcom.com ([192.19.144.208]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seMK1-00000008QIR-0DFi for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 22:18:29 +0000 Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id F0ABCC0000E7; Wed, 14 Aug 2024 15:18:21 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com F0ABCC0000E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1723673902; bh=7QFKDQf2QDftS5MiuC8M0RpYXRT4VGeXC/a9a/cPQEA=; h=From:To:Cc:Subject:Date:From; b=vSJzvx5nJYvH5gq4/5M55wKFRv2QO6lJmrly0gObGE48GUbp1HsD2Tvy04aKr7rXI A6HDozFN+OZX3rN8uN5mI8THG4ji0mYdXV5oX9KPAt+1jQ3uTfv17RmEwm586nBoUq pBLmUnM5MK16pcfnpDTlOOesuB7TPfiaM89DAWuU= Received: from pcie-dev03.dhcp.broadcom.net (pcie-dev03.dhcp.broadcom.net [10.59.171.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id CEA3218041CAC8; Wed, 14 Aug 2024 15:18:18 -0700 (PDT) From: jitendra.vegiraju@broadcom.com To: netdev@vger.kernel.org Cc: alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, jitendra.vegiraju@broadcom.com, bcm-kernel-feedback-list@broadcom.com, richardcochran@gmail.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, fancer.lancer@gmail.com, rmk+kernel@armlinux.org.uk, ahalaney@redhat.com, xiaolei.wang@windriver.com, rohan.g.thomas@intel.com, Jianheng.Zhang@synopsys.com, leong.ching.swee@intel.com, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org, andrew@lunn.ch, linux@armlinux.org.uk, horms@kernel.org, florian.fainelli@broadcom.com Subject: [net-next v4 0/5] net: stmmac: Add PCI driver support for BCM8958x Date: Wed, 14 Aug 2024 15:18:13 -0700 Message-Id: <20240814221818.2612484-1-jitendra.vegiraju@broadcom.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_151825_297656_BA9F086F X-CRM114-Status: GOOD ( 18.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jitendra Vegiraju This patchset adds basic PCI ethernet device driver support for Broadcom BCM8958x Automotive Ethernet switch SoC devices. This SoC device has PCIe ethernet MAC attached to an integrated ethernet switch using XGMII interface. The PCIe ethernet controller is presented to the Linux host as PCI network device. The following block diagram gives an overview of the application. +=================================+ | Host CPU/Linux | +=================================+ || PCIe || +==========================================+ | +--------------+ | | | PCIE Endpoint| | | | Ethernet | | | | Controller | | | | DMA | | | +--------------+ | | | MAC | BCM8958X | | +--------------+ SoC | | || XGMII | | || | | +--------------+ | | | Ethernet | | | | switch | | | +--------------+ | | || || || || | +==========================================+ || || || || More external interfaces The MAC block on BCM8958x is based on Synopsis XGMAC 4.00a core. This MAC IP introduces new DMA architecture called Hyper-DMA for virtualization scalability. Driver functionality specific to new MAC (DW25GMAC) is implemented in new file dw25gmac.c. Management of integrated ethernet switch on this SoC is not handled by the PCIe interface. This SoC device has PCIe ethernet MAC directly attached to an integrated ethernet switch using XGMII interface. v3->v4: Based on Serge's questions, received a confirmation from Synopsis that the MAC IP is indeed the new 25GMAC design. Renamed all references of XGMAC4 to 25GMAC. The patch series is rearranged slightly as follows. Patch1 (new): Define HDMA mapping data structure in kernel's stmmac.h Patch2 (v3 Patch1): Adds dma_ops for dw25gmac in stmmac core Renamed new files dwxgmac4.* to dw25gmac.* - Serge Semin Defined new Synopsis version and device id macros for DW25GMAC. Coverted bit operations to FIELD_PREP macros - Russell King Moved hwif.h to this patch, Sparse flagged warning - Simon Horman Defined macros for hardcoded values TDPS etc - Serge Semin Read number of PDMAs/VDMAs from hardware - Serge Semin Patch3 (v3 Patch2): Hooks in hardware interface handling for dw25gmac Resolved user_version quirks questions - Serge, Russell, Andrew Added new stmmac_hw entry for DW25GMAC. - Serge Added logic to override synopsis_dev_id by glue driver. Patch4 (v3 Patch3): Adds PCI driver for BCM8958x device Define bitmmap macros for hardcoded values - Andrew Lunn Added per device software node - Andrew Lunn Patch5(new/split): Adds BCM8958x driver to build system v2->v3: Addressed v2 comments from Andrew, Jakub, Russel and Simon. Based on suggestion by Russel and Andrew, added software node to create phylink in fixed-link mode. Moved dwxgmac4 specific functions to new files dwxgmac4.c and dwxgmac4.h in stmmac core module. Reorganized the code to use the existing glue logic support for xgmac in hwif.c and override ops functions for dwxgmac4 specific functions. The patch is split into three parts. Patch#1 Adds dma_ops for dwxgmac4 in stmmac core Patch#2 Hooks in the hardware interface handling for dwxgmac4 Patch#3 Adds PCI driver for BCM8958x device https://lore.kernel.org/netdev/20240802031822.1862030-1-jitendra.vegiraju@broadcom.com/ v1->v2: Minor fixes to address coding style issues. Sent v2 too soon by mistake, without waiting for review comments. Received feedback on this version. https://lore.kernel.org/netdev/20240511015924.41457-1-jitendra.vegiraju@broadcom.com/ v1: https://lore.kernel.org/netdev/20240510000331.154486-1-jitendra.vegiraju@broadcom.com/ Jitendra Vegiraju (5): Add HDMA mapping for dw25gmac support Add basic dw25gmac support to stmmac core Integrate dw25gmac into stmmac hwif handling Add PCI driver support for BCM8958x Add BCM8958x driver to build system MAINTAINERS | 8 + drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 + drivers/net/ethernet/stmicro/stmmac/Makefile | 3 +- drivers/net/ethernet/stmicro/stmmac/common.h | 2 + .../net/ethernet/stmicro/stmmac/dw25gmac.c | 173 ++++++ .../net/ethernet/stmicro/stmmac/dw25gmac.h | 90 +++ .../net/ethernet/stmicro/stmmac/dwmac-brcm.c | 530 ++++++++++++++++++ .../ethernet/stmicro/stmmac/dwxgmac2_dma.c | 31 + drivers/net/ethernet/stmicro/stmmac/hwif.c | 25 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + include/linux/stmmac.h | 50 ++ 12 files changed, 922 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dw25gmac.c create mode 100644 drivers/net/ethernet/stmicro/stmmac/dw25gmac.h create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-brcm.c