Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Bartlomiej Zolnierkiewicz | 58f189f | 2008-02-01 23:09:33 +0100 | [diff] [blame] | 2 | * Atari Falcon IDE Driver |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 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 Viro | 88f8bb780 | 2007-07-20 04:33:18 +0100 | [diff] [blame] | 11 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | #define ATA_HD_CONTROL 0x39 |
| 37 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | /* |
| 39 | * falconide_intr_lock is used to obtain access to the IDE interrupt, |
| 40 | * which is shared between several drivers. |
| 41 | */ |
| 42 | |
| 43 | int falconide_intr_lock; |
Al Viro | 88f8bb780 | 2007-07-20 04:33:18 +0100 | [diff] [blame] | 44 | EXPORT_SYMBOL(falconide_intr_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
Bartlomiej Zolnierkiewicz | 29dd597 | 2008-02-06 02:57:50 +0100 | [diff] [blame] | 46 | static 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | |
| 63 | /* |
| 64 | * Probe for a Falcon IDE interface |
| 65 | */ |
| 66 | |
Bartlomiej Zolnierkiewicz | ade2daf | 2008-01-26 20:13:07 +0100 | [diff] [blame] | 67 | static int __init falconide_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | hw_regs_t hw; |
Geert Uytterhoeven | e79f812 | 2008-02-01 23:09:15 +0100 | [diff] [blame] | 70 | ide_hwif_t *hwif; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | |
Bartlomiej Zolnierkiewicz | 29dd597 | 2008-02-06 02:57:50 +0100 | [diff] [blame] | 72 | if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE)) |
| 73 | return 0; |
| 74 | |
Bartlomiej Zolnierkiewicz | c99c92c | 2008-01-26 20:13:09 +0100 | [diff] [blame] | 75 | printk(KERN_INFO "ide: Falcon IDE controller\n"); |
| 76 | |
Bartlomiej Zolnierkiewicz | 29dd597 | 2008-02-06 02:57:50 +0100 | [diff] [blame] | 77 | falconide_setup_ports(&hw); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
Bartlomiej Zolnierkiewicz | cbb010c | 2008-01-26 20:13:06 +0100 | [diff] [blame] | 79 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
| 80 | if (hwif) { |
| 81 | u8 index = hwif->index; |
Bartlomiej Zolnierkiewicz | 8ac4ce7 | 2008-01-26 20:13:06 +0100 | [diff] [blame] | 82 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; |
Bartlomiej Zolnierkiewicz | cbb010c | 2008-01-26 20:13:06 +0100 | [diff] [blame] | 83 | |
| 84 | ide_init_port_data(hwif, index); |
| 85 | ide_init_port_hw(hwif, &hw); |
| 86 | |
Bartlomiej Zolnierkiewicz | c413b9b | 2008-02-02 19:56:31 +0100 | [diff] [blame] | 87 | ide_device_add(idx, NULL); |
Bartlomiej Zolnierkiewicz | cbb010c | 2008-01-26 20:13:06 +0100 | [diff] [blame] | 88 | } |
Bartlomiej Zolnierkiewicz | ade2daf | 2008-01-26 20:13:07 +0100 | [diff] [blame] | 89 | |
Bartlomiej Zolnierkiewicz | 29dd597 | 2008-02-06 02:57:50 +0100 | [diff] [blame] | 90 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | } |
Bartlomiej Zolnierkiewicz | ade2daf | 2008-01-26 20:13:07 +0100 | [diff] [blame] | 92 | |
| 93 | module_init(falconide_init); |