Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3825846pxb; Mon, 8 Feb 2021 00:43:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyAuy7XJWaSbKdo/E9ktWzKtiZNyU9hV87qit2pzxISQr7e2WabcWtvI1V/XmVDs/c8t4Zn X-Received: by 2002:a17:906:c09:: with SMTP id s9mr15773626ejf.539.1612773809475; Mon, 08 Feb 2021 00:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612773809; cv=none; d=google.com; s=arc-20160816; b=f50rmX8lCx90TtHDoBNzOzY0nJflkLjMLjK4pBUJvyXNlV2lUL9cykSBjfSFYFcQID TRDeGLoTUc6eHObv+C/KJ0NSjuV2SvFUn8cvIaWzuU98v1fkVLjaaygcwa7GcwD54Ysb KM4tAeOcHlbwMqw7725zoceFER9eLnazxAliFS+gl3+z3IfnDATtBPRxh52JGV/rrMxr 6AkXBsh9l02vGwkh4nkZnvjWFvHU8cEKTDonQiHovtp7Ct9DpwxYg1xCCgUORiy48Xfi mFpuBJNyywAZRN0Sx+y5R4hf3ejNWNE9AeodLf7YoAA+Kl2K41qfLsf/LrfBO1RMl1+4 UKbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0KS+r3wVSq6exDCZqH7jpYe7fDMzzt3eMep4pZT/ktk=; b=tEylLByrrq4LDpmFYlYaqTijfp+YW4FUcMt0UXNcmqM/1pbpr2cHyKBGk6WeTyIetk SmG4csCcVjhmFHzgm8n3aXs4dI4aOmNjTfxewgKRCbniiEVW3mC9fE4lh+JEgZPmYoza UpY/VmdFF5P19fJJoEbLYjEf0eE+Zes8xINA3N35MtMkD3NFKHoi1XnOcunoxWPT/LMb 3900x5WDYE9gdkNXOSH0bWbZRbT1MAKfIQF4BrvyXFKh6kYRK6UUHJRVAgzIB7nc9qee tbK2HlZQwCLULrZwK+/Sa1ydO0ZtXrbGcK7uk3p1ugFjteMTH9avR+4Sx4U9FgZ9Juno NVGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=RRfArmrh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx20si10913909ejb.599.2021.02.08.00.43.06; Mon, 08 Feb 2021 00:43:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=RRfArmrh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231166AbhBHIiZ (ORCPT + 99 others); Mon, 8 Feb 2021 03:38:25 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:10248 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230217AbhBHIev (ORCPT ); Mon, 8 Feb 2021 03:34:51 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1188TsOp021080; Mon, 8 Feb 2021 00:33:41 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=0KS+r3wVSq6exDCZqH7jpYe7fDMzzt3eMep4pZT/ktk=; b=RRfArmrhCt//mgl16g4TbJJVaoIw3StMbrE67HUaNqF0eHLoExk2eo2pHzhHKxm7MWdb b2WVLkYIWouuNjXndsetI2NfiSZkLnKq0OnsMpA5v/nEnJLnfrcyiCgj9gbGH+Mc348T gbiY0Cm/g9gJSjvPSfvaVBlCa3CzfR6FjRirwTzLsjenGgkN5qswCugAT7appC3hsoSa Q7cVCjWFvVj8kAXfyFWI++USPiCH0w0t7oEL4lN1VMvRV35UtfhTW0nDCKvDLSYW3AdT F7Ml76maziTxNXqq+D4MdSlb388BJP/gzUVBKgJ5/qVB9RK0IAK2BBXm2rQlSn4esc7+ iQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 36hsbrc51n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 08 Feb 2021 00:33:41 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Feb 2021 00:33:40 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Feb 2021 00:33:39 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 8 Feb 2021 00:33:39 -0800 Received: from stefan-pc.marvell.com (stefan-pc.marvell.com [10.5.25.21]) by maili.marvell.com (Postfix) with ESMTP id D75273F703F; Mon, 8 Feb 2021 00:33:35 -0800 (PST) From: To: CC: , , , , , , , , , , , , , , , , Subject: [PATCH v10 net-next 04/15] net: mvpp2: always compare hw-version vs MVPP21 Date: Mon, 8 Feb 2021 10:32:36 +0200 Message-ID: <1612773167-22490-5-git-send-email-stefanc@marvell.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1612773167-22490-1-git-send-email-stefanc@marvell.com> References: <1612773167-22490-1-git-send-email-stefanc@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-08_02:2021-02-05,2021-02-08 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Chulski Currently we have PP2v1 and PP2v2 hw-versions, with some different handlers depending upon condition hw_version = MVPP21/MVPP22. In a future there will be also PP2v3. Let's use now the generic "if equal/notEqual MVPP21" for all cases instead of "if MVPP22". This patch does not change any functionality. It is not intended to introduce PP2v3. It just modifies MVPP21/MVPP22 check-condition bringing it to generic and unified form correct for new-code introducing and PP2v3 net-next generation. Signed-off-by: Stefan Chulski --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index eec3796..e9c5916 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -319,7 +319,7 @@ static int mvpp2_get_nrxqs(struct mvpp2 *priv) { unsigned int nrxqs; - if (priv->hw_version == MVPP22 && queue_mode == MVPP2_QDIST_SINGLE_MODE) + if (priv->hw_version != MVPP21 && queue_mode == MVPP2_QDIST_SINGLE_MODE) return 1; /* According to the PPv2.2 datasheet and our experiments on @@ -446,7 +446,7 @@ static void mvpp2_bm_bufs_get_addrs(struct device *dev, struct mvpp2 *priv, MVPP2_BM_PHY_ALLOC_REG(bm_pool->id)); *phys_addr = mvpp2_thread_read(priv, thread, MVPP2_BM_VIRT_ALLOC_REG); - if (priv->hw_version == MVPP22) { + if (priv->hw_version != MVPP21) { u32 val; u32 dma_addr_highbits, phys_addr_highbits; @@ -742,7 +742,7 @@ static inline void mvpp2_bm_pool_put(struct mvpp2_port *port, int pool, if (test_bit(thread, &port->priv->lock_map)) spin_lock_irqsave(&port->bm_lock[thread], flags); - if (port->priv->hw_version == MVPP22) { + if (port->priv->hw_version != MVPP21) { u32 val = 0; if (sizeof(dma_addr_t) == 8) @@ -1199,7 +1199,7 @@ static bool mvpp2_port_supports_xlg(struct mvpp2_port *port) static bool mvpp2_port_supports_rgmii(struct mvpp2_port *port) { - return !(port->priv->hw_version == MVPP22 && port->gop_id == 0); + return !(port->priv->hw_version != MVPP21 && port->gop_id == 0); } /* Port configuration routines */ @@ -1817,7 +1817,7 @@ static void mvpp2_mac_reset_assert(struct mvpp2_port *port) MVPP2_GMAC_PORT_RESET_MASK; writel(val, port->base + MVPP2_GMAC_CTRL_2_REG); - if (port->priv->hw_version == MVPP22 && port->gop_id == 0) { + if (port->priv->hw_version != MVPP21 && port->gop_id == 0) { val = readl(port->base + MVPP22_XLG_CTRL0_REG) & ~MVPP22_XLG_CTRL0_MAC_RESET_DIS; writel(val, port->base + MVPP22_XLG_CTRL0_REG); @@ -1830,7 +1830,7 @@ static void mvpp22_pcs_reset_assert(struct mvpp2_port *port) void __iomem *mpcs, *xpcs; u32 val; - if (port->priv->hw_version != MVPP22 || port->gop_id != 0) + if (port->priv->hw_version == MVPP21 || port->gop_id != 0) return; mpcs = priv->iface_base + MVPP22_MPCS_BASE(port->gop_id); @@ -1851,7 +1851,7 @@ static void mvpp22_pcs_reset_deassert(struct mvpp2_port *port) void __iomem *mpcs, *xpcs; u32 val; - if (port->priv->hw_version != MVPP22 || port->gop_id != 0) + if (port->priv->hw_version == MVPP21 || port->gop_id != 0) return; mpcs = priv->iface_base + MVPP22_MPCS_BASE(port->gop_id); @@ -4188,7 +4188,7 @@ static void mvpp2_start_dev(struct mvpp2_port *port) /* Enable interrupts on all threads */ mvpp2_interrupts_enable(port); - if (port->priv->hw_version == MVPP22) + if (port->priv->hw_version != MVPP21) mvpp22_mode_reconfigure(port); if (port->phylink) { @@ -4404,7 +4404,7 @@ static int mvpp2_open(struct net_device *dev) valid = true; } - if (priv->hw_version == MVPP22 && port->port_irq) { + if (priv->hw_version != MVPP21 && port->port_irq) { err = request_irq(port->port_irq, mvpp2_port_isr, 0, dev->name, port); if (err) { @@ -6052,7 +6052,7 @@ static int mvpp2__mac_prepare(struct phylink_config *config, unsigned int mode, MVPP2_GMAC_PORT_RESET_MASK, MVPP2_GMAC_PORT_RESET_MASK); - if (port->priv->hw_version == MVPP22) { + if (port->priv->hw_version != MVPP21) { mvpp22_gop_mask_irq(port); phy_power_off(port->comphy); @@ -6106,7 +6106,7 @@ static int mvpp2_mac_finish(struct phylink_config *config, unsigned int mode, { struct mvpp2_port *port = mvpp2_phylink_to_port(config); - if (port->priv->hw_version == MVPP22 && + if (port->priv->hw_version != MVPP21 && port->phy_interface != interface) { port->phy_interface = interface; @@ -6786,7 +6786,7 @@ static int mvpp2_init(struct platform_device *pdev, struct mvpp2 *priv) if (dram_target_info) mvpp2_conf_mbus_windows(dram_target_info, priv); - if (priv->hw_version == MVPP22) + if (priv->hw_version != MVPP21) mvpp2_axi_init(priv); /* Disable HW PHY polling */ @@ -6930,7 +6930,7 @@ static int mvpp2_probe(struct platform_device *pdev) dev_warn(&pdev->dev, "Fail to alloc CM3 SRAM\n"); } - if (priv->hw_version == MVPP22 && dev_of_node(&pdev->dev)) { + if (priv->hw_version != MVPP21 && dev_of_node(&pdev->dev)) { priv->sysctrl_base = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "marvell,system-controller"); @@ -6943,7 +6943,7 @@ static int mvpp2_probe(struct platform_device *pdev) priv->sysctrl_base = NULL; } - if (priv->hw_version == MVPP22 && + if (priv->hw_version != MVPP21 && mvpp2_get_nrxqs(priv) * 2 <= MVPP2_BM_MAX_POOLS) priv->percpu_pools = 1; @@ -6988,7 +6988,7 @@ static int mvpp2_probe(struct platform_device *pdev) if (err < 0) goto err_pp_clk; - if (priv->hw_version == MVPP22) { + if (priv->hw_version != MVPP21) { priv->mg_clk = devm_clk_get(&pdev->dev, "mg_clk"); if (IS_ERR(priv->mg_clk)) { err = PTR_ERR(priv->mg_clk); @@ -7029,7 +7029,7 @@ static int mvpp2_probe(struct platform_device *pdev) return -EINVAL; } - if (priv->hw_version == MVPP22) { + if (priv->hw_version != MVPP21) { err = dma_set_mask(&pdev->dev, MVPP2_DESC_DMA_MASK); if (err) goto err_axi_clk; @@ -7104,10 +7104,10 @@ static int mvpp2_probe(struct platform_device *pdev) clk_disable_unprepare(priv->axi_clk); err_mg_core_clk: - if (priv->hw_version == MVPP22) + if (priv->hw_version != MVPP21) clk_disable_unprepare(priv->mg_core_clk); err_mg_clk: - if (priv->hw_version == MVPP22) + if (priv->hw_version != MVPP21) clk_disable_unprepare(priv->mg_clk); err_gop_clk: clk_disable_unprepare(priv->gop_clk); -- 1.9.1