From mboxrd@z Thu Jan 1 00:00:00 1970 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 46EA3C3DA4A for ; Thu, 8 Aug 2024 23:04:40 +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: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Skx3GBh0EZ38qc6WcYlol/aA6cFrTOAY50sC1FrBmBA=; b=OBo5ENbCAZ5vlxa0IzneHxkc8u Miwtx6QEUfNbIUogQ/NmhJaVUFa9T1X0ec+/dtrulETRk1niZwcCDfWs6sUzbtUkKKjyQeSwGe0Eh C6ETvPbksiFdcjn11Bk8l5+VThzuisccKVVT+S914r6euV40Fl/4LFmdgydsSLNcO2wBpJIec2flR JR/zDg72+ZaCzfvr24+8dOLnhf+qUJm8JbqpHkLXT/8U2g5utdfIOoRYL6Vq/E+H7wOpwN4k6i0ov BGz4aEbBP4XQBGo0EiK1pPk2EiWo1dQunFhca0rofcPZDwZVSsUYcmqm4Vdq1Iyr78+w+kRQTtTsd FJSkxI+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1scCBE-00000009gFi-0363; Thu, 08 Aug 2024 23:04:24 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1scCAd-00000009g7S-03Yv for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2024 23:03:48 +0000 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2cd2f89825fso1226550a91.1 for ; Thu, 08 Aug 2024 16:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723158225; x=1723763025; darn=lists.infradead.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Skx3GBh0EZ38qc6WcYlol/aA6cFrTOAY50sC1FrBmBA=; b=DRsvcNjzChW7tCfU4Z48bDnEAQ0AsOgysGj9ipE0jOtxzpIn3UAYrIcWoCxObuTJKm XxYaQLzm6tLUJGqYNbMnH6TxYaUsPuKsIHfrchAaXF+45lKkBZZWsKLrYUmfH5vdA+jJ Raum0GzVizFmTy+k1L5ZrW8AtQnvGztgeWtN0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723158225; x=1723763025; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Skx3GBh0EZ38qc6WcYlol/aA6cFrTOAY50sC1FrBmBA=; b=P8gj2wfKZsDA3KSTnPbRTZd7JbN6tPzgfVBReCcW+aPUQc2VX97TmMOCEk7M9Wtrdy TXGscp35DqL6NRdYXfNvd/T/NpBTwKwPvPguWtP1vyx1weNE4zKZG3FLdYeiEFK0UpW2 vy68IlY/BJDYurSG4zLww3Nen1cQElZQDULPFcb9y/Lc41D0zYzkZiW8jgTK4EBtiYHz Vhxyv9btcrBZgwk7Ociot0zdkEPjXglvYvv1/bPv1bqYy3+YqYqLI6poTUo/rj0J21tP FIkdcGEn6ace1DziwJKrm6a2X5sSLtdX/GWIcoUHBUXyt3hgXXKQ93Orp5v5zIt78juD nuPA== X-Forwarded-Encrypted: i=1; AJvYcCXcyKD9MADJF3iWRO+wDU+jvQtvqtkMD24IQVG6JH42mGSXM/MuiTtS1KN2K/mHmTyos/mzjO5XCOQ/yftvr5cHR79LGWN4qpAUM85VSzlSL2opOEA= X-Gm-Message-State: AOJu0YyEYzr8HXYqagdVvs5yCCEUDPjyWOCQtCOl9UWU+S2OpVUAWFx9 Md/Vnt8goBYqG282sIcyVCxC5fpDhkpsBjLC5FCwJayXvhDblArfGd+d7amJlIqymZYvgaX82Zj SPaXN3zf0kEKCLloiiLEtiumL7MSay+LkoAJH X-Google-Smtp-Source: AGHT+IEurs1ZraK16gLlx2+6o+2jGNgwZ+6lAL2/OitH1L7OF2fZ4tavR/6IquvNnXpvFpwc04B358Poa1eJ6aD7fXk= X-Received: by 2002:a17:90a:9c11:b0:2cf:c2df:67de with SMTP id 98e67ed59e1d1-2d1c33741bdmr3917540a91.9.1723158225194; Thu, 08 Aug 2024 16:03:45 -0700 (PDT) MIME-Version: 1.0 References: <20240802031822.1862030-1-jitendra.vegiraju@broadcom.com> <2vvet4ai3uihb2skzyfiym2qh6g26knb7ymjp73eejoiywqnkm@2rxxv6zqvi33> In-Reply-To: <2vvet4ai3uihb2skzyfiym2qh6g26knb7ymjp73eejoiywqnkm@2rxxv6zqvi33> From: Jitendra Vegiraju Date: Thu, 8 Aug 2024 16:03:34 -0700 Message-ID: Subject: Re: [PATCH net-next v3 0/3] net: stmmac: Add PCI driver support for BCM8958x To: Serge Semin Cc: netdev@vger.kernel.org, alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, bcm-kernel-feedback-list@broadcom.com, richardcochran@gmail.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240808_160347_198798_6CFDF19C X-CRM114-Status: GOOD ( 49.02 ) 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 On Mon, Aug 5, 2024 at 3:43=E2=80=AFPM Serge Semin wrote: > > On Fri, Aug 02, 2024 at 03:06:05PM -0700, Jitendra Vegiraju wrote: > > On Fri, Aug 2, 2024 at 3:02=E2=80=AFAM Serge Semin wrote: > > > > > > Hi Jitendra > > > > > > On Thu, Aug 01, 2024 at 08:18:19PM -0700, jitendra.vegiraju@broadcom.= com wrote: > > > > From: Jitendra Vegiraju > > > > > > > > This patchset adds basic PCI ethernet device driver support for Bro= adcom > > > > BCM8958x Automotive Ethernet switch SoC devices. > > > > > > > > This SoC device has PCIe ethernet MAC attached to an integrated eth= ernet > > > > switch using XGMII interface. The PCIe ethernet controller is prese= nted to > > > > the Linux host as PCI network device. > > > > > > > > The following block diagram gives an overview of the application. > > > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > > > > | Host CPU/Linux | > > > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > > > > || PCIe > > > > || > > > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > > > > | +--------------+ | > > > > | | PCIE Endpoint| | > > > > | | Ethernet | | > > > > | | Controller | | > > > > | | DMA | | > > > > | +--------------+ | > > > > | | MAC | BCM8958X | > > > > | +--------------+ SoC | > > > > | || XGMII | > > > > | || | > > > > | +--------------+ | > > > > | | Ethernet | | > > > > | | switch | | > > > > | +--------------+ | > > > > | || || || || | > > > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > > > > || || || || More external interfaces > > > > > > > > The MAC block on BCM8958x is based on Synopsis XGMAC 4.00a core. Th= is > > > > driver uses common dwxgmac2 code where applicable. > > > > > > Thanks for submitting the series. > > > > > > I am curious how come Broadcom got to use an IP-core which hasn't > > > been even announced by Synopsys. AFAICS the most modern DW XGMAC > > > IP-core is of v3.xxa version: > > > > > > https://www.synopsys.com/dw/ipdir.php?ds=3Ddwc_ether_xgmac > > > > > > I am not sure why the 4.00a IP-code is not announced for general > > availability yet. > > The Synopsis documentation for this IP mentions 3.xx IP as reference > > for this design and lists > > new features for 4.00a. > > > > > Are you sure that your device isn't equipped with some another DW MAC > > > IP-core, like DW 25G Ethernet MAC? (which BTW is equipped with a new > > > Hyper DMA engine with a capability to have up to 128/256 channels wit= h > > > likely indirect addressing.) Do I miss something? > > > > > Yes, I briefly mentioned the new DMA architecture in the commit log > > for patch 1/3. > > You are correct, the name for the new DMA engine is Hyper DMA. It > > probably started with some 3.xx IP-Core. > > This DW-MAC is capable of 25G, but this SOC is not using 25G support. > > Then what you have is likely the DW 25GMAC since just DW XGMAC hasn't > been announced to have neither 25G speed nor the Hyper-DMA with the > virtualization channels capabilities. Meanwhile the former IP-core > does have these features: > https://www.synopsys.com/dw/ipdir.php?ds=3Ddwc_25g_ethernet_mac_ip > > Alas I don't have the DW 25GMAC IP-core databook to say for sure, but > that's the only explanation of why you have the 0x40 Synopsys ID and > the IP-core version of v4.00a, and the 25G capability of the MAC. > > Seeing Synopsys tends to re-use the CSRs mapping even across the major > IP-core releases it isn't that surprising that the DW XGMAC 3.xx > IP-core was referenced in the doc. (See the driver, DW XLGMAC is > almost fully compatible with the DW XGMAC CSRs mapping.) > > Moreover the most DMA-capable device currently supported by the > STMMAC-driver is DW XGMAC/XLGMAC and it can't have more than 16 > DMA-channels. That allows to directly map all the channels CSRs to the > system memory. But your case is different. The DW 25GMAC IP-core is > announced to support virtualization up to 128/256 channels, for which > the direct CSRs mapping could require 16-times more memory. That's > likely why the indirect addressing was implemented to access the > settings of all the possible channels. That's also implicitly proofs > that you have the DW 25GMAC IP-core. Hi Serge(y) Thanks for reviewing the patch series. Sorry for the delay in my response. We waited for a clarification on the IP version. Its confirmed that we got an early adapter version of 25GMAC IP-Core. Added more details in the context of other questions in Patch 1,2. > > -Serge(y) > > > > > > * I'll join the patch set review after the weekend, sometime on the > > > next week. > > > > > > -Serge(y) > > > > > > > Driver functionality specific to this MAC is implemented in dwxgmac= 4.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 integ= rated > > > > ethernet switch using XGMII interface. > > > > > > > > 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 dw= xgmac4.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 function= s. > > > > 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 > > > > > > > > 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.v= egiraju@broadcom.com/ > > > > > > > > v1: > > > > https://lore.kernel.org/netdev/20240510000331.154486-1-jitendra.= vegiraju@broadcom.com/ > > > > > > > > Jitendra Vegiraju (3): > > > > Add basic dwxgmac4 support to stmmac core > > > > Integrate dwxgmac4 into stmmac hwif handling > > > > Add PCI driver support for BCM8958x > > > > > > > > MAINTAINERS | 8 + > > > > drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 + > > > > drivers/net/ethernet/stmicro/stmmac/Makefile | 3 +- > > > > drivers/net/ethernet/stmicro/stmmac/common.h | 4 + > > > > .../net/ethernet/stmicro/stmmac/dwmac-brcm.c | 517 ++++++++++++++= ++++ > > > > .../ethernet/stmicro/stmmac/dwxgmac2_dma.c | 31 ++ > > > > .../net/ethernet/stmicro/stmmac/dwxgmac4.c | 142 +++++ > > > > .../net/ethernet/stmicro/stmmac/dwxgmac4.h | 84 +++ > > > > drivers/net/ethernet/stmicro/stmmac/hwif.c | 26 +- > > > > drivers/net/ethernet/stmicro/stmmac/hwif.h | 1 + > > > > 10 files changed, 825 insertions(+), 2 deletions(-) > > > > create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-brcm.= c > > > > create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwxgmac4.c > > > > create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwxgmac4.h > > > > > > > > -- > > > > 2.34.1 > > > > > > > >