Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2936925imm; Mon, 24 Sep 2018 12:34:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV61c+aekPAzjyWqL2ZFdy4H+SXDRs3tWPJd6rMAW9ZUXLQ1mBuM7dterj/P95gtpjwdL1z8C X-Received: by 2002:a62:5b85:: with SMTP id p127-v6mr248763pfb.33.1537817644479; Mon, 24 Sep 2018 12:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537817644; cv=none; d=google.com; s=arc-20160816; b=VL9fZZc88Gt+t+isqm9Lp0sXHzcTgsTfR2WsbNgAZTMpx1+hZQhszYDvPK6BGc/Nus 3kMCIZd4hjv15cHIiQ5bkNxxXoCFgkTJW2wymdOQ4CPVDz36sPfLuBKLO6pe7yZ+TFa4 NX+5+WzYNkKXMLTCPfGizCvPeetLFRmuCkFlfuGUB3+2gRad1BAEt3/0EkyvdDcNIyf6 NS5F/pHArkNc0xIAp4zVtXD89ssyuonICdR9uMhLeFr1/nqxHp5rrVmX+/1y6lv+jSFS rn7zh3RynEeGcRLNj+Ue+xa+zXeU+wqNXzb5V5+hXymuXFUCGzYEi1/GYNJA82L4vTeh /irA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=ElyGP3i983za7JT8O7IacoH2pa4Z6qAmJG+FvzufmS0=; b=B28lSbHe2+fYqR0qEB7Vn6vJ9kJ3pv6QUgc+6f20+mqROLtjDdnTwAo5PAj4oc7Yaw wnzKCd163stmLX5YiTgyp+MaQU6qHKL3DW+/sl2cbTaxfj92en7lY24KVHnJhuwkRI/K avogfMQEuNuNj2heY/OFgwpKRIOpnFCtpOWHS4sw+3C8GMEYQkeWJmrr5alvuqtmwoC2 aw2b4p/UjlEQdRq4cpg4C7ouYI2ZZDIN3R6ZppRAmEcE5IvUU4jGfHkZXBswQL+vbGRl sN5aSDX6Zv2SD+1YPtzVkigtVHtTcFMpad+pSQgTD2CnN3/Es6xHJoIhapR+pb2ty2iY ZV2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=r7mFJ35R; 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 w2-v6si135085pfl.171.2018.09.24.12.33.48; Mon, 24 Sep 2018 12:34:04 -0700 (PDT) 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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=r7mFJ35R; 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 S2388201AbeIYBIM (ORCPT + 99 others); Mon, 24 Sep 2018 21:08:12 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:44679 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388127AbeIYBIK (ORCPT ); Mon, 24 Sep 2018 21:08:10 -0400 Received: by mail-wr1-f66.google.com with SMTP id v16-v6so20791618wro.11 for ; Mon, 24 Sep 2018 12:04:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ElyGP3i983za7JT8O7IacoH2pa4Z6qAmJG+FvzufmS0=; b=r7mFJ35R7Te5RGzC3bKSEvVNwyQyfbM5kkM4lr/kNxDPS5TdTyScnW2kUxkY50+6U1 BUovNyW1AQIqiKZ1QxNWCt7S6vM4CEg39N27iItBrU3EUX+Ya5TTLOdRbnZ+TbnsldQa 0J13R+vUn7WaFyg2mTfdcku9gfJ+4+BVmWmAA0i8MLa2zT4wj6ZyvBrsnW654RFp0DHi U8lTQk5amv1Ak0ohNGGov3/zSyFvx2LQrT2FTBlmC1B636ugx4DDyULJfyHDy+yDDaiZ kaoLlSvbL+S93jZion66KjfZdJc+rQU/Hrknpe/dtRYk+HG9zQN/fwxIXiKHPJ85YvMv VHDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ElyGP3i983za7JT8O7IacoH2pa4Z6qAmJG+FvzufmS0=; b=Y79HwXN9FXn+o0FZYoIiwjjClNPcAwjLKqcVsQ0RTFrUI+BYpoEV13bGAfQK9P+0+l tb1yJ99xwLf56HZ7p7jNojSFFf7vJy4XeAZFaRyt07IteR/2GTEMYR7oD3hgeB7idZQT peCyg5w5gH30DyGNdGzkZvnL0SbEMAM6BJtdkuvLlHKuGPCYQxRHOHboCmLND82eTTm1 bYnzsNdsjpUYgAq+/qVbWArY6kEXax3cDumBIbH/jKm3yIJjFsmsCKX0R6vfRz+e+Lfr wmh0dNLtKFfiy442OQ6qT/cRRmj+LMr17O709yvmMUlMn06oQG9kAuagJtcQ4l30jJrr Wrjw== X-Gm-Message-State: ABuFfoiktJwTgDJVGyyX7Mfi6eAC9qS1AFKU+WJD+p+dh9YC3ZYC31lu 5cVeZPx5ERPvtSmvyrHIEJeQjg== X-Received: by 2002:adf:f506:: with SMTP id q6-v6mr126443wro.241.1537815874021; Mon, 24 Sep 2018 12:04:34 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id e141-v6sm27721433wmd.32.2018.09.24.12.04.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Sep 2018 12:04:33 -0700 (PDT) From: Corentin Labbe To: Gilles.Muller@lip6.fr, Julia.Lawall@lip6.fr, agust@denx.de, airlied@linux.ie, alexandre.torgue@st.com, alistair@popple.id.au, benh@kernel.crashing.org, carlo@caione.org, davem@davemloft.net, galak@kernel.crashing.org, joabreu@synopsys.com, khilman@baylibre.com, maxime.ripard@bootlin.com, michal.lkml@markovi.net, mpe@ellerman.id.au, mporter@kernel.crashing.org, narmstrong@baylibre.com, nicolas.palix@imag.fr, oss@buserror.net, paulus@samba.org, peppe.cavallaro@st.com, tj@kernel.org, vitb@kernel.crashing.org, wens@csie.org Cc: cocci@systeme.lip6.fr, dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, Corentin Labbe Subject: [PATCH v2 7/7] net: stmmac: dwmac-meson8b: use xxxsetbits32 Date: Mon, 24 Sep 2018 19:04:16 +0000 Message-Id: <1537815856-31728-8-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537815856-31728-1-git-send-email-clabbe@baylibre.com> References: <1537815856-31728-1-git-send-email-clabbe@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch convert meson stmmac glue driver to use all xxxsetbits32 functions. Signed-off-by: Corentin Labbe --- .../net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 56 +++++++++------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c index c5979569fd60..abcf65588576 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "stmmac_platform.h" @@ -75,18 +76,6 @@ struct meson8b_dwmac_clk_configs { struct clk_gate rgmii_tx_en; }; -static void meson8b_dwmac_mask_bits(struct meson8b_dwmac *dwmac, u32 reg, - u32 mask, u32 value) -{ - u32 data; - - data = readl(dwmac->regs + reg); - data &= ~mask; - data |= (value & mask); - - writel(data, dwmac->regs + reg); -} - static struct clk *meson8b_dwmac_register_clk(struct meson8b_dwmac *dwmac, const char *name_suffix, const char **parent_names, @@ -192,14 +181,13 @@ static int meson8b_set_phy_mode(struct meson8b_dwmac *dwmac) case PHY_INTERFACE_MODE_RGMII_ID: case PHY_INTERFACE_MODE_RGMII_TXID: /* enable RGMII mode */ - meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, - PRG_ETH0_RGMII_MODE, - PRG_ETH0_RGMII_MODE); + clrsetbits_le32(dwmac->regs + PRG_ETH0, PRG_ETH0_RGMII_MODE, + PRG_ETH0_RGMII_MODE); break; case PHY_INTERFACE_MODE_RMII: /* disable RGMII mode -> enables RMII mode */ - meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, - PRG_ETH0_RGMII_MODE, 0); + clrsetbits_le32(dwmac->regs + PRG_ETH0, PRG_ETH0_RGMII_MODE, + 0); break; default: dev_err(dwmac->dev, "fail to set phy-mode %s\n", @@ -218,15 +206,15 @@ static int meson_axg_set_phy_mode(struct meson8b_dwmac *dwmac) case PHY_INTERFACE_MODE_RGMII_ID: case PHY_INTERFACE_MODE_RGMII_TXID: /* enable RGMII mode */ - meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, - PRG_ETH0_EXT_PHY_MODE_MASK, - PRG_ETH0_EXT_RGMII_MODE); + clrsetbits_le32(dwmac->regs + PRG_ETH0, + PRG_ETH0_EXT_PHY_MODE_MASK, + PRG_ETH0_EXT_RGMII_MODE); break; case PHY_INTERFACE_MODE_RMII: /* disable RGMII mode -> enables RMII mode */ - meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, - PRG_ETH0_EXT_PHY_MODE_MASK, - PRG_ETH0_EXT_RMII_MODE); + clrsetbits_le32(dwmac->regs + PRG_ETH0, + PRG_ETH0_EXT_PHY_MODE_MASK, + PRG_ETH0_EXT_RMII_MODE); break; default: dev_err(dwmac->dev, "fail to set phy-mode %s\n", @@ -255,11 +243,11 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) case PHY_INTERFACE_MODE_RGMII_ID: case PHY_INTERFACE_MODE_RGMII_TXID: /* only relevant for RMII mode -> disable in RGMII mode */ - meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, - PRG_ETH0_INVERTED_RMII_CLK, 0); + clrsetbits_le32(dwmac->regs + PRG_ETH0, + PRG_ETH0_INVERTED_RMII_CLK, 0); - meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_TXDLY_MASK, - tx_dly_val << PRG_ETH0_TXDLY_SHIFT); + clrsetbits_le32(dwmac->regs + PRG_ETH0, PRG_ETH0_TXDLY_MASK, + tx_dly_val << PRG_ETH0_TXDLY_SHIFT); /* Configure the 125MHz RGMII TX clock, the IP block changes * the output automatically (= without us having to configure @@ -287,13 +275,13 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) case PHY_INTERFACE_MODE_RMII: /* invert internal clk_rmii_i to generate 25/2.5 tx_rx_clk */ - meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, - PRG_ETH0_INVERTED_RMII_CLK, - PRG_ETH0_INVERTED_RMII_CLK); + clrsetbits_le32(dwmac->regs + PRG_ETH0, + PRG_ETH0_INVERTED_RMII_CLK, + PRG_ETH0_INVERTED_RMII_CLK); /* TX clock delay cannot be configured in RMII mode */ - meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_TXDLY_MASK, - 0); + clrsetbits_le32(dwmac->regs + PRG_ETH0, PRG_ETH0_TXDLY_MASK, + 0); break; @@ -304,8 +292,8 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) } /* enable TX_CLK and PHY_REF_CLK generator */ - meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_TX_AND_PHY_REF_CLK, - PRG_ETH0_TX_AND_PHY_REF_CLK); + clrsetbits_le32(dwmac->regs + PRG_ETH0, PRG_ETH0_TX_AND_PHY_REF_CLK, + PRG_ETH0_TX_AND_PHY_REF_CLK); return 0; } -- 2.16.4