mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-29 21:38:52 +09:00
![Tom Rini](/assets/img/avatar_default.png)
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
87 lines
1.5 KiB
C
87 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (C) Copyright 2014
|
|
* Gabriel Huau <contact@huau-gabriel.fr>
|
|
*
|
|
* (C) Copyright 2009 Freescale Semiconductor, Inc.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <asm/io.h>
|
|
#include <linux/errno.h>
|
|
#include <asm/arch/sys_proto.h>
|
|
#include <asm/arch/imx-regs.h>
|
|
|
|
#define MAX_CPUS 4
|
|
static struct src *src = (struct src *)SRC_BASE_ADDR;
|
|
|
|
static uint32_t cpu_reset_mask[MAX_CPUS] = {
|
|
0, /* We don't really want to modify the cpu0 */
|
|
SRC_SCR_CORE_1_RESET_MASK,
|
|
SRC_SCR_CORE_2_RESET_MASK,
|
|
SRC_SCR_CORE_3_RESET_MASK
|
|
};
|
|
|
|
static uint32_t cpu_ctrl_mask[MAX_CPUS] = {
|
|
0, /* We don't really want to modify the cpu0 */
|
|
SRC_SCR_CORE_1_ENABLE_MASK,
|
|
SRC_SCR_CORE_2_ENABLE_MASK,
|
|
SRC_SCR_CORE_3_ENABLE_MASK
|
|
};
|
|
|
|
int cpu_reset(int nr)
|
|
{
|
|
/* Software reset of the CPU N */
|
|
src->scr |= cpu_reset_mask[nr];
|
|
return 0;
|
|
}
|
|
|
|
int cpu_status(int nr)
|
|
{
|
|
printf("core %d => %d\n", nr, !!(src->scr & cpu_ctrl_mask[nr]));
|
|
return 0;
|
|
}
|
|
|
|
int cpu_release(int nr, int argc, char *const argv[])
|
|
{
|
|
uint32_t boot_addr;
|
|
|
|
boot_addr = simple_strtoul(argv[0], NULL, 16);
|
|
|
|
switch (nr) {
|
|
case 1:
|
|
src->gpr3 = boot_addr;
|
|
break;
|
|
case 2:
|
|
src->gpr5 = boot_addr;
|
|
break;
|
|
case 3:
|
|
src->gpr7 = boot_addr;
|
|
break;
|
|
default:
|
|
return 1;
|
|
}
|
|
|
|
/* CPU N is ready to start */
|
|
src->scr |= cpu_ctrl_mask[nr];
|
|
|
|
return 0;
|
|
}
|
|
|
|
int is_core_valid(unsigned int core)
|
|
{
|
|
uint32_t nr_cores = get_nr_cpus();
|
|
|
|
if (core > nr_cores)
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|
|
|
|
int cpu_disable(int nr)
|
|
{
|
|
/* Disable the CPU N */
|
|
src->scr &= ~cpu_ctrl_mask[nr];
|
|
return 0;
|
|
}
|