update atp870u driver to 0.78 from D-Link source
[linux-2.4.git] / drivers / ide / ppc / cpci405ide.c
1 /*
2  *  linux/drivers/ide/ppc/cpci405ide.c -- CPCI405 IDE Driver
3  *
4  *  Copyright (C) 2001-2003 Stefan Roese, stefan.roese@esd-electronics.de
5  *
6  *  This driver was written based on information obtained from the MacOS IDE
7  *  driver binary by Mikael Forselius
8  *
9  *  This file is subject to the terms and conditions of the GNU General Public
10  *  License.  See the file COPYING in the main directory of this archive for
11  *  more details.
12  */
13
14 #include <linux/types.h>
15 #include <linux/mm.h>
16 #include <linux/interrupt.h>
17 #include <linux/blkdev.h>
18 #include <linux/hdreg.h>
19 #include <linux/delay.h>
20 #include <linux/ide.h>
21 #include <linux/init.h>
22
23
24 /*
25  *  Base of the IDE interface
26  */
27
28 #define CPCI405_HD_BASE 0xf0100000
29
30 /*
31  *  Offsets from the above base (scaling 4)
32  */
33
34 #define CPCI405_HD_DATA         0x00
35 #define CPCI405_HD_ERROR        0x01            /* see err-bits */
36 #define CPCI405_HD_NSECTOR      0x02            /* nr of sectors to read/write */
37 #define CPCI405_HD_SECTOR       0x03            /* starting sector */
38 #define CPCI405_HD_LCYL         0x04            /* starting cylinder */
39 #define CPCI405_HD_HCYL         0x05            /* high byte of starting cyl */
40 #define CPCI405_HD_SELECT       0x06            /* 101dhhhh , d=drive, hhhh=head */
41 #define CPCI405_HD_STATUS       0x07            /* see status-bits */
42 #define CPCI405_HD_CONTROL      0x0e            /* control/altstatus */
43
44 #define CPCI405_IRQ_IDE         0x1f
45
46 static int cpci405ide_offsets[IDE_NR_PORTS] __initdata = {
47         CPCI405_HD_DATA, CPCI405_HD_ERROR, CPCI405_HD_NSECTOR, CPCI405_HD_SECTOR,
48         CPCI405_HD_LCYL, CPCI405_HD_HCYL, CPCI405_HD_SELECT, CPCI405_HD_STATUS,
49         CPCI405_HD_CONTROL
50 };
51
52 static void *cpci405_ide_base_mapped;
53
54
55 /*
56  *  Probe for a CPCI405 IDE interface
57  */
58
59 void __init cpci405ide_init(void)
60 {
61         hw_regs_t hw;
62         int index = -1;
63
64         cpci405_ide_base_mapped =
65                 ioremap((unsigned long) CPCI405_HD_BASE, 0x200) - _IO_BASE;
66         ide_setup_ports(&hw, (ide_ioreg_t)cpci405_ide_base_mapped,
67                         cpci405ide_offsets, 0, 0, NULL, CPCI405_IRQ_IDE);
68         index = ide_register_hw(&hw, NULL);
69         if (index != -1)
70                 printk("ide%d: CPCI405 IDE interface\n", index);
71
72 }