aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-m68k/ide.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-m68k/ide.h')
-rw-r--r--include/asm-m68k/ide.h144
1 files changed, 144 insertions, 0 deletions
diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h
new file mode 100644
index 000000000000..36118fd01867
--- /dev/null
+++ b/include/asm-m68k/ide.h
@@ -0,0 +1,144 @@
1/*
2 * linux/include/asm-m68k/ide.h
3 *
4 * Copyright (C) 1994-1996 Linus Torvalds & authors
5 */
6
7/* Copyright(c) 1996 Kars de Jong */
8/* Based on the ide driver from 1.2.13pl8 */
9
10/*
11 * Credits (alphabetical):
12 *
13 * - Bjoern Brauel
14 * - Kars de Jong
15 * - Torsten Ebeling
16 * - Dwight Engen
17 * - Thorsten Floeck
18 * - Roman Hodek
19 * - Guenther Kelleter
20 * - Chris Lawrence
21 * - Michael Rausch
22 * - Christian Sauer
23 * - Michael Schmitz
24 * - Jes Soerensen
25 * - Michael Thurm
26 * - Geert Uytterhoeven
27 */
28
29#ifndef _M68K_IDE_H
30#define _M68K_IDE_H
31
32#ifdef __KERNEL__
33
34#include <linux/config.h>
35
36#include <asm/setup.h>
37#include <asm/io.h>
38#include <asm/irq.h>
39
40#ifdef CONFIG_ATARI
41#include <linux/interrupt.h>
42#include <asm/atari_stdma.h>
43#endif
44
45#ifdef CONFIG_MAC
46#include <asm/macints.h>
47#endif
48
49#ifndef MAX_HWIFS
50#define MAX_HWIFS 4 /* same as the other archs */
51#endif
52
53/*
54 * Get rid of defs from io.h - ide has its private and conflicting versions
55 * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we
56 * always use the `raw' MMIO versions
57 */
58#undef inb
59#undef inw
60#undef insw
61#undef inl
62#undef insl
63#undef outb
64#undef outw
65#undef outsw
66#undef outl
67#undef outsl
68#undef readb
69#undef readw
70#undef readl
71#undef writeb
72#undef writew
73#undef writel
74
75#define inb in_8
76#define inw in_be16
77#define insw(port, addr, n) raw_insw((u16 *)port, addr, n)
78#define inl in_be32
79#define insl(port, addr, n) raw_insl((u32 *)port, addr, n)
80#define outb(val, port) out_8(port, val)
81#define outw(val, port) out_be16(port, val)
82#define outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
83#define outl(val, port) out_be32(port, val)
84#define outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
85#define readb in_8
86#define readw in_be16
87#define __ide_mm_insw(port, addr, n) raw_insw((u16 *)port, addr, n)
88#define readl in_be32
89#define __ide_mm_insl(port, addr, n) raw_insl((u32 *)port, addr, n)
90#define writeb(val, port) out_8(port, val)
91#define writew(val, port) out_be16(port, val)
92#define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
93#define writel(val, port) out_be32(port, val)
94#define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
95#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
96#define insw_swapw(port, addr, n) raw_insw_swapw((u16 *)port, addr, n)
97#define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n)
98#endif
99
100
101/* Q40 and Atari have byteswapped IDE busses and since many interesting
102 * values in the identification string are text, chars and words they
103 * happened to be almost correct without swapping.. However *_capacity
104 * is needed for drives over 8 GB. RZ */
105#if defined(CONFIG_Q40) || defined(CONFIG_ATARI)
106#define M68K_IDE_SWAPW (MACH_IS_Q40 || MACH_IS_ATARI)
107#endif
108
109#ifdef CONFIG_BLK_DEV_FALCON_IDE
110#define IDE_ARCH_LOCK
111
112extern int falconide_intr_lock;
113
114static __inline__ void ide_release_lock (void)
115{
116 if (MACH_IS_ATARI) {
117 if (falconide_intr_lock == 0) {
118 printk("ide_release_lock: bug\n");
119 return;
120 }
121 falconide_intr_lock = 0;
122 stdma_release();
123 }
124}
125
126static __inline__ void
127ide_get_lock(irqreturn_t (*handler)(int, void *, struct pt_regs *), void *data)
128{
129 if (MACH_IS_ATARI) {
130 if (falconide_intr_lock == 0) {
131 if (in_interrupt() > 0)
132 panic( "Falcon IDE hasn't ST-DMA lock in interrupt" );
133 stdma_lock(handler, data);
134 falconide_intr_lock = 1;
135 }
136 }
137}
138#endif /* CONFIG_BLK_DEV_FALCON_IDE */
139
140#define IDE_ARCH_ACK_INTR
141#define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1)
142
143#endif /* __KERNEL__ */
144#endif /* _M68K_IDE_H */