diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/include/asm/arch-stv0991/stv0991_gpt.h | 1 | ||||
-rw-r--r-- | arch/arm/lib/spl.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-exynos/mmu-arm64.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-meson/sm.c | 68 | ||||
-rw-r--r-- | arch/arm/mach-sunxi/board.c | 2 |
6 files changed, 79 insertions, 8 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9f20f32f3c..f7f03837fe 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1084,6 +1084,9 @@ config ARCH_SUNXI imply SPL_MMC if MMC imply SPL_POWER imply SPL_SERIAL + imply SYSRESET + imply SYSRESET_WATCHDOG + imply SYSRESET_WATCHDOG_AUTO imply USB_GADGET imply WDT diff --git a/arch/arm/include/asm/arch-stv0991/stv0991_gpt.h b/arch/arm/include/asm/arch-stv0991/stv0991_gpt.h index f1d5667c32..5b12d90d58 100644 --- a/arch/arm/include/asm/arch-stv0991/stv0991_gpt.h +++ b/arch/arm/include/asm/arch-stv0991/stv0991_gpt.h @@ -36,7 +36,6 @@ struct gpt_regs *const gpt1_regs_ptr = #define GPT_FREE_RUNNING 0xFFFF /* Timer, HZ specific defines */ -#define CONFIG_SYS_HZ 1000 #define CONFIG_SYS_HZ_CLOCK ((27 * 1000 * 1000) / GPT_PRESCALER_128) #endif diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c index 4f9b84ba34..b13897495d 100644 --- a/arch/arm/lib/spl.c +++ b/arch/arm/lib/spl.c @@ -50,7 +50,7 @@ void __weak board_init_f(ulong dummy) * This function jumps to an image with argument. Normally an FDT or ATAGS * image. */ -#ifdef CONFIG_SPL_OS_BOOT +#if CONFIG_IS_ENABLED(OS_BOOT) #ifdef CONFIG_ARM64 void __noreturn jump_to_image_linux(struct spl_image_info *spl_image) { diff --git a/arch/arm/mach-exynos/mmu-arm64.c b/arch/arm/mach-exynos/mmu-arm64.c index e3bd995143..d2c550b27d 100644 --- a/arch/arm/mach-exynos/mmu-arm64.c +++ b/arch/arm/mach-exynos/mmu-arm64.c @@ -7,7 +7,8 @@ #include <common.h> #include <asm/armv8/mmu.h> -#ifdef CONFIG_EXYNOS7420 +#if CONFIG_IS_ENABLED(EXYNOS7420) + static struct mm_region exynos7420_mem_map[] = { { .virt = 0x10000000UL, @@ -28,9 +29,9 @@ static struct mm_region exynos7420_mem_map[] = { }; struct mm_region *mem_map = exynos7420_mem_map; -#endif -#ifdef CONFIG_EXYNOS7870 +#elif CONFIG_IS_ENABLED(EXYNOS7870) + static struct mm_region exynos7870_mem_map[] = { { .virt = 0x10000000UL, @@ -61,9 +62,9 @@ static struct mm_region exynos7870_mem_map[] = { }; struct mm_region *mem_map = exynos7870_mem_map; -#endif -#ifdef CONFIG_EXYNOS7880 +#elif CONFIG_IS_ENABLED(EXYNOS7880) + static struct mm_region exynos7880_mem_map[] = { { .virt = 0x10000000UL, diff --git a/arch/arm/mach-meson/sm.c b/arch/arm/mach-meson/sm.c index 1a8f23cb1f..6c28c0f5e4 100644 --- a/arch/arm/mach-meson/sm.c +++ b/arch/arm/mach-meson/sm.c @@ -68,6 +68,26 @@ ssize_t meson_sm_read_efuse(uintptr_t offset, void *buffer, size_t size) return regs.regs[0]; } +ssize_t meson_sm_write_efuse(uintptr_t offset, void *buffer, size_t size) +{ + struct pt_regs regs; + + meson_init_shmem(); + + memcpy(shmem_input, buffer, size); + + regs.regs[0] = FN_EFUSE_WRITE; + regs.regs[1] = offset; + regs.regs[2] = size; + + smc_call(®s); + + if (regs.regs[0] == 0) + return -1; + + return 0; +} + #define SM_CHIP_ID_LENGTH 119 #define SM_CHIP_ID_OFFSET 4 #define SM_CHIP_ID_SIZE 12 @@ -187,9 +207,53 @@ static int do_sm_reboot_reason(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_SUCCESS; } +static int do_efuse_read(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + ulong address, offset, size; + int ret; + + if (argc < 4) + return CMD_RET_USAGE; + + offset = simple_strtoul(argv[1], NULL, 0); + size = simple_strtoul(argv[2], NULL, 0); + + address = simple_strtoul(argv[3], NULL, 0); + + ret = meson_sm_read_efuse(offset, (void *)address, size); + if (ret) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; +} + +static int do_efuse_write(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + ulong address, offset, size; + int ret; + + if (argc < 4) + return CMD_RET_USAGE; + + offset = simple_strtoul(argv[1], NULL, 0); + size = simple_strtoul(argv[2], NULL, 0); + + address = simple_strtoul(argv[3], NULL, 0); + + ret = meson_sm_write_efuse(offset, (void *)address, size); + if (ret) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; +} + static struct cmd_tbl cmd_sm_sub[] = { U_BOOT_CMD_MKENT(serial, 2, 1, do_sm_serial, "", ""), U_BOOT_CMD_MKENT(reboot_reason, 1, 1, do_sm_reboot_reason, "", ""), + U_BOOT_CMD_MKENT(efuseread, 4, 1, do_efuse_read, "", ""), + U_BOOT_CMD_MKENT(efusewrite, 4, 0, do_efuse_write, "", ""), }; static int do_sm(struct cmd_tbl *cmdtp, int flag, int argc, @@ -216,5 +280,7 @@ U_BOOT_CMD( sm, 5, 0, do_sm, "Secure Monitor Control", "serial <address> - read chip unique id to memory address\n" - "sm reboot_reason [name] - get reboot reason and store to to environment" + "sm reboot_reason [name] - get reboot reason and store to to environment\n" + "sm efuseread <offset> <size> <address> - read efuse to memory address\n" + "sm efusewrite <offset> <size> <address> - write into efuse from memory address" ); diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c index b4ba2a72c4..3ef179742c 100644 --- a/arch/arm/mach-sunxi/board.c +++ b/arch/arm/mach-sunxi/board.c @@ -346,6 +346,7 @@ void board_init_f(ulong dummy) } #endif +#if !CONFIG_IS_ENABLED(SYSRESET) void reset_cpu(void) { #if defined(CONFIG_SUNXI_GEN_SUN4I) || defined(CONFIG_MACH_SUN8I_R40) @@ -376,6 +377,7 @@ void reset_cpu(void) while (1) { } #endif } +#endif #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) && !defined(CONFIG_ARM64) void enable_caches(void) |