diff mbox series

[V2,resend,4/4] net: fec: add fuse check

Message ID 20200501140837.10326-5-peng.fan@nxp.com
State Accepted
Commit 3b26d527d355c00eb9a0b2b0c11536e4e62c10aa
Headers show
Series support i.MX module fuse | expand

Commit Message

Peng Fan May 1, 2020, 2:08 p.m. UTC
Add fuse check for fec. If the fuse indicates the module
will not work in the SoC, let's fail the initialization.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
Acked-by: Joe Hershberger <joe.hershberger at ni.com>
---
 drivers/net/fec_mxc.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Stefano Babic May 11, 2020, 10:17 a.m. UTC | #1
> Add fuse check for fec. If the fuse indicates the module
> will not work in the SoC, let's fail the initialization.
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> Acked-by: Joe Hershberger <joe.hershberger at ni.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 2c8f743a58..688dee3a02 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1195,6 +1195,13 @@  int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
 #endif
 	int ret;
 
+	if (CONFIG_IS_ENABLED(IMX_MODULE_FUSE)) {
+		if (enet_fused((ulong)addr)) {
+			printf("SoC fuse indicates Ethernet at 0x%x is unavailable.\n", addr);
+			return -ENODEV;
+		}
+	}
+
 #ifdef CONFIG_FEC_MXC_MDIO_BASE
 	/*
 	 * The i.MX28 has two ethernet interfaces, but they are not equal.
@@ -1333,6 +1340,13 @@  static int fecmxc_probe(struct udevice *dev)
 	uint32_t start;
 	int ret;
 
+	if (CONFIG_IS_ENABLED(IMX_MODULE_FUSE)) {
+		if (enet_fused((ulong)priv->eth)) {
+			printf("SoC fuse indicates Ethernet at 0x%lx is unavailable.\n", (ulong)priv->eth);
+			return -ENODEV;
+		}
+	}
+
 	if (IS_ENABLED(CONFIG_IMX8)) {
 		ret = clk_get_by_name(dev, "ipg", &priv->ipg_clk);
 		if (ret < 0) {