aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/serverworks.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2010-01-18 02:19:22 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-19 04:25:01 -0500
commite7593af6e5c24e323217c12d011ad7e43742ca6f (patch)
tree9cb018d472b63ddc58ff86957b25a0d2959777c5 /drivers/ide/serverworks.c
parenta337c2272731d538827153b32f547ef7c131a4cb (diff)
serverworks: cleanup svwks_udma_filter()
* remove dead OSB4 UDMA support * remove unreachable code * make isa_dev local to ->init_chipset Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ide/serverworks.c')
-rw-r--r--drivers/ide/serverworks.c40
1 files changed, 11 insertions, 29 deletions
diff --git a/drivers/ide/serverworks.c b/drivers/ide/serverworks.c
index b6554ef92716..1777c919237e 100644
--- a/drivers/ide/serverworks.c
+++ b/drivers/ide/serverworks.c
@@ -2,7 +2,7 @@
2 * Copyright (C) 1998-2000 Michel Aubry 2 * Copyright (C) 1998-2000 Michel Aubry
3 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz 3 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz
4 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz 5 * Copyright (C) 2007-2010 Bartlomiej Zolnierkiewicz
6 * Portions copyright (c) 2001 Sun Microsystems 6 * Portions copyright (c) 2001 Sun Microsystems
7 * 7 *
8 * 8 *
@@ -52,8 +52,6 @@ static const char *svwks_bad_ata100[] = {
52 NULL 52 NULL
53}; 53};
54 54
55static struct pci_dev *isa_dev;
56
57static int check_in_drive_lists (ide_drive_t *drive, const char **list) 55static int check_in_drive_lists (ide_drive_t *drive, const char **list)
58{ 56{
59 char *m = (char *)&drive->id[ATA_ID_PROD]; 57 char *m = (char *)&drive->id[ATA_ID_PROD];
@@ -67,26 +65,14 @@ static int check_in_drive_lists (ide_drive_t *drive, const char **list)
67static u8 svwks_udma_filter(ide_drive_t *drive) 65static u8 svwks_udma_filter(ide_drive_t *drive)
68{ 66{
69 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); 67 struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
70 u8 mask = 0;
71 68
72 if (dev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) 69 if (dev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) {
73 return 0x1f; 70 return 0x1f;
74 if (dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
75 u32 reg = 0;
76 if (isa_dev)
77 pci_read_config_dword(isa_dev, 0x64, &reg);
78
79 /*
80 * Don't enable UDMA on disk devices for the moment
81 */
82 if(drive->media == ide_disk)
83 return 0;
84 /* Check the OSB4 DMA33 enable bit */
85 return ((reg & 0x00004000) == 0x00004000) ? 0x07 : 0;
86 } else if (dev->revision < SVWKS_CSB5_REVISION_NEW) { 71 } else if (dev->revision < SVWKS_CSB5_REVISION_NEW) {
87 return 0x07; 72 return 0x07;
88 } else if (dev->revision >= SVWKS_CSB5_REVISION_NEW) { 73 } else {
89 u8 btr = 0, mode; 74 u8 btr = 0, mode, mask;
75
90 pci_read_config_byte(dev, 0x5A, &btr); 76 pci_read_config_byte(dev, 0x5A, &btr);
91 mode = btr & 0x3; 77 mode = btr & 0x3;
92 78
@@ -101,13 +87,9 @@ static u8 svwks_udma_filter(ide_drive_t *drive)
101 case 1: mask = 0x07; break; 87 case 1: mask = 0x07; break;
102 default: mask = 0x00; break; 88 default: mask = 0x00; break;
103 } 89 }
104 }
105 if (((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
106 (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) &&
107 (!(PCI_FUNC(dev->devfn) & 1)))
108 mask = 0x1f;
109 90
110 return mask; 91 return mask;
92 }
111} 93}
112 94
113static u8 svwks_csb_check (struct pci_dev *dev) 95static u8 svwks_csb_check (struct pci_dev *dev)
@@ -185,8 +167,9 @@ static int init_chipset_svwks(struct pci_dev *dev)
185 167
186 /* OSB4 : South Bridge and IDE */ 168 /* OSB4 : South Bridge and IDE */
187 if (dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { 169 if (dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
188 isa_dev = pci_get_device(PCI_VENDOR_ID_SERVERWORKS, 170 struct pci_dev *isa_dev =
189 PCI_DEVICE_ID_SERVERWORKS_OSB4, NULL); 171 pci_get_device(PCI_VENDOR_ID_SERVERWORKS,
172 PCI_DEVICE_ID_SERVERWORKS_OSB4, NULL);
190 if (isa_dev) { 173 if (isa_dev) {
191 pci_read_config_dword(isa_dev, 0x64, &reg); 174 pci_read_config_dword(isa_dev, 0x64, &reg);
192 reg &= ~0x00002000; /* disable 600ns interrupt mask */ 175 reg &= ~0x00002000; /* disable 600ns interrupt mask */
@@ -343,7 +326,6 @@ static u8 svwks_cable_detect(ide_hwif_t *hwif)
343static const struct ide_port_ops osb4_port_ops = { 326static const struct ide_port_ops osb4_port_ops = {
344 .set_pio_mode = svwks_set_pio_mode, 327 .set_pio_mode = svwks_set_pio_mode,
345 .set_dma_mode = svwks_set_dma_mode, 328 .set_dma_mode = svwks_set_dma_mode,
346 .udma_filter = svwks_udma_filter,
347}; 329};
348 330
349static const struct ide_port_ops svwks_port_ops = { 331static const struct ide_port_ops svwks_port_ops = {
@@ -460,6 +442,6 @@ static void __exit svwks_ide_exit(void)
460module_init(svwks_ide_init); 442module_init(svwks_ide_init);
461module_exit(svwks_ide_exit); 443module_exit(svwks_ide_exit);
462 444
463MODULE_AUTHOR("Michael Aubry. Andrzej Krzysztofowicz, Andre Hedrick"); 445MODULE_AUTHOR("Michael Aubry. Andrzej Krzysztofowicz, Andre Hedrick, Bartlomiej Zolnierkiewicz");
464MODULE_DESCRIPTION("PCI driver module for Serverworks OSB4/CSB5/CSB6 IDE"); 446MODULE_DESCRIPTION("PCI driver module for Serverworks OSB4/CSB5/CSB6 IDE");
465MODULE_LICENSE("GPL"); 447MODULE_LICENSE("GPL");