blob: 87a804bfd5f7391f5e88bc40a74c4cc10102a2aa [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Rick Chen76c0a242017-12-26 13:55:51 +08002/*
3 * Copyright (C) 2017 Andes Technology Corporation
4 * Rick Chen, Andes Technology Corporation <rick@andestech.com>
Rick Chen76c0a242017-12-26 13:55:51 +08005 */
6
7#ifndef __ASM_RISCV_SYSTEM_H
8#define __ASM_RISCV_SYSTEM_H
9
Ben Dooks0cd077d2023-05-05 09:02:06 +010010#include <asm/csr.h>
11
Simon Glassfc557362022-03-04 08:43:05 -070012struct event;
13
Rick Chen76c0a242017-12-26 13:55:51 +080014/*
Ben Dooks0cd077d2023-05-05 09:02:06 +010015 * Interupt configuration macros
Rick Chen76c0a242017-12-26 13:55:51 +080016 */
17
Ben Dooks0cd077d2023-05-05 09:02:06 +010018#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 Glassfc557362022-03-04 08:43:05 -070028/* Hook to set up the CPU (called from SPL too) */
Simon Glassb8357c12023-08-21 21:16:56 -060029int riscv_cpu_setup(void);
Simon Glassfc557362022-03-04 08:43:05 -070030
Rick Chen76c0a242017-12-26 13:55:51 +080031#endif /* __ASM_RISCV_SYSTEM_H */