From patchwork Wed Aug 14 22:18:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jitendra Vegiraju X-Patchwork-Id: 13764205 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 04B62C3DA4A for ; Wed, 14 Aug 2024 22:20:36 +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:References:In-Reply-To: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:List-Owner; bh=ixKn/udEM7nFIDIaL01/Lby9HXDDN9az1okgBVVsvus=; b=0k/sH3PitcxYcJmQQV5JEVYKFG kOW1WnBNYU187lieoXaCXaV9njY1E8VXHc40J9Js02SU6tJjLrQGpsIFrsFZkaOQlsxrnPCC14y6J DXEKMOintY3IQF2LuwrTGIt0eQ/JFoLctI1mTD2f5W8UE1HR7nXMVLhYEtvMJvoCya8Y0MdpOMAyH ESfzk3Af7FpBcPiAEhHKtsxi7NjgNbpuVFuGuGvZ1+clBOSPgC/aH5/QP2O7xmzIFc+lUMwLl/J3a ybsAOxOMPcCl0H0xU6TJ0hH873ZUUntAbbxe95+G4UcYlkTGGB2fvhDsMe//CX4DSrPlvL8DdmIvX r8ePMbBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seMLw-00000008Qpv-1PFs; Wed, 14 Aug 2024 22:20:24 +0000 Received: from relay.smtp-ext.broadcom.com ([192.19.144.205]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seMK1-00000008QIY-0k0x for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 22:18:33 +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 5F8F2C003DF8; Wed, 14 Aug 2024 15:18:23 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 5F8F2C003DF8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1723673903; bh=UloX+ivKiJ6oahpxYurB+nrONffprqk8e3KUnWuOOGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X/F53WIfhHAC5Qe4Cuw1Nv8ZmG6uwjoLSRvtwNBkUB6VT+Ih2NjTMTImOBjlupJ/8 1YEpUJ4B9Z6IiQrFtcSwGePdx4oH5KCIBPE72ftoDTXfScHGCk7uKPFP7dQpQfrX92 vILskLRJqIGUBHKTsfNJMThUMxTXq/u7m7hsH0/U= 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 4514B18041CAC9; Wed, 14 Aug 2024 15:18:20 -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 3/5] net: stmmac: Integrate dw25gmac into stmmac hwif handling Date: Wed, 14 Aug 2024 15:18:16 -0700 Message-Id: <20240814221818.2612484-4-jitendra.vegiraju@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814221818.2612484-1-jitendra.vegiraju@broadcom.com> References: <20240814221818.2612484-1-jitendra.vegiraju@broadcom.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_151825_494623_98B73445 X-CRM114-Status: GOOD ( 18.26 ) 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 Integrate dw25gmac support into stmmac hardware interface handling. Added a new entry to the stmmac_hw table in hwif.c. Define new macros DW25GMAC_CORE_4_00 and DW25GMAC_ID to identify 25GMAC device. Since BCM8958x is an early adaptor device, the synopsis_id reported in HW is 0x32 and device_id is DWXGMAC_ID. Provide override support by defining synopsys_dev_id member in struct stmmac_priv so that driver specific setup functions can override the hardware reported values. Signed-off-by: Jitendra Vegiraju --- drivers/net/ethernet/stmicro/stmmac/common.h | 2 ++ drivers/net/ethernet/stmicro/stmmac/hwif.c | 25 ++++++++++++++++++-- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 684489156dce..46edbe73a124 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -38,9 +38,11 @@ #define DWXGMAC_CORE_2_10 0x21 #define DWXGMAC_CORE_2_20 0x22 #define DWXLGMAC_CORE_2_00 0x20 +#define DW25GMAC_CORE_4_00 0x40 /* Device ID */ #define DWXGMAC_ID 0x76 +#define DW25GMAC_ID 0x55 #define DWXLGMAC_ID 0x27 #define STMMAC_CHAN0 0 /* Always supported and default for all chips */ diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c index 29367105df54..97e5594ddcda 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c @@ -278,6 +278,27 @@ static const struct stmmac_hwif_entry { .est = &dwmac510_est_ops, .setup = dwxlgmac2_setup, .quirks = stmmac_dwxlgmac_quirks, + }, { + .gmac = false, + .gmac4 = false, + .xgmac = true, + .min_id = DW25GMAC_CORE_4_00, + .dev_id = DW25GMAC_ID, + .regs = { + .ptp_off = PTP_XGMAC_OFFSET, + .mmc_off = MMC_XGMAC_OFFSET, + .est_off = EST_XGMAC_OFFSET, + }, + .desc = &dwxgmac210_desc_ops, + .dma = &dw25gmac400_dma_ops, + .mac = &dwxgmac210_ops, + .hwtimestamp = &stmmac_ptp, + .mode = NULL, + .tc = &dwmac510_tc_ops, + .mmc = &dwxgmac_mmc_ops, + .est = &dwmac510_est_ops, + .setup = dwxgmac2_setup, + .quirks = NULL, }, }; @@ -304,7 +325,7 @@ int stmmac_hwif_init(struct stmmac_priv *priv) /* Save ID for later use */ priv->synopsys_id = id; - + priv->synopsys_dev_id = dev_id; /* Lets assume some safe values first */ priv->ptpaddr = priv->ioaddr + (needs_gmac4 ? PTP_GMAC4_OFFSET : PTP_GMAC3_X_OFFSET); @@ -339,7 +360,7 @@ int stmmac_hwif_init(struct stmmac_priv *priv) /* Use synopsys_id var because some setups can override this */ if (priv->synopsys_id < entry->min_id) continue; - if (needs_xgmac && (dev_id ^ entry->dev_id)) + if (needs_xgmac && (priv->synopsys_dev_id ^ entry->dev_id)) continue; /* Only use generic HW helpers if needed */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index b23b920eedb1..9784bbaf9a51 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -282,6 +282,7 @@ struct stmmac_priv { struct stmmac_counters mmc; int hw_cap_support; int synopsys_id; + int synopsys_dev_id; u32 msg_enable; int wolopts; int wol_irq;