Skip to content

Commit

Permalink
net: fec: Use alias for device number
Browse files Browse the repository at this point in the history
Use the devicetree alias to set the ethernet device number.
Otherwise the second ethernet port has the name eth0 and the first has
the name eth1.

Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Signed-off-by: Christoph Fritz <chf@fritzc.com>
Conflicts:
        drivers/net/ethernet/freescale/fec_main.c
Signed-off-by: Jan Remmet <j.remmet@phytec.de>

Signed-off-by: Yunus Bas <y.bas@phytec.de>
Signed-off-by: Andrej Picej <andrej.picej@norik.com>
Signed-off-by: Stefan Riedmüller <s.riedmueller@phytec.de>
  • Loading branch information
FauliSchlumpf committed May 22, 2024
1 parent b5fc928 commit 21f5fec
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4304,6 +4304,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);

Expand Down Expand Up @@ -4513,6 +4514,10 @@ fec_probe(struct platform_device *pdev)
pinctrl_pm_select_sleep_state(&pdev->dev);

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)
Expand Down

0 comments on commit 21f5fec

Please sign in to comment.