summaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm/atomic.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/include/asm/atomic.h')
-rw-r--r--arch/sh/include/asm/atomic.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h
new file mode 100644
index 0000000000..7a18cb2a1c
--- /dev/null
+++ b/arch/sh/include/asm/atomic.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __ASM_SH_ATOMIC_H
+#define __ASM_SH_ATOMIC_H
+
+#if defined(CONFIG_CPU_J2)
+
+#include <asm-generic/atomic.h>
+
+#else
+
+/*
+ * Atomic operations that C can't guarantee us. Useful for
+ * resource counting etc..
+ *
+ */
+
+#include <linux/compiler.h>
+#include <linux/types.h>
+#include <asm/cmpxchg.h>
+#include <asm/barrier.h>
+
+#define arch_atomic_read(v) READ_ONCE((v)->counter)
+#define arch_atomic_set(v,i) WRITE_ONCE((v)->counter, (i))
+
+#if defined(CONFIG_GUSA_RB)
+#include <asm/atomic-grb.h>
+#elif defined(CONFIG_CPU_SH4A)
+#include <asm/atomic-llsc.h>
+#else
+#include <asm/atomic-irq.h>
+#endif
+
+#endif /* CONFIG_CPU_J2 */
+
+#endif /* __ASM_SH_ATOMIC_H */