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

Commit 454e55be authored by Alok Chauhan's avatar Alok Chauhan
Browse files

msm: emac: Fix crash during unloading of emac module



Due to wrong ephy id check the phy connect/disconnect
sequence is going out of sync and causing crash while
unloading of emac driver module. Lower MDIO clock
rate also causes emac to not communicate properly.

Add the correct ephy id check and change MDIO clock rate.

Change-Id: If72addc91a6e5ecba1e697338fe76047976e8b38
Signed-off-by: default avatarAlok Chauhan <alokc@codeaurora.org>
parent c84700b1
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -108,9 +108,7 @@ bool emac_hw_read_tx_tstamp(struct emac_hw *hw, struct emac_hwtxtstamp *ts);
#define DMAR_DLY_CNT_DEF                15
#define DMAW_DLY_CNT_DEF                4

#define MDIO_CLK_25_8                   3
#define MDIO_CLK_25_10                  4
#define MDIO_CLK_25_28                  7
#define MDIO_CLK_25_4                   0

#define RXQ0_RSS_HSTYP_IPV6_TCP_EN      0x20
#define RXQ0_RSS_HSTYP_IPV6_EN          0x10
+10 −4
Original line number Diff line number Diff line
@@ -1991,7 +1991,9 @@ void emac_mac_down(struct emac_adapter *adpt, u32 ctrl)
		if (adpt->irq[i].irq)
			free_irq(adpt->irq[i].irq, &adpt->irq[i]);

	if ((ATH8030_PHY_ID == adpt->phydev->phy_id) &&
	if (((ATH8030_PHY_ID == adpt->phydev->phy_id) ||
	     (ATH8031_PHY_ID == adpt->phydev->phy_id) ||
	     (ATH8035_PHY_ID == adpt->phydev->phy_id)) &&
	   (adpt->phy.is_ext_phy_connect)) {
		phy_disconnect(adpt->phydev);
		adpt->phy.is_ext_phy_connect = 0;
@@ -3212,10 +3214,14 @@ err_undo_napi:
err_init_mdio_gpio:
	adpt->gpio_off(adpt, true, true);
err_clk_init:
	if (ATH8030_PHY_ID == adpt->phydev->phy_id)
	if ((ATH8030_PHY_ID == adpt->phydev->phy_id) ||
	    (ATH8031_PHY_ID == adpt->phydev->phy_id) ||
	    (ATH8035_PHY_ID == adpt->phydev->phy_id))
		emac_disable_clks(adpt);
err_ldo_init:
	if (ATH8030_PHY_ID == adpt->phydev->phy_id)
	if ((ATH8030_PHY_ID == adpt->phydev->phy_id) ||
	    (ATH8031_PHY_ID == adpt->phydev->phy_id) ||
	    (ATH8035_PHY_ID == adpt->phydev->phy_id))
		emac_disable_regulator(adpt, EMAC_VREG1, EMAC_VREG5);
err_get_resource:
	free_netdev(netdev);
+2 −2
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum)
	reg = reg & ~(MDIO_REG_ADDR_BMSK | MDIO_CLK_SEL_BMSK |
			MDIO_MODE | MDIO_PR);
	reg = SUP_PREAMBLE |
	      ((MDIO_CLK_25_10 << MDIO_CLK_SEL_SHFT) & MDIO_CLK_SEL_BMSK) |
	      ((MDIO_CLK_25_4 << MDIO_CLK_SEL_SHFT) & MDIO_CLK_SEL_BMSK) |
	      ((regnum << MDIO_REG_ADDR_SHFT) & MDIO_REG_ADDR_BMSK) |
	      MDIO_START | MDIO_RD_NWR;

@@ -156,7 +156,7 @@ static int emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val)
	reg = reg & ~(MDIO_REG_ADDR_BMSK | MDIO_CLK_SEL_BMSK |
		MDIO_DATA_BMSK | MDIO_MODE | MDIO_PR);
	reg = SUP_PREAMBLE |
	((MDIO_CLK_25_10 << MDIO_CLK_SEL_SHFT) & MDIO_CLK_SEL_BMSK) |
	((MDIO_CLK_25_4 << MDIO_CLK_SEL_SHFT) & MDIO_CLK_SEL_BMSK) |
	((regnum << MDIO_REG_ADDR_SHFT) & MDIO_REG_ADDR_BMSK) |
	((val << MDIO_DATA_SHFT) & MDIO_DATA_BMSK) |
	MDIO_START;
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@

#define QCA8337_PHY_ID		0x004dd036
#define ATH8030_PHY_ID		0x004dd076
#define ATH8031_PHY_ID		0x004dd074
#define ATH8035_PHY_ID		0x004dd072
#define QCA8337_ID_QCA8337	0x13
#define QCA8337_NUM_PORTS					7
/* Make sure that port0 is the cpu port */