diff options
Diffstat (limited to 'drivers/ide/pci/serverworks.c')
-rw-r--r-- | drivers/ide/pci/serverworks.c | 103 |
1 files changed, 15 insertions, 88 deletions
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index d9c4fd1ae9..1371b5bf6b 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/serverworks.c Version 0.11 Jun 2 2007 | 2 | * linux/drivers/ide/pci/serverworks.c Version 0.20 Jun 3 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 1998-2000 Michel Aubry | 4 | * Copyright (C) 1998-2000 Michel Aubry |
5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz | 5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz |
@@ -151,84 +151,11 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
151 | if(dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4 && | 151 | if(dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4 && |
152 | drive->media == ide_disk && speed >= XFER_UDMA_0) | 152 | drive->media == ide_disk && speed >= XFER_UDMA_0) |
153 | BUG(); | 153 | BUG(); |
154 | 154 | ||
155 | pci_read_config_byte(dev, drive_pci[drive->dn], &pio_timing); | ||
156 | pci_read_config_byte(dev, drive_pci2[drive->dn], &dma_timing); | ||
157 | pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); | 155 | pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); |
158 | pci_read_config_word(dev, 0x4A, &csb5_pio); | 156 | pci_read_config_word(dev, 0x4A, &csb5_pio); |
159 | pci_read_config_byte(dev, 0x54, &ultra_enable); | 157 | pci_read_config_byte(dev, 0x54, &ultra_enable); |
160 | 158 | ||
161 | /* If we are in RAID mode (eg AMI MegaIDE) then we can't it | ||
162 | turns out trust the firmware configuration */ | ||
163 | |||
164 | if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) | ||
165 | goto oem_setup_failed; | ||
166 | |||
167 | /* Per Specified Design by OEM, and ASIC Architect */ | ||
168 | if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || | ||
169 | (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) { | ||
170 | if (!drive->init_speed) { | ||
171 | u8 dma_stat = inb(hwif->dma_status); | ||
172 | |||
173 | if (((ultra_enable << (7-drive->dn) & 0x80) == 0x80) && | ||
174 | ((dma_stat & (1<<(5+unit))) == (1<<(5+unit)))) { | ||
175 | drive->current_speed = drive->init_speed = XFER_UDMA_0 + udma_modes[(ultra_timing >> (4*unit)) & ~(0xF0)]; | ||
176 | return 0; | ||
177 | } else if ((dma_timing) && | ||
178 | ((dma_stat&(1<<(5+unit)))==(1<<(5+unit)))) { | ||
179 | u8 dmaspeed; | ||
180 | |||
181 | switch (dma_timing & 0x77) { | ||
182 | case 0x20: | ||
183 | dmaspeed = XFER_MW_DMA_2; | ||
184 | break; | ||
185 | case 0x21: | ||
186 | dmaspeed = XFER_MW_DMA_1; | ||
187 | break; | ||
188 | case 0x77: | ||
189 | dmaspeed = XFER_MW_DMA_0; | ||
190 | break; | ||
191 | default: | ||
192 | goto dma_pio; | ||
193 | } | ||
194 | |||
195 | drive->current_speed = drive->init_speed = dmaspeed; | ||
196 | return 0; | ||
197 | } | ||
198 | dma_pio: | ||
199 | if (pio_timing) { | ||
200 | u8 piospeed; | ||
201 | |||
202 | switch (pio_timing & 0x7f) { | ||
203 | case 0x20: | ||
204 | piospeed = XFER_PIO_4; | ||
205 | break; | ||
206 | case 0x22: | ||
207 | piospeed = XFER_PIO_3; | ||
208 | break; | ||
209 | case 0x34: | ||
210 | piospeed = XFER_PIO_2; | ||
211 | break; | ||
212 | case 0x47: | ||
213 | piospeed = XFER_PIO_1; | ||
214 | break; | ||
215 | case 0x5d: | ||
216 | piospeed = XFER_PIO_0; | ||
217 | break; | ||
218 | default: | ||
219 | goto oem_setup_failed; | ||
220 | } | ||
221 | |||
222 | drive->current_speed = drive->init_speed = piospeed; | ||
223 | return 0; | ||
224 | } | ||
225 | } | ||
226 | } | ||
227 | |||
228 | oem_setup_failed: | ||
229 | |||
230 | pio_timing = 0; | ||
231 | dma_timing = 0; | ||
232 | ultra_timing &= ~(0x0F << (4*unit)); | 159 | ultra_timing &= ~(0x0F << (4*unit)); |
233 | ultra_enable &= ~(0x01 << drive->dn); | 160 | ultra_enable &= ~(0x01 << drive->dn); |
234 | csb5_pio &= ~(0x0F << (4*drive->dn)); | 161 | csb5_pio &= ~(0x0F << (4*drive->dn)); |
@@ -402,9 +329,9 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha | |||
402 | return dev->irq; | 329 | return dev->irq; |
403 | } | 330 | } |
404 | 331 | ||
405 | static unsigned int __devinit ata66_svwks_svwks (ide_hwif_t *hwif) | 332 | static u8 __devinit ata66_svwks_svwks(ide_hwif_t *hwif) |
406 | { | 333 | { |
407 | return 1; | 334 | return ATA_CBL_PATA80; |
408 | } | 335 | } |
409 | 336 | ||
410 | /* On Dell PowerEdge servers with a CSB5/CSB6, the top two bits | 337 | /* On Dell PowerEdge servers with a CSB5/CSB6, the top two bits |
@@ -414,7 +341,7 @@ static unsigned int __devinit ata66_svwks_svwks (ide_hwif_t *hwif) | |||
414 | * Bit 14 clear = primary IDE channel does not have 80-pin cable. | 341 | * Bit 14 clear = primary IDE channel does not have 80-pin cable. |
415 | * Bit 14 set = primary IDE channel has 80-pin cable. | 342 | * Bit 14 set = primary IDE channel has 80-pin cable. |
416 | */ | 343 | */ |
417 | static unsigned int __devinit ata66_svwks_dell (ide_hwif_t *hwif) | 344 | static u8 __devinit ata66_svwks_dell(ide_hwif_t *hwif) |
418 | { | 345 | { |
419 | struct pci_dev *dev = hwif->pci_dev; | 346 | struct pci_dev *dev = hwif->pci_dev; |
420 | if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL && | 347 | if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL && |
@@ -422,8 +349,8 @@ static unsigned int __devinit ata66_svwks_dell (ide_hwif_t *hwif) | |||
422 | (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE || | 349 | (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE || |
423 | dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE)) | 350 | dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE)) |
424 | return ((1 << (hwif->channel + 14)) & | 351 | return ((1 << (hwif->channel + 14)) & |
425 | dev->subsystem_device) ? 1 : 0; | 352 | dev->subsystem_device) ? ATA_CBL_PATA80 : ATA_CBL_PATA40; |
426 | return 0; | 353 | return ATA_CBL_PATA40; |
427 | } | 354 | } |
428 | 355 | ||
429 | /* Sun Cobalt Alpine hardware avoids the 80-pin cable | 356 | /* Sun Cobalt Alpine hardware avoids the 80-pin cable |
@@ -432,18 +359,18 @@ static unsigned int __devinit ata66_svwks_dell (ide_hwif_t *hwif) | |||
432 | * | 359 | * |
433 | * WARNING: this only works on Alpine hardware! | 360 | * WARNING: this only works on Alpine hardware! |
434 | */ | 361 | */ |
435 | static unsigned int __devinit ata66_svwks_cobalt (ide_hwif_t *hwif) | 362 | static u8 __devinit ata66_svwks_cobalt(ide_hwif_t *hwif) |
436 | { | 363 | { |
437 | struct pci_dev *dev = hwif->pci_dev; | 364 | struct pci_dev *dev = hwif->pci_dev; |
438 | if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN && | 365 | if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN && |
439 | dev->vendor == PCI_VENDOR_ID_SERVERWORKS && | 366 | dev->vendor == PCI_VENDOR_ID_SERVERWORKS && |
440 | dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) | 367 | dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) |
441 | return ((1 << (hwif->channel + 14)) & | 368 | return ((1 << (hwif->channel + 14)) & |
442 | dev->subsystem_device) ? 1 : 0; | 369 | dev->subsystem_device) ? ATA_CBL_PATA80 : ATA_CBL_PATA40; |
443 | return 0; | 370 | return ATA_CBL_PATA40; |
444 | } | 371 | } |
445 | 372 | ||
446 | static unsigned int __devinit ata66_svwks (ide_hwif_t *hwif) | 373 | static u8 __devinit ata66_svwks(ide_hwif_t *hwif) |
447 | { | 374 | { |
448 | struct pci_dev *dev = hwif->pci_dev; | 375 | struct pci_dev *dev = hwif->pci_dev; |
449 | 376 | ||
@@ -462,9 +389,9 @@ static unsigned int __devinit ata66_svwks (ide_hwif_t *hwif) | |||
462 | /* Per Specified Design by OEM, and ASIC Architect */ | 389 | /* Per Specified Design by OEM, and ASIC Architect */ |
463 | if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || | 390 | if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || |
464 | (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) | 391 | (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) |
465 | return 1; | 392 | return ATA_CBL_PATA80; |
466 | 393 | ||
467 | return 0; | 394 | return ATA_CBL_PATA40; |
468 | } | 395 | } |
469 | 396 | ||
470 | static void __devinit init_hwif_svwks (ide_hwif_t *hwif) | 397 | static void __devinit init_hwif_svwks (ide_hwif_t *hwif) |
@@ -495,8 +422,8 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) | |||
495 | 422 | ||
496 | hwif->ide_dma_check = &svwks_config_drive_xfer_rate; | 423 | hwif->ide_dma_check = &svwks_config_drive_xfer_rate; |
497 | if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { | 424 | if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { |
498 | if (!hwif->udma_four) | 425 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
499 | hwif->udma_four = ata66_svwks(hwif); | 426 | hwif->cbl = ata66_svwks(hwif); |
500 | } | 427 | } |
501 | if (!noautodma) | 428 | if (!noautodma) |
502 | hwif->autodma = 1; | 429 | hwif->autodma = 1; |