mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From 934747eba782050ba87a29a3a59f805e36410685 Mon Sep 17 00:00:00 2001
 | |
| From: =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= <opensource@vdorst.com>
 | |
| Date: Fri, 21 Jun 2019 10:04:05 +0200
 | |
| Subject: [PATCH] net: ethernet: mediatek: support net-labels
 | |
| MIME-Version: 1.0
 | |
| Content-Type: text/plain; charset=UTF-8
 | |
| Content-Transfer-Encoding: 8bit
 | |
| 
 | |
| With this patch, device name can be set within dts file in the same way as dsa
 | |
| port can.
 | |
| Add: label = "wan"; to GMAC node.
 | |
| 
 | |
| Signed-off-by: René van Dorst <opensource@vdorst.com>
 | |
| ---
 | |
|  drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
 | |
|  1 file changed, 4 insertions(+)
 | |
| 
 | |
| diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 | |
| index c61069340f4f..87ced6269411 100644
 | |
| --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 | |
| +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 | |
| @@ -2756,6 +2756,7 @@ static const struct net_device_ops mtk_netdev_ops = {
 | |
|  
 | |
|  static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
 | |
|  {
 | |
| +	const char *name = of_get_property(np, "label", NULL);
 | |
|  	const __be32 *_id = of_get_property(np, "reg", NULL);
 | |
|  	struct phylink *phylink;
 | |
|  	int phy_mode, id, err;
 | |
| @@ -2846,6 +2847,9 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
 | |
|  	eth->netdev[id]->irq = eth->irq[0];
 | |
|  	eth->netdev[id]->dev.of_node = np;
 | |
|  
 | |
| +	if (name)
 | |
| +		strlcpy(eth->netdev[id]->name, name, IFNAMSIZ);
 | |
| +
 | |
|  	return 0;
 | |
|  
 | |
|  free_netdev:
 |