common: Move hang() to the same header as panic()
[oweals/u-boot.git] / drivers / misc / fsl_iim.c
index 44ae7b1028cc4285954dd9980e2264accd25cc21..f8075db8d5ec33973659eef9c9aa05aef1c74913 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2009-2013 ADVANSEE
  * Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
@@ -5,16 +6,15 @@
  * Based on the mpc512x iim code:
  * Copyright 2008 Silicon Turnkey Express, Inc.
  * Martha Marx <mmarx@silicontkx.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <fuse.h>
-#include <asm/errno.h>
+#include <linux/errno.h>
 #include <asm/io.h>
-#ifndef CONFIG_MPC512X
 #include <asm/arch/imx-regs.h>
+#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
+#include <asm/arch/clock.h>
 #endif
 
 /* FSL IIM-specific constants */
@@ -93,6 +93,10 @@ struct fsl_iim {
        } bank[8];
 };
 
+#if !defined(CONFIG_MX51) && !defined(CONFIG_MX53)
+#define enable_efuse_prog_supply(enable)
+#endif
+
 static int prepare_access(struct fsl_iim **regs, u32 bank, u32 word, int assert,
                                const char *caller)
 {
@@ -237,12 +241,16 @@ int fuse_prog(u32 bank, u32 word, u32 val)
        if (ret)
                return ret;
 
+       enable_efuse_prog_supply(1);
        for (bit = 0; val; bit++, val >>= 1)
                if (val & 0x01) {
                        ret = prog_bit(regs, bank, word, bit);
-                       if (ret)
+                       if (ret) {
+                               enable_efuse_prog_supply(0);
                                return ret;
+                       }
                }
+       enable_efuse_prog_supply(0);
 
        return 0;
 }