Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Rick Chen | 76c0a24 | 2017-12-26 13:55:51 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2017 Andes Technology Corporation |
| 4 | * Rick Chen, Andes Technology Corporation <rick@andestech.com> |
Rick Chen | 76c0a24 | 2017-12-26 13:55:51 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __ASM_RISCV_SYSTEM_H |
| 8 | #define __ASM_RISCV_SYSTEM_H |
| 9 | |
Ben Dooks | 0cd077d | 2023-05-05 09:02:06 +0100 | [diff] [blame] | 10 | #include <asm/csr.h> |
| 11 | |
Simon Glass | fc55736 | 2022-03-04 08:43:05 -0700 | [diff] [blame] | 12 | struct event; |
| 13 | |
Rick Chen | 76c0a24 | 2017-12-26 13:55:51 +0800 | [diff] [blame] | 14 | /* |
Ben Dooks | 0cd077d | 2023-05-05 09:02:06 +0100 | [diff] [blame] | 15 | * Interupt configuration macros |
Rick Chen | 76c0a24 | 2017-12-26 13:55:51 +0800 | [diff] [blame] | 16 | */ |
| 17 | |
Ben Dooks | 0cd077d | 2023-05-05 09:02:06 +0100 | [diff] [blame] | 18 | #define local_irq_save(__flags) \ |
| 19 | do { \ |
| 20 | __flags = csr_read_clear(CSR_SSTATUS, SR_SIE) & SR_SIE; \ |
| 21 | } while (0) |
| 22 | |
| 23 | #define local_irq_restore(__flags) \ |
| 24 | do { \ |
| 25 | csr_set(CSR_SSTATUS, __flags & SR_SIE); \ |
| 26 | } while (0) |
| 27 | |
Simon Glass | fc55736 | 2022-03-04 08:43:05 -0700 | [diff] [blame] | 28 | /* Hook to set up the CPU (called from SPL too) */ |
Simon Glass | b8357c1 | 2023-08-21 21:16:56 -0600 | [diff] [blame] | 29 | int riscv_cpu_setup(void); |
Simon Glass | fc55736 | 2022-03-04 08:43:05 -0700 | [diff] [blame] | 30 | |
Rick Chen | 76c0a24 | 2017-12-26 13:55:51 +0800 | [diff] [blame] | 31 | #endif /* __ASM_RISCV_SYSTEM_H */ |