summaryrefslogtreecommitdiff
path: root/board/toradex/colibri_imx6/do_fuse.c
diff options
context:
space:
mode:
authorMax Krummenacher <max.oss.09@gmail.com>2016-11-30 19:43:09 +0100
committerStefano Babic <sbabic@denx.de>2016-12-16 10:03:43 +0100
commita02d517b0182f83771565eba1329fb323674ec58 (patch)
treedbe6ce15d9d7d1418056935fd69dd8b5ee0cd917 /board/toradex/colibri_imx6/do_fuse.c
parent592f4aed6db765172e21f228800b49f9a27ff201 (diff)
downloadu-boot-imx-a02d517b0182f83771565eba1329fb323674ec58.zip
u-boot-imx-a02d517b0182f83771565eba1329fb323674ec58.tar.gz
u-boot-imx-a02d517b0182f83771565eba1329fb323674ec58.tar.bz2
arm: imx: initial support for colibri imx6
This adds board support for the Toradex module family Colibri iMX6. The familiy consists of a module with i.MX6 DualLite, i.MX6 Solo, both with a version for commercial and industrial temperature range. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Diffstat (limited to 'board/toradex/colibri_imx6/do_fuse.c')
-rw-r--r--board/toradex/colibri_imx6/do_fuse.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/board/toradex/colibri_imx6/do_fuse.c b/board/toradex/colibri_imx6/do_fuse.c
new file mode 100644
index 0000000..cff07e9
--- /dev/null
+++ b/board/toradex/colibri_imx6/do_fuse.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2014-2016, Toradex AG
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+/*
+ * Helpers for i.MX OTP fusing during module production
+*/
+
+#include <common.h>
+#ifndef CONFIG_SPL_BUILD
+#include <console.h>
+#include <fuse.h>
+
+static int mfgr_fuse(void)
+{
+ unsigned val, val6;
+
+ fuse_sense(0, 5, &val);
+ printf("Fuse 0, 5: %8x\n", val);
+ fuse_sense(0, 6, &val6);
+ printf("Fuse 0, 6: %8x\n", val6);
+ fuse_sense(4, 3, &val);
+ printf("Fuse 4, 3: %8x\n", val);
+ fuse_sense(4, 2, &val);
+ printf("Fuse 4, 2: %8x\n", val);
+ if (val6 & 0x10) {
+ puts("BT_FUSE_SEL already fused, will do nothing\n");
+ return CMD_RET_FAILURE;
+ }
+ /* boot cfg */
+ fuse_prog(0, 5, 0x00005072);
+ /* BT_FUSE_SEL */
+ fuse_prog(0, 6, 0x00000010);
+ 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;
+}
+
+int do_updt_fuse(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ unsigned val;
+ int ret;
+ int confirmed = argc >= 1 && !strcmp(argv[1], "-y");
+
+ /* can be used in scripts for command availability check */
+ if (argc >= 1 && !strcmp(argv[1], "-n"))
+ return CMD_RET_SUCCESS;
+
+ /* boot cfg */
+ fuse_sense(0, 5, &val);
+ printf("Fuse 0, 5: %8x\n", val);
+ if (val & 0x10) {
+ puts("Fast boot mode already fused, no need to fuse\n");
+ return CMD_RET_SUCCESS;
+ }
+ if (!confirmed) {
+ puts("Warning: Programming fuses is an irreversible operation!\n"
+ " Updating to fast boot mode prevents easy\n"
+ " downgrading to previous BSP versions.\n"
+ "\nReally perform this fuse programming? <y/N>\n");
+ if (!confirm_yesno())
+ return CMD_RET_FAILURE;
+ }
+ puts("Fusing fast boot mode...\n");
+ ret = fuse_prog(0, 5, 0x00005072);
+ 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",
+ ""
+);
+
+U_BOOT_CMD(
+ updt_fuse, 2, 0, do_updt_fuse,
+ "OTP fusing during module update",
+ "updt_fuse [-n] [-y] - boot cfg fast boot mode fusing"
+);
+#endif /* CONFIG_SPL_BUILD */