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 3/4] net: systemport: Set correct RSB endian bits based on host
Date: Tue, 29 Aug 2017 11:39:44 -0700 [thread overview]
Message-ID: <1504031985-52808-4-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1504031985-52808-1-git-send-email-f.fainelli@gmail.com>
LE CPU:
* set RSB_SWAP0 (both SYSTEMPORT and SYSTEMPORT Lite)
* clear RSB_SWAP1 (SYSTEMPORT Lite only)
BE CPU:
* clear RSB_SWAP0 (both SYSTEMPORT and SYSTEMPORTE lite)
* set RSB_SWAP1 (SYSTEMPORT Lite only)
With these settings, we have the Receive Status Block always match the
host endian and we do not need to perform any conversion.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index a7e84292af50..7c7558a6b720 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1762,9 +1762,14 @@ static void rbuf_init(struct bcm_sysport_priv *priv)
reg = rbuf_readl(priv, RBUF_CONTROL);
reg |= RBUF_4B_ALGN | RBUF_RSB_EN;
/* Set a correct RSB format on SYSTEMPORT Lite */
- if (priv->is_lite) {
- reg &= ~RBUF_RSB_SWAP1;
+ if (!IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) {
+ if (priv->is_lite)
+ reg &= ~RBUF_RSB_SWAP1;
reg |= RBUF_RSB_SWAP0;
+ } else {
+ if (priv->is_lite)
+ reg |= RBUF_RSB_SWAP1;
+ reg &= ~RBUF_RSB_SWAP0;
}
rbuf_writel(priv, reg, RBUF_CONTROL);
}
--
1.9.1
next prev parent reply other threads:[~2017-08-29 18:46 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 ` [PATCH net-next 2/4] net: dsa: bcm_sf2: " Florian Fainelli
2017-08-29 18:39 ` Florian Fainelli [this message]
2017-08-29 18:39 ` [PATCH net-next 4/4] net: phy: mdio-bcm-unimac: " 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-4-git-send-email-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=vivien.didelot@savoirfairelinux.com \
/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).