lkml.org 
[lkml]   [2020]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] net: fec: Keep device numbering consistent with datasheet
Date
From: Christian Hemp <c.hemp@phytec.de>

Make use of device tree alias for device enumeration to keep the device
order consistent with the naming in the datasheet.

Otherwise for the i.MX 6UL/ULL the ENET1 interface is enumerated as eth1
and ENET2 as eth0.

Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
---
drivers/net/ethernet/freescale/fec_main.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index fb37816a74db..97dd41bed70a 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3504,6 +3504,7 @@ fec_probe(struct platform_device *pdev)
char irq_name[8];
int irq_cnt;
struct fec_devinfo *dev_info;
+ int eth_id;

fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs);

@@ -3691,6 +3692,10 @@ fec_probe(struct platform_device *pdev)

ndev->max_mtu = PKT_MAXBUF_SIZE - ETH_HLEN - ETH_FCS_LEN;

+ eth_id = of_alias_get_id(pdev->dev.of_node, "ethernet");
+ if (eth_id >= 0)
+ sprintf(ndev->name, "eth%d", eth_id);
+
ret = register_netdev(ndev);
if (ret)
goto failed_register;
--
2.25.1
\
 
 \ /
  Last update: 2020-09-23 16:27    [W:0.071 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site