Marek Vasut | e39fa7d | 2018-10-03 12:44:13 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * R-Car Gen3 recovery SPL |
| 4 | * |
| 5 | * Copyright (C) 2019 Marek Vasut <marek.vasut@gmail.com> |
| 6 | */ |
| 7 | |
Simon Glass | afb0215 | 2019-12-28 10:45:01 -0700 | [diff] [blame] | 8 | #include <cpu_func.h> |
Simon Glass | 2dc9c34 | 2020-05-10 11:40:01 -0600 | [diff] [blame] | 9 | #include <image.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 10 | #include <init.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 11 | #include <log.h> |
Marek Vasut | e39fa7d | 2018-10-03 12:44:13 +0200 | [diff] [blame] | 12 | #include <asm/io.h> |
| 13 | #include <spl.h> |
Simon Glass | 4dcacfc | 2020-05-10 11:40:13 -0600 | [diff] [blame] | 14 | #include <linux/bitops.h> |
Marek Vasut | e39fa7d | 2018-10-03 12:44:13 +0200 | [diff] [blame] | 15 | |
| 16 | #define RCAR_CNTC_BASE 0xE6080000 |
| 17 | #define CNTCR_EN BIT(0) |
| 18 | |
| 19 | void board_init_f(ulong dummy) |
| 20 | { |
| 21 | writel(CNTCR_EN, RCAR_CNTC_BASE); |
| 22 | timer_init(); |
| 23 | } |
| 24 | |
| 25 | void spl_board_init(void) |
| 26 | { |
| 27 | /* UART clocks enabled and gd valid - init serial console */ |
| 28 | preloader_console_init(); |
| 29 | } |
| 30 | |
| 31 | u32 spl_boot_device(void) |
| 32 | { |
| 33 | return BOOT_DEVICE_UART; |
| 34 | } |
| 35 | |
| 36 | void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) |
| 37 | { |
| 38 | debug("image entry point: 0x%lx\n", spl_image->entry_point); |
| 39 | if (spl_image->os == IH_OS_ARM_TRUSTED_FIRMWARE) { |
| 40 | typedef void (*image_entry_arg_t)(int, int, int, int) |
| 41 | __attribute__ ((noreturn)); |
| 42 | image_entry_arg_t image_entry = |
| 43 | (image_entry_arg_t)(uintptr_t) spl_image->entry_point; |
| 44 | image_entry(IH_MAGIC, CONFIG_SPL_TEXT_BASE, 0, 0); |
| 45 | } else { |
| 46 | typedef void __noreturn (*image_entry_noargs_t)(void); |
| 47 | image_entry_noargs_t image_entry = |
| 48 | (image_entry_noargs_t)spl_image->entry_point; |
| 49 | image_entry(); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | void s_init(void) |
| 54 | { |
| 55 | } |
| 56 | |
Harald Seiler | 6f14d5f | 2020-12-15 16:47:52 +0100 | [diff] [blame] | 57 | void reset_cpu(void) |
Marek Vasut | e39fa7d | 2018-10-03 12:44:13 +0200 | [diff] [blame] | 58 | { |
| 59 | } |