blob: c9bd6bfb1f3b788a3eee877bfae5b1affcf7a763 [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
36#define ATA_HD_DATA 0x00
37#define ATA_HD_ERROR 0x05 /* see err-bits */
38#define ATA_HD_NSECTOR 0x09 /* nr of sectors to read/write */
39#define ATA_HD_SECTOR 0x0d /* starting sector */
40#define ATA_HD_LCYL 0x11 /* starting cylinder */
41#define ATA_HD_HCYL 0x15 /* high byte of starting cyl */
42#define ATA_HD_SELECT 0x19 /* 101dhhhh , d=drive, hhhh=head */
43#define ATA_HD_STATUS 0x1d /* see status-bits */
44#define ATA_HD_CONTROL 0x39
45
46static int falconide_offsets[IDE_NR_PORTS] __initdata = {
47 ATA_HD_DATA, ATA_HD_ERROR, ATA_HD_NSECTOR, ATA_HD_SECTOR, ATA_HD_LCYL,
48 ATA_HD_HCYL, ATA_HD_SELECT, ATA_HD_STATUS, ATA_HD_CONTROL, -1
49};
50
51
52 /*
53 * falconide_intr_lock is used to obtain access to the IDE interrupt,
54 * which is shared between several drivers.
55 */
56
57int falconide_intr_lock;
Al Viro88f8bb7802007-07-20 04:33:18 +010058EXPORT_SYMBOL(falconide_intr_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
60
61 /*
62 * Probe for a Falcon IDE interface
63 */
64
Bartlomiej Zolnierkiewiczade2daf2008-01-26 20:13:07 +010065static int __init falconide_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070066{
67 if (MACH_IS_ATARI && ATARIHW_PRESENT(IDE)) {
68 hw_regs_t hw;
Geert Uytterhoevene79f8122008-02-01 23:09:15 +010069 ide_hwif_t *hwif;
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
Bartlomiej Zolnierkiewiczc99c92c2008-01-26 20:13:09 +010071 printk(KERN_INFO "ide: Falcon IDE controller\n");
72
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 ide_setup_ports(&hw, ATA_HD_BASE, falconide_offsets,
74 0, 0, NULL,
75// falconide_iops,
76 IRQ_MFP_IDE);
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Bartlomiej Zolnierkiewiczcbb010c2008-01-26 20:13:06 +010078 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
79 if (hwif) {
80 u8 index = hwif->index;
Bartlomiej Zolnierkiewicz8ac4ce72008-01-26 20:13:06 +010081 u8 idx[4] = { index, 0xff, 0xff, 0xff };
Bartlomiej Zolnierkiewiczcbb010c2008-01-26 20:13:06 +010082
83 ide_init_port_data(hwif, index);
84 ide_init_port_hw(hwif, &hw);
85
Bartlomiej Zolnierkiewicz8ac4ce72008-01-26 20:13:06 +010086 ide_device_add(idx);
Bartlomiej Zolnierkiewiczcbb010c2008-01-26 20:13:06 +010087 }
Bartlomiej Zolnierkiewiczade2daf2008-01-26 20:13:07 +010088 }
89
90 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091}
Bartlomiej Zolnierkiewiczade2daf2008-01-26 20:13:07 +010092
93module_init(falconide_init);