1 // SPDX-License-Identifier: GPL-2.0+
4 * Gabriel Huau <contact@huau-gabriel.fr>
6 * (C) Copyright 2009 Freescale Semiconductor, Inc.
11 #include <linux/errno.h>
12 #include <asm/arch/sys_proto.h>
13 #include <asm/arch/imx-regs.h>
16 static struct src
*src
= (struct src
*)SRC_BASE_ADDR
;
18 static uint32_t cpu_reset_mask
[MAX_CPUS
] = {
19 0, /* We don't really want to modify the cpu0 */
20 SRC_SCR_CORE_1_RESET_MASK
,
21 SRC_SCR_CORE_2_RESET_MASK
,
22 SRC_SCR_CORE_3_RESET_MASK
25 static uint32_t cpu_ctrl_mask
[MAX_CPUS
] = {
26 0, /* We don't really want to modify the cpu0 */
27 SRC_SCR_CORE_1_ENABLE_MASK
,
28 SRC_SCR_CORE_2_ENABLE_MASK
,
29 SRC_SCR_CORE_3_ENABLE_MASK
34 /* Software reset of the CPU N */
35 src
->scr
|= cpu_reset_mask
[nr
];
39 int cpu_status(int nr
)
41 printf("core %d => %d\n", nr
, !!(src
->scr
& cpu_ctrl_mask
[nr
]));
45 int cpu_release(int nr
, int argc
, char *const argv
[])
49 boot_addr
= simple_strtoul(argv
[0], NULL
, 16);
53 src
->gpr3
= boot_addr
;
56 src
->gpr5
= boot_addr
;
59 src
->gpr7
= boot_addr
;
65 /* CPU N is ready to start */
66 src
->scr
|= cpu_ctrl_mask
[nr
];
71 int is_core_valid(unsigned int core
)
73 uint32_t nr_cores
= get_nr_cpus();
81 int cpu_disable(int nr
)
83 /* Disable the CPU N */
84 src
->scr
&= ~cpu_ctrl_mask
[nr
];