diff mbox series

[net-next,1/7] net: pcs: xpcs: add specific vendor supoprt for Wangxun 10Gb NICs

Message ID 20230724102341.10401-2-jiawenwu@trustnetic.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series support more link mode for TXGBE | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1369 this patch: 1369
netdev/cc_maintainers warning 4 maintainers not CCed: kuba@kernel.org edumazet@google.com davem@davemloft.net pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 1365 this patch: 1365
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1392 this patch: 1392
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 31 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jiawen Wu July 24, 2023, 10:23 a.m. UTC
Since Wangxun 10Gb NICs require some special configuration on the IP of
Synopsys Designware XPCS, the vendor identification of wangxun devices
is added by comparing the name of mii bus.

And interrupt mode is used in Wangxun devices, so make it to be the first
specific configuration.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/pcs/pcs-xpcs.c   | 11 ++++++++++-
 include/linux/pcs/pcs-xpcs.h |  2 ++
 2 files changed, 12 insertions(+), 1 deletion(-)

Comments

Andrew Lunn July 25, 2023, 5:24 p.m. UTC | #1
> +static bool xpcs_dev_is_txgbe(struct dw_xpcs *xpcs)
> +{
> +	if (!strcmp(xpcs->mdiodev->bus->name, DW_MII_BUS_TXGBE))
> +		return true;
> +
> +	return false;
> +}

> +#define DW_MII_BUS_TXGBE	"txgbe_pcs_mdio_bus"

I don't see much value in using a #define here. Just use the string
directly.

	Andrew
diff mbox series

Patch

diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index 44b037646865..79a34ffb7518 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -238,6 +238,14 @@  static int xpcs_write_vpcs(struct dw_xpcs *xpcs, int reg, u16 val)
 	return xpcs_write_vendor(xpcs, MDIO_MMD_PCS, reg, val);
 }
 
+static bool xpcs_dev_is_txgbe(struct dw_xpcs *xpcs)
+{
+	if (!strcmp(xpcs->mdiodev->bus->name, DW_MII_BUS_TXGBE))
+		return true;
+
+	return false;
+}
+
 static int xpcs_poll_reset(struct dw_xpcs *xpcs, int dev)
 {
 	/* Poll until the reset bit clears (50ms per retry == 0.6 sec) */
@@ -1289,7 +1297,8 @@  static struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
 		if (compat->an_mode == DW_10GBASER)
 			return xpcs;
 
-		xpcs->pcs.poll = true;
+		if (!xpcs_dev_is_txgbe(xpcs))
+			xpcs->pcs.poll = true;
 
 		ret = xpcs_soft_reset(xpcs, compat);
 		if (ret)
diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h
index ff99cf7a5d0d..fb60c7e28623 100644
--- a/include/linux/pcs/pcs-xpcs.h
+++ b/include/linux/pcs/pcs-xpcs.h
@@ -20,6 +20,8 @@ 
 #define DW_AN_C37_1000BASEX		4
 #define DW_10GBASER			5
 
+#define DW_MII_BUS_TXGBE	"txgbe_pcs_mdio_bus"
+
 struct xpcs_id;
 
 struct dw_xpcs {