The following set of patches provides some cleanup and bugfixes for
drivers/net/ethernet/freescale/fec.c and makes the driver buildable as
a module.
Changes wrt v2:
- subject prefix changed to be in sync with existing commits
- added Acked-by:
Lothar WaÃmann (8):
misc cleanups
set con_id in clk_get() call to NULL
prevent dobule restart of interface on FDX/HDX change
don't request invalid IRQ
don't munge MAC address from platform data
preserve MII/RMII setting in fec_stop()
fix the .remove code
make FEC driver buildable as module
drivers/net/ethernet/freescale/Kconfig | 2 +-
drivers/net/ethernet/freescale/fec.c | 63 ++++++++++++++++++++++----------
2 files changed, 44 insertions(+), 21 deletions(-)
prevent calling request_irq() with a known invalid IRQ number and
preserve the return value of the platform_get_irq() function
Signed-off-by: Lothar Waßmann <redacted>
Acked-by: Shawn Guo <redacted>
---
drivers/net/ethernet/freescale/fec.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
@@ -972,8 +972,9 @@ static int fec_enet_mii_probe(struct net_device *ndev)}if(phy_id>=PHY_MAX_ADDR){-printk(KERN_INFO"%s: no PHY, assuming direct connection "-"to switch\n",ndev->name);+printk(KERN_INFO+"%s: no PHY, assuming direct connection to switch\n",+ndev->name);strncpy(mdio_bus_id,"0",MII_BUS_ID_SIZE);phy_id=0;}
Additionally to setting the ETHER_EN bit in FEC_ECNTRL the MII/RMII
setting in FEC_R_CNTRL needs to be preserved to keep the MII interface
functional.
Signed-off-by: Lothar Waßmann <redacted>
Tested-by: Shawn Guo <redacted>
Acked-by: Shawn Guo <redacted>
---
drivers/net/ethernet/freescale/fec.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
@@ -515,6 +515,7 @@ fec_stop(struct net_device *ndev)structfec_enet_private*fep=netdev_priv(ndev);conststructplatform_device_id*id_entry=platform_get_device_id(fep->pdev);+u32rmii_mode=readl(fep->hwp+FEC_R_CNTRL)&(1<<8);/* We cannot expect a graceful transmit stop without link !!! */if(fep->link){
@@ -531,8 +532,10 @@ fec_stop(struct net_device *ndev)writel(FEC_DEFAULT_IMASK,fep->hwp+FEC_IMASK);/* We have to keep ENET enabled to have MII interrupt stay working */-if(id_entry->driver_data&FEC_QUIRK_ENET_MAC)+if(id_entry->driver_data&FEC_QUIRK_ENET_MAC){writel(2,fep->hwp+FEC_ECNTRL);+writel(rmii_mode,fep->hwp+FEC_R_CNTRL);+}}
When the MAC address is supplied via platform_data it should be OK as
it is and should not be modified in case of a dual FEC setup.
Also copying the MAC from platform_data to the single 'macaddr'
variable will overwrite the MAC for the first interface in case of a
dual FEC setup.
Signed-off-by: Lothar Waßmann <redacted>
Acked-by: Shawn Guo <redacted>
---
drivers/net/ethernet/freescale/fec.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
The .remove code is broken in several ways.
- mdiobus_unregister() is called twice for the same object in case of dual FEC
- phy_disconnect() is being called when the PHY is already disconnected
- the requested IRQ(s) are not freed
- fec_stop() is being called with the inteface already stopped
All of those lead to kernel crashes if the remove function is actually used.
Signed-off-by: Lothar Waßmann <redacted>
Tested-by: Shawn Guo <redacted>
Acked-by: Shawn Guo <redacted>
---
drivers/net/ethernet/freescale/fec.c | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
The following set of patches provides some cleanup and bugfixes for
drivers/net/ethernet/freescale/fec.c and makes the driver buildable as
a module.
Changes wrt v2:
- subject prefix changed to be in sync with existing commits
- added Acked-by: