blob: f044048903b3ebc8af7b3f67aa4cb8a073c89bc7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Bartlomiej Zolnierkiewicz58f189f2008-02-01 23:09:33 +01002 * Atari Falcon IDE Driver
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Created 12 Jul 1997 by Geert Uytterhoeven
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
8 * more details.
9 */
10
Al Viro88f8bb7802007-07-20 04:33:18 +010011#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/types.h>
13#include <linux/mm.h>
14#include <linux/interrupt.h>
15#include <linux/blkdev.h>
16#include <linux/hdreg.h>
17#include <linux/ide.h>
18#include <linux/init.h>
19
20#include <asm/setup.h>
21#include <asm/atarihw.h>
22#include <asm/atariints.h>
23#include <asm/atari_stdma.h>
24
25
26 /*
27 * Base of the IDE interface
28 */
29
30#define ATA_HD_BASE 0xfff00000
31
32 /*
33 * Offsets from the above base
34 */
35
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#define ATA_HD_CONTROL 0x39
37
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 /*
39 * falconide_intr_lock is used to obtain access to the IDE interrupt,
40 * which is shared between several drivers.
41 */
42
43int falconide_intr_lock;
Al Viro88f8bb7802007-07-20 04:33:18 +010044EXPORT_SYMBOL(falconide_intr_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
Bartlomiej Zolnierkiewicz29dd5972008-02-06 02:57:50 +010046static void __init falconide_setup_ports(hw_regs_t *hw)
47{
48 int i;
49
50 memset(hw, 0, sizeof(*hw));
51
52 hw->io_ports[IDE_DATA_OFFSET] = ATA_HD_BASE;
53
54 for (i = 1; i < 8; i++)
55 hw->io_ports[i] = ATA_HD_BASE + 1 + i * 4;
56
57 hw->io_ports[IDE_CONTROL_OFFSET] = ATA_HD_CONTROL;
58
59 hw->irq = IRQ_MFP_IDE;
60 hw->ack_intr = NULL;
61}
Linus Torvalds1da177e2005-04-16 15:20:36 -070062
63 /*
64 * Probe for a Falcon IDE interface
65 */
66
Bartlomiej Zolnierkiewiczade2daf2008-01-26 20:13:07 +010067static int __init falconide_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070068{
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 hw_regs_t hw;
Geert Uytterhoevene79f8122008-02-01 23:09:15 +010070 ide_hwif_t *hwif;
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
Bartlomiej Zolnierkiewicz29dd5972008-02-06 02:57:50 +010072 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE))
73 return 0;
74
Bartlomiej Zolnierkiewiczc99c92c2008-01-26 20:13:09 +010075 printk(KERN_INFO "ide: Falcon IDE controller\n");
76
Bartlomiej Zolnierkiewicz29dd5972008-02-06 02:57:50 +010077 falconide_setup_ports(&hw);
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
Bartlomiej Zolnierkiewiczcbb010c2008-01-26 20:13:06 +010079 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
80 if (hwif) {
81 u8 index = hwif->index;
Bartlomiej Zolnierkiewicz8ac4ce72008-01-26 20:13:06 +010082 u8 idx[4] = { index, 0xff, 0xff, 0xff };
Bartlomiej Zolnierkiewiczcbb010c2008-01-26 20:13:06 +010083
84 ide_init_port_data(hwif, index);
85 ide_init_port_hw(hwif, &hw);
86
Bartlomiej Zolnierkiewiczc413b9b2008-02-02 19:56:31 +010087 ide_device_add(idx, NULL);
Bartlomiej Zolnierkiewiczcbb010c2008-01-26 20:13:06 +010088 }
Bartlomiej Zolnierkiewiczade2daf2008-01-26 20:13:07 +010089
Bartlomiej Zolnierkiewicz29dd5972008-02-06 02:57:50 +010090 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091}
Bartlomiej Zolnierkiewiczade2daf2008-01-26 20:13:07 +010092
93module_init(falconide_init);