1 /*
2 * linux/drivers/ide/pci/rz1000.c Version 0.06 January 12, 2003
3 *
4 * Copyright (C) 1995-1998 Linus Torvalds & author (see below)
5 */
6
7 /*
8 * Principal Author: mlord@pobox.com (Mark Lord)
9 *
10 * See linux/MAINTAINERS for address of current maintainer.
11 *
12 * This file provides support for disabling the buggy read-ahead
13 * mode of the RZ1000 IDE chipset, commonly used on Intel motherboards.
14 *
15 * Dunno if this fixes both ports, or only the primary port (?).
16 */
17
18 #undef REALLY_SLOW_IO /* most systems can safely undef this */
19
20 #include <linux/config.h> /* for CONFIG_BLK_DEV_IDEPCI */
21 #include <linux/types.h>
22 #include <linux/module.h>
23 #include <linux/kernel.h>
24 #include <linux/delay.h>
25 #include <linux/timer.h>
26 #include <linux/mm.h>
27 #include <linux/ioport.h>
28 #include <linux/blkdev.h>
29 #include <linux/hdreg.h>
30 #include <linux/pci.h>
31 #include <linux/ide.h>
32 #include <linux/init.h>
33
34 #include <asm/io.h>
35
36 #include "rz1000.h"
37
init_hwif_rz1000(ide_hwif_t * hwif)38 static void __init init_hwif_rz1000 (ide_hwif_t *hwif)
39 {
40 u16 reg;
41 struct pci_dev *dev = hwif->pci_dev;
42
43 hwif->chipset = ide_rz1000;
44 if (!pci_read_config_word (dev, 0x40, ®) &&
45 !pci_write_config_word(dev, 0x40, reg & 0xdfff)) {
46 printk(KERN_INFO "%s: disabled chipset read-ahead "
47 "(buggy RZ1000/RZ1001)\n", hwif->name);
48 } else {
49 hwif->serialized = 1;
50 hwif->drives[0].no_unmask = 1;
51 hwif->drives[1].no_unmask = 1;
52 printk(KERN_INFO "%s: serialized, disabled unmasking "
53 "(buggy RZ1000/RZ1001)\n", hwif->name);
54 }
55 }
56
57 extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
58
rz1000_init_one(struct pci_dev * dev,const struct pci_device_id * id)59 static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id)
60 {
61 ide_pci_device_t *d = &rz1000_chipsets[id->driver_data];
62 if (dev->device != d->device)
63 BUG();
64 ide_setup_pci_device(dev, d);
65 MOD_INC_USE_COUNT;
66 return 0;
67 }
68
69 static struct pci_device_id rz1000_pci_tbl[] __devinitdata = {
70 { PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
71 { PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
72 { 0, },
73 };
74
75 static struct pci_driver driver = {
76 .name = "RZ1000 IDE",
77 .id_table = rz1000_pci_tbl,
78 .probe = rz1000_init_one,
79 };
80
rz1000_ide_init(void)81 static int rz1000_ide_init(void)
82 {
83 return ide_pci_register_driver(&driver);
84 }
85
rz1000_ide_exit(void)86 static void rz1000_ide_exit(void)
87 {
88 ide_pci_unregister_driver(&driver);
89 }
90
91 module_init(rz1000_ide_init);
92 module_exit(rz1000_ide_exit);
93
94 MODULE_AUTHOR("Andre Hedrick");
95 MODULE_DESCRIPTION("PCI driver module for RZ1000 IDE");
96 MODULE_LICENSE("GPL");
97
98 EXPORT_NO_SYMBOLS;
99
100