diff options
Diffstat (limited to 'drivers/staging/fsl-dpaa2/mac')
-rw-r--r-- | drivers/staging/fsl-dpaa2/mac/mac.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/drivers/staging/fsl-dpaa2/mac/mac.c b/drivers/staging/fsl-dpaa2/mac/mac.c index 3016963..3ddf344 100644 --- a/drivers/staging/fsl-dpaa2/mac/mac.c +++ b/drivers/staging/fsl-dpaa2/mac/mac.c @@ -119,15 +119,6 @@ static void dpaa2_mac_link_changed(struct net_device *netdev) dev_err(&priv->mc_dev->dev, "dpmac_set_link_state: %d\n", err); } -#ifdef CONFIG_FSL_DPAA2_MAC_NETDEVS -static netdev_tx_t dpaa2_mac_drop_frame(struct sk_buff *skb, - struct net_device *dev) -{ - /* we don't support I/O for now, drop the frame */ - dev_kfree_skb_any(skb); - return NETDEV_TX_OK; -} - static int dpaa2_mac_open(struct net_device *netdev) { /* start PHY state machine */ @@ -152,6 +143,15 @@ done: return 0; } +#ifdef CONFIG_FSL_DPAA2_MAC_NETDEVS +static netdev_tx_t dpaa2_mac_drop_frame(struct sk_buff *skb, + struct net_device *dev) +{ + /* we don't support I/O for now, drop the frame */ + dev_kfree_skb_any(skb); + return NETDEV_TX_OK; +} + static int dpaa2_mac_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) { @@ -312,9 +312,9 @@ static int dpaa2_mac_get_sset_count(struct net_device *dev, int sset) } static const struct net_device_ops dpaa2_mac_ndo_ops = { - .ndo_start_xmit = &dpaa2_mac_drop_frame, .ndo_open = &dpaa2_mac_open, .ndo_stop = &dpaa2_mac_stop, + .ndo_start_xmit = &dpaa2_mac_drop_frame, .ndo_get_stats64 = &dpaa2_mac_get_stats, }; @@ -542,10 +542,9 @@ static int dpaa2_mac_probe(struct fsl_mc_device *mc_dev) } #endif /* CONFIG_FSL_DPAA2_MAC_NETDEVS */ - /* probe the PHY as a fixed-link if the link type declared in DPC - * explicitly mandates this + /* probe the PHY as a fixed-link if there's a phy-handle defined + * in the device tree */ - phy_node = of_parse_phandle(dpmac_node, "phy-handle", 0); if (!phy_node) { goto probe_fixed_link; @@ -597,12 +596,8 @@ probe_fixed_link: dev_info(dev, "Registered fixed PHY.\n"); } - /* start PHY state machine */ -#ifdef CONFIG_FSL_DPAA2_MAC_NETDEVS dpaa2_mac_open(netdev); -#else /* CONFIG_FSL_DPAA2_MAC_NETDEVS */ - phy_start(netdev->phydev); -#endif /* CONFIG_FSL_DPAA2_MAC_NETDEVS */ + return 0; err_defer: @@ -626,6 +621,15 @@ static int dpaa2_mac_remove(struct fsl_mc_device *mc_dev) { struct device *dev = &mc_dev->dev; struct dpaa2_mac_priv *priv = dev_get_drvdata(dev); + struct net_device *netdev = priv->netdev; + + dpaa2_mac_stop(netdev); + + if (phy_is_pseudo_fixed_link(netdev->phydev)) + fixed_phy_unregister(netdev->phydev); + else + phy_disconnect(netdev->phydev); + netdev->phydev = NULL; #ifdef CONFIG_FSL_DPAA2_MAC_NETDEVS unregister_netdev(priv->netdev); @@ -636,7 +640,6 @@ static int dpaa2_mac_remove(struct fsl_mc_device *mc_dev) free_netdev(priv->netdev); dev_set_drvdata(dev, NULL); - kfree(priv); return 0; } |