diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 94331d380ea2..a53fd5a8aeba 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -381,6 +381,13 @@ static int qcom_ethqos_add_ipaddr(struct ip_params *ip_info, ETHQOSINFO("Sock is null, unable to assign ipv4 address\n"); return res; } + + if (!net->ipv4.devconf_dflt) { + ETHQOSERR("ipv4.devconf_dflt is null, schedule wq\n"); + schedule_delayed_work(&pethqos->ipv4_addr_assign_wq, + msecs_to_jiffies(1000)); + return res; + } /*For valid Ipv4 address*/ memset(&ir, 0, sizeof(ir)); memcpy(&sin->sin_addr.s_addr, &ip_info->ipv4_addr, @@ -1247,7 +1254,7 @@ static void ethqos_is_ipv4_NW_stack_ready(struct work_struct *work) struct net_device *ndev = NULL; int ret; - ETHQOSINFO("\n"); + ETHQOSDBG("\n"); dwork = container_of(work, struct delayed_work, work); ethqos = container_of(dwork, struct qcom_ethqos, ipv4_addr_assign_wq); @@ -1277,7 +1284,7 @@ static void ethqos_is_ipv6_NW_stack_ready(struct work_struct *work) struct net_device *ndev = NULL; int ret; - ETHQOSINFO("\n"); + ETHQOSDBG("\n"); dwork = container_of(work, struct delayed_work, work); ethqos = container_of(dwork, struct qcom_ethqos, ipv6_addr_assign_wq); @@ -1308,16 +1315,11 @@ static int ethqos_set_early_eth_param(struct stmmac_priv *priv, priv->plat->mdio_bus_data->phy_mask = priv->plat->mdio_bus_data->phy_mask | DUPLEX_FULL | SPEED_100; - priv->early_eth = ethqos->early_eth_enabled; - qcom_ethqos_add_ipaddr(&pparams, priv->dev); if (pparams.is_valid_ipv4_addr) { INIT_DELAYED_WORK(ðqos->ipv4_addr_assign_wq, ethqos_is_ipv4_NW_stack_ready); - ret = qcom_ethqos_add_ipaddr(&pparams, priv->dev); - if (ret) - schedule_delayed_work(ðqos->ipv4_addr_assign_wq, - msecs_to_jiffies(1000)); + schedule_delayed_work(ðqos->ipv4_addr_assign_wq, 0); } if (pparams.is_valid_ipv6_addr) { @@ -1596,6 +1598,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->has_gmac4 = 1; plat_dat->pmt = 1; plat_dat->tso_en = of_property_read_bool(np, "snps,tso"); + plat_dat->early_eth = ethqos->early_eth_enabled; if (of_property_read_bool(pdev->dev.of_node, "emac-core-version")) { @@ -1785,7 +1788,7 @@ static int __init qcom_ethqos_init_module(void) { int ret = 0; - ETHQOSINFO("\n"); + ETHQOSDBG("enter\n"); ret = platform_driver_register(&qcom_ethqos_driver); if (ret < 0) { @@ -1793,18 +1796,18 @@ static int __init qcom_ethqos_init_module(void) return ret; } - ETHQOSINFO("\n"); + ETHQOSDBG("Exit\n"); return ret; } static void __exit qcom_ethqos_exit_module(void) { - ETHQOSINFO("\n"); + ETHQOSDBG("Enter\n"); platform_driver_unregister(&qcom_ethqos_driver); - ETHQOSINFO("\n"); + ETHQOSDBG("Exit\n"); } /*! diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-gpio.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-gpio.c index ab288d4cf858..12a4df709e77 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-gpio.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-gpio.c @@ -212,7 +212,7 @@ int ethqos_init_pinctrl(struct device *dev) return ret; } - ETHQOSINFO("pinctrl_lookup_state %s succeded\n", name); + ETHQOSDBG("pinctrl_lookup_state %s succeded\n", name); ret = pinctrl_select_state(pinctrl, pinctrl_state); if (ret) { @@ -220,7 +220,7 @@ int ethqos_init_pinctrl(struct device *dev) return ret; } - ETHQOSINFO("pinctrl_select_state %s succeded\n", name); + ETHQOSDBG("pinctrl_select_state %s succeded\n", name); } return ret; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index f0bcd1c61d6f..02456e23ceb5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -219,7 +219,6 @@ struct stmmac_priv { void __iomem *ptpaddr; unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; bool boot_kpi; - bool early_eth; bool early_eth_config_set; #ifdef CONFIG_DEBUG_FS struct dentry *dbgfs_dir; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 097a6d84dff2..c156f42c37b9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -881,7 +881,7 @@ static void stmmac_validate(struct phylink_config *config, /* Early ethernet settings to bring up link in 100M, * Auto neg Off with full duplex link. */ - if (priv->early_eth && !priv->early_eth_config_set) { + if (priv->phydev && priv->plat->early_eth && !priv->early_eth_config_set) { priv->phydev->autoneg = AUTONEG_DISABLE; priv->phydev->speed = SPEED_100; priv->phydev->duplex = DUPLEX_FULL; @@ -1120,8 +1120,6 @@ static int stmmac_init_phy(struct net_device *dev) priv->phydev->irq = PHY_POLL; } } - pr_info(" qcom-ethqos: %s early eth setting stmmac init\n", - __func__); return ret; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 7433d1b81328..8729a3c0dfe5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -269,7 +269,7 @@ int stmmac_mdio_reset(struct mii_bus *bus) #ifdef CONFIG_DWMAC_QCOM_ETHQOS active_high = false; #endif - if (priv->early_eth) + if (priv->plat->early_eth) return 0; #ifdef CONFIG_OF diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index d6489ff82b8a..b340385e4d41 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -186,5 +186,6 @@ struct plat_stmmacenet_data { struct net_device *sb_dev); unsigned int (*get_plat_tx_coal_frames) (struct sk_buff *skb); + bool early_eth; }; #endif