1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2014-2016, Toradex AG
7 * Helpers for i.MX OTP fusing during module production
11 #ifndef CONFIG_SPL_BUILD
15 static int mfgr_fuse(void)
19 fuse_sense(0, 5, &val);
20 printf("Fuse 0, 5: %8x\n", val);
21 fuse_sense(0, 6, &val6);
22 printf("Fuse 0, 6: %8x\n", val6);
23 fuse_sense(4, 3, &val);
24 printf("Fuse 4, 3: %8x\n", val);
25 fuse_sense(4, 2, &val);
26 printf("Fuse 4, 2: %8x\n", val);
28 puts("BT_FUSE_SEL already fused, will do nothing\n");
29 return CMD_RET_FAILURE;
32 fuse_prog(0, 5, 0x00005072);
34 fuse_prog(0, 6, 0x00000010);
35 return CMD_RET_SUCCESS;
38 int do_mfgr_fuse(cmd_tbl_t *cmdtp, int flag, int argc,
44 if (ret == CMD_RET_SUCCESS)
51 int do_updt_fuse(cmd_tbl_t *cmdtp, int flag, int argc,
56 int confirmed = argc >= 1 && !strcmp(argv[1], "-y");
58 /* can be used in scripts for command availability check */
59 if (argc >= 1 && !strcmp(argv[1], "-n"))
60 return CMD_RET_SUCCESS;
63 fuse_sense(0, 5, &val);
64 printf("Fuse 0, 5: %8x\n", val);
66 puts("Fast boot mode already fused, no need to fuse\n");
67 return CMD_RET_SUCCESS;
70 puts("Warning: Programming fuses is an irreversible operation!\n"
71 " Updating to fast boot mode prevents easy\n"
72 " downgrading to previous BSP versions.\n"
73 "\nReally perform this fuse programming? <y/N>\n");
75 return CMD_RET_FAILURE;
77 puts("Fusing fast boot mode...\n");
78 ret = fuse_prog(0, 5, 0x00005072);
79 if (ret == CMD_RET_SUCCESS)
87 mfgr_fuse, 1, 0, do_mfgr_fuse,
88 "OTP fusing during module production",
93 updt_fuse, 2, 0, do_updt_fuse,
94 "OTP fusing during module update",
95 "updt_fuse [-n] [-y] - boot cfg fast boot mode fusing"
97 #endif /* CONFIG_SPL_BUILD */