]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: fec: add fuse check
authorPeng Fan <peng.fan@nxp.com>
Fri, 1 May 2020 14:08:37 +0000 (22:08 +0800)
committerStefano Babic <sbabic@denx.de>
Sun, 10 May 2020 11:21:34 +0000 (13:21 +0200)
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@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/fec_mxc.c

index 345d37be4e825ddde165b033c47142a499b8e592..3046305cfb65b827f306223af81f20392e699c14 100644 (file)
@@ -1204,6 +1204,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@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.
@@ -1342,6 +1349,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@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) {