Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c03d41e8 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: stmmac: optimization to boot up KPI"

parents 029b5d41 8c7409e8
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
@@ -1006,6 +1006,9 @@ static int ethqos_phy_intr_enable(struct qcom_ethqos *ethqos)
			  ethqos->phy_intr);
		return ret;
	}
#ifdef CONFIG_MSM_BOOT_TIME_MARKER
	place_marker("M - Phy IRQ interrupt enabled");
#endif
	phy_intr_en = true;
	return ret;
}
@@ -1468,6 +1471,10 @@ static void qcom_ethqos_bringup_iface(struct work_struct *work)
	if (dev_change_flags(ndev, ndev->flags | IFF_UP) < 0)
		ETHQOSINFO("ERROR\n");

#ifdef CONFIG_MSM_BOOT_TIME_MARKER
	place_marker("M - Device flag changed to UP ");
#endif

	rtnl_unlock();

	ETHQOSINFO("exit\n");
@@ -1590,8 +1597,6 @@ static int ethqos_set_early_eth_param(struct stmmac_priv *priv,
		 priv->plat->mdio_bus_data->phy_mask | DUPLEX_FULL | SPEED_100;

	priv->plat->max_speed = 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(&ethqos->ipv4_addr_assign_wq,
@@ -1628,6 +1633,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
	struct net_device *ndev;
	struct stmmac_priv *priv;
	int ret;
	struct phy_device *phydev;

#ifdef CONFIG_MSM_BOOT_TIME_MARKER
	place_marker("M - Ethernet probe start");
@@ -1712,6 +1718,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, "qcom,arm-smmu")) {
		emac_emb_smmu_ctx.pdev_master = pdev;
@@ -1781,7 +1788,16 @@ static int qcom_ethqos_probe(struct platform_device *pdev)

	ndev = dev_get_drvdata(&ethqos->pdev->dev);
	priv = netdev_priv(ndev);

	phydev = mdiobus_get_phy(priv->mii, priv->plat->phy_addr);
	if (phydev && phydev->drv &&
	    phydev->drv->config_intr &&
		!phydev->drv->config_intr(phydev)) {
		qcom_ethqos_request_phy_wol(priv->plat);
		phydev->irq = PHY_IGNORE_INTERRUPT;
		phydev->interrupts =  PHY_INTERRUPT_ENABLED;
	} else {
		ETHQOSERR("config_phy_intr configuration failed");
	}
	if (ethqos->early_eth_enabled) {
		/* Initialize work*/
		INIT_WORK(&ethqos->early_eth,
+0 −1
Original line number Diff line number Diff line
@@ -148,7 +148,6 @@ struct stmmac_priv {
	void __iomem *ptpaddr;
	u32 mss;
	bool boot_kpi;
	bool early_eth;
#ifdef CONFIG_DEBUG_FS
	struct dentry *dbgfs_dir;
	struct dentry *dbgfs_rings_status;
+30 −18
Original line number Diff line number Diff line
@@ -949,30 +949,16 @@ static int stmmac_init_phy(struct net_device *dev)
	struct stmmac_priv *priv = netdev_priv(dev);
	u32 tx_cnt = priv->plat->tx_queues_to_use;
	struct phy_device *phydev;
	char phy_id_fmt[MII_BUS_ID_SIZE + 3];
	char bus_id[MII_BUS_ID_SIZE];
	int interface = priv->plat->interface;
	int max_speed = priv->plat->max_speed;
	int ret = 0;
	priv->oldlink = false;
	priv->boot_kpi = false;
	priv->speed = SPEED_UNKNOWN;
	priv->oldduplex = DUPLEX_UNKNOWN;

	if (priv->plat->phy_node) {
		phydev = of_phy_connect(dev, priv->plat->phy_node,
					&stmmac_adjust_link, 0, interface);
	} else {
		snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x",
			 priv->plat->bus_id);

		snprintf(phy_id_fmt, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id,
			 priv->plat->phy_addr);
		netdev_dbg(priv->dev, "%s: trying to attach to %s\n", __func__,
			   phy_id_fmt);
	phydev = mdiobus_get_phy(priv->mii, priv->plat->phy_addr);

		phydev = phy_connect(dev, phy_id_fmt, &stmmac_adjust_link,
				     interface);
	}

	if (IS_ERR_OR_NULL(phydev)) {
		netdev_err(priv->dev, "Could not attach to PHY\n");
@@ -981,6 +967,25 @@ static int stmmac_init_phy(struct net_device *dev)

		return PTR_ERR(phydev);
	}

	phydev->skip_sw_reset = true;

	ret = phy_connect_direct(dev, phydev, &stmmac_adjust_link, interface);

	if (ret) {
		pr_info("phy_connect_direct failed\n");
		return ret;
	}
	/* Broken HW is sometimes missing the pull-up resistor on the
	 * MDIO line, which results in reads to non-existent devices returning
	 * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent
	 * device as well.
	 * Note: phydev->phy_id is the result of reading the UID PHY registers.
	 */
	if (!priv->plat->phy_node && phydev->phy_id == 0) {
		phy_disconnect(phydev);
		return -ENODEV;
	}
	pr_info(" qcom-ethqos: %s early eth setting stmmac init\n",
				 __func__);

@@ -1000,10 +1005,13 @@ static int stmmac_init_phy(struct net_device *dev)
				       SUPPORTED_100baseT_Half |
				       SUPPORTED_10baseT_Half);

#ifdef CONFIG_MSM_BOOT_TIME_MARKER
place_marker("M - Init Phy device");
#endif
	/* Early ethernet settings to bring up link in 100M,
	 * Auto neg Off with full duplex link.
	 */
	if (max_speed == SPEED_100 && priv->early_eth) {
	if (max_speed == SPEED_100 && priv->plat->early_eth) {
		phydev->autoneg = AUTONEG_DISABLE;
		phydev->speed = SPEED_100;
		phydev->duplex = DUPLEX_FULL;
@@ -2687,6 +2695,10 @@ static int stmmac_open(struct net_device *dev)
	struct stmmac_priv *priv = netdev_priv(dev);
	int ret;

#ifdef CONFIG_MSM_BOOT_TIME_MARKER
	place_marker("M - Stmmac open called");
#endif

	if (priv->hw->pcs != STMMAC_PCS_RGMII &&
	    priv->hw->pcs != STMMAC_PCS_TBI &&
	    priv->hw->pcs != STMMAC_PCS_RTBI) {
+0 −3
Original line number Diff line number Diff line
@@ -139,9 +139,6 @@ int stmmac_mdio_reset(struct mii_bus *bus)
	unsigned int mii_address = priv->hw->mii.addr;
	struct stmmac_mdio_bus_data *data = priv->plat->mdio_bus_data;

	if (priv->early_eth)
		return 0;

#ifdef CONFIG_OF
	if (priv->device->of_node) {
		if (data->reset_gpio < 0) {
+1 −0
Original line number Diff line number Diff line
@@ -198,5 +198,6 @@ struct plat_stmmacenet_data {
		 select_queue_fallback_t fallback);
	unsigned int (*get_plat_tx_coal_frames)
		(struct sk_buff *skb);
	bool early_eth;
};
#endif