aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:31 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:31 -0500
commitc413b9b94d9a8e7548cc4b2e04b7df0439ce76fd (patch)
tree5d23110a0d1f87ad0c88fb1746194e532808eaab /drivers/ide/pci
parent1ebf74936b1fccb5b65940f99ccddd74ec4d1fef (diff)
ide: add struct ide_port_info instances to legacy host drivers
* Remove 'struct pci_dev *dev' argument from ide_hwif_setup_dma(). * Un-static ide_hwif_setup_dma() and add CONFIG_BLK_DEV_IDEDMA_PCI=n version. * Add 'const struct ide_port_info *d' argument to ide_device_add[_all](). * Factor out generic ports init from ide_pci_setup_ports() to ide_init_port(), move it to ide-probe.c and call it in in ide_device_add_all() instead of ide_pci_setup_ports(). * Move ->mate setup to ide_device_add_all() from ide_port_init(). * Add IDE_HFLAG_NO_AUTOTUNE host flag for host drivers that don't enable ->autotune currently. * Setup hwif->chipset in ide_init_port() but iff pi->chipset is set (to not override setup done by ide_hwif_configure()). * Add ETRAX host handling to ide_device_add_all(). * cmd640.c: set IDE_HFLAG_ABUSE_* also for CONFIG_BLK_DEV_CMD640_ENHANCED=n. * pmac.c: make pmac_ide_setup_dma() return an error value and move DMA masks setup to pmac_ide_setup_device(). * Add 'struct ide_port_info' instances to legacy host drivers, pass them to ide_device_add() calls and then remove open-coded ports initialization. Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r--drivers/ide/pci/cmd640.c29
-rw-r--r--drivers/ide/pci/cs5520.c2
-rw-r--r--drivers/ide/pci/sgiioc4.c18
3 files changed, 27 insertions, 22 deletions
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index 7240c20b959..ea0cb500df6 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -703,6 +703,18 @@ static int pci_conf2(void)
703 return 0; 703 return 0;
704} 704}
705 705
706static const struct ide_port_info cmd640_port_info __initdata = {
707 .chipset = ide_cmd640,
708 .host_flags = IDE_HFLAG_SERIALIZE |
709 IDE_HFLAG_NO_DMA |
710 IDE_HFLAG_NO_AUTOTUNE |
711 IDE_HFLAG_ABUSE_PREFETCH |
712 IDE_HFLAG_ABUSE_FAST_DEVSEL,
713#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
714 .pio_mask = ATA_PIO5,
715#endif
716};
717
706/* 718/*
707 * Probe for a cmd640 chipset, and initialize it if found. 719 * Probe for a cmd640 chipset, and initialize it if found.
708 */ 720 */
@@ -760,11 +772,7 @@ static int __init cmd640x_init(void)
760 setup_device_ptrs (); 772 setup_device_ptrs ();
761 printk("%s: buggy cmd640%c interface on %s, config=0x%02x\n", 773 printk("%s: buggy cmd640%c interface on %s, config=0x%02x\n",
762 cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr); 774 cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr);
763 cmd_hwif0->chipset = ide_cmd640;
764#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 775#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
765 cmd_hwif0->host_flags = IDE_HFLAG_ABUSE_PREFETCH |
766 IDE_HFLAG_ABUSE_FAST_DEVSEL;
767 cmd_hwif0->pio_mask = ATA_PIO5;
768 cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode; 776 cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode;
769#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 777#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
770 778
@@ -815,23 +823,14 @@ static int __init cmd640x_init(void)
815 * Initialize data for secondary cmd640 port, if enabled 823 * Initialize data for secondary cmd640 port, if enabled
816 */ 824 */
817 if (second_port_cmd640) { 825 if (second_port_cmd640) {
818 cmd_hwif0->serialized = 1;
819 cmd_hwif1->serialized = 1;
820 cmd_hwif1->chipset = ide_cmd640;
821 cmd_hwif0->mate = cmd_hwif1;
822 cmd_hwif1->mate = cmd_hwif0;
823 cmd_hwif1->channel = 1;
824#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 826#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
825 cmd_hwif1->host_flags = IDE_HFLAG_ABUSE_PREFETCH |
826 IDE_HFLAG_ABUSE_FAST_DEVSEL;
827 cmd_hwif1->pio_mask = ATA_PIO5;
828 cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode; 827 cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode;
829#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 828#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
830 829
831 idx[1] = cmd_hwif1->index; 830 idx[1] = cmd_hwif1->index;
832 } 831 }
833 printk(KERN_INFO "%s: %sserialized, secondary interface %s\n", cmd_hwif1->name, 832 printk(KERN_INFO "%s: %sserialized, secondary interface %s\n", cmd_hwif1->name,
834 cmd_hwif0->serialized ? "" : "not ", port2); 833 second_port_cmd640 ? "" : "not ", port2);
835 834
836 /* 835 /*
837 * Establish initial timings/prefetch for all drives. 836 * Establish initial timings/prefetch for all drives.
@@ -876,7 +875,7 @@ static int __init cmd640x_init(void)
876 cmd640_dump_regs(); 875 cmd640_dump_regs();
877#endif 876#endif
878 877
879 ide_device_add(idx); 878 ide_device_add(idx, &cmd640_port_info);
880 879
881 return 1; 880 return 1;
882} 881}
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index eb68a9ad0c9..79352866667 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -180,7 +180,7 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic
180 180
181 ide_pci_setup_ports(dev, d, 14, &idx[0]); 181 ide_pci_setup_ports(dev, d, 14, &idx[0]);
182 182
183 ide_device_add(idx); 183 ide_device_add(idx, d);
184 184
185 return 0; 185 return 0;
186} 186}
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 85902074b1f..651845bf1ae 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -555,7 +555,6 @@ static void __devinit
555ide_init_sgiioc4(ide_hwif_t * hwif) 555ide_init_sgiioc4(ide_hwif_t * hwif)
556{ 556{
557 hwif->mmio = 1; 557 hwif->mmio = 1;
558 hwif->pio_mask = 0x00;
559 hwif->set_pio_mode = NULL; /* Sets timing for PIO mode */ 558 hwif->set_pio_mode = NULL; /* Sets timing for PIO mode */
560 hwif->set_dma_mode = &sgiioc4_set_dma_mode; 559 hwif->set_dma_mode = &sgiioc4_set_dma_mode;
561 hwif->selectproc = NULL;/* Use the default routine to select drive */ 560 hwif->selectproc = NULL;/* Use the default routine to select drive */
@@ -572,8 +571,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
572 if (hwif->dma_base == 0) 571 if (hwif->dma_base == 0)
573 return; 572 return;
574 573
575 hwif->mwdma_mask = ATA_MWDMA2_ONLY;
576
577 hwif->dma_host_set = &sgiioc4_dma_host_set; 574 hwif->dma_host_set = &sgiioc4_dma_host_set;
578 hwif->dma_setup = &sgiioc4_ide_dma_setup; 575 hwif->dma_setup = &sgiioc4_ide_dma_setup;
579 hwif->dma_start = &sgiioc4_ide_dma_start; 576 hwif->dma_start = &sgiioc4_ide_dma_start;
@@ -583,6 +580,13 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
583 hwif->dma_timeout = &ide_dma_timeout; 580 hwif->dma_timeout = &ide_dma_timeout;
584} 581}
585 582
583static const struct ide_port_info sgiioc4_port_info __devinitdata = {
584 .chipset = ide_pci,
585 .host_flags = IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
586 IDE_HFLAG_NO_AUTOTUNE,
587 .mwdma_mask = ATA_MWDMA2_ONLY,
588};
589
586static int __devinit 590static int __devinit
587sgiioc4_ide_setup_pci_device(struct pci_dev *dev) 591sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
588{ 592{
@@ -593,6 +597,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
593 int h; 597 int h;
594 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 598 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
595 hw_regs_t hw; 599 hw_regs_t hw;
600 struct ide_port_info d = sgiioc4_port_info;
596 601
597 /* 602 /*
598 * Find an empty HWIF; if none available, return -ENOMEM. 603 * Find an empty HWIF; if none available, return -ENOMEM.
@@ -641,7 +646,6 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
641 ide_init_port_hw(hwif, &hw); 646 ide_init_port_hw(hwif, &hw);
642 647
643 hwif->dev = &dev->dev; 648 hwif->dev = &dev->dev;
644 hwif->channel = 0; /* Single Channel chip */
645 649
646 /* The IOC4 uses MMIO rather than Port IO. */ 650 /* The IOC4 uses MMIO rather than Port IO. */
647 default_hwif_mmiops(hwif); 651 default_hwif_mmiops(hwif);
@@ -649,15 +653,17 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
649 /* Initializing chipset IRQ Registers */ 653 /* Initializing chipset IRQ Registers */
650 writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); 654 writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4));
651 655
652 if (dma_base == 0 || ide_dma_sgiioc4(hwif, dma_base)) 656 if (dma_base == 0 || ide_dma_sgiioc4(hwif, dma_base)) {
653 printk(KERN_INFO "%s: %s Bus-Master DMA disabled\n", 657 printk(KERN_INFO "%s: %s Bus-Master DMA disabled\n",
654 hwif->name, DRV_NAME); 658 hwif->name, DRV_NAME);
659 d.mwdma_mask = 0;
660 }
655 661
656 ide_init_sgiioc4(hwif); 662 ide_init_sgiioc4(hwif);
657 663
658 idx[0] = hwif->index; 664 idx[0] = hwif->index;
659 665
660 if (ide_device_add(idx)) 666 if (ide_device_add(idx, &d))
661 return -EIO; 667 return -EIO;
662 668
663 return 0; 669 return 0;