Stefan Kristiansson | 6e560bb | 2011-11-26 19:04:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2011, Julius Baxter <julius@opencores.org> |
| 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Stefan Kristiansson | 6e560bb | 2011-11-26 19:04:49 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __ASM_OPENRISC_SYSTEM_H |
| 8 | #define __ASM_OPENRISC_SYSTEM_H |
| 9 | |
| 10 | #include <asm/spr-defs.h> |
| 11 | |
| 12 | static 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 | |
| 21 | static 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 */ |