From patchwork Fri Oct 18 20:53:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jitendra Vegiraju X-Patchwork-Id: 13842420 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 33DB7D3F29E for ; Fri, 18 Oct 2024 20:58:22 +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=nqAJbAm3HYjcYU2ZM4JvAZt0jRQ5Wrdrirj4itsznEE=; b=j15dEGIF6LzR0u694NoJ2/2G6w UaIvJ0fEwCBGMC5LJ7H90zfCFQ3W93hh/78kZgkCPgjQk8wUtEU3qFjqn/FM+PFgHNn7Azxp75/C8 Q4VCpPcqis69zeZNryyfyjzHC9eZKybmGWsIud4nvBfH8uSarDt4EIanwFFpH6wRPAspagQpJymH3 +XHTTnLJcJKWGsEOaHHIq/CDC5NqJj29OK/oIy6nMXCGc73uEGdZ2np91/OkxUrvNh1aGPNuvMAdI OfK48RWsYanrHcarYH7EANnq7dtkewkywNgTXoz/LR8Vz1bVXkyHEvNO++j8ZvewWhxXDiyig3yP9 p3+9ZK5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1u31-000000021qY-11XF; Fri, 18 Oct 2024 20:58:11 +0000 Received: from relay.smtp-ext.broadcom.com ([192.19.144.207]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1tyf-000000021EW-176h for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2024 20:53:44 +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 31F2DC003AD1; Fri, 18 Oct 2024 13:53:38 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 31F2DC003AD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1729284818; bh=0jiB1tRHc2IgEsT0lkF5yK8TzDqhVGpedseWUDNs8HI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P9MktG33gf9fUSfp6ywesUxei0uEgvl277RPQ0zhTJjzpdekx9LoCPz7uJEvlNjgY IZ7Hg+YbHcmNORrysMhea+fsUk7lZztAT2fPmFXYqtq/sLgOndWepGGk/ci37sxeqY YSi8IVzynC2BIIpavKryYSNqdVIkT0KsdGZqMxJM= 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 8715018041CACA; Fri, 18 Oct 2024 13:53:37 -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, 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, quic_abchauha@quicinc.com Subject: [PATCH net-next v6 3/5] net: stmmac: Integrate dw25gmac into stmmac hwif handling Date: Fri, 18 Oct 2024 13:53:30 -0700 Message-Id: <20241018205332.525595-4-jitendra.vegiraju@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241018205332.525595-1-jitendra.vegiraju@broadcom.com> References: <20241018205332.525595-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-20241018_135341_556157_C354DF77 X-CRM114-Status: GOOD ( 15.16 ) 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. Since BCM8958x is an early adopter device, the synopsis_id reported in HW is 0x32 and device_id is DWXGMAC_ID. Provide override support by giving preference to snps_id, dev_id values when initialized to non-zero values by glue driver. Signed-off-by: Jitendra Vegiraju --- drivers/net/ethernet/stmicro/stmmac/hwif.c | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c index 88cce28b2f98..b8ee7bf20037 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c @@ -257,6 +257,27 @@ static const struct stmmac_hwif_entry { .est = &dwmac510_est_ops, .setup = dwxgmac2_setup, .quirks = NULL, + }, { + .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 = dw25gmac_setup, + .quirks = NULL, }, { .gmac = false, .gmac4 = false, @@ -292,7 +313,10 @@ int stmmac_hwif_init(struct stmmac_priv *priv) u32 id, dev_id = 0; int i, ret; - if (needs_gmac) { + if (priv->plat->snps_id && priv->plat->dev_id) { + id = priv->plat->snps_id; + dev_id = priv->plat->dev_id; + } else if (needs_gmac) { id = stmmac_get_id(priv, GMAC_VERSION); } else if (needs_gmac4 || needs_xgmac) { id = stmmac_get_id(priv, GMAC4_VERSION);