diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:22 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:22 -0400 |
commit | b123f56e04c7c112f754f948198d1ea5a80e649d (patch) | |
tree | c58e83e954159d7755aa7f04d433e4c7e25dc330 /drivers/ide/pci/alim15x3.c | |
parent | f629b38beddf2ff8bc3fda1754bbd6cc7d3acc03 (diff) |
ide: do complete DMA setup in ->init_dma method (take 2)
* Make ide_hwif_setup_dma() return an error value.
* Pass 'const struct ide_port_info *d' instead of 'unsigned long dmabase'
to ->init_dma method and make it return an error value.
* Rename ide_get_or_set_dma_base() to ide_pci_dma_base(),
change ordering of its arguments and then export it.
* Export ide_pci_set_master().
* Do complete DMA setup inside ->init_dma method and update ->init_dma
users accordingly.
* Sanitize code for DMA setup in ide_init_port().
v2:
* Fix for CONFIG_BLK_DEV_IDEDMA_PCI=n configs
(from Jiri Slaby <jirislaby@gmail.com>):
Fix following compiler warning by returning EINVAL:
In file included from ANYTHING-INCLUDING-IDE.H:45:
include/linux/ide.h: In function ‘ide_hwif_setup_dma’:
include/linux/ide.h:1022: warning: no return statement in function returning non-void
Cc: Jiri Slaby <jirislaby@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/alim15x3.c')
-rw-r--r-- | drivers/ide/pci/alim15x3.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index fbb55fa2d067..5261f308d946 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -723,17 +723,32 @@ static void __devinit init_hwif_ali15x3 (ide_hwif_t *hwif) | |||
723 | /** | 723 | /** |
724 | * init_dma_ali15x3 - set up DMA on ALi15x3 | 724 | * init_dma_ali15x3 - set up DMA on ALi15x3 |
725 | * @hwif: IDE interface | 725 | * @hwif: IDE interface |
726 | * @dmabase: DMA interface base PCI address | 726 | * @d: IDE port info |
727 | * | 727 | * |
728 | * Set up the DMA functionality on the ALi 15x3. For the ALi | 728 | * Set up the DMA functionality on the ALi 15x3. |
729 | * controllers this is generic so we can let the generic code do | ||
730 | * the actual work. | ||
731 | */ | 729 | */ |
732 | 730 | ||
733 | static void __devinit init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) | 731 | static int __devinit init_dma_ali15x3(ide_hwif_t *hwif, |
732 | const struct ide_port_info *d) | ||
734 | { | 733 | { |
734 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
735 | unsigned long base = ide_pci_dma_base(hwif, d); | ||
736 | |||
737 | if (base == 0 || ide_pci_set_master(dev, d->name) < 0) | ||
738 | return -1; | ||
739 | |||
735 | if (!hwif->channel) | 740 | if (!hwif->channel) |
736 | outb(inb(dmabase + 2) & 0x60, dmabase + 2); | 741 | outb(inb(base + 2) & 0x60, base + 2); |
742 | |||
743 | printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx\n", | ||
744 | hwif->name, base, base + 7); | ||
745 | |||
746 | if (ide_allocate_dma_engine(hwif)) | ||
747 | return -1; | ||
748 | |||
749 | ide_setup_dma(hwif, base); | ||
750 | |||
751 | return 0; | ||
737 | } | 752 | } |
738 | 753 | ||
739 | static const struct ide_port_ops ali_port_ops = { | 754 | static const struct ide_port_ops ali_port_ops = { |