diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-26 13:44:19 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-26 13:44:19 -0700 |
commit | a52b0d25a722e84da999005b75f972aa4824253c (patch) | |
tree | 4a3a48305f744e6bde2e3fd663a4473dd712049c /drivers/ide/ppc | |
parent | 539a5fe22620a1665cce504167953a71a43232ad (diff) | |
parent | f37afdaca711838b50ecd89b9c15fc745270d77c (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (46 commits)
ide: constify struct ide_dma_ops
ide: add struct ide_dma_ops (take 3)
ide: add IDE_HFLAG_SERIALIZE_DMA host flag
sl82c105: check bridge revision in sl82c105_init_one()
au1xxx-ide: use ->init_dma method
palm_bk3710: use ->init_dma method
sgiioc4: use ->init_dma method
icside: use ->init_dma method
ide-pmac: use ->init_dma method
ide: do complete DMA setup in ->init_dma method (take 2)
au1xxx-ide: fix MWDMA support
ide: cleanup ide_setup_dma()
ide: factor out setting PCI bus-mastering from ide_hwif_setup_dma()
ide: export ide_allocate_dma_engine()
ide: move ide_setup_dma() call out from ->init_dma method
alim15x3: skip DMA initialization completely on revs < 0x20
pdc202xx_old: remove init_dma_pdc202xx()
ide: don't display "BIOS" settings in ide_setup_dma()
ide: remove ->cds field from ide_hwif_t (take 2)
ide: remove ide_dma_iobase()
...
Diffstat (limited to 'drivers/ide/ppc')
-rw-r--r-- | drivers/ide/ppc/mpc8xx.c | 12 | ||||
-rw-r--r-- | drivers/ide/ppc/pmac.c | 86 |
2 files changed, 61 insertions, 37 deletions
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c index 467656f06cc..a82f6efb660 100644 --- a/drivers/ide/ppc/mpc8xx.c +++ b/drivers/ide/ppc/mpc8xx.c @@ -438,10 +438,14 @@ static void m8xx_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) #elif defined(CONFIG_IDE_EXT_DIRECT) printk("%s[%d] %s: not implemented yet!\n", - __FILE__,__LINE__,__FUNCTION__); + __FILE__, __LINE__, __func__); #endif /* defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_PCMCIA */ } +static const struct ide_port_ops m8xx_port_ops = { + .set_pio_mode = m8xx_ide_set_pio_mode, +}; + static void ide_interrupt_ack (void *dev) { @@ -810,9 +814,8 @@ static int __init mpc8xx_ide_probe(void) ide_hwif_t *hwif = &ide_hwifs[0]; ide_init_port_hw(hwif, &hw); - hwif->mmio = 1; hwif->pio_mask = ATA_PIO4; - hwif->set_pio_mode = m8xx_ide_set_pio_mode; + hwif->port_ops = &m8xx_port_ops; idx[0] = 0; } @@ -822,9 +825,8 @@ static int __init mpc8xx_ide_probe(void) ide_hwif_t *mate = &ide_hwifs[1]; ide_init_port_hw(mate, &hw); - mate->mmio = 1; mate->pio_mask = ATA_PIO4; - mate->set_pio_mode = m8xx_ide_set_pio_mode; + mate->port_ops = &m8xx_port_ops; idx[1] = 1; } diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 177961edc43..185faa0dce9 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) */ #define IDE_WAKEUP_DELAY (1*HZ) -static int pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif); +static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *); static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq); static void pmac_ide_selectproc(ide_drive_t *drive); static void pmac_ide_kauai_selectproc(ide_drive_t *drive); @@ -918,11 +918,29 @@ pmac_ide_do_resume(ide_hwif_t *hwif) return 0; } +static const struct ide_port_ops pmac_ide_ata6_port_ops = { + .set_pio_mode = pmac_ide_set_pio_mode, + .set_dma_mode = pmac_ide_set_dma_mode, + .selectproc = pmac_ide_kauai_selectproc, +}; + +static const struct ide_port_ops pmac_ide_port_ops = { + .set_pio_mode = pmac_ide_set_pio_mode, + .set_dma_mode = pmac_ide_set_dma_mode, + .selectproc = pmac_ide_selectproc, +}; + +static const struct ide_dma_ops pmac_dma_ops; + static const struct ide_port_info pmac_port_info = { + .init_dma = pmac_ide_init_dma, .chipset = ide_pmac, +#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC + .dma_ops = &pmac_dma_ops, +#endif + .port_ops = &pmac_ide_port_ops, .host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | IDE_HFLAG_POST_SET_MODE | - IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ IDE_HFLAG_UNMASK_IRQS, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2, @@ -947,12 +965,15 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) pmif->broken_dma = pmif->broken_dma_warn = 0; if (of_device_is_compatible(np, "shasta-ata")) { pmif->kind = controller_sh_ata6; + d.port_ops = &pmac_ide_ata6_port_ops; d.udma_mask = ATA_UDMA6; } else if (of_device_is_compatible(np, "kauai-ata")) { pmif->kind = controller_un_ata6; + d.port_ops = &pmac_ide_ata6_port_ops; d.udma_mask = ATA_UDMA5; } else if (of_device_is_compatible(np, "K2-UATA")) { pmif->kind = controller_k2_ata6; + d.port_ops = &pmac_ide_ata6_port_ops; d.udma_mask = ATA_UDMA5; } else if (of_device_is_compatible(np, "keylargo-ata")) { if (strcmp(np->name, "ata-4") == 0) { @@ -1029,37 +1050,29 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) default_hwif_mmiops(hwif); hwif->OUTBSYNC = pmac_outbsync; - /* Tell common code _not_ to mess with resources */ - hwif->mmio = 1; hwif->hwif_data = pmif; ide_init_port_hw(hwif, hw); - hwif->noprobe = pmif->mediabay; hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; - hwif->set_pio_mode = pmac_ide_set_pio_mode; - if (pmif->kind == controller_un_ata6 - || pmif->kind == controller_k2_ata6 - || pmif->kind == controller_sh_ata6) - hwif->selectproc = pmac_ide_kauai_selectproc; - else - hwif->selectproc = pmac_ide_selectproc; - hwif->set_dma_mode = pmac_ide_set_dma_mode; printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s, irq %d\n", hwif->index, model_name[pmif->kind], pmif->aapl_bus_id, pmif->mediabay ? " (mediabay)" : "", hwif->irq); - + + if (pmif->mediabay) { #ifdef CONFIG_PMAC_MEDIABAY - if (pmif->mediabay && check_media_bay_by_base(pmif->regbase, MB_CD) == 0) - hwif->noprobe = 0; -#endif /* CONFIG_PMAC_MEDIABAY */ + if (check_media_bay_by_base(pmif->regbase, MB_CD)) { +#else + if (1) { +#endif + hwif->drives[0].noprobe = 1; + hwif->drives[1].noprobe = 1; + } + } #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC if (pmif->cable_80 == 0) d.udma_mask &= ATA_UDMA2; - /* has a DBDMA controller channel */ - if (pmif->dma_regs == 0 || pmac_ide_setup_dma(pmif, hwif) < 0) #endif - d.udma_mask = d.mwdma_mask = 0; idx[0] = hwif->index; @@ -1662,18 +1675,31 @@ pmac_ide_dma_lost_irq (ide_drive_t *drive) printk(KERN_ERR "ide-pmac lost interrupt, dma status: %lx\n", status); } +static const struct ide_dma_ops pmac_dma_ops = { + .dma_host_set = pmac_ide_dma_host_set, + .dma_setup = pmac_ide_dma_setup, + .dma_exec_cmd = pmac_ide_dma_exec_cmd, + .dma_start = pmac_ide_dma_start, + .dma_end = pmac_ide_dma_end, + .dma_test_irq = pmac_ide_dma_test_irq, + .dma_timeout = ide_dma_timeout, + .dma_lost_irq = pmac_ide_dma_lost_irq, +}; + /* * Allocate the data structures needed for using DMA with an interface * and fill the proper list of functions pointers */ -static int __devinit pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) +static int __devinit pmac_ide_init_dma(ide_hwif_t *hwif, + const struct ide_port_info *d) { + pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)hwif->hwif_data; struct pci_dev *dev = to_pci_dev(hwif->dev); /* We won't need pci_dev if we switch to generic consistent * DMA routines ... */ - if (dev == NULL) + if (dev == NULL || pmif->dma_regs == 0) return -ENODEV; /* * Allocate space for the DBDMA commands. @@ -1692,18 +1718,14 @@ static int __devinit pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) hwif->sg_max_nents = MAX_DCMDS; - hwif->dma_host_set = &pmac_ide_dma_host_set; - hwif->dma_setup = &pmac_ide_dma_setup; - hwif->dma_exec_cmd = &pmac_ide_dma_exec_cmd; - hwif->dma_start = &pmac_ide_dma_start; - hwif->ide_dma_end = &pmac_ide_dma_end; - hwif->ide_dma_test_irq = &pmac_ide_dma_test_irq; - hwif->dma_timeout = &ide_dma_timeout; - hwif->dma_lost_irq = &pmac_ide_dma_lost_irq; - return 0; } - +#else +static int __devinit pmac_ide_init_dma(ide_hwif_t *hwif, + const struct ide_port_info *d) +{ + return -EOPNOTSUPP; +} #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ module_init(pmac_ide_probe); |