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

Commit 82d8d446 authored by Alok Chauhan's avatar Alok Chauhan
Browse files

msm: emac: Avoid MDIO access in suspended state



External phy driver can initiate the MDIO transfers
when EMAC controller in suspended state. This will
lead to unclock access.

Added a check for EMAC runtime PM state before
allowing MDIO access.

Change-Id: Ib1af4eefafcbab8d1bc5be3c783c9a9db1205007
Signed-off-by: default avatarAlok Chauhan <alokc@codeaurora.org>
parent 4bd5b5c3
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -78,6 +78,12 @@ static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum)
	u32 reg = 0;
	int ret = 0;

	if (pm_runtime_enabled(adpt->netdev->dev.parent) &&
	    pm_runtime_status_suspended(adpt->netdev->dev.parent)) {
		emac_dbg(adpt, hw, "EMAC in suspended state\n");
		return ret;
	}

	if (phy->external) {
		ret = emac_phy_mdio_autopoll_disable(hw);
		if (ret) {
@@ -128,6 +134,12 @@ static int emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val)
	u32 reg = 0;
	int ret = 0;

	if (pm_runtime_enabled(adpt->netdev->dev.parent) &&
	    pm_runtime_status_suspended(adpt->netdev->dev.parent)) {
		emac_dbg(adpt, hw, "EMAC in suspended state\n");
		return ret;
	}

	if (phy->external) {
		ret = emac_phy_mdio_autopoll_disable(hw);
		if (ret) {