2 * Keystone EVM : Board initialization
5 * Texas Instruments Incorporated, <www.ti.com>
7 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/arch/mon.h>
13 #include <asm/arch/psc_defs.h>
14 #include <asm/arch/hardware.h>
15 #include <asm/arch/hardware.h>
18 * cpu_to_bus - swap bytes of the 32-bit data if the device is BE
19 * @ptr - array of data
20 * @length - lenght of data array
22 int cpu_to_bus(u32 *ptr, u32 length)
26 if (!(readl(KS2_DEVSTAT) & 0x1))
27 for (i = 0; i < length; i++, ptr++)
28 *ptr = cpu_to_be32(*ptr);
33 static int turn_off_myself(void)
35 printf("Turning off ourselves\r\n");
38 psc_disable_module(KS2_LPSC_TETRIS);
39 psc_disable_domain(KS2_TETRIS_PWR_DOMAIN);
45 printf("What! Should not see that\n");
49 static void turn_off_all_dsps(int num_dsps)
53 for (i = 0; i < num_dsps; i++) {
54 if (psc_disable_module(i + KS2_LPSC_GEM_0))
55 printf("Cannot disable module for #%d DSP", i);
57 if (psc_disable_domain(i + 8))
58 printf("Cannot disable domain for #%d DSP", i);
62 int do_killme_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
64 return turn_off_myself();
68 killme, 1, 0, do_killme_cmd,
69 "turn off main ARM core",
70 "turn off main ARM core. Should not live after that :(\n"
78 env = getenv("ks2_debug");
81 ks2_debug = simple_strtol(env, NULL, 0);
83 if ((ks2_debug & DBG_LEAVE_DSPS_ON) == 0)
84 turn_off_all_dsps(KS2_NUM_DSPS);