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

Commit 336fdc58 authored by Suraj Jaiswal's avatar Suraj Jaiswal Committed by Gerrit - the friendly Code Review server
Browse files

net: stmmac: Low power management optimization



Do not check for oldlink, always check for phydev link
when we suspend and resume the device.

Change-Id: I9cad2a1ecc3aea62b1b005ba09b3e7f21a07349f
Acked-by: default avatarNagarjuna Chaganti <nchagant@qti.qualcomm.com>
Signed-off-by: default avatarSuraj Jaiswal <jsuraj@codeaurora.org>
parent c3d8f280
Loading
Loading
Loading
Loading
+16 −18
Original line number Diff line number Diff line
@@ -911,33 +911,31 @@ static void qcom_ethqos_phy_suspend_clks(struct qcom_ethqos *ethqos)
	ETHQOSINFO("Exit\n");
}

static bool qcom_ethqos_is_phy_link_up(struct qcom_ethqos *ethqos,
				       struct net_device *ndev)
inline void *qcom_ethqos_get_priv(struct qcom_ethqos *ethqos)
{
	if (!ethqos) {
		ETHQOSINFO("ethqos addr is NULL");
		return false;
	}
	struct platform_device *pdev = ethqos->pdev;
	struct net_device *dev = platform_get_drvdata(pdev);
	struct stmmac_priv *priv = netdev_priv(dev);

	if (!ndev) {
		ETHQOSINFO("dev addr is NULL");
		return false;
	return priv;
}

inline bool qcom_ethqos_is_phy_link_up(struct qcom_ethqos *ethqos)
{
	/* PHY driver initializes phydev->link=1.
	 * So, phydev->link is 1 even on booup with no PHY connected.
	 * So, phydev->link is 1 even on bootup with no PHY connected.
	 * phydev->link is valid only after adjust_link is called once.
	 * Use (pdata->oldlink != -1) to indicate phy link is not up
	 */
	return (ethqos->oldlink != -1 && ndev->phydev && ndev->phydev->link);
	struct stmmac_priv *priv = qcom_ethqos_get_priv(ethqos);

	return (priv->dev->phydev && priv->dev->phydev->link);
}

static void qcom_ethqos_phy_resume_clks(struct qcom_ethqos *ethqos,
					struct net_device *ndev)
static void qcom_ethqos_phy_resume_clks(struct qcom_ethqos *ethqos)
{
	ETHQOSINFO("Enter\n");

	if (qcom_ethqos_is_phy_link_up(ethqos, ndev))
	if (qcom_ethqos_is_phy_link_up(ethqos))
		ethqos_update_rgmii_clk_and_bus_cfg(ethqos, ethqos->speed);
	else
		ethqos_update_rgmii_clk_and_bus_cfg(ethqos, SPEED_10);
@@ -1022,7 +1020,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
	}

	ethqos->pdev = pdev;
	ethqos->oldlink = -1;

	ethqos_init_reqgulators(ethqos);
	ethqos_init_gpio(ethqos);

@@ -1202,7 +1200,7 @@ static int qcom_ethqos_resume(struct device *dev)
		return -EINVAL;
	}

	qcom_ethqos_phy_resume_clks(ethqos, ndev);
	qcom_ethqos_phy_resume_clks(ethqos);

	ret = stmmac_resume(dev);

+3 −2
Original line number Diff line number Diff line
@@ -146,7 +146,6 @@ struct qcom_ethqos {
	unsigned long avb_class_a_intr_cnt;
	unsigned long avb_class_b_intr_cnt;

	int oldlink;
	/* saving state for Wake-on-LAN */
	int wolopts;
	/* state of enabled wol options in PHY*/
@@ -157,7 +156,6 @@ struct qcom_ethqos {
	int clks_suspended;
	/* Structure which holds done and wait members */
	struct completion clk_enable_done;

};

struct pps_cfg {
@@ -193,6 +191,9 @@ int create_pps_interrupt_device_node(dev_t *pps_dev_t,
				     struct cdev **pps_cdev,
				     struct class **pps_class,
				     char *pps_dev_node_name);
bool qcom_ethqos_is_phy_link_up(struct qcom_ethqos *ethqos);
void *qcom_ethqos_get_priv(struct qcom_ethqos *ethqos);

int ppsout_config(struct stmmac_priv *priv, struct ifr_data_struct *req);

u16 dwmac_qcom_select_queue(struct net_device *dev,