3 * Gabriel Huau <contact@huau-gabriel.fr>
5 * (C) Copyright 2009 Freescale Semiconductor, Inc.
7 * SPDX-License-Identifier: GPL-2.0+
12 #include <linux/errno.h>
13 #include <asm/arch/sys_proto.h>
14 #include <asm/arch/imx-regs.h>
17 static struct src *src = (struct src *)SRC_BASE_ADDR;
19 static uint32_t cpu_reset_mask[MAX_CPUS] = {
20 0, /* We don't really want to modify the cpu0 */
21 SRC_SCR_CORE_1_RESET_MASK,
22 SRC_SCR_CORE_2_RESET_MASK,
23 SRC_SCR_CORE_3_RESET_MASK
26 static uint32_t cpu_ctrl_mask[MAX_CPUS] = {
27 0, /* We don't really want to modify the cpu0 */
28 SRC_SCR_CORE_1_ENABLE_MASK,
29 SRC_SCR_CORE_2_ENABLE_MASK,
30 SRC_SCR_CORE_3_ENABLE_MASK
35 /* Software reset of the CPU N */
36 src->scr |= cpu_reset_mask[nr];
40 int cpu_status(int nr)
42 printf("core %d => %d\n", nr, !!(src->scr & cpu_ctrl_mask[nr]));
46 int cpu_release(int nr, int argc, char *const argv[])
50 boot_addr = simple_strtoul(argv[0], NULL, 16);
54 src->gpr3 = boot_addr;
57 src->gpr5 = boot_addr;
60 src->gpr7 = boot_addr;
66 /* CPU N is ready to start */
67 src->scr |= cpu_ctrl_mask[nr];
72 int is_core_valid(unsigned int core)
74 uint32_t nr_cores = get_nr_cpus();
82 int cpu_disable(int nr)
84 /* Disable the CPU N */
85 src->scr &= ~cpu_ctrl_mask[nr];