I2C: TWL4030: Kconfig and Makefile changes
[linux-ginger.git] / arch / sh / kernel / io.c
blob2b8991229900cbaf96a1f595ebb0fc91a484d00d
1 /*
2 * linux/arch/sh/kernel/io.c
4 * Copyright (C) 2000 Stuart Menefy
5 * Copyright (C) 2005 Paul Mundt
7 * Provide real functions which expand to whatever the header file defined.
8 * Also definitions of machine independent IO functions.
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
14 #include <linux/module.h>
15 #include <asm/machvec.h>
16 #include <asm/io.h>
19 * Copy data from IO memory space to "real" memory space.
20 * This needs to be optimized.
22 void memcpy_fromio(void *to, volatile void __iomem *from, unsigned long count)
24 char *p = to;
25 while (count) {
26 count--;
27 *p = readb((void __iomem *)from);
28 p++;
29 from++;
32 EXPORT_SYMBOL(memcpy_fromio);
35 * Copy data from "real" memory space to IO memory space.
36 * This needs to be optimized.
38 void memcpy_toio(volatile void __iomem *to, const void *from, unsigned long count)
40 const char *p = from;
41 while (count) {
42 count--;
43 writeb(*p, (void __iomem *)to);
44 p++;
45 to++;
48 EXPORT_SYMBOL(memcpy_toio);
51 * "memset" on IO memory space.
52 * This needs to be optimized.
54 void memset_io(volatile void __iomem *dst, int c, unsigned long count)
56 while (count) {
57 count--;
58 writeb(c, (void __iomem *)dst);
59 dst++;
62 EXPORT_SYMBOL(memset_io);
64 void __iomem *ioport_map(unsigned long port, unsigned int nr)
66 void __iomem *ret;
68 ret = __ioport_map_trapped(port, nr);
69 if (ret)
70 return ret;
72 return __ioport_map(port, nr);
74 EXPORT_SYMBOL(ioport_map);
76 void ioport_unmap(void __iomem *addr)
78 sh_mv.mv_ioport_unmap(addr);
80 EXPORT_SYMBOL(ioport_unmap);