aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/lib64/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/lib64/io.c')
-rw-r--r--arch/sh/lib64/io.c128
1 files changed, 0 insertions, 128 deletions
diff --git a/arch/sh/lib64/io.c b/arch/sh/lib64/io.c
deleted file mode 100644
index a3f3a2b8e25b..000000000000
--- a/arch/sh/lib64/io.c
+++ /dev/null
@@ -1,128 +0,0 @@
1/*
2 * Copyright (C) 2000 David J. Mckay (david.mckay@st.com)
3 *
4 * May be copied or modified under the terms of the GNU General Public
5 * License. See linux/COPYING for more information.
6 *
7 * This file contains the I/O routines for use on the overdrive board
8 *
9 */
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/delay.h>
14#include <linux/module.h>
15#include <asm/system.h>
16#include <asm/processor.h>
17#include <asm/io.h>
18
19/* Now for the string version of these functions */
20void outsb(unsigned long port, const void *addr, unsigned long count)
21{
22 int i;
23 unsigned char *p = (unsigned char *) addr;
24
25 for (i = 0; i < count; i++, p++) {
26 outb(*p, port);
27 }
28}
29EXPORT_SYMBOL(outsb);
30
31void insb(unsigned long port, void *addr, unsigned long count)
32{
33 int i;
34 unsigned char *p = (unsigned char *) addr;
35
36 for (i = 0; i < count; i++, p++) {
37 *p = inb(port);
38 }
39}
40EXPORT_SYMBOL(insb);
41
42/* For the 16 and 32 bit string functions, we have to worry about alignment.
43 * The SH does not do unaligned accesses, so we have to read as bytes and
44 * then write as a word or dword.
45 * This can be optimised a lot more, especially in the case where the data
46 * is aligned
47 */
48
49void outsw(unsigned long port, const void *addr, unsigned long count)
50{
51 int i;
52 unsigned short tmp;
53 unsigned char *p = (unsigned char *) addr;
54
55 for (i = 0; i < count; i++, p += 2) {
56 tmp = (*p) | ((*(p + 1)) << 8);
57 outw(tmp, port);
58 }
59}
60EXPORT_SYMBOL(outsw);
61
62void insw(unsigned long port, void *addr, unsigned long count)
63{
64 int i;
65 unsigned short tmp;
66 unsigned char *p = (unsigned char *) addr;
67
68 for (i = 0; i < count; i++, p += 2) {
69 tmp = inw(port);
70 p[0] = tmp & 0xff;
71 p[1] = (tmp >> 8) & 0xff;
72 }
73}
74EXPORT_SYMBOL(insw);
75
76void outsl(unsigned long port, const void *addr, unsigned long count)
77{
78 int i;
79 unsigned tmp;
80 unsigned char *p = (unsigned char *) addr;
81
82 for (i = 0; i < count; i++, p += 4) {
83 tmp = (*p) | ((*(p + 1)) << 8) | ((*(p + 2)) << 16) |
84 ((*(p + 3)) << 24);
85 outl(tmp, port);
86 }
87}
88EXPORT_SYMBOL(outsl);
89
90void insl(unsigned long port, void *addr, unsigned long count)
91{
92 int i;
93 unsigned tmp;
94 unsigned char *p = (unsigned char *) addr;
95
96 for (i = 0; i < count; i++, p += 4) {
97 tmp = inl(port);
98 p[0] = tmp & 0xff;
99 p[1] = (tmp >> 8) & 0xff;
100 p[2] = (tmp >> 16) & 0xff;
101 p[3] = (tmp >> 24) & 0xff;
102
103 }
104}
105EXPORT_SYMBOL(insl);
106
107void memcpy_toio(void __iomem *to, const void *from, long count)
108{
109 unsigned char *p = (unsigned char *) from;
110
111 while (count) {
112 count--;
113 writeb(*p++, to++);
114 }
115}
116EXPORT_SYMBOL(memcpy_toio);
117
118void memcpy_fromio(void *to, void __iomem *from, long count)
119{
120 int i;
121 unsigned char *p = (unsigned char *) to;
122
123 for (i = 0; i < count; i++) {
124 p[i] = readb(from);
125 from++;
126 }
127}
128EXPORT_SYMBOL(memcpy_fromio);