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

Commit f7c1e9eb authored by Sneh Shah's avatar Sneh Shah
Browse files

net: stmmac: Add check for micrel phy for phy interrupt



Add check for micrel phy for phy interrupt before enabling phy irq.

Change-Id: I5f850a4c4b36373676ac3bd792eac327001a0f76
Signed-off-by: default avatarSneh Shah <snehshah@codeaurora.org>
parent ecbb3684
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -1038,9 +1038,15 @@ static irqreturn_t ETHQOS_PHY_ISR(int irq, void *dev_data)
	return IRQ_HANDLED;
}

static int ethqos_phy_intr_enable(struct qcom_ethqos *ethqos)
int ethqos_phy_intr_enable(struct stmmac_priv *priv)
{
	int ret = 0;
	struct qcom_ethqos *ethqos = priv->plat->bsp_priv;

	if (ethqos_phy_intr_config(ethqos)) {
		ret = 1;
		return ret;
	}

	INIT_WORK(&ethqos->emac_phy_work, ethqos_defer_phy_isr_work);
	init_completion(&ethqos->clk_enable_done);
@@ -1052,7 +1058,6 @@ static int ethqos_phy_intr_enable(struct qcom_ethqos *ethqos)
			  ethqos->phy_intr);
		return ret;
	}

	phy_intr_en = true;
	return ret;
}
@@ -1879,10 +1884,6 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
	if (ret)
		goto err_clk;

	if (!ethqos_phy_intr_config(ethqos))
		ethqos_phy_intr_enable(ethqos);
	else
		ETHQOSERR("Phy interrupt configuration failed");
	rgmii_dump(ethqos);

	if (ethqos->emac_ver == EMAC_HW_v2_3_2) {
+0 −1
Original line number Diff line number Diff line
@@ -222,7 +222,6 @@ do {\
#define ATH8035_PHY_ID 0x004dd072
#define QCA8337_PHY_ID 0x004dd036
#define ATH8030_PHY_ID 0x004dd076
#define MICREL_PHY_ID PHY_ID_KSZ9031
#define DWC_ETH_QOS_MICREL_PHY_INTCS 0x1b
#define DWC_ETH_QOS_MICREL_PHY_CTL 0x1f
#define DWC_ETH_QOS_BASIC_STATUS     0x0001
+3 −0
Original line number Diff line number Diff line
@@ -173,9 +173,12 @@ extern struct stmmac_emb_smmu_cb_ctx stmmac_emb_smmu_ctx;
#define GET_MEM_PDEV_DEV (stmmac_emb_smmu_ctx.valid ? \
			&stmmac_emb_smmu_ctx.smmu_pdev->dev : priv->device)

#define MICREL_PHY_ID 0x00221620

int ethqos_handle_prv_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
int ethqos_init_pps(struct stmmac_priv *priv);

int ethqos_phy_intr_enable(struct stmmac_priv *priv);
extern bool phy_intr_en;
void qcom_ethqos_request_phy_wol(struct plat_stmmacenet_data *plat_dat);

+9 −0
Original line number Diff line number Diff line
@@ -1053,6 +1053,15 @@ static int stmmac_init_phy(struct net_device *dev)
	if (phydev->is_pseudo_fixed_link)
		phydev->irq = PHY_POLL;

	if (((phydev->phy_id & phydev->drv->phy_id_mask) == MICREL_PHY_ID) &&
	    !priv->plat->phy_intr_en) {
		ret = ethqos_phy_intr_enable(priv);
		if (ret)
			pr_alert("qcom-ethqos: Unable to enable PHY interrupt\n");
		else
			priv->plat->phy_intr_en = true;
	}

	if (phy_intr_en) {
		if (phydev->drv->config_intr &&
		    !phydev->drv->config_intr(phydev)) {
+1 −0
Original line number Diff line number Diff line
@@ -200,5 +200,6 @@ struct plat_stmmacenet_data {
		(struct sk_buff *skb);
	bool early_eth;
	bool crc_strip_en;
	bool phy_intr_en;
};
#endif