Loading drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +15 −2 Original line number Diff line number Diff line Loading @@ -2124,8 +2124,13 @@ inline bool qcom_ethqos_is_phy_link_up(struct qcom_ethqos *ethqos) */ struct stmmac_priv *priv = qcom_ethqos_get_priv(ethqos); if (priv->plat->mac2mac_en) { return true; } else { return ((priv->oldlink != -1) && (priv->dev->phydev && priv->dev->phydev->link)); (priv->dev->phydev && priv->dev->phydev->link)); } } static void qcom_ethqos_phy_resume_clks(struct qcom_ethqos *ethqos) Loading Loading @@ -2443,6 +2448,14 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->tso_en = of_property_read_bool(np, "snps,tso"); plat_dat->early_eth = ethqos->early_eth_enabled; /* Get rgmii interface speed for mac2c from device tree */ if (of_property_read_u32(np, "mac2mac-rgmii-speed", &plat_dat->mac2mac_rgmii_speed)) plat_dat->mac2mac_rgmii_speed = -1; else ETHQOSINFO("mac2mac rgmii speed = %d\n", plat_dat->mac2mac_rgmii_speed); if (of_property_read_bool(pdev->dev.of_node, "qcom,arm-smmu")) { stmmac_emb_smmu_ctx.pdev_master = pdev; ret = of_platform_populate(pdev->dev.of_node, Loading drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +30 −5 Original line number Diff line number Diff line Loading @@ -286,6 +286,12 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev, struct stmmac_priv *priv = netdev_priv(dev); struct phy_device *phy = dev->phydev; if (!phy) { pr_err("%s: %s: PHY is not registered\n", __func__, dev->name); return -ENODEV; } if (priv->hw->pcs & STMMAC_PCS_RGMII || priv->hw->pcs & STMMAC_PCS_SGMII) { struct rgmii_adv adv; Loading Loading @@ -365,11 +371,6 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev, return 0; } if (phy == NULL) { pr_err("%s: %s: PHY is not registered\n", __func__, dev->name); return -ENODEV; } if (!netif_running(dev)) { pr_err("%s: interface is disabled: we cannot track " "link speed / duplex setting\n", dev->name); Loading @@ -388,6 +389,12 @@ stmmac_ethtool_set_link_ksettings(struct net_device *dev, int rc; u32 cmd_speed = cmd->base.speed; if (!phy) { pr_err("%s: %s: PHY is not registered\n", __func__, dev->name); return -ENODEV; } if (priv->hw->pcs & STMMAC_PCS_RGMII || priv->hw->pcs & STMMAC_PCS_SGMII) { u32 mask = ADVERTISED_Autoneg | ADVERTISED_Pause; Loading Loading @@ -505,6 +512,12 @@ stmmac_set_pauseparam(struct net_device *netdev, struct phy_device *phy = netdev->phydev; int new_pause = FLOW_OFF; if (!phy) { pr_err("%s: %s: PHY is not registered\n", __func__, netdev->name); return -ENODEV; } if (priv->hw->pcs && priv->hw->mac->pcs_get_adv_lp) { struct rgmii_adv adv_lp; Loading Loading @@ -634,6 +647,12 @@ static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { struct stmmac_priv *priv = netdev_priv(dev); if (!priv->phydev) { pr_err("%s: %s: PHY is not registered\n", __func__, dev->name); return; } phy_ethtool_get_wol(priv->phydev, wol); mutex_lock(&priv->lock); if (device_can_wakeup(priv->device)) { Loading @@ -650,6 +669,12 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) u32 emac_wol_support = 0; int ret; if (!priv->phydev) { pr_err("%s: %s: PHY is not registered\n", __func__, dev->name); return -ENODEV; } if (ethqos->phy_state == PHY_IS_OFF) { ETHQOSINFO("Phy is in off state Wol set not possible\n"); return -EOPNOTSUPP; Loading drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +28 −6 Original line number Diff line number Diff line Loading @@ -2736,9 +2736,10 @@ static int stmmac_open(struct net_device *dev) struct stmmac_priv *priv = netdev_priv(dev); int ret; if (priv->hw->pcs != STMMAC_PCS_RGMII && if (!priv->plat->mac2mac_en && (priv->hw->pcs != STMMAC_PCS_RGMII && priv->hw->pcs != STMMAC_PCS_TBI && priv->hw->pcs != STMMAC_PCS_RTBI) { priv->hw->pcs != STMMAC_PCS_RTBI)) { ret = stmmac_init_phy(dev); if (ret) { netdev_err(priv->dev, Loading Loading @@ -2826,6 +2827,26 @@ static int stmmac_open(struct net_device *dev) if (priv->tx_queue[IPA_DMA_TX_CH].skip_sw) ethqos_ipa_offload_event_handler(priv, EV_DEV_OPEN); if (priv->plat->mac2mac_en) { u32 ctrl = readl_relaxed(priv->ioaddr + MAC_CTRL_REG); ctrl &= ~priv->hw->link.speed_mask; if (priv->plat->mac2mac_rgmii_speed == SPEED_1000) { ctrl |= priv->hw->link.speed1000; priv->speed = SPEED_1000; } else if (priv->plat->mac2mac_rgmii_speed == SPEED_100) { ctrl |= priv->hw->link.speed100; priv->speed = SPEED_100; } else { ctrl |= priv->hw->link.speed10; priv->speed = SPEED_10; } stmmac_hw_fix_mac_speed(priv); writel_relaxed(ctrl, priv->ioaddr + MAC_CTRL_REG); } return 0; lpiirq_error: Loading Loading @@ -4595,9 +4616,10 @@ int stmmac_dvr_probe(struct device *device, stmmac_check_pcs_mode(priv); if (priv->hw->pcs != STMMAC_PCS_RGMII && if (!priv->plat->mac2mac_en && (priv->hw->pcs != STMMAC_PCS_RGMII && priv->hw->pcs != STMMAC_PCS_TBI && priv->hw->pcs != STMMAC_PCS_RTBI) { priv->hw->pcs != STMMAC_PCS_RTBI)) { /* MDIO bus Registration */ ret = stmmac_mdio_register(ndev); if (ret < 0) { Loading drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +7 −2 Original line number Diff line number Diff line Loading @@ -400,6 +400,9 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) /* Default to phy auto-detection */ plat->phy_addr = -1; /* Flag for mac2mac feature support*/ plat->mac2mac_en = of_property_read_bool(np, "mac2mac"); /* "snps,phy-addr" is not a standard property. Mark it as deprecated * and warn of its use. Remove this when phy node support is added. */ Loading @@ -407,8 +410,10 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); /* To Configure PHY by using all device-tree supported properties */ if (!plat->mac2mac_en) { if (stmmac_dt_phy(plat, np, &pdev->dev)) return ERR_PTR(-ENODEV); } of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); Loading include/linux/stmmac.h +2 −0 Original line number Diff line number Diff line Loading @@ -201,5 +201,7 @@ struct plat_stmmacenet_data { bool early_eth; bool crc_strip_en; bool phy_intr_en; int mac2mac_rgmii_speed; bool mac2mac_en; }; #endif Loading
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +15 −2 Original line number Diff line number Diff line Loading @@ -2124,8 +2124,13 @@ inline bool qcom_ethqos_is_phy_link_up(struct qcom_ethqos *ethqos) */ struct stmmac_priv *priv = qcom_ethqos_get_priv(ethqos); if (priv->plat->mac2mac_en) { return true; } else { return ((priv->oldlink != -1) && (priv->dev->phydev && priv->dev->phydev->link)); (priv->dev->phydev && priv->dev->phydev->link)); } } static void qcom_ethqos_phy_resume_clks(struct qcom_ethqos *ethqos) Loading Loading @@ -2443,6 +2448,14 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->tso_en = of_property_read_bool(np, "snps,tso"); plat_dat->early_eth = ethqos->early_eth_enabled; /* Get rgmii interface speed for mac2c from device tree */ if (of_property_read_u32(np, "mac2mac-rgmii-speed", &plat_dat->mac2mac_rgmii_speed)) plat_dat->mac2mac_rgmii_speed = -1; else ETHQOSINFO("mac2mac rgmii speed = %d\n", plat_dat->mac2mac_rgmii_speed); if (of_property_read_bool(pdev->dev.of_node, "qcom,arm-smmu")) { stmmac_emb_smmu_ctx.pdev_master = pdev; ret = of_platform_populate(pdev->dev.of_node, Loading
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +30 −5 Original line number Diff line number Diff line Loading @@ -286,6 +286,12 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev, struct stmmac_priv *priv = netdev_priv(dev); struct phy_device *phy = dev->phydev; if (!phy) { pr_err("%s: %s: PHY is not registered\n", __func__, dev->name); return -ENODEV; } if (priv->hw->pcs & STMMAC_PCS_RGMII || priv->hw->pcs & STMMAC_PCS_SGMII) { struct rgmii_adv adv; Loading Loading @@ -365,11 +371,6 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev, return 0; } if (phy == NULL) { pr_err("%s: %s: PHY is not registered\n", __func__, dev->name); return -ENODEV; } if (!netif_running(dev)) { pr_err("%s: interface is disabled: we cannot track " "link speed / duplex setting\n", dev->name); Loading @@ -388,6 +389,12 @@ stmmac_ethtool_set_link_ksettings(struct net_device *dev, int rc; u32 cmd_speed = cmd->base.speed; if (!phy) { pr_err("%s: %s: PHY is not registered\n", __func__, dev->name); return -ENODEV; } if (priv->hw->pcs & STMMAC_PCS_RGMII || priv->hw->pcs & STMMAC_PCS_SGMII) { u32 mask = ADVERTISED_Autoneg | ADVERTISED_Pause; Loading Loading @@ -505,6 +512,12 @@ stmmac_set_pauseparam(struct net_device *netdev, struct phy_device *phy = netdev->phydev; int new_pause = FLOW_OFF; if (!phy) { pr_err("%s: %s: PHY is not registered\n", __func__, netdev->name); return -ENODEV; } if (priv->hw->pcs && priv->hw->mac->pcs_get_adv_lp) { struct rgmii_adv adv_lp; Loading Loading @@ -634,6 +647,12 @@ static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { struct stmmac_priv *priv = netdev_priv(dev); if (!priv->phydev) { pr_err("%s: %s: PHY is not registered\n", __func__, dev->name); return; } phy_ethtool_get_wol(priv->phydev, wol); mutex_lock(&priv->lock); if (device_can_wakeup(priv->device)) { Loading @@ -650,6 +669,12 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) u32 emac_wol_support = 0; int ret; if (!priv->phydev) { pr_err("%s: %s: PHY is not registered\n", __func__, dev->name); return -ENODEV; } if (ethqos->phy_state == PHY_IS_OFF) { ETHQOSINFO("Phy is in off state Wol set not possible\n"); return -EOPNOTSUPP; Loading
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +28 −6 Original line number Diff line number Diff line Loading @@ -2736,9 +2736,10 @@ static int stmmac_open(struct net_device *dev) struct stmmac_priv *priv = netdev_priv(dev); int ret; if (priv->hw->pcs != STMMAC_PCS_RGMII && if (!priv->plat->mac2mac_en && (priv->hw->pcs != STMMAC_PCS_RGMII && priv->hw->pcs != STMMAC_PCS_TBI && priv->hw->pcs != STMMAC_PCS_RTBI) { priv->hw->pcs != STMMAC_PCS_RTBI)) { ret = stmmac_init_phy(dev); if (ret) { netdev_err(priv->dev, Loading Loading @@ -2826,6 +2827,26 @@ static int stmmac_open(struct net_device *dev) if (priv->tx_queue[IPA_DMA_TX_CH].skip_sw) ethqos_ipa_offload_event_handler(priv, EV_DEV_OPEN); if (priv->plat->mac2mac_en) { u32 ctrl = readl_relaxed(priv->ioaddr + MAC_CTRL_REG); ctrl &= ~priv->hw->link.speed_mask; if (priv->plat->mac2mac_rgmii_speed == SPEED_1000) { ctrl |= priv->hw->link.speed1000; priv->speed = SPEED_1000; } else if (priv->plat->mac2mac_rgmii_speed == SPEED_100) { ctrl |= priv->hw->link.speed100; priv->speed = SPEED_100; } else { ctrl |= priv->hw->link.speed10; priv->speed = SPEED_10; } stmmac_hw_fix_mac_speed(priv); writel_relaxed(ctrl, priv->ioaddr + MAC_CTRL_REG); } return 0; lpiirq_error: Loading Loading @@ -4595,9 +4616,10 @@ int stmmac_dvr_probe(struct device *device, stmmac_check_pcs_mode(priv); if (priv->hw->pcs != STMMAC_PCS_RGMII && if (!priv->plat->mac2mac_en && (priv->hw->pcs != STMMAC_PCS_RGMII && priv->hw->pcs != STMMAC_PCS_TBI && priv->hw->pcs != STMMAC_PCS_RTBI) { priv->hw->pcs != STMMAC_PCS_RTBI)) { /* MDIO bus Registration */ ret = stmmac_mdio_register(ndev); if (ret < 0) { Loading
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +7 −2 Original line number Diff line number Diff line Loading @@ -400,6 +400,9 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) /* Default to phy auto-detection */ plat->phy_addr = -1; /* Flag for mac2mac feature support*/ plat->mac2mac_en = of_property_read_bool(np, "mac2mac"); /* "snps,phy-addr" is not a standard property. Mark it as deprecated * and warn of its use. Remove this when phy node support is added. */ Loading @@ -407,8 +410,10 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); /* To Configure PHY by using all device-tree supported properties */ if (!plat->mac2mac_en) { if (stmmac_dt_phy(plat, np, &pdev->dev)) return ERR_PTR(-ENODEV); } of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); Loading
include/linux/stmmac.h +2 −0 Original line number Diff line number Diff line Loading @@ -201,5 +201,7 @@ struct plat_stmmacenet_data { bool early_eth; bool crc_strip_en; bool phy_intr_en; int mac2mac_rgmii_speed; bool mac2mac_en; }; #endif