blob: 9b92eae78180fba69de3e5a2dc55f62625628902 [file] [log] [blame]
Clement Le Marquis613cf232021-03-25 17:30:32 +08001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2018 NXP
4 */
5
6/*
7 * Boot command to get and set the PRIBLOB bitfield form the SCFGR register
8 * of the CAAM IP. It is recommended to set this bitfield to 3 once your
9 * encrypted boot image is ready, to prevent the generation of blobs usable
10 * to decrypt an encrypted boot image.
11 */
12
13#include <asm/io.h>
14#include <common.h>
15#include <command.h>
16#include "../drivers/crypto/fsl_caam_internal.h"
17
Peng Fana8f46302021-08-07 16:21:34 +080018int do_priblob_write(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
Clement Le Marquis613cf232021-03-25 17:30:32 +080019{
20 writel((readl(CAAM_SCFGR) & 0xFFFFFFFC) | 3, CAAM_SCFGR);
21 printf("New priblob setting = 0x%x\n", readl(CAAM_SCFGR) & 0x3);
22
23 return 0;
24}
25
26U_BOOT_CMD(
27 set_priblob_bitfield, 1, 0, do_priblob_write,
28 "Set the PRIBLOB bitfield to 3",
29 "<value>\n"
30 " - Write 3 in PRIBLOB bitfield of SCFGR regiter of CAAM IP.\n"
31 " Prevent the generation of blobs usable to decrypt an\n"
32 " encrypted boot image."
33);