Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/types.h> |
| 17 | #include <linux/module.h> |
| 18 | #include <linux/kernel.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #include <linux/pci.h> |
| 20 | #include <linux/ide.h> |
| 21 | #include <linux/init.h> |
| 22 | |
Bartlomiej Zolnierkiewicz | ced3ec8 | 2008-07-24 22:53:32 +0200 | [diff] [blame] | 23 | #define DRV_NAME "rz1000" |
| 24 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) |
| 26 | { |
Bartlomiej Zolnierkiewicz | 3650165 | 2008-02-01 23:09:31 +0100 | [diff] [blame] | 27 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | u16 reg; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | if (!pci_read_config_word (dev, 0x40, ®) && |
| 31 | !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { |
| 32 | printk(KERN_INFO "%s: disabled chipset read-ahead " |
| 33 | "(buggy RZ1000/RZ1001)\n", hwif->name); |
| 34 | } else { |
Bartlomiej Zolnierkiewicz | 746f312 | 2007-10-20 00:32:29 +0200 | [diff] [blame] | 35 | if (hwif->mate) |
| 36 | hwif->mate->serialized = hwif->serialized = 1; |
Bartlomiej Zolnierkiewicz | 807b90d | 2008-02-02 19:56:40 +0100 | [diff] [blame] | 37 | hwif->host_flags |= IDE_HFLAG_NO_UNMASK_IRQS; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | printk(KERN_INFO "%s: serialized, disabled unmasking " |
| 39 | "(buggy RZ1000/RZ1001)\n", hwif->name); |
| 40 | } |
| 41 | } |
| 42 | |
Bartlomiej Zolnierkiewicz | 8562043 | 2007-10-20 00:32:34 +0200 | [diff] [blame] | 43 | static const struct ide_port_info rz1000_chipset __devinitdata = { |
Bartlomiej Zolnierkiewicz | ced3ec8 | 2008-07-24 22:53:32 +0200 | [diff] [blame] | 44 | .name = DRV_NAME, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | .init_hwif = init_hwif_rz1000, |
Bartlomiej Zolnierkiewicz | 528a572 | 2007-10-20 00:32:30 +0200 | [diff] [blame] | 46 | .chipset = ide_rz1000, |
Bartlomiej Zolnierkiewicz | 5e71d9c | 2008-04-26 17:36:35 +0200 | [diff] [blame] | 47 | .host_flags = IDE_HFLAG_NO_DMA, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 51 | { |
Bartlomiej Zolnierkiewicz | 6cdf6eb | 2008-07-24 22:53:14 +0200 | [diff] [blame] | 52 | return ide_pci_init_one(dev, &rz1000_chipset, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | } |
| 54 | |
Bartlomiej Zolnierkiewicz | 9cbcc5e | 2007-10-16 22:29:56 +0200 | [diff] [blame] | 55 | static 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | { 0, }, |
| 59 | }; |
| 60 | MODULE_DEVICE_TABLE(pci, rz1000_pci_tbl); |
| 61 | |
Bartlomiej Zolnierkiewicz | a9ab09e | 2008-10-13 21:39:41 +0200 | [diff] [blame] | 62 | static struct pci_driver rz1000_pci_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | .name = "RZ1000_IDE", |
| 64 | .id_table = rz1000_pci_tbl, |
| 65 | .probe = rz1000_init_one, |
Bartlomiej Zolnierkiewicz | 0fd1880 | 2008-07-24 22:53:24 +0200 | [diff] [blame] | 66 | .remove = ide_pci_remove, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | }; |
| 68 | |
Bartlomiej Zolnierkiewicz | 82ab1ee | 2007-01-27 13:46:56 +0100 | [diff] [blame] | 69 | static int __init rz1000_ide_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | { |
Bartlomiej Zolnierkiewicz | a9ab09e | 2008-10-13 21:39:41 +0200 | [diff] [blame] | 71 | return ide_pci_register_driver(&rz1000_pci_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | } |
| 73 | |
Bartlomiej Zolnierkiewicz | 0fd1880 | 2008-07-24 22:53:24 +0200 | [diff] [blame] | 74 | static void __exit rz1000_ide_exit(void) |
| 75 | { |
Bartlomiej Zolnierkiewicz | a9ab09e | 2008-10-13 21:39:41 +0200 | [diff] [blame] | 76 | pci_unregister_driver(&rz1000_pci_driver); |
Bartlomiej Zolnierkiewicz | 0fd1880 | 2008-07-24 22:53:24 +0200 | [diff] [blame] | 77 | } |
| 78 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | module_init(rz1000_ide_init); |
Bartlomiej Zolnierkiewicz | 0fd1880 | 2008-07-24 22:53:24 +0200 | [diff] [blame] | 80 | module_exit(rz1000_ide_exit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | |
| 82 | MODULE_AUTHOR("Andre Hedrick"); |
| 83 | MODULE_DESCRIPTION("PCI driver module for RZ1000 IDE"); |
| 84 | MODULE_LICENSE("GPL"); |
| 85 | |