aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/io.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2012-03-05 06:49:29 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2012-09-17 08:42:04 -0400
commitfc47897d2c65bc94b6868a5c914afbd33216e26f (patch)
tree0926daf682eba58fe67995d7b3c7c1bc65ea58e9 /arch/arm64/kernel/io.c
parent6170a97460dbda12686bef0dec65ce2d59867f9e (diff)
arm64: Device specific operations
This patch adds several definitions for device communication, including I/O accessors and ioremap(). The __raw_* accessors are implemented as inline asm to avoid compiler generation of post-indexed accesses (less efficient to emulate in a virtualised environment). Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Nicolas Pitre <nico@linaro.org> Acked-by: Olof Johansson <olof@lixom.net> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch/arm64/kernel/io.c')
-rw-r--r--arch/arm64/kernel/io.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/arch/arm64/kernel/io.c b/arch/arm64/kernel/io.c
new file mode 100644
index 000000000000..7d37ead4d199
--- /dev/null
+++ b/arch/arm64/kernel/io.c
@@ -0,0 +1,64 @@
1/*
2 * Based on arch/arm/kernel/io.c
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <linux/export.h>
20#include <linux/types.h>
21#include <linux/io.h>
22
23/*
24 * Copy data from IO memory space to "real" memory space.
25 */
26void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
27{
28 unsigned char *t = to;
29 while (count) {
30 count--;
31 *t = readb(from);
32 t++;
33 from++;
34 }
35}
36EXPORT_SYMBOL(__memcpy_fromio);
37
38/*
39 * Copy data from "real" memory space to IO memory space.
40 */
41void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count)
42{
43 const unsigned char *f = from;
44 while (count) {
45 count--;
46 writeb(*f, to);
47 f++;
48 to++;
49 }
50}
51EXPORT_SYMBOL(__memcpy_toio);
52
53/*
54 * "memset" on IO memory space.
55 */
56void __memset_io(volatile void __iomem *dst, int c, size_t count)
57{
58 while (count) {
59 count--;
60 writeb(c, dst);
61 dst++;
62 }
63}
64EXPORT_SYMBOL(__memset_io);