Skip to content

Commit

Permalink
Merge branch 'qcom-emac-various-minor-improvements'
Browse files Browse the repository at this point in the history
Timur Tabi says:

====================
net: qcom/emac: various minor improvements

A collection of minor fixes and features to the Qualcomm Technologies
EMAC network driver.
====================

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed Jun 25, 2017
2 parents e3c42b6 + ceef551 commit cb72577
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
23 changes: 21 additions & 2 deletions drivers/net/ethernet/qualcomm/emac/emac-sgmii.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct platform_device *sgmii_pdev = NULL;
Expand All @@ -311,8 +319,19 @@ int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt)
emac_sgmii_acpi_match);

if (!dev) {
dev_err(&pdev->dev, "cannot find internal phy node\n");
return -ENODEV;
dev_warn(&pdev->dev, "cannot find internal phy node\n");
/* 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);
Expand Down
16 changes: 14 additions & 2 deletions drivers/net/ethernet/qualcomm/emac/emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,6 @@ static int emac_probe(struct platform_device *pdev)
goto err_undo_mdiobus;
}

emac_mac_reset(adpt);

/* set hw features */
netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM |
NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_RX |
Expand Down Expand Up @@ -762,6 +760,19 @@ static int emac_remove(struct platform_device *pdev)
return 0;
}

static void emac_shutdown(struct platform_device *pdev)
{
struct net_device *netdev = dev_get_drvdata(&pdev->dev);
struct emac_adapter *adpt = netdev_priv(netdev);
struct emac_sgmii *sgmii = &adpt->phy;

/* Closing the SGMII turns off its interrupts */
sgmii->close(adpt);

/* Resetting the MAC turns off all DMA and its interrupts */
emac_mac_reset(adpt);
}

static struct platform_driver emac_platform_driver = {
.probe = emac_probe,
.remove = emac_remove,
Expand All @@ -770,6 +781,7 @@ static struct platform_driver emac_platform_driver = {
.of_match_table = emac_dt_match,
.acpi_match_table = ACPI_PTR(emac_acpi_match),
},
.shutdown = emac_shutdown,
};

module_platform_driver(emac_platform_driver);
Expand Down

0 comments on commit cb72577

Please sign in to comment.