Commit ceef551f authored by Timur Tabi's avatar Timur Tabi Committed by David S. Miller

net: qcom/emac: add support for emulation systems

On emulation systems, the EMAC's internal PHY ("SGMII") is not present,
but is not needed for network functionality.  So just display a warning
message and ignore the SGMII.
Tested-by: default avatarPhilip Elcan <pelcan@codeaurora.org>
Tested-by: default avatarAdam Wallis <awallis@codeaurora.org>
Signed-off-by: default avatarTimur Tabi <timur@codeaurora.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 867ae6ab
...@@ -297,6 +297,14 @@ static const struct of_device_id emac_sgmii_dt_match[] = { ...@@ -297,6 +297,14 @@ static const struct of_device_id emac_sgmii_dt_match[] = {
{} {}
}; };
/* Dummy function for systems without an internal PHY. This avoids having
* to check for NULL pointers before calling the functions.
*/
static int emac_sgmii_dummy(struct emac_adapter *adpt)
{
return 0;
}
int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt) int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt)
{ {
struct platform_device *sgmii_pdev = NULL; struct platform_device *sgmii_pdev = NULL;
...@@ -311,8 +319,19 @@ int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt) ...@@ -311,8 +319,19 @@ int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt)
emac_sgmii_acpi_match); emac_sgmii_acpi_match);
if (!dev) { if (!dev) {
dev_err(&pdev->dev, "cannot find internal phy node\n"); dev_warn(&pdev->dev, "cannot find internal phy node\n");
return -ENODEV; /* There is typically no internal PHY on emulation
* systems, so if we can't find the node, assume
* we are on an emulation system and stub-out
* support for the internal PHY. These systems only
* use ACPI.
*/
phy->open = emac_sgmii_dummy;
phy->close = emac_sgmii_dummy;
phy->link_up = emac_sgmii_dummy;
phy->link_down = emac_sgmii_dummy;
return 0;
} }
sgmii_pdev = to_platform_device(dev); sgmii_pdev = to_platform_device(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment