aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/bugfix/m68k/m68k-generic-io.diff
blob: da0ad5558022ea39634dea9de7a883783b296227 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
From jongk@linux-m68k.org Fri Nov  3 10:12:53 2006
Date: Fri, 03 Nov 2006 00:06:13 +0100
From: Kars de Jong <jongk@linux-m68k.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@vger.kernel.org
Subject: [RFC PATCH] m68k: GENERIC_IOMAP support

On do, 2006-11-02 at 22:34 +0100, Geert Uytterhoeven wrote:
> > OK, here's the patch, without the m68k generic iomap changes.
> 
> Ah, the missing io{read,write}*() stuff :-)

And here is the proposed patch to add iomap support. I think we need to
rethink our I/O support when we want to support all our I/O buses
properly, but that has been discussed before. I will commit my Amiga
PCMCIA support soon, I promise!

I'm personally in favour of dropping the "generic" m68k kernel support.
Even a specific 2.6.18 kernel with only MVME167 support and the bare
essentials is already 2.5 MBytes these days. I don't even dare to think
of the size of a generic m68k kernel these days.

Since Debian also builds "specific" kernels these days, I wonder if we
still need "generic" installation type kernels. Dropping that support
does make implementing some of the I/O stuff a lot easier, IMO, since it
can then be done at compile time.

On vr, 2006-11-03 at 00:06 +0100, Kars de Jong wrote:
> On do, 2006-11-02 at 22:34 +0100, Geert Uytterhoeven wrote:
> > > OK, here's the patch, without the m68k generic iomap changes.
> > 
> > Ah, the missing io{read,write}*() stuff :-)
> 
> And here is the proposed patch to add iomap support. I think we need to
> rethink our I/O support when we want to support all our I/O buses
> properly, but that has been discussed before. I will commit my Amiga
> PCMCIA support soon, I promise!

Here's the updated version of this patch. It should now work with Amiga
and Q40 defconfig.

I don't think the CONFIG_ATARI_ROM_ISA definitions are complete yet, the
32-bit variants are missing.

Kind regards,

Kars.

---
 arch/m68k/Kconfig         |    4 ++
 include/asm-m68k/io.h     |   63 +++++++++++++++++++++++++++++++++++++---------
 include/asm-m68k/raw_io.h |    8 ++++-
 3 files changed, 61 insertions(+), 14 deletions(-)

--- linux-m68k-2.6.21.orig/arch/m68k/Kconfig
+++ linux-m68k-2.6.21/arch/m68k/Kconfig
@@ -37,6 +37,10 @@ config TIME_LOW_RES
 	bool
 	default y
 
+config GENERIC_IOMAP
+	bool
+	default y
+
 config ARCH_MAY_HAVE_PC_FDC
 	bool
 	depends on Q40 || (BROKEN && SUN3X)
--- linux-m68k-2.6.21.orig/include/asm-m68k/io.h
+++ linux-m68k-2.6.21/include/asm-m68k/io.h
@@ -27,6 +27,7 @@
 #include <asm/raw_io.h>
 #include <asm/virtconvert.h>
 
+#include <asm-generic/iomap.h>
 
 #ifdef CONFIG_ATARI
 #include <asm/atarihw.h>
@@ -175,6 +176,16 @@ static inline u16 __iomem *isa_itw(unsig
     default: return NULL; /* avoid warnings, just in case */
     }
 }
