mediatek: Add support for Xiaomi Redmi Router AX6S
[openwrt/staging/mkresin.git] / target / linux / layerscape / patches-5.4 / 701-net-0163-staging-fsl-dpaa2-mac-Cleanup-code.patch
1 From c2dfd6095bd7f812c9a1aa4d381022579702af4d Mon Sep 17 00:00:00 2001
2 From: Bogdan Purcareata <bogdan.purcareata@nxp.com>
3 Date: Thu, 5 Oct 2017 08:05:55 +0000
4 Subject: [PATCH] staging: fsl-dpaa2/mac: Cleanup code
5
6 - move dpaa2_mac_open and dpaa2_mac_stop out of
7 CONFIG_FSL_DPAA2_MAC_NETDEVS, since their implementation is necessary
8 regardless of it
9 - reorder ndo ops to match function implementation order
10 - update comment to describe the phy connection mode that's to be used -
11 it no longer depends on DPC, but on the device tree
12
13 Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
14 ---
15 drivers/staging/fsl-dpaa2/mac/mac.c | 31 +++++++++++++------------------
16 1 file changed, 13 insertions(+), 18 deletions(-)
17
18 --- a/drivers/staging/fsl-dpaa2/mac/mac.c
19 +++ b/drivers/staging/fsl-dpaa2/mac/mac.c
20 @@ -118,15 +118,6 @@ static void dpaa2_mac_link_changed(struc
21 dev_err(&priv->mc_dev->dev, "dpmac_set_link_state: %d\n", err);
22 }
23
24 -#ifdef CONFIG_FSL_DPAA2_MAC_NETDEVS
25 -static netdev_tx_t dpaa2_mac_drop_frame(struct sk_buff *skb,
26 - struct net_device *dev)
27 -{
28 - /* we don't support I/O for now, drop the frame */
29 - dev_kfree_skb_any(skb);
30 - return NETDEV_TX_OK;
31 -}
32 -
33 static int dpaa2_mac_open(struct net_device *netdev)
34 {
35 /* start PHY state machine */
36 @@ -151,6 +142,15 @@ done:
37 return 0;
38 }
39
40 +#ifdef CONFIG_FSL_DPAA2_MAC_NETDEVS
41 +static netdev_tx_t dpaa2_mac_drop_frame(struct sk_buff *skb,
42 + struct net_device *dev)
43 +{
44 + /* we don't support I/O for now, drop the frame */
45 + dev_kfree_skb_any(skb);
46 + return NETDEV_TX_OK;
47 +}
48 +
49 static int dpaa2_mac_get_link_ksettings(struct net_device *netdev,
50 struct ethtool_link_ksettings *ks)
51 {
52 @@ -313,9 +313,9 @@ static int dpaa2_mac_get_sset_count(stru
53 }
54
55 static const struct net_device_ops dpaa2_mac_ndo_ops = {
56 - .ndo_start_xmit = &dpaa2_mac_drop_frame,
57 .ndo_open = &dpaa2_mac_open,
58 .ndo_stop = &dpaa2_mac_stop,
59 + .ndo_start_xmit = &dpaa2_mac_drop_frame,
60 .ndo_get_stats64 = &dpaa2_mac_get_stats,
61 };
62
63 @@ -545,10 +545,9 @@ static int dpaa2_mac_probe(struct fsl_mc
64 }
65 #endif /* CONFIG_FSL_DPAA2_MAC_NETDEVS */
66
67 - /* probe the PHY as a fixed-link if the link type declared in DPC
68 - * explicitly mandates this
69 + /* probe the PHY as a fixed-link if there's a phy-handle defined
70 + * in the device tree
71 */
72 -
73 phy_node = of_parse_phandle(dpmac_node, "phy-handle", 0);
74 if (!phy_node) {
75 goto probe_fixed_link;
76 @@ -599,12 +598,8 @@ probe_fixed_link:
77 dev_info(dev, "Registered fixed PHY.\n");
78 }
79
80 - /* start PHY state machine */
81 -#ifdef CONFIG_FSL_DPAA2_MAC_NETDEVS
82 dpaa2_mac_open(netdev);
83 -#else /* CONFIG_FSL_DPAA2_MAC_NETDEVS */
84 - phy_start(netdev->phydev);
85 -#endif /* CONFIG_FSL_DPAA2_MAC_NETDEVS */
86 +
87 return 0;
88
89 err_defer: