summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2016-02-11 14:37:54 +0100
committerMax Krummenacher <max.krummenacher@toradex.com>2016-03-09 15:03:33 +0100
commit3daf86f5f4ed2cee6e9578c458c5b3f558c3a06f (patch)
tree7f43efe255cb0c27021547bb377f3d6d18c87063
parentf5f3dd007a6b84af590f429fbb628677e6de6264 (diff)
colibri_imx7: add do_fuse command
Used during manufacturing for setting the boot fuses. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
-rw-r--r--board/toradex/colibri_imx7/Kconfig8
-rw-r--r--board/toradex/colibri_imx7/Makefile1
-rw-r--r--board/toradex/colibri_imx7/do_fuse.c47
3 files changed, 56 insertions, 0 deletions
diff --git a/board/toradex/colibri_imx7/Kconfig b/board/toradex/colibri_imx7/Kconfig
index 2323183039..77f0dade68 100644
--- a/board/toradex/colibri_imx7/Kconfig
+++ b/board/toradex/colibri_imx7/Kconfig
@@ -12,4 +12,12 @@ config SYS_SOC
config SYS_CONFIG_NAME
default "colibri_imx7"
+menuconfig TRDX_CMD_IMX_MFGR
+ bool "Enable factory testing commands for Toradex iMX 7[B modules"
+ help
+ This adds the command
+ mfgr_fuse: OTP fusing during module production
+ If executed on already fused modules they don't change any fuse setting.
+ default y
+
endif
diff --git a/board/toradex/colibri_imx7/Makefile b/board/toradex/colibri_imx7/Makefile
index 4b18dff37b..0e13f2440e 100644
--- a/board/toradex/colibri_imx7/Makefile
+++ b/board/toradex/colibri_imx7/Makefile
@@ -4,6 +4,7 @@
#
obj-y := colibri_imx7.o
+obj-$(CONFIG_TRDX_CMD_IMX_MFGR) += do_fuse.o
extra-$(CONFIG_USE_PLUGIN) := plugin.bin
$(obj)/plugin.bin: $(obj)/plugin.o
diff --git a/board/toradex/colibri_imx7/do_fuse.c b/board/toradex/colibri_imx7/do_fuse.c
new file mode 100644
index 0000000000..13f3efa97c
--- /dev/null
+++ b/board/toradex/colibri_imx7/do_fuse.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2016, Toradex AG
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+/*
+ * Helpers for i.MX OTP fusing during module production
+*/
+
+#include <common.h>
+#include <fuse.h>
+
+static int mfgr_fuse(void)
+{
+ unsigned val, val6;
+
+ fuse_sense(1, 3, &val);
+ printf("Fuse 1, 3: %8x\n", val);
+ if(val & 0x10000000)
+ {
+ puts("BT_FUSE_SEL already fused, will do nothing\n");
+ return CMD_RET_FAILURE;
+ }
+ /* BT_FUSE_SEL & boot cfg */
+ fuse_prog(1, 3, 0x10003400);
+ return CMD_RET_SUCCESS;
+}
+
+int do_mfgr_fuse(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ int ret;
+ puts("Fusing...\n");
+ ret = mfgr_fuse();
+ if (ret == CMD_RET_SUCCESS)
+ puts("done.\n");
+ else
+ puts("failed.\n");
+ return ret;
+}
+
+U_BOOT_CMD(
+ mfgr_fuse, 1, 0, do_mfgr_fuse,
+ "OTP fusing during module production\n",
+ ""
+);