diff options
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r-- | drivers/ide/ide-dma.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index c3546fe9af63..9937fa7da546 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -798,9 +798,9 @@ static int ide_release_dma_engine(ide_hwif_t *hwif) | |||
798 | 798 | ||
799 | static int ide_release_iomio_dma(ide_hwif_t *hwif) | 799 | static int ide_release_iomio_dma(ide_hwif_t *hwif) |
800 | { | 800 | { |
801 | if ((hwif->dma_extra) && (hwif->channel == 0)) | ||
802 | release_region((hwif->dma_base + 16), hwif->dma_extra); | ||
803 | release_region(hwif->dma_base, 8); | 801 | release_region(hwif->dma_base, 8); |
802 | if (hwif->extra_ports) | ||
803 | release_region(hwif->extra_base, hwif->extra_ports); | ||
804 | if (hwif->dma_base2) | 804 | if (hwif->dma_base2) |
805 | release_region(hwif->dma_base, 8); | 805 | release_region(hwif->dma_base, 8); |
806 | return 1; | 806 | return 1; |
@@ -840,9 +840,7 @@ static int ide_mapped_mmio_dma(ide_hwif_t *hwif, unsigned long base, unsigned in | |||
840 | { | 840 | { |
841 | printk(KERN_INFO " %s: MMIO-DMA ", hwif->name); | 841 | printk(KERN_INFO " %s: MMIO-DMA ", hwif->name); |
842 | 842 | ||
843 | hwif->dma_base = base; | 843 | hwif->dma_base = base; |
844 | if (hwif->cds->extra && hwif->channel == 0) | ||
845 | hwif->dma_extra = hwif->cds->extra; | ||
846 | 844 | ||
847 | if(hwif->mate) | 845 | if(hwif->mate) |
848 | hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base; | 846 | hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base; |
@@ -854,17 +852,29 @@ static int ide_mapped_mmio_dma(ide_hwif_t *hwif, unsigned long base, unsigned in | |||
854 | static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int ports) | 852 | static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int ports) |
855 | { | 853 | { |
856 | printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx", | 854 | printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx", |
857 | hwif->name, base, base + ports - 1); | 855 | hwif->name, base, base + ports - 1); |
856 | |||
858 | if (!request_region(base, ports, hwif->name)) { | 857 | if (!request_region(base, ports, hwif->name)) { |
859 | printk(" -- Error, ports in use.\n"); | 858 | printk(" -- Error, ports in use.\n"); |
860 | return 1; | 859 | return 1; |
861 | } | 860 | } |
861 | |||
862 | hwif->dma_base = base; | 862 | hwif->dma_base = base; |
863 | if ((hwif->cds->extra) && (hwif->channel == 0)) { | 863 | |
864 | request_region(base+16, hwif->cds->extra, hwif->cds->name); | 864 | if (hwif->cds->extra) { |
865 | hwif->dma_extra = hwif->cds->extra; | 865 | hwif->extra_base = base + (hwif->channel ? 8 : 16); |
866 | |||
867 | if (!hwif->mate || !hwif->mate->extra_ports) { | ||
868 | if (!request_region(hwif->extra_base, | ||
869 | hwif->cds->extra, hwif->cds->name)) { | ||
870 | printk(" -- Error, extra ports in use.\n"); | ||
871 | release_region(base, ports); | ||
872 | return 1; | ||
873 | } | ||
874 | hwif->extra_ports = hwif->cds->extra; | ||
875 | } | ||
866 | } | 876 | } |
867 | 877 | ||
868 | if(hwif->mate) | 878 | if(hwif->mate) |
869 | hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base; | 879 | hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base; |
870 | else | 880 | else |
@@ -874,6 +884,8 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port | |||
874 | { | 884 | { |
875 | printk(" -- Error, secondary ports in use.\n"); | 885 | printk(" -- Error, secondary ports in use.\n"); |
876 | release_region(base, ports); | 886 | release_region(base, ports); |
887 | if (hwif->extra_ports) | ||
888 | release_region(hwif->extra_base, hwif->extra_ports); | ||
877 | return 1; | 889 | return 1; |
878 | } | 890 | } |
879 | } | 891 | } |