1 // SPDX-License-Identifier: GPL-2.0+
3 * K2HK: secure kernel command file
5 * (C) Copyright 2012-2014
6 * Texas Instruments Incorporated, <www.ti.com>
13 asm(".arch_extension sec\n\t");
15 static int do_mon_install(cmd_tbl_t *cmdtp, int flag, int argc,
18 u32 addr, dpsc_base = 0x1E80000, freq, load_addr, size;
20 struct image_header *header;
21 u32 ecrypt_bm_addr = 0;
26 freq = CONFIG_SYS_HZ_CLOCK;
28 addr = simple_strtoul(argv[1], NULL, 16);
30 header = (struct image_header *)addr;
32 if (image_get_magic(header) != IH_MAGIC) {
33 printf("## Please update monitor image\n");
37 load_addr = image_get_load(header);
38 size = image_get_data_size(header);
39 memcpy((void *)load_addr, (void *)(addr + sizeof(struct image_header)),
43 ecrypt_bm_addr = simple_strtoul(argv[2], NULL, 16);
45 rcode = mon_install(load_addr, dpsc_base, freq, ecrypt_bm_addr);
46 printf("## installed monitor @ 0x%x, freq [%d], status %d\n",
47 load_addr, freq, rcode);
52 U_BOOT_CMD(mon_install, 3, 0, do_mon_install,
53 "Install boot kernel at 'addr'",
57 static void core_spin(void)
68 int do_mon_power(cmd_tbl_t *cmdtp, int flag, int argc,
71 int rcode = 0, core_id, on;
79 core_id = simple_strtoul(argv[1], NULL, 16);
80 on = simple_strtoul(argv[2], NULL, 16);
83 rcode = mon_power_on(core_id, fn);
85 rcode = mon_power_off(core_id);
89 printf("core %d powered on successfully\n", core_id);
91 printf("core %d power on failure\n", core_id);
93 printf("core %d powered off successfully\n", core_id);
99 U_BOOT_CMD(mon_power, 3, 0, do_mon_power,
100 "Power On/Off secondary core",
101 "mon_power <coreid> <oper>\n"
102 "- coreid (1-3) and oper (1 - ON, 0 - OFF)\n"