nvethernet: get interface name from DT

Bug 200763996

Change-Id: I7a6636eeace9aff162763aa8260d9d1eda3a9216
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2587523
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Bhadram Varka
2021-09-02 00:03:59 +05:30
committed by Revanth Kumar Uppala
parent 2a68302c12
commit eee46a197b

View File

@@ -5963,6 +5963,7 @@ static int ether_probe(struct platform_device *pdev)
struct net_device *ndev;
int ret = 0, i, val;
void __iomem *reg;
const char *if_name;
/* WAR to program PAD control registers until MB1 changes done */
if (tegra_get_chip_id() == TEGRA234) {
@@ -6030,9 +6031,18 @@ static int ether_probe(struct platform_device *pdev)
return -ENOMEM;
}
/* allocate and set up the ethernet device */
ndev = alloc_etherdev_mq((int)sizeof(struct ether_priv_data),
num_dma_chans);
if_name = (const char *)of_get_property(pdev->dev.of_node,
"nvidia,if-name", NULL);
if (if_name) {
ndev = alloc_netdev_mqs((int)sizeof(struct ether_priv_data), if_name,
NET_NAME_UNKNOWN, ether_setup,
num_dma_chans, num_dma_chans);
} else {
/* allocate and set up the ethernet device */
ndev = alloc_etherdev_mq((int)sizeof(struct ether_priv_data),
num_dma_chans);
}
if (ndev == NULL) {
dev_err(&pdev->dev, "failed to allocate net device\n");
return -ENOMEM;