mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 09:12:08 +02:00
cmd: Add ariscrun command for starting CPUS
CPUS is a power management co-processor on some Allwinner SoCs (H3, A83T). Signed-off-by: Ondrej Jirman <megous@megous.com>
This commit is contained in:
@@ -1691,6 +1691,15 @@ endmenu
|
|||||||
|
|
||||||
source "cmd/ti/Kconfig"
|
source "cmd/ti/Kconfig"
|
||||||
|
|
||||||
|
menu "sunxi specific command line interface"
|
||||||
|
|
||||||
|
config CMD_SUNXI_ARISC
|
||||||
|
bool "command for starting ARISC code on sunxi platforms"
|
||||||
|
help
|
||||||
|
Support for starting OpenRISC coprocessor on sunxi platforms.
|
||||||
|
|
||||||
|
endmenu
|
||||||
|
|
||||||
config CMD_BOOTSTAGE
|
config CMD_BOOTSTAGE
|
||||||
bool "Enable the 'bootstage' command"
|
bool "Enable the 'bootstage' command"
|
||||||
depends on BOOTSTAGE
|
depends on BOOTSTAGE
|
||||||
|
@@ -169,6 +169,7 @@ obj-$(CONFIG_CMD_PMIC) += pmic.o
|
|||||||
obj-$(CONFIG_CMD_REGULATOR) += regulator.o
|
obj-$(CONFIG_CMD_REGULATOR) += regulator.o
|
||||||
|
|
||||||
obj-$(CONFIG_CMD_BLOB) += blob.o
|
obj-$(CONFIG_CMD_BLOB) += blob.o
|
||||||
|
obj-$(CONFIG_CMD_SUNXI_ARISC) += sunxi-arisc.o
|
||||||
|
|
||||||
# Android Verified Boot 2.0
|
# Android Verified Boot 2.0
|
||||||
obj-$(CONFIG_CMD_AVB) += avb.o
|
obj-$(CONFIG_CMD_AVB) += avb.o
|
||||||
|
69
cmd/sunxi-arisc.c
Normal file
69
cmd/sunxi-arisc.c
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Written by Ondrej Jirman <megous@megous.com>, 2018
|
||||||
|
* SPDX-License-Identifier: GPL-2.0+
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <command.h>
|
||||||
|
#include <asm/io.h>
|
||||||
|
#include <watchdog.h>
|
||||||
|
|
||||||
|
#define R_CPUCFG_BASE 0x01f01c00
|
||||||
|
|
||||||
|
static void reset_cpus(int stop)
|
||||||
|
{
|
||||||
|
uint32_t cpu_cfg;
|
||||||
|
|
||||||
|
cpu_cfg = readl(R_CPUCFG_BASE);
|
||||||
|
cpu_cfg &= ~(1uL);
|
||||||
|
writel(cpu_cfg, R_CPUCFG_BASE);
|
||||||
|
|
||||||
|
mdelay(1);
|
||||||
|
|
||||||
|
if (!stop) {
|
||||||
|
cpu_cfg |= 1;
|
||||||
|
writel(cpu_cfg, R_CPUCFG_BASE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int do_arisc_start(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
|
||||||
|
{
|
||||||
|
reset_cpus(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int do_arisc_stop(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
|
||||||
|
{
|
||||||
|
reset_cpus(1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int do_arisc_takeover(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
|
||||||
|
{
|
||||||
|
reset_cpus(0);
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
WATCHDOG_RESET();
|
||||||
|
mdelay(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
U_BOOT_CMD(
|
||||||
|
arisc_start, 3, 1, do_arisc_start,
|
||||||
|
"reset arisc comprocessor and de-assert the reset line",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
U_BOOT_CMD(
|
||||||
|
arisc_stop, 3, 1, do_arisc_stop,
|
||||||
|
"reset arisc comprocessor and keep it reset",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
U_BOOT_CMD(
|
||||||
|
arisc_takeover, 3, 1, do_arisc_takeover,
|
||||||
|
"reset arisc comprocessor and de-assert the reset line, stop u-boot",
|
||||||
|
""
|
||||||
|
);
|
Reference in New Issue
Block a user