diff mbox series

[v2,net-next] net: fec: Prevent unbind operation

Message ID 20200218153444.4899-1-festevam@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series [v2,net-next] net: fec: Prevent unbind operation | expand

Commit Message

Fabio Estevam Feb. 18, 2020, 3:34 p.m. UTC
After performing an unbind/bind operation the network is no longer
functional on i.MX6 (which has a single FEC instance):

# echo 2188000.ethernet > /sys/bus/platform/drivers/fec/unbind
# echo 2188000.ethernet > /sys/bus/platform/drivers/fec/bind
[   10.756519] pps pps0: new PPS source ptp0
[   10.792626] libphy: fec_enet_mii_bus: probed
[   10.799330] fec 2188000.ethernet eth0: registered PHC device 1
# udhcpc -i eth0
udhcpc: started, v1.31.1
[   14.985211] fec 2188000.ethernet eth0: no PHY, assuming direct connection to switch
[   14.993140] libphy: PHY fixed-0:00 not found
[   14.997643] fec 2188000.ethernet eth0: could not attach to PHY

On SoCs with two FEC instances there are some cases where one FEC instance
depends on the other one being present. One such example is i.MX28, which
has the following FEC dependency as noted in the comments:

	/*
	 * The i.MX28 dual fec interfaces are not equal.
	 * Here are the differences:
	 *
	 *  - fec0 supports MII & RMII modes while fec1 only supports RMII
	 *  - fec0 acts as the 1588 time master while fec1 is slave
	 *  - external phys can only be configured by fec0
	 *
	 * That is to say fec1 can not work independently. It only works
	 * when fec0 is working. The reason behind this design is that the
	 * second interface is added primarily for Switch mode.
	 *
	 * Because of the last point above, both phys are attached on fec0
	 * mdio interface in board design, and need to be configured by
	 * fec0 mii_bus.
	 */

Prevent the unbind operation to avoid these issues.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Changes since v1:
- Prevent unbind operation.

 drivers/net/ethernet/freescale/fec_main.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Miller Feb. 18, 2020, 8:30 p.m. UTC | #1
From: Fabio Estevam <festevam@gmail.com>
Date: Tue, 18 Feb 2020 12:34:44 -0300

> After performing an unbind/bind operation the network is no longer
> functional on i.MX6 (which has a single FEC instance):
> 
> # echo 2188000.ethernet > /sys/bus/platform/drivers/fec/unbind
> # echo 2188000.ethernet > /sys/bus/platform/drivers/fec/bind
> [   10.756519] pps pps0: new PPS source ptp0
> [   10.792626] libphy: fec_enet_mii_bus: probed
> [   10.799330] fec 2188000.ethernet eth0: registered PHC device 1
> # udhcpc -i eth0
> udhcpc: started, v1.31.1
> [   14.985211] fec 2188000.ethernet eth0: no PHY, assuming direct connection to switch
> [   14.993140] libphy: PHY fixed-0:00 not found
> [   14.997643] fec 2188000.ethernet eth0: could not attach to PHY
> 
> On SoCs with two FEC instances there are some cases where one FEC instance
> depends on the other one being present. One such example is i.MX28, which
> has the following FEC dependency as noted in the comments:
 ...
> Prevent the unbind operation to avoid these issues.
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 4432a59904c7..12edd4e358f8 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3793,6 +3793,7 @@  static struct platform_driver fec_driver = {
 		.name	= DRIVER_NAME,
 		.pm	= &fec_pm_ops,
 		.of_match_table = fec_dt_ids,
+		.suppress_bind_attrs = true,
 	},
 	.id_table = fec_devtype,
 	.probe	= fec_probe,