aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/kernel/io.c')
-rw-r--r--arch/arm/kernel/io.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/arm/kernel/io.c b/arch/arm/kernel/io.c
new file mode 100644
index 000000000000..6c20c1188b60
--- /dev/null
+++ b/arch/arm/kernel/io.c
@@ -0,0 +1,51 @@
1#include <linux/module.h>
2#include <linux/types.h>
3
4#include <asm/io.h>
5
6/*
7 * Copy data from IO memory space to "real" memory space.
8 * This needs to be optimized.
9 */
10void _memcpy_fromio(void *to, void __iomem *from, size_t count)
11{
12 unsigned char *t = to;
13 while (count) {
14 count--;
15 *t = readb(from);
16 t++;
17 from++;
18 }
19}
20
21/*
22 * Copy data from "real" memory space to IO memory space.
23 * This needs to be optimized.
24 */
25void _memcpy_toio(void __iomem *to, const void *from, size_t count)
26{
27 const unsigned char *f = from;
28 while (count) {
29 count--;
30 writeb(*f, to);
31 f++;
32 to++;
33 }
34}
35
36/*
37 * "memset" on IO memory space.
38 * This needs to be optimized.
39 */
40void _memset_io(void __iomem *dst, int c, size_t count)
41{
42 while (count) {
43 count--;
44 writeb(c, dst);
45 dst++;
46 }
47}
48
49EXPORT_SYMBOL(_memcpy_fromio);
50EXPORT_SYMBOL(_memcpy_toio);
51EXPORT_SYMBOL(_memset_io);