update atp870u driver to 0.78 from D-Link source
[linux-2.4.git] / drivers / ide / pci / adma100.c
1 /*
2  *  linux/drivers/ide/pci/adma100.c -- basic support for Pacific Digital ADMA-100 boards
3  *
4  *     Created 09 Apr 2002 by Mark Lord
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
11 #include <linux/config.h> /* for CONFIG_BLK_DEV_IDEPCI */
12 #include <linux/types.h>
13 #include <linux/module.h>
14 #include <linux/mm.h>
15 #include <linux/blkdev.h>
16 #include <linux/hdreg.h>
17 #include <linux/ide.h>
18 #include <linux/init.h>
19 #include <linux/pci.h>
20 #include <asm/io.h>
21
22 #include "adma100.h"
23
24 void __init init_hwif_adma100 (ide_hwif_t *hwif)
25 {
26         unsigned long  phy_admctl = pci_resource_start(hwif->pci_dev, 4) + 0x80 + (hwif->channel * 0x20);
27         void *v_admctl;
28
29         hwif->autodma  = 0;             // not compatible with normal IDE DMA transfers
30         hwif->dma_base = 0;             // disable DMA completely
31         hwif->io_ports[IDE_CONTROL_OFFSET] += 4;        // chip needs offset of 6 instead of 2
32         v_admctl = ioremap_nocache(phy_admctl, 1024);   // map config regs, so we can turn on drive IRQs
33         *((unsigned short *)v_admctl) &= 3;             // enable aIEN; preserve PIO mode
34         iounmap(v_admctl);                              // all done; unmap config regs
35         printk("ADMA100: initialized %s for basic PIO-only operation\n", hwif->name);
36 }
37
38 extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
39
40 static int __devinit adma100_init_one (struct pci_dev *dev, const struct pci_device_id *id)
41 {
42         ide_pci_device_t *d = &adma100_chipsets[id->driver_data];
43
44         if (dev->device != d->device)
45                 BUG();
46         ide_setup_pci_device(dev, d);
47         MOD_INC_USE_COUNT;
48         return 0;
49 }
50
51 static struct pci_device_id adma100_pci_tbl[] __devinitdata = {
52         { PCI_VENDOR_ID_PDC, PCI_DEVICE_ID_PDC_ADMA100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
53         { 0, },
54 };
55
56 static struct pci_driver driver = {
57         .name           = "ADMA100 IDE",
58         .id_table       = adma100_pci_tbl,
59         .probe          = adma100_init_one,
60 };
61
62 static int adma100_ide_init (void)
63 {
64         return ide_pci_register_driver(&driver);
65 }
66
67 static void adma100_ide_exit (void)
68 {
69         ide_pci_unregister_driver(&driver);
70 }
71
72 module_init(adma100_ide_init);
73 module_exit(adma100_ide_exit);
74
75 MODULE_AUTHOR("Mark Lord");
76 MODULE_DESCRIPTION("Basic PIO support for ADMA100 IDE");
77 MODULE_LICENSE("GPL");
78
79 EXPORT_NO_SYMBOLS;
80