From: Corentin Labbe <clabbe@baylibre•com>
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, matthias.bgg@gmail•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: netdev@vger•kernel.org, linux-kernel@vger•kernel.org,
dri-devel@lists•freedesktop.org, linux-ide@vger•kernel.org,
linux-sunxi@googlegroups•com, linux-mediatek@lists•infradead.org,
Corentin Labbe <clabbe@baylibre•com>,
linux-amlogic@lists•infradead.org, linuxppc-dev@lists•ozlabs.org,
cocci@systeme•lip6.fr, linux-arm-kernel@lists•infradead.org
Subject: [PATCH v3 7/7] net: stmmac: dwmac-meson8b: use xxxsetbits_le32
Date: Wed, 24 Oct 2018 07:35:53 +0000 [thread overview]
Message-ID: <1540366553-18541-8-git-send-email-clabbe@baylibre.com> (raw)
In-Reply-To: <1540366553-18541-1-git-send-email-clabbe@baylibre.com>
This patch convert meson stmmac glue driver to use all xxxsetbits_le32 functions.
Signed-off-by: Corentin Labbe <clabbe@baylibre•com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre•com>
---
.../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 <linux/mfd/syscon.h>
#include <linux/platform_device.h>
#include <linux/stmmac.h>
+#include <linux/setbits.h>
#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.18.1
next prev parent reply other threads:[~2018-10-24 7:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 7:35 [PATCH v3 0/7] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 Corentin Labbe
2018-10-24 7:35 ` [PATCH v3 1/7] powerpc: rename setbits32/clrbits32 to setbits_be32/clrbits_be32 Corentin Labbe
2018-10-24 7:35 ` [PATCH v3 2/7] include: add setbits_leXX/clrbits_leXX/clrsetbits_leXX in linux/setbits.h Corentin Labbe
2018-10-24 22:46 ` Jakub Kicinski
2018-10-24 7:35 ` [PATCH v3 3/7 DONOTMERGE] coccinelle: add xxxsetbits_leXX converting spatch Corentin Labbe
2018-10-24 7:35 ` [PATCH v3 4/7] ata: ahci_sunxi: use xxxsetbitsi_le32 functions Corentin Labbe
2018-10-24 7:57 ` Sergei Shtylyov
2018-10-24 7:35 ` [PATCH v3 5/7] net: ethernet: stmmac: dwmac-sun8i: use xxxsetbits_le32 Corentin Labbe
2018-10-24 7:35 ` [PATCH v3 6/7] drm: meson: " Corentin Labbe
2018-10-24 7:35 ` Corentin Labbe [this message]
2018-10-24 8:57 ` [PATCH v3 0/7] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 Russell King - ARM Linux
2018-11-15 9:30 ` LABBE Corentin
2018-11-15 9:33 ` Russell King - ARM Linux
2018-11-15 12:24 ` LABBE Corentin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1540366553-18541-8-git-send-email-clabbe@baylibre.com \
--to=clabbe@baylibre$(echo .)com \
--cc=Gilles.Muller@lip6$(echo .)fr \
--cc=Julia.Lawall@lip6$(echo .)fr \
--cc=agust@denx$(echo .)de \
--cc=airlied@linux$(echo .)ie \
--cc=alexandre.torgue@st$(echo .)com \
--cc=alistair@popple$(echo .)id.au \
--cc=benh@kernel$(echo .)crashing.org \
--cc=carlo@caione$(echo .)org \
--cc=cocci@systeme$(echo .)lip6.fr \
--cc=davem@davemloft$(echo .)net \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=galak@kernel$(echo .)crashing.org \
--cc=joabreu@synopsys$(echo .)com \
--cc=khilman@baylibre$(echo .)com \
--cc=linux-amlogic@lists$(echo .)infradead.org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-ide@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-mediatek@lists$(echo .)infradead.org \
--cc=linux-sunxi@googlegroups$(echo .)com \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=matthias.bgg@gmail$(echo .)com \
--cc=maxime.ripard@bootlin$(echo .)com \
--cc=michal.lkml@markovi$(echo .)net \
--cc=mpe@ellerman$(echo .)id.au \
--cc=mporter@kernel$(echo .)crashing.org \
--cc=narmstrong@baylibre$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=nicolas.palix@imag$(echo .)fr \
--cc=oss@buserror$(echo .)net \
--cc=paulus@samba$(echo .)org \
--cc=peppe.cavallaro@st$(echo .)com \
--cc=tj@kernel$(echo .)org \
--cc=vitb@kernel$(echo .)crashing.org \
--cc=wens@csie$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox