From patchwork Mon Sep 24 19:04:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 10612803 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C00FA14BD for ; Mon, 24 Sep 2018 19:11:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B28F92A54E for ; Mon, 24 Sep 2018 19:11:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5A402A562; Mon, 24 Sep 2018 19:11:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 156782A54E for ; Mon, 24 Sep 2018 19:11:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PlmFwCJ9p/96fv7bJ1zYaMvBBbIw/8gOl1NMOxT06Rc=; b=WQpVeoEk+toAZSeV8F1lknZGIf YkNj6yuMsp0fCGWlTYCkGbZFh0NrQtoZzMi5lmWYQ0Iv2L+jchyTKiC1tCVO5RsJj8Lzthrbw+Jts fzwFoCzCEhyWYJs3kxin0REzyHSCXPYyCLrxc2v3kglRINrNaMFbVLrlB+ALQf7KkCpvOcBX9aiTr 8f+YMfDc5/9OxNS3KMr6ub3RqQbjhvSGKYXVyB9Cb6oZunK7fWtbcdrQVX3tXrUNgGnVrGbCDskHS BIy5qr7O7UMyzVU87a0lpEQssJzqrzLdz3VZVfB7E2cSHEIIF8mWjss9I6KEs4hFMyKVOON1S2f1J zoE+7QNw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4WGh-00058D-7b; Mon, 24 Sep 2018 19:11:39 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4WAG-0000i2-A6 for linux-amlogic@lists.infradead.org; Mon, 24 Sep 2018 19:05:25 +0000 Received: by mail-wr1-x442.google.com with SMTP id e1-v6so20806097wrt.3 for ; Mon, 24 Sep 2018 12:04:35 -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=bL6cbD7ocYR6++ZNYvusObFAnPtVT6P9DGJ0kwGwSBWnxH3RmKtSMlvHvPMLL7MGSD PYwrl3KckIwV1rxyY7/FKZqJ33XxQmL2GVXhmQlTgMojHJNrK+0KpNgO86O+FnlHS08J NBQhAOrwA7WbOf7msvAnL0/xLwVfJ31vZWI0yOviSMMOLONGi0S3/th4JChjbG8XoUPO dm2s0oFH+OxChSsfiE3pS+jvbDsoD9tldXvhw7vps7pSYRxrkch8KdmDl+0WfMku6QkK SWKCyysKxX4A9t7RDwucurZEkwykaWr6zwshoJFG8dIqkMxyXbhaMxIL8b2LXy8yWtpy cAUA== X-Gm-Message-State: ABuFfoihrd8v3SraWsCGU+eHvgqYw5wiu/gn0PkH1B7FobG3WDwbh8Vf 2H5ixpLswRDvrYLsdmoiMP/n1g== X-Google-Smtp-Source: ACcGV63sTUVI0HgRJ5VUlmxNENKxGBqqa/CpvyDWsm0uRMngvY03UgCo4N732GTs1wM1rUw0r2sV/Q== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180924_120500_495179_1AA38B5A X-CRM114-Status: GOOD ( 12.69 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.org, Corentin Labbe , linux-amlogic@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, cocci@systeme.lip6.fr, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch convert meson stmmac glue driver to use all xxxsetbits32 functions. Signed-off-by: Corentin Labbe Reviewed-by: Neil Armstrong --- .../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; }