From patchwork Wed Sep 4 05:48: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: 13789738 X-Patchwork-Delegate: kuba@kernel.org Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.207]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 869A91FC8; Wed, 4 Sep 2024 05:58:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.207 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725429485; cv=none; b=kPJbQFkyWmprROlX2/swKGybOpattgiD2qe+IYKAZi7hyMafHGa3AZGRp1JzdiPMWJsvS0lw4kUForDtNBXjgR4Dv9xWjRqqqGdsOoatsxxiZVdUG1Zt5Xo+YxUIL3QIlTdmowTe2g67pdS1o+Rs91175ZD+DwynjTiOF2z6iLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725429485; c=relaxed/simple; bh=GEWC4A5BiyrTzmE451wA0w+oR72ztVH+Btbb8ptS+2M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WB+xRLV2Ub+6ZCiBNkbeM0lKQZ0DkETrLNyigpsxb9w92NdkOz0kTnP0XpKis5BWCG9/0b0vcyHUZRy8HyEvTSBQA/defEIYJc0dLvJwPHpg9TeuOhsmV1lw+PdTvya0mM3ic+Dfpsjp1cPPgm3Ku2FpxwDhfVmmQ0LRUDozO0w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=qBxq2nZ1; arc=none smtp.client-ip=192.19.144.207 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="qBxq2nZ1" 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 CC932C0000D8; Tue, 3 Sep 2024 22:48:29 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com CC932C0000D8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1725428909; bh=GEWC4A5BiyrTzmE451wA0w+oR72ztVH+Btbb8ptS+2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qBxq2nZ1prpA+mBT2Q+8iheufSyvE1qsHz5Z18bKRTK1VNIReFdVpfMXSkU1bT5il oQLBWbOCcc9an5rYPkYNLs5f1XqYIjhpCS/ed+igGpQNlNEze7a7SCVnws9jXPUk9D XRoN5+Pd6cgVTESumCNrM0FdkOfGDqTwEU5PS/ZA= 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 2222418041D1E4; Tue, 3 Sep 2024 22:48:29 -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 Subject: [PATCH net-next v5 3/5] net: stmmac: Integrate dw25gmac into stmmac hwif handling Date: Tue, 3 Sep 2024 22:48:13 -0700 Message-Id: <20240904054815.1341712-4-jitendra.vegiraju@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240904054815.1341712-1-jitendra.vegiraju@broadcom.com> References: <20240904054815.1341712-1-jitendra.vegiraju@broadcom.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.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, snps_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 29367105df54..ad76dbab6622 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->snps_dev_id) { + id = priv->plat->snps_id; + dev_id = priv->plat->snps_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);