diff options
author | Richard Kuo <rkuo@codeaurora.org> | 2011-10-31 19:48:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-01 10:34:20 -0400 |
commit | 013bf24c38293ca1142823d3c67a4aa4d90c6e66 (patch) | |
tree | fbae4d8bb2900a5dbcdec456eec85b31d169eb66 /arch/hexagon/lib/io.c | |
parent | 7567746e1c0d66ac0ef8a9d8816ca694462c7370 (diff) |
Hexagon: Provide basic implementation and/or stubs for I/O routines.
Signed-off-by: Richard Kuo <rkuo@codeaurora.org>
Signed-off-by: Linas Vepstas <linas@codeaurora.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/hexagon/lib/io.c')
-rw-r--r-- | arch/hexagon/lib/io.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/arch/hexagon/lib/io.c b/arch/hexagon/lib/io.c new file mode 100644 index 000000000000..8ae47ba0e705 --- /dev/null +++ b/arch/hexagon/lib/io.c | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * I/O access functions for Hexagon | ||
3 | * | ||
4 | * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. | ||
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 and | ||
8 | * only version 2 as 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, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
18 | * 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #include <asm/io.h> | ||
22 | |||
23 | /* These are all FIFO routines! */ | ||
24 | |||
25 | /* | ||
26 | * __raw_readsw - read words a short at a time | ||
27 | * @addr: source address | ||
28 | * @data: data address | ||
29 | * @len: number of shorts to read | ||
30 | */ | ||
31 | void __raw_readsw(const void __iomem *addr, void *data, int len) | ||
32 | { | ||
33 | const volatile short int *src = (short int *) addr; | ||
34 | short int *dst = (short int *) data; | ||
35 | |||
36 | if ((u32)data & 0x1) | ||
37 | panic("unaligned pointer to readsw"); | ||
38 | |||
39 | while (len-- > 0) | ||
40 | *dst++ = *src; | ||
41 | |||
42 | } | ||
43 | |||
44 | /* | ||
45 | * __raw_writesw - read words a short at a time | ||
46 | * @addr: source address | ||
47 | * @data: data address | ||
48 | * @len: number of shorts to read | ||
49 | */ | ||
50 | void __raw_writesw(void __iomem *addr, const void *data, int len) | ||
51 | { | ||
52 | const short int *src = (short int *)data; | ||
53 | volatile short int *dst = (short int *)addr; | ||
54 | |||
55 | if ((u32)data & 0x1) | ||
56 | panic("unaligned pointer to writesw"); | ||
57 | |||
58 | while (len-- > 0) | ||
59 | *dst = *src++; | ||
60 | |||
61 | |||
62 | } | ||
63 | |||
64 | /* Pretty sure len is pre-adjusted for the length of the access already */ | ||
65 | void __raw_readsl(const void __iomem *addr, void *data, int len) | ||
66 | { | ||
67 | const volatile long *src = (long *) addr; | ||
68 | long *dst = (long *) data; | ||
69 | |||
70 | if ((u32)data & 0x3) | ||
71 | panic("unaligned pointer to readsl"); | ||
72 | |||
73 | while (len-- > 0) | ||
74 | *dst++ = *src; | ||
75 | |||
76 | |||
77 | } | ||
78 | |||
79 | void __raw_writesl(void __iomem *addr, const void *data, int len) | ||
80 | { | ||
81 | const long *src = (long *)data; | ||
82 | volatile long *dst = (long *)addr; | ||
83 | |||
84 | if ((u32)data & 0x3) | ||
85 | panic("unaligned pointer to writesl"); | ||
86 | |||
87 | while (len-- > 0) | ||
88 | *dst = *src++; | ||
89 | |||
90 | |||
91 | } | ||