summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBogdan Purcareata <bogdan.purcareata@nxp.com>2017-10-05 08:05:55 (GMT)
committerXie Xiaobo <xiaobo.xie@nxp.com>2017-12-12 07:32:43 (GMT)
commit59588e43bc30b522f012a6e4b0c5142264498987 (patch)
tree501e8e16c2d8180df2d3873f99c0c8c3307312eb
parent818a4151170855edb66a1de95f566b400b64d009 (diff)
downloadlinux-59588e43bc30b522f012a6e4b0c5142264498987.tar.xz
staging: fsl-dpaa2/mac: Cleanup code
- move dpaa2_mac_open and dpaa2_mac_stop out of CONFIG_FSL_DPAA2_MAC_NETDEVS, since their implementation is necessary regardless of it - reorder ndo ops to match function implementation order - update comment to describe the phy connection mode that's to be used - it no longer depends on DPC, but on the device tree Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
-rw-r--r--drivers/staging/fsl-dpaa2/mac/mac.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/staging/fsl-dpaa2/mac/mac.c b/drivers/staging/fsl-dpaa2/mac/mac.c
index a3b458a..50fccbd 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: