50 lines
1.5 KiB
Diff
50 lines
1.5 KiB
Diff
|
Index: net/dsa/Kconfig
|
||
|
===================================================================
|
||
|
--- net/dsa/Kconfig
|
||
|
+++ linux-imx/net/dsa/Kconfig
|
||
|
@@ -40,4 +40,9 @@ config NET_DSA_TAG_TRAILER
|
||
|
config NET_DSA_TAG_QCA
|
||
|
bool
|
||
|
|
||
|
+config NET_DSA_SLAVE_MAC
|
||
|
+ bool "DSA Extension for Tiesse TGR"
|
||
|
+ ---help---
|
||
|
+ This enables a Tiesse TGR specific mac assignement schema
|
||
|
+
|
||
|
endif
|
||
|
Index: net/dsa/slave.c
|
||
|
===================================================================
|
||
|
--- net/dsa/slave.c
|
||
|
+++ linux-imx/net/dsa/slave.c
|
||
|
@@ -27,6 +27,18 @@
|
||
|
|
||
|
static bool dsa_slave_dev_check(struct net_device *dev);
|
||
|
|
||
|
+#ifdef CONFIG_NET_DSA_SLAVE_MAC
|
||
|
+static inline void eth_hw_addr_assign(int port_index,
|
||
|
+ struct net_device *dst,
|
||
|
+ struct net_device *src)
|
||
|
+{
|
||
|
+ u64 temp = ether_addr_to_u64(src->dev_addr);
|
||
|
+ temp += port_index-1;
|
||
|
+ u64_to_ether_addr(temp, dst->dev_addr);
|
||
|
+ dst->addr_assign_type = src->addr_assign_type;
|
||
|
+}
|
||
|
+#endif
|
||
|
+
|
||
|
/* slave mii_bus handling ***************************************************/
|
||
|
static int dsa_slave_phy_read(struct mii_bus *bus, int addr, int reg)
|
||
|
{
|
||
|
@@ -1277,7 +1289,11 @@ int dsa_slave_create(struct dsa_port *po
|
||
|
slave_dev->features = master->vlan_features | NETIF_F_HW_TC;
|
||
|
slave_dev->hw_features |= NETIF_F_HW_TC;
|
||
|
slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
|
||
|
+#ifdef CONFIG_NET_DSA_SLAVE_MAC
|
||
|
+ eth_hw_addr_assign(port->index, slave_dev, master);
|
||
|
+#else
|
||
|
eth_hw_addr_inherit(slave_dev, master);
|
||
|
+#endif
|
||
|
slave_dev->priv_flags |= IFF_NO_QUEUE;
|
||
|
slave_dev->netdev_ops = &dsa_slave_netdev_ops;
|
||
|
slave_dev->switchdev_ops = &dsa_slave_switchdev_ops;
|