]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - board/toradex/colibri_imx6/do_fuse.c
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
16 static int mfgr_fuse(void)
20 fuse_sense(0, 5, &val
);
21 printf("Fuse 0, 5: %8x\n", val
);
22 fuse_sense(0, 6, &val6
);
23 printf("Fuse 0, 6: %8x\n", val6
);
24 fuse_sense(4, 3, &val
);
25 printf("Fuse 4, 3: %8x\n", val
);
26 fuse_sense(4, 2, &val
);
27 printf("Fuse 4, 2: %8x\n", val
);
29 puts("BT_FUSE_SEL already fused, will do nothing\n");
30 return CMD_RET_FAILURE
;
33 fuse_prog(0, 5, 0x00005062);
35 fuse_prog(0, 6, 0x00000010);
36 return CMD_RET_SUCCESS
;
39 int do_mfgr_fuse(struct cmd_tbl
*cmdtp
, int flag
, int argc
,
45 if (ret
== CMD_RET_SUCCESS
)
52 int do_updt_fuse(struct cmd_tbl
*cmdtp
, int flag
, int argc
,
57 int confirmed
= argc
>= 1 && !strcmp(argv
[1], "-y");
59 /* can be used in scripts for command availability check */
60 if (argc
>= 1 && !strcmp(argv
[1], "-n"))
61 return CMD_RET_SUCCESS
;
64 fuse_sense(0, 5, &val
);
65 printf("Fuse 0, 5: %8x\n", val
);
67 puts("Fast boot mode already fused, no need to fuse\n");
68 return CMD_RET_SUCCESS
;
71 puts("Warning: Programming fuses is an irreversible operation!\n"
72 " Updating to fast boot mode prevents easy\n"
73 " downgrading to previous BSP versions.\n"
74 "\nReally perform this fuse programming? <y/N>\n");
76 return CMD_RET_FAILURE
;
78 puts("Fusing fast boot mode...\n");
79 ret
= fuse_prog(0, 5, 0x00005072);
80 if (ret
== CMD_RET_SUCCESS
)
88 mfgr_fuse
, 1, 0, do_mfgr_fuse
,
89 "OTP fusing during module production",
94 updt_fuse
, 2, 0, do_updt_fuse
,
95 "OTP fusing during module update",
96 "updt_fuse [-n] [-y] - boot cfg fast boot mode fusing"
98 #endif /* CONFIG_SPL_BUILD */