treewide: backport support for nvmem on non platform devices
[openwrt/staging/ldir.git] / target / linux / ipq40xx / files / drivers / net / ethernet / qualcomm / essedma / edma_axi.c
index 50335b0d14b985562e6eab855044e9ef918d0ef8..b5ca99598d1f480f86c4413d9b2001fe5a43c1f6 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/timer.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
+#include <linux/of_mdio.h>
 #include <linux/clk.h>
 #include <linux/string.h>
 #include <linux/reset.h>
@@ -713,9 +714,7 @@ static int edma_axi_probe(struct platform_device *pdev)
        struct device_node *np = pdev->dev.of_node;
        struct device_node *pnp;
        struct device_node *mdio_node = NULL;
-       struct platform_device *mdio_plat = NULL;
        struct mii_bus *miibus = NULL;
-       struct edma_mdio_data *mdio_data = NULL;
        int i, j, k, err = 0;
        int portid_bmp;
        int idx = 0, idx_mac = 0;
@@ -889,25 +888,9 @@ static int edma_axi_probe(struct platform_device *pdev)
                        goto err_mdiobus_init_fail;
                }
 
-               mdio_plat = of_find_device_by_node(mdio_node);
-               if (!mdio_plat) {
-                       dev_err(&pdev->dev,
-                               "cannot find platform device from mdio node");
-                       of_node_put(mdio_node);
-                       err = -EIO;
-                       goto err_mdiobus_init_fail;
-               }
-
-               mdio_data = dev_get_drvdata(&mdio_plat->dev);
-               if (!mdio_data) {
-                       dev_err(&pdev->dev,
-                               "cannot get mii bus reference from device data");
-                       of_node_put(mdio_node);
-                       err = -EIO;
-                       goto err_mdiobus_init_fail;
-               }
-
-               miibus = mdio_data->mii_bus;
+               miibus = of_mdio_find_bus(mdio_node);
+               if (!miibus)
+                       return -EINVAL;
        }
 
        if (of_property_read_bool(np, "qcom,single-phy") &&
@@ -922,8 +905,6 @@ static int edma_axi_probe(struct platform_device *pdev)
        }
 
        for_each_available_child_of_node(np, pnp) {
-               const char *mac_addr;
-
                /* this check is needed if parent and daughter dts have
                 * different number of gmac nodes
                 */
@@ -932,9 +913,7 @@ static int edma_axi_probe(struct platform_device *pdev)
                        break;
                }
 
-               mac_addr = of_get_mac_address(pnp);
-               if (!IS_ERR(mac_addr))
-                       memcpy(edma_netdev[idx_mac]->dev_addr, mac_addr, ETH_ALEN);
+               of_get_mac_address(pnp, edma_netdev[idx_mac]->dev_addr);
 
                idx_mac++;
        }
@@ -969,7 +948,7 @@ static int edma_axi_probe(struct platform_device *pdev)
                edma_netdev[i]->max_mtu = 9000;
                edma_netdev[i]->features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM
                                      | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_SG |
-                                     NETIF_F_TSO | NETIF_F_GRO;
+                                     NETIF_F_TSO | NETIF_F_GRO | NETIF_F_HW_VLAN_CTAG_TX;
                edma_netdev[i]->hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM |
                                NETIF_F_HW_VLAN_CTAG_RX
                                | NETIF_F_SG | NETIF_F_TSO | NETIF_F_GRO;
@@ -979,10 +958,10 @@ static int edma_axi_probe(struct platform_device *pdev)
                                             NETIF_F_TSO | NETIF_F_GRO;
 
 #ifdef CONFIG_RFS_ACCEL
-               edma_netdev[i]->features |=  NETIF_F_NTUPLE;
-               edma_netdev[i]->hw_features |=  NETIF_F_NTUPLE;
-               edma_netdev[i]->vlan_features |= NETIF_F_NTUPLE;
-               edma_netdev[i]->wanted_features |= NETIF_F_NTUPLE;
+               edma_netdev[i]->features |=  NETIF_F_NTUPLE | NETIF_F_RXHASH;
+               edma_netdev[i]->hw_features |=  NETIF_F_NTUPLE | NETIF_F_RXHASH;
+               edma_netdev[i]->vlan_features |= NETIF_F_NTUPLE | NETIF_F_RXHASH;
+               edma_netdev[i]->wanted_features |= NETIF_F_NTUPLE | NETIF_F_RXHASH;
 #endif
                edma_set_ethtool_ops(edma_netdev[i]);