Merge tag 'locking-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / csky / include / asm / io.h
blobe909587f24c56e7ce095c3013653edaca5e886a2
1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
4 #ifndef __ASM_CSKY_IO_H
5 #define __ASM_CSKY_IO_H
7 #include <linux/pgtable.h>
8 #include <linux/types.h>
9 #include <linux/version.h>
12 * I/O memory access primitives. Reads are ordered relative to any
13 * following Normal memory access. Writes are ordered relative to any prior
14 * Normal memory access.
16 * For CACHEV1 (807, 810), store instruction could fast retire, so we need
17 * another mb() to prevent st fast retire.
19 * For CACHEV2 (860), store instruction with PAGE_ATTR_NO_BUFFERABLE won't
20 * fast retire.
22 #define readb(c) ({ u8 __v = readb_relaxed(c); rmb(); __v; })
23 #define readw(c) ({ u16 __v = readw_relaxed(c); rmb(); __v; })
24 #define readl(c) ({ u32 __v = readl_relaxed(c); rmb(); __v; })
26 #ifdef CONFIG_CPU_HAS_CACHEV2
27 #define writeb(v,c) ({ wmb(); writeb_relaxed((v),(c)); })
28 #define writew(v,c) ({ wmb(); writew_relaxed((v),(c)); })
29 #define writel(v,c) ({ wmb(); writel_relaxed((v),(c)); })
30 #else
31 #define writeb(v,c) ({ wmb(); writeb_relaxed((v),(c)); mb(); })
32 #define writew(v,c) ({ wmb(); writew_relaxed((v),(c)); mb(); })
33 #define writel(v,c) ({ wmb(); writel_relaxed((v),(c)); mb(); })
34 #endif
37 * I/O memory mapping functions.
39 #define ioremap_wc(addr, size) \
40 ioremap_prot((addr), (size), \
41 (_PAGE_IOREMAP & ~_CACHE_MASK) | _CACHE_UNCACHED)
43 #include <asm-generic/io.h>
45 #endif /* __ASM_CSKY_IO_H */