cmd: rk_secure_storage: dump data which is written in OTP or efuse
Change-Id: I644add22f3aaed546d727de7727d3230ae1a6c01 Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
parent
95e4d4078e
commit
2b4182c1ed
|
|
@ -930,6 +930,11 @@ config CMD_RKSFC
|
||||||
help
|
help
|
||||||
Rockchip SFC device support
|
Rockchip SFC device support
|
||||||
|
|
||||||
|
config CMD_RK_SECURE_STORAGE
|
||||||
|
bool "dump rockchip efuse/otp content"
|
||||||
|
help
|
||||||
|
Dump the data which is written in OTP or efuse.
|
||||||
|
|
||||||
config CMD_SATA
|
config CMD_SATA
|
||||||
bool "sata - Access SATA subsystem"
|
bool "sata - Access SATA subsystem"
|
||||||
select SATA
|
select SATA
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ obj-$(CONFIG_CMD_NVME) += nvme.o
|
||||||
obj-$(CONFIG_CMD_ROCKUSB) += rockusb.o
|
obj-$(CONFIG_CMD_ROCKUSB) += rockusb.o
|
||||||
obj-$(CONFIG_CMD_RKNAND) += rknand.o
|
obj-$(CONFIG_CMD_RKNAND) += rknand.o
|
||||||
obj-$(CONFIG_CMD_RKSFC) += rksfc.o
|
obj-$(CONFIG_CMD_RKSFC) += rksfc.o
|
||||||
|
obj-$(CONFIG_CMD_RK_SECURE_STORAGE) += rk_secure_storage.o
|
||||||
obj-$(CONFIG_CMD_SF) += sf.o
|
obj-$(CONFIG_CMD_SF) += sf.o
|
||||||
obj-$(CONFIG_CMD_SCSI) += scsi.o disk.o
|
obj-$(CONFIG_CMD_SCSI) += scsi.o disk.o
|
||||||
obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o
|
obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <command.h>
|
||||||
|
#include <dm.h>
|
||||||
|
#include <misc.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_ROCKCHIP_OTP
|
||||||
|
static int dump_otps(cmd_tbl_t *cmdtp, int flag,
|
||||||
|
int argc, char * const argv[])
|
||||||
|
{
|
||||||
|
struct udevice *dev;
|
||||||
|
u8 otps[64] = {0};
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* retrieve the device */
|
||||||
|
ret = uclass_get_device_by_driver(UCLASS_MISC,
|
||||||
|
DM_GET_DRIVER(rockchip_otp), &dev);
|
||||||
|
if (ret) {
|
||||||
|
printf("%s: no misc-device found\n", __func__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = misc_read(dev, 0, &otps, sizeof(otps));
|
||||||
|
if (ret) {
|
||||||
|
printf("%s: misc_read failed\n", __func__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("otp-contents:\n");
|
||||||
|
print_buffer(0, otps, 1, 64, 16);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
U_BOOT_CMD(
|
||||||
|
rockchip_dump_otps, 1, 1, dump_otps,
|
||||||
|
"Dump the content of the otps",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ROCKCHIP_EFUSE
|
||||||
|
static int dump_efuses(cmd_tbl_t *cmdtp, int flag,
|
||||||
|
int argc, char * const argv[])
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* N.B.: This function is tailored towards the RK3399 and assumes that
|
||||||
|
* there's always 32 fuses x 32 bits (i.e. 128 bytes of data) to
|
||||||
|
* be read.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct udevice *dev;
|
||||||
|
u8 fuses[128] = {0};
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* retrieve the device */
|
||||||
|
ret = uclass_get_device_by_driver(UCLASS_MISC,
|
||||||
|
DM_GET_DRIVER(rockchip_efuse), &dev);
|
||||||
|
if (ret) {
|
||||||
|
printf("%s: no misc-device found\n", __func__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = misc_read(dev, 0, &fuses, sizeof(fuses));
|
||||||
|
if (ret) {
|
||||||
|
printf("%s: misc_read failed\n", __func__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("efuse-contents:\n");
|
||||||
|
print_buffer(0, fuses, 1, 128, 16);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
U_BOOT_CMD(
|
||||||
|
rockchip_dump_efuses, 1, 1, dump_efuses,
|
||||||
|
"Dump the content of the efuses",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue