@@ -82,6 +82,8 @@ static unsigned char macaddr[ETH_ALEN];
module_param_array(macaddr, byte, NULL, 0);
MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
+static int dual_mac;
+
#if defined(CONFIG_M5272)
/*
* Some hardware gets it MAC address out of local flash memory.
@@ -456,6 +459,8 @@ static void
fec_stop(struct net_device *ndev)
{
struct fec_enet_private *fep = netdev_priv(ndev);
+ const struct platform_device_id *id_entry =
+ platform_get_device_id(fep->pdev);
/* We cannot expect a graceful transmit stop without link !!! */
if (fep->link) {
@@ -466,11 +471,22 @@ fec_stop(struct net_device *ndev)
printk("fec_stop : Graceful transmit stop did not complete !\n");
}
- /* Whack a reset. We should wait for this. */
- writel(FEC_ECNTRL_RESET, fep->hwp + FEC_ECNTRL);
- udelay(10);
- writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
- writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+ if ((id_entry->driver_data & FEC_QUIRK_ENET_MAC) && dual_mac &&
+ fep->pdev->id == 0) {
+ /* clear the RDAR/TDAR bits to stop recv/xmit,
+ * but do not reset the controller since the second MAC
+ * may still be using the MII interface and requires ETHER_EN
+ * on the first MAC to be asserted for MII interrupts!
+ */
+ writel(0, fep->hwp + FEC_ECNTRL);
+ writel(FEC_ECNTRL_ETHER_EN, fep->hwp + FEC_ECNTRL);
+ } else {
+ /* Whack a reset. We should wait for this. */
+ writel(FEC_ECNTRL_RESET, fep->hwp + FEC_ECNTRL);
+ udelay(10);
+ writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
+ writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+ }
}
static void
@@ -1435,6 +1461,9 @@ fec_probe(struct platform_device *pdev)
if (ret)
goto failed_register;
+ if (pdev->id > 0)
+ dual_mac = 1;
+
return 0;
failed_register: