Blame view
drivers/ide/macide.c
2.98 KB
1da177e4c Linux-2.6.12-rc2 |
1 |
/* |
58f189fcc ide: delete filen... |
2 |
* Macintosh IDE Driver |
1da177e4c Linux-2.6.12-rc2 |
3 4 5 6 7 8 9 10 11 12 |
* * Copyright (C) 1998 by Michael Schmitz * * This driver was written based on information obtained from the MacOS IDE * driver binary by Mikael Forselius * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details. */ |
1da177e4c Linux-2.6.12-rc2 |
13 14 15 16 |
#include <linux/types.h> #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/blkdev.h> |
1da177e4c Linux-2.6.12-rc2 |
17 18 |
#include <linux/delay.h> #include <linux/ide.h> |
bff7832dd ide/ata: Add modu... |
19 |
#include <linux/module.h> |
1da177e4c Linux-2.6.12-rc2 |
20 |
|
1da177e4c Linux-2.6.12-rc2 |
21 22 23 24 25 26 27 28 29 30 |
#include <asm/macintosh.h> #include <asm/macints.h> #include <asm/mac_baboon.h> #define IDE_BASE 0x50F1A000 /* Base address of IDE controller */ /* * Generic IDE registers as offsets from the base * These match MkLinux so they should be correct. */ |
1da177e4c Linux-2.6.12-rc2 |
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
#define IDE_CONTROL 0x38 /* control/altstatus */ /* * Mac-specific registers */ /* * this register is odd; it doesn't seem to do much and it's * not word-aligned like virtually every other hardware register * on the Mac... */ #define IDE_IFR 0x101 /* (0x101) IDE interrupt flags on Quadra: * * Bit 0+1: some interrupt flags * Bit 2+3: some interrupt enable * Bit 4: ?? * Bit 5: IDE interrupt flag (any hwif) * Bit 6: maybe IDE interrupt enable (any hwif) ?? * Bit 7: Any interrupt condition */ volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR); |
f4d3ffa52 ide: move ack_int... |
54 |
int macide_test_irq(ide_hwif_t *hwif) |
1da177e4c Linux-2.6.12-rc2 |
55 |
{ |
eba8999ce ide: move IRQ cle... |
56 |
if (*ide_ifr & 0x20) |
1da177e4c Linux-2.6.12-rc2 |
57 |
return 1; |
1da177e4c Linux-2.6.12-rc2 |
58 59 |
return 0; } |
eba8999ce ide: move IRQ cle... |
60 61 62 63 |
static void macide_clear_irq(ide_drive_t *drive) { *ide_ifr &= ~0x20; } |
9f36d3143 ide: remove hw_re... |
64 |
static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base, |
f4d3ffa52 ide: move ack_int... |
65 |
int irq) |
29dd59755 ide: remove ide_s... |
66 67 68 69 70 71 |
{ int i; memset(hw, 0, sizeof(*hw)); for (i = 0; i < 8; i++) |
4c3032d8a ide: add struct i... |
72 |
hw->io_ports_array[i] = base + i * 4; |
29dd59755 ide: remove ide_s... |
73 |
|
4c3032d8a ide: add struct i... |
74 |
hw->io_ports.ctl_addr = base + IDE_CONTROL; |
29dd59755 ide: remove ide_s... |
75 76 |
hw->irq = irq; |
29dd59755 ide: remove ide_s... |
77 |
} |
eba8999ce ide: move IRQ cle... |
78 79 |
static const struct ide_port_ops macide_port_ops = { .clear_irq = macide_clear_irq, |
f4d3ffa52 ide: move ack_int... |
80 |
.test_irq = macide_test_irq, |
eba8999ce ide: move IRQ cle... |
81 |
}; |
211176cce macide: use struc... |
82 |
static const struct ide_port_info macide_port_info = { |
eba8999ce ide: move IRQ cle... |
83 |
.port_ops = &macide_port_ops, |
09a3e7918 ide: make m68k ho... |
84 |
.host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, |
255115fb3 ide: allow host d... |
85 |
.irq_flags = IRQF_SHARED, |
29e52cf79 ide: remove chips... |
86 |
.chipset = ide_generic, |
211176cce macide: use struc... |
87 |
}; |
c99c92c58 ide: print banner... |
88 89 |
static const char *mac_ide_name[] = { "Quadra", "Powerbook", "Powerbook Baboon" }; |
1da177e4c Linux-2.6.12-rc2 |
90 91 92 |
/* * Probe for a Macintosh IDE interface */ |
ade2daf9c ide: make remaini... |
93 |
static int __init macide_init(void) |
1da177e4c Linux-2.6.12-rc2 |
94 |
{ |
29dd59755 ide: remove ide_s... |
95 96 |
unsigned long base; int irq; |
9f36d3143 ide: remove hw_re... |
97 |
struct ide_hw hw, *hws[] = { &hw }; |
eba8999ce ide: move IRQ cle... |
98 |
struct ide_port_info d = macide_port_info; |
1da177e4c Linux-2.6.12-rc2 |
99 |
|
3ce92a2a7 m68k: macide does... |
100 101 |
if (!MACH_IS_MAC) return -ENODEV; |
1da177e4c Linux-2.6.12-rc2 |
102 103 |
switch (macintosh_config->ide_type) { case MAC_IDE_QUADRA: |
29dd59755 ide: remove ide_s... |
104 |
base = IDE_BASE; |
29dd59755 ide: remove ide_s... |
105 |
irq = IRQ_NUBUS_F; |
1da177e4c Linux-2.6.12-rc2 |
106 107 |
break; case MAC_IDE_PB: |
29dd59755 ide: remove ide_s... |
108 |
base = IDE_BASE; |
29dd59755 ide: remove ide_s... |
109 |
irq = IRQ_NUBUS_C; |
1da177e4c Linux-2.6.12-rc2 |
110 111 |
break; case MAC_IDE_BABOON: |
29dd59755 ide: remove ide_s... |
112 |
base = BABOON_BASE; |
eba8999ce ide: move IRQ cle... |
113 |
d.port_ops = NULL; |
29dd59755 ide: remove ide_s... |
114 |
irq = IRQ_BABOON_1; |
cbb010c18 ide: drop 'initia... |
115 116 |
break; default: |
ade2daf9c ide: make remaini... |
117 |
return -ENODEV; |
cbb010c18 ide: drop 'initia... |
118 |
} |
1da177e4c Linux-2.6.12-rc2 |
119 |
|
c99c92c58 ide: print banner... |
120 121 122 |
printk(KERN_INFO "ide: Macintosh %s IDE controller ", mac_ide_name[macintosh_config->ide_type - 1]); |
f4d3ffa52 ide: move ack_int... |
123 |
macide_setup_ports(&hw, base, irq); |
29dd59755 ide: remove ide_s... |
124 |
|
eba8999ce ide: move IRQ cle... |
125 |
return ide_host_add(&d, hws, 1, NULL); |
1da177e4c Linux-2.6.12-rc2 |
126 |
} |
ade2daf9c ide: make remaini... |
127 128 |
module_init(macide_init); |
37c807a2e ide/legacy/macide... |
129 130 |
MODULE_LICENSE("GPL"); |