aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-5.4/701-net-0163-staging-fsl-dpaa2-mac-Cleanup-code.patch
blob: 7aa7b281d918edf505cad79456e7bb3c4569d7cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
From c2dfd6095bd7f812c9a1aa4d381022579702af4d Mon Sep 17 00:00:00 2001
From: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Date: Thu, 5 Oct 2017 08:05:55 +0000
Subject: [PATCH] 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>
---
 drivers/staging/fsl-dpaa2/mac/mac.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

--- a/drivers/staging/fsl-dpaa2/mac/mac.c
+++ b/drivers/staging/fsl-dpaa2/mac/mac.c
@@ -118,15 +118,6 @@ static void dpaa2_mac_link_changed(struc
 		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 */
@@ -151,6 +142,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_link_ksettings(struct net_device *netdev,
 					struct ethtool_link_ksettings *ks)
 {
@@ -313,9 +313,9 @@ static int dpaa2_mac_get_sset_count(stru
 }
 
 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,
 };
 
@@ -545,10 +545,9 @@ static int dpaa2_mac_probe(struct fsl_mc
 	}
 #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;
@@ -599,12 +598,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: