From 119db1915caf1bfa42ae9e6d331d693c8585a5f4 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Wed, 30 Mar 2016 17:48:11 +0200 Subject: apalis/colibri_imx6: adding update fusing command Adding update fusing command to assist in updating modules to the fast boot mode as per the following article on our developer website: http://developer.toradex.com/knowledge-base/linux-booting#eMMC_Fast_Boot_Mode_ApalisColibri_iMX6 Signed-off-by: Marcel Ziswiler Acked-by: Max Krummenacher --- board/toradex/apalis_imx6/do_fuse.c | 44 +++++++++++++++++++++++++++++++++--- board/toradex/colibri_imx6/do_fuse.c | 44 +++++++++++++++++++++++++++++++++--- 2 files changed, 82 insertions(+), 6 deletions(-) diff --git a/board/toradex/apalis_imx6/do_fuse.c b/board/toradex/apalis_imx6/do_fuse.c index 8595fefe48..57e0b07713 100644 --- a/board/toradex/apalis_imx6/do_fuse.c +++ b/board/toradex/apalis_imx6/do_fuse.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014, Toradex AG + * Copyright (C) 2014-2016, Toradex AG * * SPDX-License-Identifier: GPL-2.0+ */ @@ -29,7 +29,7 @@ static int mfgr_fuse(void) return CMD_RET_FAILURE; } /* boot cfg */ - fuse_prog(0, 5, 0x00005062); + fuse_prog(0, 5, 0x00005072); /* BT_FUSE_SEL */ fuse_prog(0, 6, 0x00000010); return CMD_RET_SUCCESS; @@ -48,8 +48,46 @@ int do_mfgr_fuse(cmd_tbl_t *cmdtp, int flag, int argc, 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"); + + /* 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? \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\n", + "OTP fusing during module production", "" ); + +U_BOOT_CMD( + updt_fuse, 2, 0, do_updt_fuse, + "OTP fusing during module update", + "updt_fuse [-y] - boot cfg fast boot mode fusing" +); diff --git a/board/toradex/colibri_imx6/do_fuse.c b/board/toradex/colibri_imx6/do_fuse.c index 8595fefe48..57e0b07713 100644 --- a/board/toradex/colibri_imx6/do_fuse.c +++ b/board/toradex/colibri_imx6/do_fuse.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014, Toradex AG + * Copyright (C) 2014-2016, Toradex AG * * SPDX-License-Identifier: GPL-2.0+ */ @@ -29,7 +29,7 @@ static int mfgr_fuse(void) return CMD_RET_FAILURE; } /* boot cfg */ - fuse_prog(0, 5, 0x00005062); + fuse_prog(0, 5, 0x00005072); /* BT_FUSE_SEL */ fuse_prog(0, 6, 0x00000010); return CMD_RET_SUCCESS; @@ -48,8 +48,46 @@ int do_mfgr_fuse(cmd_tbl_t *cmdtp, int flag, int argc, 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"); + + /* 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? \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\n", + "OTP fusing during module production", "" ); + +U_BOOT_CMD( + updt_fuse, 2, 0, do_updt_fuse, + "OTP fusing during module update", + "updt_fuse [-y] - boot cfg fast boot mode fusing" +); -- cgit v1.2.3