From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: "Marek Behún" <kabel@kernel.org>
Cc: Felix Fietkau <nbd@nbd.name>, John Crispin <john@phrozen.org>,
Sean Wang <sean.wang@mediatek.com>,
Mark Lee <Mark-MC.Lee@mediatek.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: [PATCH RFC net-next 03/12] net: mtk_eth_soc: add mask and update PCS speed definitions
Date: Wed, 06 Apr 2022 15:35:09 +0100 [thread overview]
Message-ID: <E1nc6kX-004ijj-Qk@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <Yk2k9D40QojsRhoo@shell.armlinux.org.uk>
The PCS speed setting is a two bit field, but it is defined as two
separate bits. Add a bitfield mask for the speed definitions, an
use the FIELD_PREP() macro to define each PCS speed.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 8a10761adda0..f31ef594008a 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -17,6 +17,7 @@
#include <linux/phylink.h>
#include <linux/rhashtable.h>
#include <linux/dim.h>
+#include <linux/bitfield.h>
#include "mtk_ppe.h"
#define MTK_QDMA_PAGE_SIZE 2048
@@ -485,9 +486,10 @@
#define SGMSYS_SGMII_MODE 0x20
#define SGMII_IF_MODE_BIT0 BIT(0)
#define SGMII_SPEED_DUPLEX_AN BIT(1)
-#define SGMII_SPEED_10 0x0
-#define SGMII_SPEED_100 BIT(2)
-#define SGMII_SPEED_1000 BIT(3)
+#define SGMII_SPEED_MASK GENMASK(3, 2)
+#define SGMII_SPEED_10 FIELD_PREP(SGMII_SPEED_MASK, 0)
+#define SGMII_SPEED_100 FIELD_PREP(SGMII_SPEED_MASK, 1)
+#define SGMII_SPEED_1000 FIELD_PREP(SGMII_SPEED_MASK, 2)
#define SGMII_DUPLEX_FULL BIT(4)
#define SGMII_IF_MODE_BIT5 BIT(5)
#define SGMII_REMOTE_FAULT_DIS BIT(8)
--
2.30.2
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2022-04-06 14:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-06 14:34 [PATCH RFC 00/12] mtk_eth_soc phylink updates Russell King (Oracle)
2022-04-06 14:34 ` [PATCH RFC net-next 01/12] net: mtk_eth_soc: remove unused mac->mode Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 02/12] net: mtk_eth_soc: remove unused sgmii flags Russell King (Oracle)
2022-04-06 14:35 ` Russell King (Oracle) [this message]
2022-04-06 14:35 ` [PATCH RFC net-next 04/12] net: mtk_eth_soc: correct 802.3z speed setting Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 05/12] net: mtk_eth_soc: correct 802.3z duplex setting Russell King
2022-04-06 14:35 ` [PATCH RFC net-next 06/12] net: mtk_eth_soc: stop passing phylink state to sgmii setup Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 07/12] net: mtk_eth_soc: provide mtk_sgmii_config() Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 08/12] net: mtk_eth_soc: add fixme comment for state->speed use Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 09/12] net: mtk_eth_soc: move MAC_MCR setting to mac_finish() Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 10/12] net: mtk_eth_soc: move restoration of SYSCFG0 " Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 11/12] net: mtk_eth_soc: convert code structure to suit split PCS support Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 12/12] net: mtk_eth_soc: partially convert to phylink_pcs Russell King (Oracle)
2022-04-11 13:30 ` [PATCH RFC 00/12] mtk_eth_soc phylink updates Russell King (Oracle)
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=E1nc6kX-004ijj-Qk@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=Mark-MC.Lee@mediatek.com \
--cc=davem@davemloft.net \
--cc=john@phrozen.org \
--cc=kabel@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sean.wang@mediatek.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).