diff options
author | Greg Ungerer <gerg@linux-m68k.org> | 2018-03-25 08:17:38 -0400 |
---|---|---|
committer | Greg Ungerer <gerg@linux-m68k.org> | 2018-05-27 19:45:26 -0400 |
commit | 9746882f547d2f00d2e761b418ae690cd406c8e2 (patch) | |
tree | 0725af19adb03a2d9743b5f0b8bfe5d202265655 | |
parent | 4478048b4485285353cc095a47683d2a86509c7d (diff) |
m68k: group io mapping definitions and functions
Create a new header file, kmap.h, that groups all the definitions and
functions associated with the io mapping and remapping.
Currently the functions are spread across raw_io.h and io_mm.h. And in
the future we will want to use these in io_no.h as well. So it makes
sense to move them all together into a single header file.
It is named after the arch/m68k/mm/kmap.c file that actually implements
many of the exported functions.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Tested-by: Angelo Dureghello <angelo@sysam.it>
-rw-r--r-- | arch/m68k/include/asm/atarihw.h | 1 | ||||
-rw-r--r-- | arch/m68k/include/asm/io_mm.h | 43 | ||||
-rw-r--r-- | arch/m68k/include/asm/io_no.h | 12 | ||||
-rw-r--r-- | arch/m68k/include/asm/kmap.h | 80 | ||||
-rw-r--r-- | arch/m68k/include/asm/nubus.h | 1 | ||||
-rw-r--r-- | arch/m68k/include/asm/q40_master.h | 2 | ||||
-rw-r--r-- | arch/m68k/include/asm/raw_io.h | 14 | ||||
-rw-r--r-- | arch/m68k/include/asm/vga.h | 1 | ||||
-rw-r--r-- | arch/m68k/include/asm/zorro.h | 1 |
9 files changed, 98 insertions, 57 deletions
diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h index 972c8f33f055..9000b249d225 100644 --- a/arch/m68k/include/asm/atarihw.h +++ b/arch/m68k/include/asm/atarihw.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/types.h> | 23 | #include <linux/types.h> |
24 | #include <asm/bootinfo-atari.h> | 24 | #include <asm/bootinfo-atari.h> |
25 | #include <asm/raw_io.h> | 25 | #include <asm/raw_io.h> |
26 | #include <asm/kmap.h> | ||
26 | 27 | ||
27 | extern u_long atari_mch_cookie; | 28 | extern u_long atari_mch_cookie; |
28 | extern u_long atari_mch_type; | 29 | extern u_long atari_mch_type; |
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h index 22e778e293c6..21fba26f57f4 100644 --- a/arch/m68k/include/asm/io_mm.h +++ b/arch/m68k/include/asm/io_mm.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/compiler.h> | 26 | #include <linux/compiler.h> |
27 | #include <asm/raw_io.h> | 27 | #include <asm/raw_io.h> |
28 | #include <asm/virtconvert.h> | 28 | #include <asm/virtconvert.h> |
29 | #include <asm/kmap.h> | ||
29 | 30 | ||
30 | #include <asm-generic/iomap.h> | 31 | #include <asm-generic/iomap.h> |
31 | 32 | ||
@@ -461,39 +462,6 @@ static inline void isa_delay(void) | |||
461 | 462 | ||
462 | #define mmiowb() | 463 | #define mmiowb() |
463 | 464 | ||
464 | static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size) | ||
465 | { | ||
466 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); | ||
467 | } | ||
468 | static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned long size) | ||
469 | { | ||
470 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); | ||
471 | } | ||
472 | #define ioremap_uc ioremap_nocache | ||
473 | static inline void __iomem *ioremap_wt(unsigned long physaddr, | ||
474 | unsigned long size) | ||
475 | { | ||
476 | return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); | ||
477 | } | ||
478 | static inline void __iomem *ioremap_fullcache(unsigned long physaddr, | ||
479 | unsigned long size) | ||
480 | { | ||
481 | return __ioremap(physaddr, size, IOMAP_FULL_CACHING); | ||
482 | } | ||
483 | |||
484 | static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) | ||
485 | { | ||
486 | __builtin_memset((void __force *) addr, val, count); | ||
487 | } | ||
488 | static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) | ||
489 | { | ||
490 | __builtin_memcpy(dst, (void __force *) src, count); | ||
491 | } | ||
492 | static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count) | ||
493 | { | ||
494 | __builtin_memcpy((void __force *) dst, src, count); | ||
495 | } | ||
496 | |||
497 | #ifndef CONFIG_SUN3 | 465 | #ifndef CONFIG_SUN3 |
498 | #define IO_SPACE_LIMIT 0xffff | 466 | #define IO_SPACE_LIMIT 0xffff |
499 | #else | 467 | #else |
@@ -515,15 +483,6 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int | |||
515 | */ | 483 | */ |
516 | #define xlate_dev_kmem_ptr(p) p | 484 | #define xlate_dev_kmem_ptr(p) p |
517 | 485 | ||
518 | static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) | ||
519 | { | ||
520 | return (void __iomem *) port; | ||
521 | } | ||
522 | |||
523 | static inline void ioport_unmap(void __iomem *p) | ||
524 | { | ||
525 | } | ||
526 | |||
527 | #define readb_relaxed(addr) readb(addr) | 486 | #define readb_relaxed(addr) readb(addr) |
528 | #define readw_relaxed(addr) readw(addr) | 487 | #define readw_relaxed(addr) readw(addr) |
529 | #define readl_relaxed(addr) readl(addr) | 488 | #define readl_relaxed(addr) readl(addr) |
diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h index 5095693e46ce..e9c70f754e02 100644 --- a/arch/m68k/include/asm/io_no.h +++ b/arch/m68k/include/asm/io_no.h | |||
@@ -25,6 +25,18 @@ | |||
25 | #define writew __raw_writew | 25 | #define writew __raw_writew |
26 | #define writel __raw_writel | 26 | #define writel __raw_writel |
27 | 27 | ||
28 | /* | ||
29 | * These are defined in kmap.h as static inline functions. To maintain | ||
30 | * previous behavior we put these define guards here so io_mm.h doesn't | ||
31 | * see them. | ||
32 | */ | ||
33 | #ifdef CONFIG_MMU | ||
34 | #define memset_io memset_io | ||
35 | #define memcpy_fromio memcpy_fromio | ||
36 | #define memcpy_toio memcpy_toio | ||
37 | #endif | ||
38 | |||
39 | #include <asm/kmap.h> | ||
28 | #include <asm/virtconvert.h> | 40 | #include <asm/virtconvert.h> |
29 | #include <asm-generic/io.h> | 41 | #include <asm-generic/io.h> |
30 | 42 | ||
diff --git a/arch/m68k/include/asm/kmap.h b/arch/m68k/include/asm/kmap.h new file mode 100644 index 000000000000..84b8333db8ad --- /dev/null +++ b/arch/m68k/include/asm/kmap.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef _KMAP_H | ||
3 | #define _KMAP_H | ||
4 | |||
5 | #ifdef CONFIG_MMU | ||
6 | |||
7 | /* Values for nocacheflag and cmode */ | ||
8 | #define IOMAP_FULL_CACHING 0 | ||
9 | #define IOMAP_NOCACHE_SER 1 | ||
10 | #define IOMAP_NOCACHE_NONSER 2 | ||
11 | #define IOMAP_WRITETHROUGH 3 | ||
12 | |||
13 | /* | ||
14 | * These functions exported by arch/m68k/mm/kmap.c. | ||
15 | * Only needed on MMU enabled systems. | ||
16 | */ | ||
17 | extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size, | ||
18 | int cacheflag); | ||
19 | extern void iounmap(void __iomem *addr); | ||
20 | extern void __iounmap(void *addr, unsigned long size); | ||
21 | |||
22 | #define ioremap ioremap | ||
23 | static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size) | ||
24 | { | ||
25 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); | ||
26 | } | ||
27 | |||
28 | #define ioremap_nocache ioremap_nocache | ||
29 | static inline void __iomem *ioremap_nocache(unsigned long physaddr, | ||
30 | unsigned long size) | ||
31 | { | ||
32 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); | ||
33 | } | ||
34 | |||
35 | #define ioremap_uc ioremap_nocache | ||
36 | static inline void __iomem *ioremap_wt(unsigned long physaddr, | ||
37 | unsigned long size) | ||
38 | { | ||
39 | return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); | ||
40 | } | ||
41 | |||
42 | #define ioremap_fillcache ioremap_fullcache | ||
43 | static inline void __iomem *ioremap_fullcache(unsigned long physaddr, | ||
44 | unsigned long size) | ||
45 | { | ||
46 | return __ioremap(physaddr, size, IOMAP_FULL_CACHING); | ||
47 | } | ||
48 | |||
49 | static inline void memset_io(volatile void __iomem *addr, unsigned char val, | ||
50 | int count) | ||
51 | { | ||
52 | __builtin_memset((void __force *) addr, val, count); | ||
53 | } | ||
54 | |||
55 | static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, | ||
56 | int count) | ||
57 | { | ||
58 | __builtin_memcpy(dst, (void __force *) src, count); | ||
59 | } | ||
60 | |||
61 | static inline void memcpy_toio(volatile void __iomem *dst, const void *src, | ||
62 | int count) | ||
63 | { | ||
64 | __builtin_memcpy((void __force *) dst, src, count); | ||
65 | } | ||
66 | |||
67 | #endif /* CONFIG_MMU */ | ||
68 | |||
69 | #define ioport_map ioport_map | ||
70 | static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) | ||
71 | { | ||
72 | return (void __iomem *) port; | ||
73 | } | ||
74 | |||
75 | #define ioport_unmap ioport_unmap | ||
76 | static inline void ioport_unmap(void __iomem *p) | ||
77 | { | ||
78 | } | ||
79 | |||
80 | #endif /* _KMAP_H */ | ||
diff --git a/arch/m68k/include/asm/nubus.h b/arch/m68k/include/asm/nubus.h index d0d2039e434e..c2281da6c51a 100644 --- a/arch/m68k/include/asm/nubus.h +++ b/arch/m68k/include/asm/nubus.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #define _ASM_M68K_NUBUS_H | 3 | #define _ASM_M68K_NUBUS_H |
4 | 4 | ||
5 | #include <asm/raw_io.h> | 5 | #include <asm/raw_io.h> |
6 | #include <asm/kmap.h> | ||
6 | 7 | ||
7 | #define nubus_readb raw_inb | 8 | #define nubus_readb raw_inb |
8 | #define nubus_readw raw_inw | 9 | #define nubus_readw raw_inw |
diff --git a/arch/m68k/include/asm/q40_master.h b/arch/m68k/include/asm/q40_master.h index 3a89c088800c..9b00fb8079e6 100644 --- a/arch/m68k/include/asm/q40_master.h +++ b/arch/m68k/include/asm/q40_master.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #define _Q40_MASTER_H | 8 | #define _Q40_MASTER_H |
9 | 9 | ||
10 | #include <asm/raw_io.h> | 10 | #include <asm/raw_io.h> |
11 | 11 | #include <asm/kmap.h> | |
12 | 12 | ||
13 | #define q40_master_addr 0xff000000 | 13 | #define q40_master_addr 0xff000000 |
14 | 14 | ||
diff --git a/arch/m68k/include/asm/raw_io.h b/arch/m68k/include/asm/raw_io.h index 05e940c29b54..85761255dde5 100644 --- a/arch/m68k/include/asm/raw_io.h +++ b/arch/m68k/include/asm/raw_io.h | |||
@@ -13,20 +13,6 @@ | |||
13 | 13 | ||
14 | #include <asm/byteorder.h> | 14 | #include <asm/byteorder.h> |
15 | 15 | ||
16 | |||
17 | /* Values for nocacheflag and cmode */ | ||
18 | #define IOMAP_FULL_CACHING 0 | ||
19 | #define IOMAP_NOCACHE_SER 1 | ||
20 | #define IOMAP_NOCACHE_NONSER 2 | ||
21 | #define IOMAP_WRITETHROUGH 3 | ||
22 | |||
23 | extern void iounmap(void __iomem *addr); | ||
24 | |||
25 | extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size, | ||
26 | int cacheflag); | ||
27 | extern void __iounmap(void *addr, unsigned long size); | ||
28 | |||
29 | |||
30 | /* ++roman: The assignments to temp. vars avoid that gcc sometimes generates | 16 | /* ++roman: The assignments to temp. vars avoid that gcc sometimes generates |
31 | * two accesses to memory, which may be undesirable for some devices. | 17 | * two accesses to memory, which may be undesirable for some devices. |
32 | */ | 18 | */ |
diff --git a/arch/m68k/include/asm/vga.h b/arch/m68k/include/asm/vga.h index 010a624d1b39..819d46d91886 100644 --- a/arch/m68k/include/asm/vga.h +++ b/arch/m68k/include/asm/vga.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #define _ASM_M68K_VGA_H | 3 | #define _ASM_M68K_VGA_H |
4 | 4 | ||
5 | #include <asm/raw_io.h> | 5 | #include <asm/raw_io.h> |
6 | #include <asm/kmap.h> | ||
6 | 7 | ||
7 | /* | 8 | /* |
8 | * FIXME | 9 | * FIXME |
diff --git a/arch/m68k/include/asm/zorro.h b/arch/m68k/include/asm/zorro.h index 96f64bf7bcaa..60fc4b6f294d 100644 --- a/arch/m68k/include/asm/zorro.h +++ b/arch/m68k/include/asm/zorro.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #define _ASM_M68K_ZORRO_H | 3 | #define _ASM_M68K_ZORRO_H |
4 | 4 | ||
5 | #include <asm/raw_io.h> | 5 | #include <asm/raw_io.h> |
6 | #include <asm/kmap.h> | ||
6 | 7 | ||
7 | #define z_readb raw_inb | 8 | #define z_readb raw_inb |
8 | #define z_readw raw_inw | 9 | #define z_readw raw_inw |