aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/jazz/io.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/jazz/io.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/mips/jazz/io.c')
-rw-r--r--arch/mips/jazz/io.c135
1 files changed, 135 insertions, 0 deletions
diff --git a/arch/mips/jazz/io.c b/arch/mips/jazz/io.c
new file mode 100644
index 000000000000..e86904454c89
--- /dev/null
+++ b/arch/mips/jazz/io.c
@@ -0,0 +1,135 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Low level I/O functions for Jazz family machines.
7 *
8 * Copyright (C) 1997 by Ralf Baechle.
9 */
10#include <linux/string.h>
11#include <linux/spinlock.h>
12#include <asm/addrspace.h>
13#include <asm/system.h>
14#include <asm/jazz.h>
15
16/*
17 * Map an 16mb segment of the EISA address space to 0xe3000000;
18 */
19static inline void map_eisa_address(unsigned long address)
20{
21 /* XXX */
22 /* We've got an wired entry in the TLB. We just need to modify it.
23 fast and clean. But since we want to get rid of wired entries
24 things are a little bit more complicated ... */
25}
26
27static unsigned char jazz_readb(unsigned long addr)
28{
29 unsigned char res;
30
31 map_eisa_address(addr);
32 addr &= 0xffffff;
33 res = *(volatile unsigned char *) (JAZZ_EISA_BASE + addr);
34
35 return res;
36}
37
38static unsigned short jazz_readw(unsigned long addr)
39{
40 unsigned short res;
41
42 map_eisa_address(addr);
43 addr &= 0xffffff;
44 res = *(volatile unsigned char *) (JAZZ_EISA_BASE + addr);
45
46 return res;
47}
48
49static unsigned int jazz_readl(unsigned long addr)
50{
51 unsigned int res;
52
53 map_eisa_address(addr);
54 addr &= 0xffffff;
55 res = *(volatile unsigned char *) (JAZZ_EISA_BASE + addr);
56
57 return res;
58}
59
60static void jazz_writeb(unsigned char val, unsigned long addr)
61{
62 map_eisa_address(addr);
63 addr &= 0xffffff;
64 *(volatile unsigned char *) (JAZZ_EISA_BASE + addr) = val;
65}
66
67static void jazz_writew(unsigned short val, unsigned long addr)
68{
69 map_eisa_address(addr);
70 addr &= 0xffffff;
71 *(volatile unsigned char *) (JAZZ_EISA_BASE + addr) = val;
72}
73
74static void jazz_writel(unsigned int val, unsigned long addr)
75{
76 map_eisa_address(addr);
77 addr &= 0xffffff;
78 *(volatile unsigned char *) (JAZZ_EISA_BASE + addr) = val;
79}
80
81static void jazz_memset_io(unsigned long addr, int val, unsigned long len)
82{
83 unsigned long waddr;
84
85 waddr = JAZZ_EISA_BASE | (addr & 0xffffff);
86 while(len) {
87 unsigned long fraglen;
88
89 fraglen = (~addr + 1) & 0xffffff;
90 fraglen = (fraglen < len) ? fraglen : len;
91 map_eisa_address(addr);
92 memset((char *)waddr, val, fraglen);
93 addr += fraglen;
94 waddr = waddr + fraglen - 0x1000000;
95 len -= fraglen;
96 }
97}
98
99static void jazz_memcpy_fromio(unsigned long to, unsigned long from, unsigned long len)
100{
101 unsigned long waddr;
102
103 waddr = JAZZ_EISA_BASE | (from & 0xffffff);
104 while(len) {
105 unsigned long fraglen;
106
107 fraglen = (~from + 1) & 0xffffff;
108 fraglen = (fraglen < len) ? fraglen : len;
109 map_eisa_address(from);
110 memcpy((void *)to, (void *)waddr, fraglen);
111 to += fraglen;
112 from += fraglen;
113 waddr = waddr + fraglen - 0x1000000;
114 len -= fraglen;
115 }
116}
117
118static void jazz_memcpy_toio(unsigned long to, unsigned long from, unsigned long len)
119{
120 unsigned long waddr;
121
122 waddr = JAZZ_EISA_BASE | (to & 0xffffff);
123 while(len) {
124 unsigned long fraglen;
125
126 fraglen = (~to + 1) & 0xffffff;
127 fraglen = (fraglen < len) ? fraglen : len;
128 map_eisa_address(to);
129 memcpy((char *)to + JAZZ_EISA_BASE, (void *)from, fraglen);
130 to += fraglen;
131 from += fraglen;
132 waddr = waddr + fraglen - 0x1000000;
133 len -= fraglen;
134 }
135}