From: jszhang@marvell.com (Jisheng Zhang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] net: mv643xx_eth: use {readl|writel}_relaxed instead of readl/writel
Date: Fri, 13 May 2016 19:59:19 +0800 [thread overview]
Message-ID: <1463140760-7128-2-git-send-email-jszhang@marvell.com> (raw)
In-Reply-To: <1463140760-7128-1-git-send-email-jszhang@marvell.com>
Since appropriate memory barriers are already there, use the relaxed
version to improve performance a bit.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
drivers/net/ethernet/marvell/mv643xx_eth.c | 33 +++++++++++++++---------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 5583118..c6d8124 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -433,22 +433,22 @@ struct mv643xx_eth_private {
/* port register accessors **************************************************/
static inline u32 rdl(struct mv643xx_eth_private *mp, int offset)
{
- return readl(mp->shared->base + offset);
+ return readl_relaxed(mp->shared->base + offset);
}
static inline u32 rdlp(struct mv643xx_eth_private *mp, int offset)
{
- return readl(mp->base + offset);
+ return readl_relaxed(mp->base + offset);
}
static inline void wrl(struct mv643xx_eth_private *mp, int offset, u32 data)
{
- writel(data, mp->shared->base + offset);
+ writel_relaxed(data, mp->shared->base + offset);
}
static inline void wrlp(struct mv643xx_eth_private *mp, int offset, u32 data)
{
- writel(data, mp->base + offset);
+ writel_relaxed(data, mp->base + offset);
}
@@ -2642,10 +2642,10 @@ mv643xx_eth_conf_mbus_windows(struct mv643xx_eth_shared_private *msp,
int i;
for (i = 0; i < 6; i++) {
- writel(0, base + WINDOW_BASE(i));
- writel(0, base + WINDOW_SIZE(i));
+ writel_relaxed(0, base + WINDOW_BASE(i));
+ writel_relaxed(0, base + WINDOW_SIZE(i));
if (i < 4)
- writel(0, base + WINDOW_REMAP_HIGH(i));
+ writel_relaxed(0, base + WINDOW_REMAP_HIGH(i));
}
win_enable = 0x3f;
@@ -2654,16 +2654,17 @@ mv643xx_eth_conf_mbus_windows(struct mv643xx_eth_shared_private *msp,
for (i = 0; i < dram->num_cs; i++) {
const struct mbus_dram_window *cs = dram->cs + i;
- writel((cs->base & 0xffff0000) |
+ writel_relaxed((cs->base & 0xffff0000) |
(cs->mbus_attr << 8) |
dram->mbus_dram_target_id, base + WINDOW_BASE(i));
- writel((cs->size - 1) & 0xffff0000, base + WINDOW_SIZE(i));
+ writel_relaxed((cs->size - 1) & 0xffff0000,
+ base + WINDOW_SIZE(i));
win_enable &= ~(1 << i);
win_protect |= 3 << (2 * i);
}
- writel(win_enable, base + WINDOW_BAR_ENABLE);
+ writel_relaxed(win_enable, base + WINDOW_BAR_ENABLE);
msp->win_protect = win_protect;
}
@@ -2674,8 +2675,8 @@ static void infer_hw_params(struct mv643xx_eth_shared_private *msp)
* [21:8], or a 16-bit coal limit in bits [25,21:7] of the
* SDMA config register.
*/
- writel(0x02000000, msp->base + 0x0400 + SDMA_CONFIG);
- if (readl(msp->base + 0x0400 + SDMA_CONFIG) & 0x02000000)
+ writel_relaxed(0x02000000, msp->base + 0x0400 + SDMA_CONFIG);
+ if (readl_relaxed(msp->base + 0x0400 + SDMA_CONFIG) & 0x02000000)
msp->extended_rx_coal_limit = 1;
else
msp->extended_rx_coal_limit = 0;
@@ -2685,12 +2686,12 @@ static void infer_hw_params(struct mv643xx_eth_shared_private *msp)
* yes, whether its associated registers are in the old or
* the new place.
*/
- writel(1, msp->base + 0x0400 + TX_BW_MTU_MOVED);
- if (readl(msp->base + 0x0400 + TX_BW_MTU_MOVED) & 1) {
+ writel_relaxed(1, msp->base + 0x0400 + TX_BW_MTU_MOVED);
+ if (readl_relaxed(msp->base + 0x0400 + TX_BW_MTU_MOVED) & 1) {
msp->tx_bw_control = TX_BW_CONTROL_NEW_LAYOUT;
} else {
- writel(7, msp->base + 0x0400 + TX_BW_RATE);
- if (readl(msp->base + 0x0400 + TX_BW_RATE) & 7)
+ writel_relaxed(7, msp->base + 0x0400 + TX_BW_RATE);
+ if (readl_relaxed(msp->base + 0x0400 + TX_BW_RATE) & 7)
msp->tx_bw_control = TX_BW_CONTROL_OLD_LAYOUT;
else
msp->tx_bw_control = TX_BW_CONTROL_ABSENT;
--
2.8.1
next prev parent reply other threads:[~2016-05-13 11:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-13 11:59 [PATCH 0/2] net: mv643xx_eth: improve performance Jisheng Zhang
2016-05-13 11:59 ` Jisheng Zhang [this message]
2016-05-13 12:09 ` [PATCH 1/2] net: mv643xx_eth: use {readl|writel}_relaxed instead of readl/writel Arnd Bergmann
2016-05-13 12:19 ` Jisheng Zhang
2016-05-13 15:24 ` Andrew Lunn
2016-05-13 11:59 ` [PATCH 2/2] net: mv643xx_eth: use dma_wmb/rmb where appropriate Jisheng Zhang
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=1463140760-7128-2-git-send-email-jszhang@marvell.com \
--to=jszhang@marvell.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).