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 |
> +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 --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 {
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(-)