aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ppc
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:22 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:22 -0400
commit0d07192297f664afdee36b330ab4fe52a8e38a6a (patch)
tree1f2934176abbc1ee7895235f723cb2aa007ef7ad /drivers/ide/ppc
parentb123f56e04c7c112f754f948198d1ea5a80e649d (diff)
ide-pmac: use ->init_dma method
* Move pmif->dma_regs check from pmac_ide_setup_device() to pmac_ide_init_dma(). * Get 'pmif' from 'hwif->hwif_data' in pmac_ide_init_dma() and replace 'pmac_ide_hwif_t *pmif' argument by 'const struct ide_port_info *d'. * Add pmac_ide_init_dma() implementation for CONFIG_BLK_DEV_IDEDMA_PMAC=n case and convert the driver to use ->init_dma method. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ppc')
-rw-r--r--drivers/ide/ppc/pmac.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 16869cf95e1a..ac36c6c4013f 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -409,7 +409,7 @@ kauai_lookup_timing(struct kauai_timing* table, int cycle_time)
409 */ 409 */
410#define IDE_WAKEUP_DELAY (1*HZ) 410#define IDE_WAKEUP_DELAY (1*HZ)
411 411
412static int pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif); 412static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *);
413static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq); 413static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq);
414static void pmac_ide_selectproc(ide_drive_t *drive); 414static void pmac_ide_selectproc(ide_drive_t *drive);
415static void pmac_ide_kauai_selectproc(ide_drive_t *drive); 415static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
@@ -931,11 +931,11 @@ static const struct ide_port_ops pmac_ide_port_ops = {
931}; 931};
932 932
933static const struct ide_port_info pmac_port_info = { 933static const struct ide_port_info pmac_port_info = {
934 .init_dma = pmac_ide_init_dma,
934 .chipset = ide_pmac, 935 .chipset = ide_pmac,
935 .port_ops = &pmac_ide_port_ops, 936 .port_ops = &pmac_ide_port_ops,
936 .host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | 937 .host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA |
937 IDE_HFLAG_POST_SET_MODE | 938 IDE_HFLAG_POST_SET_MODE |
938 IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
939 IDE_HFLAG_UNMASK_IRQS, 939 IDE_HFLAG_UNMASK_IRQS,
940 .pio_mask = ATA_PIO4, 940 .pio_mask = ATA_PIO4,
941 .mwdma_mask = ATA_MWDMA2, 941 .mwdma_mask = ATA_MWDMA2,
@@ -1067,10 +1067,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
1067#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC 1067#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
1068 if (pmif->cable_80 == 0) 1068 if (pmif->cable_80 == 0)
1069 d.udma_mask &= ATA_UDMA2; 1069 d.udma_mask &= ATA_UDMA2;
1070 /* has a DBDMA controller channel */
1071 if (pmif->dma_regs == 0 || pmac_ide_setup_dma(pmif, hwif) < 0)
1072#endif 1070#endif
1073 d.udma_mask = d.mwdma_mask = 0;
1074 1071
1075 idx[0] = hwif->index; 1072 idx[0] = hwif->index;
1076 1073
@@ -1677,14 +1674,16 @@ pmac_ide_dma_lost_irq (ide_drive_t *drive)
1677 * Allocate the data structures needed for using DMA with an interface 1674 * Allocate the data structures needed for using DMA with an interface
1678 * and fill the proper list of functions pointers 1675 * and fill the proper list of functions pointers
1679 */ 1676 */
1680static int __devinit pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) 1677static int __devinit pmac_ide_init_dma(ide_hwif_t *hwif,
1678 const struct ide_port_info *d)
1681{ 1679{
1680 pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
1682 struct pci_dev *dev = to_pci_dev(hwif->dev); 1681 struct pci_dev *dev = to_pci_dev(hwif->dev);
1683 1682
1684 /* We won't need pci_dev if we switch to generic consistent 1683 /* We won't need pci_dev if we switch to generic consistent
1685 * DMA routines ... 1684 * DMA routines ...
1686 */ 1685 */
1687 if (dev == NULL) 1686 if (dev == NULL || pmif->dma_regs == 0)
1688 return -ENODEV; 1687 return -ENODEV;
1689 /* 1688 /*
1690 * Allocate space for the DBDMA commands. 1689 * Allocate space for the DBDMA commands.
@@ -1714,7 +1713,12 @@ static int __devinit pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1714 1713
1715 return 0; 1714 return 0;
1716} 1715}
1717 1716#else
1717static int __devinit pmac_ide_init_dma(ide_hwif_t *hwif,
1718 const struct ide_port_info *d)
1719{
1720 return -EOPNOTSUPP;
1721}
1718#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ 1722#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
1719 1723
1720module_init(pmac_ide_probe); 1724module_init(pmac_ide_probe);