[PATCH net-next 2/2] net: stmmac: dwmac-qcom-ethqos: Enable support for 2500BASEX

Andrew Lunn andrew at lunn.ch
Fri May 24 09:07:15 PDT 2024


On Fri, May 24, 2024 at 06:36:53PM +0530, Sneh Shah wrote:
> With integrated PCS qcom mac supports both SGMII and 2500BASEX mode.
> Implement get_interfaces to add support for 2500BASEX.

I don't know this driver very well..... but

/* PCS defines */
#define STMMAC_PCS_RGMII        (1 << 0)
#define STMMAC_PCS_SGMII        (1 << 1)
#define STMMAC_PCS_TBI          (1 << 2)
#define STMMAC_PCS_RTBI         (1 << 3)


static int stmmac_ethtool_get_link_ksettings(struct net_device *dev,
                                             struct ethtool_link_ksettings *cmd)
{
        struct stmmac_priv *priv = netdev_priv(dev);

        if (!(priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS) &&
            (priv->hw->pcs & STMMAC_PCS_RGMII ||
             priv->hw->pcs & STMMAC_PCS_SGMII)) {
                struct rgmii_adv adv;
                u32 supported, advertising, lp_advertising;

                if (!priv->xstats.pcs_link) {
                        cmd->base.speed = SPEED_UNKNOWN;
                        cmd->base.duplex = DUPLEX_UNKNOWN;
                        return 0;
                }

/**
 * stmmac_check_pcs_mode - verify if RGMII/SGMII is supported
 * @priv: driver private structure
 * Description: this is to verify if the HW supports the PCS.
 * Physical Coding Sublayer (PCS) interface that can be used when the MAC is
 * configured for the TBI, RTBI, or SGMII PHY interface.
 */
static void stmmac_check_pcs_mode(struct stmmac_priv *priv)
{
        int interface = priv->plat->mac_interface;

        if (priv->dma_cap.pcs) {
                if ((interface == PHY_INTERFACE_MODE_RGMII) ||
                    (interface == PHY_INTERFACE_MODE_RGMII_ID) ||
                    (interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
                    (interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
                        netdev_dbg(priv->dev, "PCS RGMII support enabled\n");
                        priv->hw->pcs = STMMAC_PCS_RGMII;
                } else if (interface == PHY_INTERFACE_MODE_SGMII) {
                        netdev_dbg(priv->dev, "PCS SGMII support enabled\n");
                        priv->hw->pcs = STMMAC_PCS_SGMII;
                }
        }
}

I get the feeling this is a minimal hack, rather than a proper
solution.

    Andrew

---
pw-bot: cr



More information about the linux-arm-kernel mailing list