aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/serverworks.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/serverworks.c')
-rw-r--r--drivers/ide/pci/serverworks.c86
1 files changed, 31 insertions, 55 deletions
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index d3ffc52e22af..a3d880e21d0b 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -360,23 +360,10 @@ static u8 __devinit ata66_svwks(ide_hwif_t *hwif)
360 360
361static void __devinit init_hwif_svwks (ide_hwif_t *hwif) 361static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
362{ 362{
363 if (!hwif->irq)
364 hwif->irq = hwif->channel ? 15 : 14;
365
366 hwif->set_pio_mode = &svwks_set_pio_mode; 363 hwif->set_pio_mode = &svwks_set_pio_mode;
367 hwif->set_dma_mode = &svwks_set_dma_mode; 364 hwif->set_dma_mode = &svwks_set_dma_mode;
368 hwif->udma_filter = &svwks_udma_filter; 365 hwif->udma_filter = &svwks_udma_filter;
369 366
370 hwif->atapi_dma = 1;
371
372 if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE)
373 hwif->ultra_mask = 0x3f;
374
375 hwif->mwdma_mask = 0x07;
376
377 hwif->drives[0].autotune = 1;
378 hwif->drives[1].autotune = 1;
379
380 if (!hwif->dma_base) 367 if (!hwif->dma_base)
381 return; 368 return;
382 369
@@ -386,72 +373,49 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
386 } 373 }
387} 374}
388 375
389static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d)
390{
391 return ide_setup_pci_device(dev, d);
392}
393
394static int __devinit init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d)
395{
396 if (!(PCI_FUNC(dev->devfn) & 1)) {
397 d->bootable = NEVER_BOARD;
398 if (dev->resource[0].start == 0x01f1)
399 d->bootable = ON_BOARD;
400 }
401
402 if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE ||
403 dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) &&
404 (!(PCI_FUNC(dev->devfn) & 1)))
405 d->host_flags |= IDE_HFLAG_SINGLE;
406 else
407 d->host_flags &= ~IDE_HFLAG_SINGLE;
408
409 return ide_setup_pci_device(dev, d);
410}
411
412static ide_pci_device_t serverworks_chipsets[] __devinitdata = { 376static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
413 { /* 0 */ 377 { /* 0 */
414 .name = "SvrWks OSB4", 378 .name = "SvrWks OSB4",
415 .init_setup = init_setup_svwks,
416 .init_chipset = init_chipset_svwks, 379 .init_chipset = init_chipset_svwks,
417 .init_hwif = init_hwif_svwks, 380 .init_hwif = init_hwif_svwks,
418 .autodma = AUTODMA, 381 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
419 .bootable = ON_BOARD,
420 .pio_mask = ATA_PIO4, 382 .pio_mask = ATA_PIO4,
383 .mwdma_mask = ATA_MWDMA2,
384 .udma_mask = 0x00, /* UDMA is problematic on OSB4 */
421 },{ /* 1 */ 385 },{ /* 1 */
422 .name = "SvrWks CSB5", 386 .name = "SvrWks CSB5",
423 .init_setup = init_setup_svwks,
424 .init_chipset = init_chipset_svwks, 387 .init_chipset = init_chipset_svwks,
425 .init_hwif = init_hwif_svwks, 388 .init_hwif = init_hwif_svwks,
426 .autodma = AUTODMA, 389 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
427 .bootable = ON_BOARD,
428 .pio_mask = ATA_PIO4, 390 .pio_mask = ATA_PIO4,
391 .mwdma_mask = ATA_MWDMA2,
392 .udma_mask = ATA_UDMA5,
429 },{ /* 2 */ 393 },{ /* 2 */
430 .name = "SvrWks CSB6", 394 .name = "SvrWks CSB6",
431 .init_setup = init_setup_csb6,
432 .init_chipset = init_chipset_svwks, 395 .init_chipset = init_chipset_svwks,
433 .init_hwif = init_hwif_svwks, 396 .init_hwif = init_hwif_svwks,
434 .autodma = AUTODMA, 397 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
435 .bootable = ON_BOARD,
436 .pio_mask = ATA_PIO4, 398 .pio_mask = ATA_PIO4,
399 .mwdma_mask = ATA_MWDMA2,
400 .udma_mask = ATA_UDMA5,
437 },{ /* 3 */ 401 },{ /* 3 */
438 .name = "SvrWks CSB6", 402 .name = "SvrWks CSB6",
439 .init_setup = init_setup_csb6,
440 .init_chipset = init_chipset_svwks, 403 .init_chipset = init_chipset_svwks,
441 .init_hwif = init_hwif_svwks, 404 .init_hwif = init_hwif_svwks,
442 .autodma = AUTODMA, 405 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_SINGLE |
443 .bootable = ON_BOARD, 406 IDE_HFLAG_BOOTABLE,
444 .host_flags = IDE_HFLAG_SINGLE,
445 .pio_mask = ATA_PIO4, 407 .pio_mask = ATA_PIO4,
408 .mwdma_mask = ATA_MWDMA2,
409 .udma_mask = ATA_UDMA5,
446 },{ /* 4 */ 410 },{ /* 4 */
447 .name = "SvrWks HT1000", 411 .name = "SvrWks HT1000",
448 .init_setup = init_setup_svwks,
449 .init_chipset = init_chipset_svwks, 412 .init_chipset = init_chipset_svwks,
450 .init_hwif = init_hwif_svwks, 413 .init_hwif = init_hwif_svwks,
451 .autodma = AUTODMA, 414 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_SINGLE |
452 .bootable = ON_BOARD, 415 IDE_HFLAG_BOOTABLE,
453 .host_flags = IDE_HFLAG_SINGLE,
454 .pio_mask = ATA_PIO4, 416 .pio_mask = ATA_PIO4,
417 .mwdma_mask = ATA_MWDMA2,
418 .udma_mask = ATA_UDMA5,
455 } 419 }
456}; 420};
457 421
@@ -466,9 +430,21 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
466 430
467static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) 431static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id)
468{ 432{
469 ide_pci_device_t *d = &serverworks_chipsets[id->driver_data]; 433 ide_pci_device_t d;
434 u8 idx = id->driver_data;
435
436 d = serverworks_chipsets[idx];
437
438 if (idx == 2 || idx == 3) {
439 if ((PCI_FUNC(dev->devfn) & 1) == 0) {
440 if (pci_resource_start(dev, 0) != 0x01f1)
441 d.host_flags &= ~IDE_HFLAG_BOOTABLE;
442 d.host_flags |= IDE_HFLAG_SINGLE;
443 } else
444 d.host_flags &= ~IDE_HFLAG_SINGLE;
445 }
470 446
471 return d->init_setup(dev, d); 447 return ide_setup_pci_device(dev, &d);
472} 448}
473 449
474static const struct pci_device_id svwks_pci_tbl[] = { 450static const struct pci_device_id svwks_pci_tbl[] = {