blob: 8d11ee838a2a825702f31a56429a1f25dd663010 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Copyright (C) 1995-1998 Linus Torvalds & author (see below)
3 */
4
5/*
6 * Principal Author: mlord@pobox.com (Mark Lord)
7 *
8 * See linux/MAINTAINERS for address of current maintainer.
9 *
10 * This file provides support for disabling the buggy read-ahead
11 * mode of the RZ1000 IDE chipset, commonly used on Intel motherboards.
12 *
13 * Dunno if this fixes both ports, or only the primary port (?).
14 */
15
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <linux/types.h>
17#include <linux/module.h>
18#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <linux/hdreg.h>
20#include <linux/pci.h>
21#include <linux/ide.h>
22#include <linux/init.h>
23
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +020024#define DRV_NAME "rz1000"
25
Linus Torvalds1da177e2005-04-16 15:20:36 -070026static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif)
27{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +010028 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 u16 reg;
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 if (!pci_read_config_word (dev, 0x40, &reg) &&
32 !pci_write_config_word(dev, 0x40, reg & 0xdfff)) {
33 printk(KERN_INFO "%s: disabled chipset read-ahead "
34 "(buggy RZ1000/RZ1001)\n", hwif->name);
35 } else {
Bartlomiej Zolnierkiewicz746f3122007-10-20 00:32:29 +020036 if (hwif->mate)
37 hwif->mate->serialized = hwif->serialized = 1;
Bartlomiej Zolnierkiewicz807b90d2008-02-02 19:56:40 +010038 hwif->host_flags |= IDE_HFLAG_NO_UNMASK_IRQS;
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 printk(KERN_INFO "%s: serialized, disabled unmasking "
40 "(buggy RZ1000/RZ1001)\n", hwif->name);
41 }
42}
43
Bartlomiej Zolnierkiewicz85620432007-10-20 00:32:34 +020044static const struct ide_port_info rz1000_chipset __devinitdata = {
Bartlomiej Zolnierkiewiczced3ec82008-07-24 22:53:32 +020045 .name = DRV_NAME,
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 .init_hwif = init_hwif_rz1000,
Bartlomiej Zolnierkiewicz528a5722007-10-20 00:32:30 +020047 .chipset = ide_rz1000,
Bartlomiej Zolnierkiewicz5e71d9c2008-04-26 17:36:35 +020048 .host_flags = IDE_HFLAG_NO_DMA,
Linus Torvalds1da177e2005-04-16 15:20:36 -070049};
50
51static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id)
52{
Bartlomiej Zolnierkiewicz6cdf6eb2008-07-24 22:53:14 +020053 return ide_pci_init_one(dev, &rz1000_chipset, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -070054}
55
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +020056static const struct pci_device_id rz1000_pci_tbl[] = {
57 { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000), 0 },
58 { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001), 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 { 0, },
60};
61MODULE_DEVICE_TABLE(pci, rz1000_pci_tbl);
62
63static struct pci_driver driver = {
64 .name = "RZ1000_IDE",
65 .id_table = rz1000_pci_tbl,
66 .probe = rz1000_init_one,
Bartlomiej Zolnierkiewicz0fd18802008-07-24 22:53:24 +020067 .remove = ide_pci_remove,
Linus Torvalds1da177e2005-04-16 15:20:36 -070068};
69
Bartlomiej Zolnierkiewicz82ab1ee2007-01-27 13:46:56 +010070static int __init rz1000_ide_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070071{
72 return ide_pci_register_driver(&driver);
73}
74
Bartlomiej Zolnierkiewicz0fd18802008-07-24 22:53:24 +020075static void __exit rz1000_ide_exit(void)
76{
77 pci_unregister_driver(&driver);
78}
79
Linus Torvalds1da177e2005-04-16 15:20:36 -070080module_init(rz1000_ide_init);
Bartlomiej Zolnierkiewicz0fd18802008-07-24 22:53:24 +020081module_exit(rz1000_ide_exit);
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
83MODULE_AUTHOR("Andre Hedrick");
84MODULE_DESCRIPTION("PCI driver module for RZ1000 IDE");
85MODULE_LICENSE("GPL");
86