layerscape: add patches-5.4
[openwrt/staging/wigyori.git] / target / linux / layerscape / patches-5.4 / 701-net-0163-staging-fsl-dpaa2-mac-Cleanup-code.patch
diff --git a/target/linux/layerscape/patches-5.4/701-net-0163-staging-fsl-dpaa2-mac-Cleanup-code.patch b/target/linux/layerscape/patches-5.4/701-net-0163-staging-fsl-dpaa2-mac-Cleanup-code.patch
new file mode 100644 (file)
index 0000000..7aa7b28
--- /dev/null
@@ -0,0 +1,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: