diff options
author | Suraj Jaiswal <jsuraj@codeaurora.org> | 2019-12-23 17:07:34 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2020-01-27 22:42:04 -0800 |
commit | a95d79c6e61cc78c8c607900efa2942e6d2ee487 (patch) | |
tree | db3bd142766f00d10ba7cecb90ef155d03fa4d1d | |
parent | bdc07671ca3f0f6e5d37f667ce028fe128636679 (diff) | |
download | data-kernel-a95d79c6e61cc78c8c607900efa2942e6d2ee487.tar.gz |
data-kernel: EMAC: Etherent phy detection optimization.
Read phy address from dtis to avoid dynamic phy
detection which will reduce ethernet initialization
time.
Change-Id: I95e4386e98bebf9a71aa186b3ebd20cea758c7db
Signed-off-by: Sunil Paidimarri <hisunil@codeaurora.org>
-rw-r--r-- | drivers/emac-dwc-eqos/DWC_ETH_QOS_mdio.c | 17 | ||||
-rw-r--r-- | drivers/emac-dwc-eqos/DWC_ETH_QOS_platform.c | 10 | ||||
-rw-r--r-- | drivers/emac-dwc-eqos/DWC_ETH_QOS_yheader.h | 1 |
3 files changed, 28 insertions, 0 deletions
diff --git a/drivers/emac-dwc-eqos/DWC_ETH_QOS_mdio.c b/drivers/emac-dwc-eqos/DWC_ETH_QOS_mdio.c index faac49e..f636804 100644 --- a/drivers/emac-dwc-eqos/DWC_ETH_QOS_mdio.c +++ b/drivers/emac-dwc-eqos/DWC_ETH_QOS_mdio.c @@ -1250,6 +1250,21 @@ int DWC_ETH_QOS_mdio_register(struct net_device *dev) DBGPR_MDIO("-->DWC_ETH_QOS_mdio_register\n"); + if (pdata->res_data->phy_addr != -1) { + phy_reg_read_status = + DWC_ETH_QOS_mdio_read_direct(pdata, pdata->res_data->phy_addr, MII_BMSR, + &mii_status); + if (phy_reg_read_status == 0) { + if (mii_status != 0x0000 && mii_status != 0xffff) { + phy_detected = 1; + phyaddr = pdata->res_data->phy_addr; + EMACINFO("skip_phy_detection (phyaddr)%d\n", phyaddr); + goto skip_phy_detection; + } else + EMACERR("Invlaid phy address specified in device tree\n"); + } + } + /* find the phy ID or phy address which is connected to our MAC */ for (phyaddr = 0; phyaddr < 32; phyaddr++) { @@ -1276,6 +1291,8 @@ int DWC_ETH_QOS_mdio_register(struct net_device *dev) return -ENOLINK; } + skip_phy_detection: + pdata->phyaddr = phyaddr; pdata->bus_id = 0x1; pdata->phy_intr_en = false; diff --git a/drivers/emac-dwc-eqos/DWC_ETH_QOS_platform.c b/drivers/emac-dwc-eqos/DWC_ETH_QOS_platform.c index 50d1e55..1ef2dc4 100644 --- a/drivers/emac-dwc-eqos/DWC_ETH_QOS_platform.c +++ b/drivers/emac-dwc-eqos/DWC_ETH_QOS_platform.c @@ -920,6 +920,16 @@ static int DWC_ETH_QOS_get_dts_config(struct platform_device *pdev) dwc_eth_qos_res_data.is_pinctrl_names = true; EMACDBG("qcom,pinctrl-names present\n"); } + dwc_eth_qos_res_data.phy_addr = -1; + if (of_property_read_bool(pdev->dev.of_node, "emac-phy-addr")) { + ret = of_property_read_u32(pdev->dev.of_node, "emac-phy-addr", + &dwc_eth_qos_res_data.phy_addr); + if (ret) { + EMACINFO("Pphy_addr not specified, using dynamic phy detection\n"); + dwc_eth_qos_res_data.phy_addr = -1; + } + EMACINFO("phy_addr = %d\n", dwc_eth_qos_res_data.phy_addr); + } return ret; diff --git a/drivers/emac-dwc-eqos/DWC_ETH_QOS_yheader.h b/drivers/emac-dwc-eqos/DWC_ETH_QOS_yheader.h index ee29121..2473897 100644 --- a/drivers/emac-dwc-eqos/DWC_ETH_QOS_yheader.h +++ b/drivers/emac-dwc-eqos/DWC_ETH_QOS_yheader.h @@ -1584,6 +1584,7 @@ struct DWC_ETH_QOS_res_data { unsigned int emac_hw_version_type; bool early_eth_en; bool pps_lpass_conn_en; + int phy_addr; }; struct DWC_ETH_QOS_prv_ipa_data { |