Commit 0b9273a3 authored by Troy Kisky's avatar Troy Kisky Committed by Kevin Hilman

ARM: DaVinci: emac: move random_ether_addr to davinci_emac

Move the creation of a random ethernet address from devices.c
into davinci_emac.c. This allows me to delete the davinci_emac_init
function and directly call the dmxxx specific function from the
board file.
Signed-off-by: default avatarTroy Kisky <troy.kisky@boundarydevices.com>
parent 2fb1d125
......@@ -704,7 +704,7 @@ static __init void davinci_evm_init(void)
davinci_setup_mmc(0, &dm6446evm_mmc_config);
davinci_serial_init(&uart_config);
davinci_init_emac(&dm644x_evm_emac_pdata);
dm644x_init_emac(&dm644x_evm_emac_pdata);
/* Register the fixup for PHY on DaVinci */
phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK,
......
......@@ -275,7 +275,7 @@ static __init void evm_init(void)
{
evm_init_i2c();
davinci_serial_init(&uart_config);
davinci_init_emac(&dm646x_evm_emac_pdata);
dm646x_init_emac(&dm646x_evm_emac_pdata);
}
static __init void davinci_dm646x_evm_irq_init(void)
......
......@@ -166,7 +166,7 @@ static __init void davinci_sffsdr_init(void)
sffsdr_init_i2c();
davinci_serial_init(&uart_config);
memcpy(sffsdr_emac_pdata.mac_addr, davinci_sffsdr_mac_addr, 6);
davinci_init_emac(&sffsdr_emac_pdata);
dm644x_init_emac(&sffsdr_emac_pdata);
setup_usb(0, 0); /* We support only peripheral mode. */
/* mux VLYNQ pins */
......
......@@ -243,37 +243,6 @@ static void davinci_init_wdt(void)
/*-------------------------------------------------------------------------*/
#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE)
void davinci_init_emac(struct emac_platform_data *pdata)
{
DECLARE_MAC_BUF(buf);
if (cpu_is_davinci_dm644x())
dm644x_init_emac(pdata);
else if (cpu_is_davinci_dm646x())
dm646x_init_emac(pdata);
/* if valid MAC exists, don't re-register */
if (is_valid_ether_addr(pdata->mac_addr))
return;
else {
/* Use random MAC if none passed */
random_ether_addr(pdata->mac_addr);
printk(KERN_WARNING "%s: using random MAC addr: %s\n",
__func__, print_mac(buf, pdata->mac_addr));
}
}
#else
void davinci_init_emac(struct emac_platform_data *unused) {}
#endif
/*-------------------------------------------------------------------------*/
static int __init davinci_init_devices(void)
{
/* please keep these calls, and their implementations above,
......
......@@ -2700,6 +2700,13 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
}
ndev->irq = res->start;
if (!is_valid_ether_addr(priv->mac_addr)) {
DECLARE_MAC_BUF(buf);
/* Use random MAC if none passed */
random_ether_addr(priv->mac_addr);
printk(KERN_WARNING "%s: using random MAC addr: %s\n",
__func__, print_mac(buf, priv->mac_addr));
}
/* populate the device structure */
ndev->validate_addr = NULL;
ndev->open = emac_dev_open; /* i.e. start device */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment