aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/serverworks.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-06-28 07:27:02 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-28 17:59:07 -0400
commitf201f5046ddaeeccb036bdf6848549bf5cb51bb1 (patch)
tree5944310bd67382bbbc6a3998e0d152a194834404 /drivers/ide/pci/serverworks.c
parentda574af755bcb1d604e01feadf2a8c31b364447c (diff)
[PATCH] ide: housekeeping on IDE drivers
Move auto arrays to static (const). Clean up using PCI_DEVICE in places, remove unreachable junk and dead code. Fix the serverworks cable detect logic (if ordering is wrong). Backport from libata. Plenty of scope for more cleanup left. Signed-off-by: Alan Cox <alan@redhat.com> Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/ide/pci/serverworks.c')
-rw-r--r--drivers/ide/pci/serverworks.c53
1 files changed, 16 insertions, 37 deletions
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index 0d3073f4eab4..5100b827a935 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -123,11 +123,11 @@ static u8 svwks_csb_check (struct pci_dev *dev)
123} 123}
124static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) 124static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
125{ 125{
126 u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; 126 static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
127 u8 dma_modes[] = { 0x77, 0x21, 0x20 }; 127 static const u8 dma_modes[] = { 0x77, 0x21, 0x20 };
128 u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; 128 static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
129 u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; 129 static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 };
130 u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; 130 static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 };
131 131
132 ide_hwif_t *hwif = HWIF(drive); 132 ide_hwif_t *hwif = HWIF(drive);
133 struct pci_dev *dev = hwif->pci_dev; 133 struct pci_dev *dev = hwif->pci_dev;
@@ -392,16 +392,6 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha
392 } 392 }
393 outb_p(0x06, 0x0c00); 393 outb_p(0x06, 0x0c00);
394 dev->irq = inb_p(0x0c01); 394 dev->irq = inb_p(0x0c01);
395#if 0
396 printk("%s: device class (0x%04x)\n",
397 name, dev->class);
398 if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) {
399 dev->class &= ~0x000F0F00;
400 // dev->class |= ~0x00000400;
401 dev->class |= ~0x00010100;
402 /**/
403 }
404#endif
405 } else { 395 } else {
406 struct pci_dev * findev = NULL; 396 struct pci_dev * findev = NULL;
407 u8 reg41 = 0; 397 u8 reg41 = 0;
@@ -452,7 +442,7 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha
452 pci_write_config_byte(dev, 0x5A, btr); 442 pci_write_config_byte(dev, 0x5A, btr);
453 } 443 }
454 444
455 return (dev->irq) ? dev->irq : 0; 445 return dev->irq;
456} 446}
457 447
458static unsigned int __devinit ata66_svwks_svwks (ide_hwif_t *hwif) 448static unsigned int __devinit ata66_svwks_svwks (ide_hwif_t *hwif)
@@ -500,11 +490,6 @@ static unsigned int __devinit ata66_svwks (ide_hwif_t *hwif)
500{ 490{
501 struct pci_dev *dev = hwif->pci_dev; 491 struct pci_dev *dev = hwif->pci_dev;
502 492
503 /* Per Specified Design by OEM, and ASIC Architect */
504 if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
505 (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2))
506 return 1;
507
508 /* Server Works */ 493 /* Server Works */
509 if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS) 494 if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS)
510 return ata66_svwks_svwks (hwif); 495 return ata66_svwks_svwks (hwif);
@@ -517,10 +502,14 @@ static unsigned int __devinit ata66_svwks (ide_hwif_t *hwif)
517 if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN) 502 if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN)
518 return ata66_svwks_cobalt (hwif); 503 return ata66_svwks_cobalt (hwif);
519 504
505 /* Per Specified Design by OEM, and ASIC Architect */
506 if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
507 (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2))
508 return 1;
509
520 return 0; 510 return 0;
521} 511}
522 512
523#undef CAN_SW_DMA
524static void __devinit init_hwif_svwks (ide_hwif_t *hwif) 513static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
525{ 514{
526 u8 dma_stat = 0; 515 u8 dma_stat = 0;
@@ -537,9 +526,6 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
537 hwif->ultra_mask = 0x3f; 526 hwif->ultra_mask = 0x3f;
538 527
539 hwif->mwdma_mask = 0x07; 528 hwif->mwdma_mask = 0x07;
540#ifdef CAN_SW_DMA
541 hwif->swdma_mask = 0x07;
542#endif /* CAN_SW_DMA */
543 529
544 hwif->autodma = 0; 530 hwif->autodma = 0;
545 531
@@ -562,8 +548,6 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
562 hwif->drives[1].autodma = (dma_stat & 0x40); 548 hwif->drives[1].autodma = (dma_stat & 0x40);
563 hwif->drives[0].autotune = (!(dma_stat & 0x20)); 549 hwif->drives[0].autotune = (!(dma_stat & 0x20));
564 hwif->drives[1].autotune = (!(dma_stat & 0x40)); 550 hwif->drives[1].autotune = (!(dma_stat & 0x40));
565// hwif->drives[0].autodma = hwif->autodma;
566// hwif->drives[1].autodma = hwif->autodma;
567} 551}
568 552
569/* 553/*
@@ -593,11 +577,6 @@ static int __devinit init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d)
593 if (dev->resource[0].start == 0x01f1) 577 if (dev->resource[0].start == 0x01f1)
594 d->bootable = ON_BOARD; 578 d->bootable = ON_BOARD;
595 } 579 }
596#if 0
597 if ((IDE_PCI_DEVID_EQ(d->devid, DEVID_CSB6) &&
598 (!(PCI_FUNC(dev->devfn) & 1)))
599 d->autodma = AUTODMA;
600#endif
601 580
602 d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || 581 d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE ||
603 dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && 582 dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) &&
@@ -671,11 +650,11 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device
671} 650}
672 651
673static struct pci_device_id svwks_pci_tbl[] = { 652static struct pci_device_id svwks_pci_tbl[] = {
674 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 653 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0},
675 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 654 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE), 1},
676 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, 655 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE), 2},
677 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, 656 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2), 3},
678 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, 657 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE), 4},
679 { 0, }, 658 { 0, },
680}; 659};
681MODULE_DEVICE_TABLE(pci, svwks_pci_tbl); 660MODULE_DEVICE_TABLE(pci, svwks_pci_tbl);