1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _KMAP_H
3 #define _KMAP_H
4
5 #ifdef CONFIG_MMU
6
7 #define ARCH_HAS_IOREMAP_WT
8
9 /* Values for nocacheflag and cmode */
10 #define IOMAP_FULL_CACHING 0
11 #define IOMAP_NOCACHE_SER 1
12 #define IOMAP_NOCACHE_NONSER 2
13 #define IOMAP_WRITETHROUGH 3
14
15 /*
16 * These functions exported by arch/m68k/mm/kmap.c.
17 * Only needed on MMU enabled systems.
18 */
19 extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size,
20 int cacheflag);
21 #define iounmap iounmap
22 extern void iounmap(void __iomem *addr);
23 extern void __iounmap(void *addr, unsigned long size);
24
25 #define ioremap ioremap
ioremap(unsigned long physaddr,unsigned long size)26 static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
27 {
28 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
29 }
30
31 #define ioremap_nocache ioremap
32 #define ioremap_uc ioremap
33 #define ioremap_wt ioremap_wt
ioremap_wt(unsigned long physaddr,unsigned long size)34 static inline void __iomem *ioremap_wt(unsigned long physaddr,
35 unsigned long size)
36 {
37 return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
38 }
39
40 #define memset_io memset_io
memset_io(volatile void __iomem * addr,unsigned char val,int count)41 static inline void memset_io(volatile void __iomem *addr, unsigned char val,
42 int count)
43 {
44 __builtin_memset((void __force *) addr, val, count);
45 }
46
47 #define memcpy_fromio memcpy_fromio
memcpy_fromio(void * dst,const volatile void __iomem * src,int count)48 static inline void memcpy_fromio(void *dst, const volatile void __iomem *src,
49 int count)
50 {
51 __builtin_memcpy(dst, (void __force *) src, count);
52 }
53
54 #define memcpy_toio memcpy_toio
memcpy_toio(volatile void __iomem * dst,const void * src,int count)55 static inline void memcpy_toio(volatile void __iomem *dst, const void *src,
56 int count)
57 {
58 __builtin_memcpy((void __force *) dst, src, count);
59 }
60
61 #endif /* CONFIG_MMU */
62
63 #define ioport_map ioport_map
ioport_map(unsigned long port,unsigned int nr)64 static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
65 {
66 return (void __iomem *) port;
67 }
68
69 #define ioport_unmap ioport_unmap
ioport_unmap(void __iomem * p)70 static inline void ioport_unmap(void __iomem *p)
71 {
72 }
73
74 #endif /* _KMAP_H */
75