+static inline u32 __iomem *isa_itl(unsigned long addr)
+{
+  switch(ISA_TYPE)
+    {
+#ifdef CONFIG_AMIGA_PCMCIA
+    case AG_ISA: return (u32 *)AG_ISA_IO_W(addr);
+#endif
+    default: return 0; /* avoid warnings, just in case */
+    }
+}
 static inline u8 __iomem *isa_mtb(unsigned long addr)
 {
   switch(ISA_TYPE)
@@ -217,8 +228,10 @@ static inline u16 __iomem *isa_mtw(unsig
 
 #define isa_inb(port)      in_8(isa_itb(port))
 #define isa_inw(port)      (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port)))
+#define isa_inl(port)      (ISA_SEX ? in_be32(isa_itl(port)) : in_le32(isa_itl(port)))
 #define isa_outb(val,port) out_8(isa_itb(port),(val))
 #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val)))
+#define isa_outl(val,port) (ISA_SEX ? out_be32(isa_itl(port),(val)) : out_le32(isa_itl(port),(val)))
 
 #define isa_readb(p)       in_8(isa_mtb((unsigned long)(p)))
 #define isa_readw(p)       \
@@ -280,6 +293,14 @@ static inline void isa_delay(void)
        (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) :  \
                   raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
 
+#define isa_insl(port, buf, nr)     \
+       (ISA_SEX ? raw_insl(isa_itl(port), (u32 *)(buf), (nr)) :    \
+                  raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
+
+#define isa_outsl(port, buf, nr)    \
+       (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) :  \
+                  raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
+
 #if defined(CONFIG_ATARI_ROM_ISA)
 #define isa_rom_inb_p(p)	({ u8 _v = isa_rom_inb(p); isa_delay(); _v; })
 #define isa_rom_inw_p(p)	({ u16 _v = isa_rom_inw(p); isa_delay(); _v; })
@@ -314,14 +335,16 @@ static inline void isa_delay(void)
 #define inw_p   isa_inw_p
 #define outw    isa_outw
 #define outw_p  isa_outw_p
-#define inl     isa_inw
-#define inl_p   isa_inw_p
-#define outl    isa_outw
-#define outl_p  isa_outw_p
+#define inl     isa_inl
+#define inl_p   isa_inl_p
+#define outl    isa_outl
+#define outl_p  isa_outl_p
 #define insb    isa_insb
 #define insw    isa_insw
+#define insl    isa_insl
 #define outsb   isa_outsb
 #define outsw   isa_outsw
+#define outsl   isa_outsl
 #define readb   isa_readb
 #define readw   isa_readw
 #define writeb  isa_writeb
@@ -330,8 +353,6 @@ static inline void isa_delay(void)
 
 #if defined(CONFIG_PCI)
 
-#define inl(port)        in_le32(port)
-#define outl(val,port)   out_le32((port),(val))
 #define readl(addr)      in_le32(addr)
 #define writel(val,addr) out_le32((addr),(val))
 
@@ -346,10 +367,13 @@ static inline void isa_delay(void)
 #define readl_relaxed(addr) readl(addr)
 
 #ifndef CONFIG_ISA
+
 #define inb(port)      in_8(port)
 #define outb(val,port) out_8((port),(val))
 #define inw(port)      in_le16(port)
 #define outw(val,port) out_le16((port),(val))
+#define inl(port)      in_le32(port)
+#define outl(val,port) out_le32((port),(val))
 
 #else
 /*
@@ -401,20 +425,35 @@ static inline void isa_delay(void)
 #define outsw   isa_rom_outsw
 #endif
 
-#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) && !defined(CONFIG_ATARI_ROM_ISA) && defined(CONFIG_HP300)
+#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) && !defined(CONFIG_ATARI_ROM_ISA)
 /*
- * We need to define dummy functions otherwise drivers/serial/8250.c doesn't link
+ * We need to define dummy functions for GENERIC_IOMAP support.
  */
-#define inb(port)        0xff
-#define inb_p(port)      0xff
-#define outb(val,port)   do { } while (0)
-#define outb_p(val,port) do { } while (0)
+#define inb(port)          0xff
+#define inb_p(port)        0xff
+#define outb(val,port)     do { } while (0)
+#define outb_p(val,port)   do { } while (0)
+#define inw(port)          0xffff
+#define outw(val,port)     do { } while (0)
+#define inl(port)          0xffffffffUL
+#define outl(val,port)     do { } while (0)
+
+#define insb(port,buf,nr)  do { } while (0)
+#define outsb(port,buf,nr) do { } while (0)
+#define insw(port,buf,nr)  do { } while (0)
+#define outsw(port,buf,nr) do { } while (0)
+#define insl(port,buf,nr)  do { } while (0)
+#define outsl(port,buf,nr) do { } while (0)
 
 /*
  * These should be valid on any ioremap()ed region
  */
 #define readb(addr)      in_8(addr)
 #define writeb(val,addr) out_8((addr),(val))
+#define readw(addr)      in_le16(addr)
+#define writew(val,addr) out_le16((addr),(val))
+#endif /* !CONFIG_ISA && !CONFIG_PCI && !CONFIG_ATARI_ROM_ISA */
+#if !defined(CONFIG_PCI)
 #define readl(addr)      in_le32(addr)
 #define writel(val,addr) out_le32((addr),(val))
 #endif
--- linux-m68k-2.6.21.orig/include/asm-m68k/raw_io.h
+++ linux-m68k-2.6.21/include/asm-m68k/raw_io.h
@@ -49,10 +49,16 @@ extern void __iounmap(void *addr, unsign
 #define raw_inb in_8
 #define raw_inw in_be16
 #define raw_inl in_be32
+#define __raw_readb in_8
+#define __raw_readw in_be16
+#define __raw_readl in_be32
 
 #define raw_outb(val,port) out_8((port),(val))
 #define raw_outw(val,port) out_be16((port),(val))
 #define raw_outl(val,port) out_be32((port),(val))
+#define __raw_writeb(val,addr) out_8((addr),(val))
+#define __raw_writew(val,addr) out_be16((addr),(val))
+#define __raw_writel(val,addr) out_be32((addr),(val))
 
 /*
  * Atari ROM port (cartridge port) ISA adapter, used for the EtherNEC NE2000
@@ -432,8 +438,6 @@ static inline void raw_rom_outsw_swapw(v
 }
 #endif /* CONFIG_ATARI_ROM_ISA */
 
-#define __raw_writel raw_outl
-
 #endif /* __KERNEL__ */
 
 #endif /* _RAW_IO_H */