Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp637444img; Thu, 28 Feb 2019 05:33:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IYuVdyOeHS0GcDgc5vrohOvVSfotwLX8YKNCVI8kb2AioiLwKkKTddonXVvz9mvb8z7OARN X-Received: by 2002:a62:568e:: with SMTP id h14mr7781416pfj.134.1551360819494; Thu, 28 Feb 2019 05:33:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551360819; cv=none; d=google.com; s=arc-20160816; b=RGraE+iU3JUPa1XEPJxPXBFIDUQeiS+xeH0CUz5nFI9hRj+h77ytaBPgDASAFu3fOy s2WMx71EKNjSKUZMhC+4+kyrx8Hv9CEYBoEgg32f9EWWfeo3SUs4mpZikBwe+CsOwYWC qz7W+UX2QjZufhIna9DyAlbgwJTmfukKuDNsOY5kMoD3SEwr25G2NGSHohHxERG/8GPO MSa7+3nm8wyvVLiDGcR/S87PsT2QSFCONRLpE01aQ8V8yF0+0jwWmuwz36ueK2qlivVJ 2TgKAj+aXitNmiZVAbt7jL/1mBHTutIQK8m5lwwcUGagfojenx+VvukrNZCBNyup+gHB SWTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=d83goryjYCbuhCMP00k7hPg1rYIUSJMH/m14GlmlfB0=; b=BxXaZfywaGTlNqAoGFRltwZbpY7XaaUt49QCp+vfTk0y1+jI3roFomyYURyCkGdgh7 syypgA9Gq6cKubjISAkxN4/NeQj/IyxymgcLkOnPMpE3msDnOTT0GzI4ZY2aVnfZK+wY 4byTA+Qa27Ti3vhFHmmYkc/8YsXgKjd9l50jdoWBdK0mAmCW40mOTHhkkLj/on0vpcHK UYdF7y/EgznsCMhXWci7KlVBtx65tmWZmWgi00HRZm94kcuzUaOmjKc8Guk7YwEF4URN eehHRv8fenIGAau+8hg8k4gMzmPCBp55XVMuGR+5r9J7wRjnximXEJWynguT0s587EDX +Zog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f73si18110514pff.184.2019.02.28.05.33.24; Thu, 28 Feb 2019 05:33:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732875AbfB1NZb (ORCPT + 99 others); Thu, 28 Feb 2019 08:25:31 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:43495 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726876AbfB1NZ3 (ORCPT ); Thu, 28 Feb 2019 08:25:29 -0500 X-Originating-IP: 90.88.147.150 Received: from localhost (aaubervilliers-681-1-27-150.w90-88.abo.wanadoo.fr [90.88.147.150]) (Authenticated sender: antoine.tenart@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 43975E000B; Thu, 28 Feb 2019 13:25:26 +0000 (UTC) From: Antoine Tenart To: davem@davemloft.net, linux@armlinux.org.uk Cc: Antoine Tenart , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, maxime.chevallier@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, ymarkman@marvell.com, mw@semihalf.com Subject: [PATCH net-next 10/15] net: mvpp2: only update the XLG configuration when needed Date: Thu, 28 Feb 2019 14:21:23 +0100 Message-Id: <20190228132128.30154-11-antoine.tenart@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228132128.30154-1-antoine.tenart@bootlin.com> References: <20190228132128.30154-1-antoine.tenart@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch improves the XLG configuration function, to only update the XLG configuration register when a change is needed. This helps not writing over and over the same XLG configuration each time phylink request the MAC to be configured. This mimics the GMAC configuration function. Signed-off-by: Antoine Tenart --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index b27966355df9..59ee9e7545b0 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -4506,10 +4506,11 @@ static void mvpp2_mac_an_restart(struct net_device *dev) static void mvpp2_xlg_config(struct mvpp2_port *port, unsigned int mode, const struct phylink_link_state *state) { - u32 ctrl0, ctrl4; + u32 old_ctrl0, ctrl0; + u32 old_ctrl4, ctrl4; - ctrl0 = readl(port->base + MVPP22_XLG_CTRL0_REG); - ctrl4 = readl(port->base + MVPP22_XLG_CTRL4_REG); + old_ctrl0 = ctrl0 = readl(port->base + MVPP22_XLG_CTRL0_REG); + old_ctrl4 = ctrl4 = readl(port->base + MVPP22_XLG_CTRL4_REG); if (state->pause & MLO_PAUSE_TX) ctrl0 |= MVPP22_XLG_CTRL0_TX_FLOW_CTRL_EN; @@ -4525,8 +4526,10 @@ static void mvpp2_xlg_config(struct mvpp2_port *port, unsigned int mode, ctrl4 |= MVPP22_XLG_CTRL4_FWD_FC | MVPP22_XLG_CTRL4_FWD_PFC | MVPP22_XLG_CTRL4_EN_IDLE_CHECK; - writel(ctrl0, port->base + MVPP22_XLG_CTRL0_REG); - writel(ctrl4, port->base + MVPP22_XLG_CTRL4_REG); + if (old_ctrl0 != ctrl0) + writel(ctrl0, port->base + MVPP22_XLG_CTRL0_REG); + if (old_ctrl4 != ctrl4) + writel(ctrl4, port->base + MVPP22_XLG_CTRL4_REG); } static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode, -- 2.20.1