blob: 7adfd8809ccddbe84d43321896bebf130f85962b [file] [log] [blame]
Stefan Kristianssonca9d3ab2011-11-26 19:04:49 +00001/*
2 * (C) Copyright 2011, Julius Baxter <julius@opencores.org>
3 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Stefan Kristianssonca9d3ab2011-11-26 19:04:49 +00005 */
6
7#ifndef __ASM_OPENRISC_SYSTEM_H
8#define __ASM_OPENRISC_SYSTEM_H
9
10#include <asm/spr-defs.h>
11
12static inline unsigned long mfspr(unsigned long add)
13{
14 unsigned long ret;
15
16 __asm__ __volatile__ ("l.mfspr %0,r0,%1" : "=r" (ret) : "K" (add));
17
18 return ret;
19}
20
21static inline void mtspr(unsigned long add, unsigned long val)
22{
23 __asm__ __volatile__ ("l.mtspr r0,%1,%0" : : "K" (add), "r" (val));
24}
25
26#endif /* __ASM_OPENRISC_SYSTEM_H */