blob: dd0d18ba0022fe78f7beccea5c097394f8d92770 [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
Linus Torvalds1da177e2005-04-16 15:20:36 -070024static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif)
25{
Bartlomiej Zolnierkiewicz36501652008-02-01 23:09:31 +010026 struct pci_dev *dev = to_pci_dev(hwif->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 u16 reg;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 if (!pci_read_config_word (dev, 0x40, &reg) &&
30 !pci_write_config_word(dev, 0x40, reg & 0xdfff)) {
31 printk(KERN_INFO "%s: disabled chipset read-ahead "
32 "(buggy RZ1000/RZ1001)\n", hwif->name);
33 } else {
Bartlomiej Zolnierkiewicz746f3122007-10-20 00:32:29 +020034 if (hwif->mate)
35 hwif->mate->serialized = hwif->serialized = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 hwif->drives[0].no_unmask = 1;
37 hwif->drives[1].no_unmask = 1;
38 printk(KERN_INFO "%s: serialized, disabled unmasking "
39 "(buggy RZ1000/RZ1001)\n", hwif->name);
40 }
41}
42
Bartlomiej Zolnierkiewicz85620432007-10-20 00:32:34 +020043static const struct ide_port_info rz1000_chipset __devinitdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 .name = "RZ100x",
45 .init_hwif = init_hwif_rz1000,
Bartlomiej Zolnierkiewicz528a5722007-10-20 00:32:30 +020046 .chipset = ide_rz1000,
Bartlomiej Zolnierkiewicz47b68782007-10-19 00:30:06 +020047 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_BOOTABLE,
Linus Torvalds1da177e2005-04-16 15:20:36 -070048};
49
50static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id)
51{
52 return ide_setup_pci_device(dev, &rz1000_chipset);
53}
54
Bartlomiej Zolnierkiewicz9cbcc5e2007-10-16 22:29:56 +020055static const struct pci_device_id rz1000_pci_tbl[] = {
56 { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000), 0 },
57 { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001), 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 { 0, },
59};
60MODULE_DEVICE_TABLE(pci, rz1000_pci_tbl);
61
62static struct pci_driver driver = {
63 .name = "RZ1000_IDE",
64 .id_table = rz1000_pci_tbl,
65 .probe = rz1000_init_one,
66};
67
Bartlomiej Zolnierkiewicz82ab1ee2007-01-27 13:46:56 +010068static int __init rz1000_ide_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070069{
70 return ide_pci_register_driver(&driver);
71}
72
73module_init(rz1000_ide_init);
74
75MODULE_AUTHOR("Andre Hedrick");
76MODULE_DESCRIPTION("PCI driver module for RZ1000 IDE");
77MODULE_LICENSE("GPL");
78