From: Florian Fainelli <f.fainelli@gmail•com>
To: netdev@vger•kernel.org
Cc: davem@davemloft•net, opendmb@gmail•com, andrew@lunn•ch,
vivien.didelot@savoirfairelinux•com,
Florian Fainelli <f.fainelli@gmail•com>
Subject: [PATCH net-next 2/4] net: dsa: bcm_sf2: Use correct I/O accessors
Date: Tue, 29 Aug 2017 11:39:43 -0700 [thread overview]
Message-ID: <1504031985-52808-3-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1504031985-52808-1-git-send-email-f.fainelli@gmail.com>
The Starfigther 2 driver currently uses __raw_{read,write}l which means
native I/O endian. This works correctly for an ARM LE kernel (default)
but fails miserably on an ARM BE (BE8) kernel where registers are kept
little endian, so replace uses with {read,write}l_relaxed here which is
what we want because this is all performance sensitive code.
Signed-off-by: Florian Fainelli <f.fainelli@gmail•com>
---
drivers/net/dsa/bcm_sf2.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dsa/bcm_sf2.h b/drivers/net/dsa/bcm_sf2.h
index 7d3030e04f11..d9c96b281fc0 100644
--- a/drivers/net/dsa/bcm_sf2.h
+++ b/drivers/net/dsa/bcm_sf2.h
@@ -130,12 +130,12 @@ static inline u32 bcm_sf2_mangle_addr(struct bcm_sf2_priv *priv, u32 off)
#define SF2_IO_MACRO(name) \
static inline u32 name##_readl(struct bcm_sf2_priv *priv, u32 off) \
{ \
- return __raw_readl(priv->name + off); \
+ return readl_relaxed(priv->name + off); \
} \
static inline void name##_writel(struct bcm_sf2_priv *priv, \
u32 val, u32 off) \
{ \
- __raw_writel(val, priv->name + off); \
+ writel_relaxed(val, priv->name + off); \
} \
/* Accesses to 64-bits register requires us to latch the hi/lo pairs
@@ -179,23 +179,23 @@ static inline u32 bcm_sf2_mangle_addr(struct bcm_sf2_priv *priv, u32 off)
static inline u32 core_readl(struct bcm_sf2_priv *priv, u32 off)
{
u32 tmp = bcm_sf2_mangle_addr(priv, off);
- return __raw_readl(priv->core + tmp);
+ return readl_relaxed(priv->core + tmp);
}
static inline void core_writel(struct bcm_sf2_priv *priv, u32 val, u32 off)
{
u32 tmp = bcm_sf2_mangle_addr(priv, off);
- __raw_writel(val, priv->core + tmp);
+ writel_relaxed(val, priv->core + tmp);
}
static inline u32 reg_readl(struct bcm_sf2_priv *priv, u16 off)
{
- return __raw_readl(priv->reg + priv->reg_offsets[off]);
+ return readl_relaxed(priv->reg + priv->reg_offsets[off]);
}
static inline void reg_writel(struct bcm_sf2_priv *priv, u32 val, u16 off)
{
- __raw_writel(val, priv->reg + priv->reg_offsets[off]);
+ writel_relaxed(val, priv->reg + priv->reg_offsets[off]);
}
SF2_IO64_MACRO(core);
--
1.9.1
next prev parent reply other threads:[~2017-08-29 18:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 18:39 [PATCH net-next 0/4] Endian fixes for SYSTEMPORT/SF2/MDIO Florian Fainelli
2017-08-29 18:39 ` [PATCH net-next 1/4] net: systemport: Use correct I/O accessors Florian Fainelli
2017-08-29 18:39 ` Florian Fainelli [this message]
2017-08-29 18:39 ` [PATCH net-next 3/4] net: systemport: Set correct RSB endian bits based on host Florian Fainelli
2017-08-29 18:39 ` [PATCH net-next 4/4] net: phy: mdio-bcm-unimac: Use correct I/O accessors Florian Fainelli
2017-08-29 20:17 ` [PATCH net-next 0/4] Endian fixes for SYSTEMPORT/SF2/MDIO Florian Fainelli
2017-08-29 21:42 ` David Miller
2017-08-29 21:45 ` Florian Fainelli
2017-08-29 21:52 ` David Miller
2017-08-29 22:08 ` Florian Fainelli
2017-08-29 22:12 ` David Miller
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=1504031985-52808-3-git-send-email-f.fainelli@gmail.com \
--to=f.fainelli@gmail$(echo .)com \
--cc=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
--cc=opendmb@gmail$(echo .)com \
--cc=vivien.didelot@savoirfairelinux$(echo .)com \
/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