diff options
-rw-r--r-- | drivers/ide/ide-iops.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/cs5520.c | 29 | ||||
-rw-r--r-- | drivers/ide/setup-pci.c | 10 |
3 files changed, 25 insertions, 16 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index c97c0719ddf1..e3e5e39f4906 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -799,7 +799,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
799 | 799 | ||
800 | skip: | 800 | skip: |
801 | #ifdef CONFIG_BLK_DEV_IDEDMA | 801 | #ifdef CONFIG_BLK_DEV_IDEDMA |
802 | if (speed >= XFER_SW_DMA_0) | 802 | if (speed >= XFER_SW_DMA_0 || (hwif->host_flags & IDE_HFLAG_VDMA)) |
803 | hwif->dma_host_on(drive); | 803 | hwif->dma_host_on(drive); |
804 | else if (hwif->ide_dma_on) /* check if host supports DMA */ | 804 | else if (hwif->ide_dma_on) /* check if host supports DMA */ |
805 | hwif->dma_off_quietly(drive); | 805 | hwif->dma_off_quietly(drive); |
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index d1a91bcb5b29..78058ca2ce76 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c | |||
@@ -71,7 +71,6 @@ static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
71 | ide_hwif_t *hwif = HWIF(drive); | 71 | ide_hwif_t *hwif = HWIF(drive); |
72 | struct pci_dev *pdev = hwif->pci_dev; | 72 | struct pci_dev *pdev = hwif->pci_dev; |
73 | int controller = drive->dn > 1 ? 1 : 0; | 73 | int controller = drive->dn > 1 ? 1 : 0; |
74 | u8 reg; | ||
75 | 74 | ||
76 | /* FIXME: if DMA = 1 do we need to set the DMA bit here ? */ | 75 | /* FIXME: if DMA = 1 do we need to set the DMA bit here ? */ |
77 | 76 | ||
@@ -91,11 +90,6 @@ static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
91 | pci_write_config_byte(pdev, 0x66 + 4*controller + (drive->dn&1), | 90 | pci_write_config_byte(pdev, 0x66 + 4*controller + (drive->dn&1), |
92 | (cs5520_pio_clocks[pio].recovery << 4) | | 91 | (cs5520_pio_clocks[pio].recovery << 4) | |
93 | (cs5520_pio_clocks[pio].assert)); | 92 | (cs5520_pio_clocks[pio].assert)); |
94 | |||
95 | /* Set the DMA enable/disable flag */ | ||
96 | reg = inb(hwif->dma_base + 0x02 + 8*controller); | ||
97 | reg |= 1<<((drive->dn&1)+5); | ||
98 | outb(reg, hwif->dma_base + 0x02 + 8*controller); | ||
99 | } | 93 | } |
100 | 94 | ||
101 | static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed) | 95 | static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed) |
@@ -109,13 +103,23 @@ static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
109 | * We wrap the DMA activate to set the vdma flag. This is needed | 103 | * We wrap the DMA activate to set the vdma flag. This is needed |
110 | * so that the IDE DMA layer issues PIO not DMA commands over the | 104 | * so that the IDE DMA layer issues PIO not DMA commands over the |
111 | * DMA channel | 105 | * DMA channel |
106 | * | ||
107 | * ATAPI is harder so disable it for now using IDE_HFLAG_NO_ATAPI_DMA | ||
112 | */ | 108 | */ |
113 | 109 | ||
114 | static int cs5520_dma_on(ide_drive_t *drive) | 110 | static void cs5520_dma_host_on(ide_drive_t *drive) |
115 | { | 111 | { |
116 | /* ATAPI is harder so leave it for now */ | 112 | if (drive->using_dma) |
117 | drive->vdma = 1; | 113 | drive->vdma = 1; |
118 | return 0; | 114 | |
115 | ide_dma_host_on(drive); | ||
116 | } | ||
117 | |||
118 | static void cs5520_dma_host_off(ide_drive_t *drive) | ||
119 | { | ||
120 | drive->vdma = 0; | ||
121 | |||
122 | ide_dma_host_off(drive); | ||
119 | } | 123 | } |
120 | 124 | ||
121 | static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) | 125 | static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) |
@@ -126,7 +130,8 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) | |||
126 | if (hwif->dma_base == 0) | 130 | if (hwif->dma_base == 0) |
127 | return; | 131 | return; |
128 | 132 | ||
129 | hwif->ide_dma_on = &cs5520_dma_on; | 133 | hwif->dma_host_on = &cs5520_dma_host_on; |
134 | hwif->dma_host_off = &cs5520_dma_host_off; | ||
130 | } | 135 | } |
131 | 136 | ||
132 | #define DECLARE_CS_DEV(name_str) \ | 137 | #define DECLARE_CS_DEV(name_str) \ |
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index d2cd5a3d38f8..bbfdf7e0f182 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -165,13 +165,17 @@ static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_ | |||
165 | 165 | ||
166 | dma_base = pci_resource_start(dev, baridx); | 166 | dma_base = pci_resource_start(dev, baridx); |
167 | 167 | ||
168 | if (dma_base == 0) | 168 | if (dma_base == 0) { |
169 | printk(KERN_ERR "%s: DMA base is invalid\n", d->name); | 169 | printk(KERN_ERR "%s: DMA base is invalid\n", d->name); |
170 | return 0; | ||
171 | } | ||
170 | } | 172 | } |
171 | 173 | ||
172 | if ((d->host_flags & IDE_HFLAG_CS5520) == 0 && dma_base) { | 174 | if (hwif->channel) |
175 | dma_base += 8; | ||
176 | |||
177 | if ((d->host_flags & IDE_HFLAG_CS5520) == 0) { | ||
173 | u8 simplex_stat = 0; | 178 | u8 simplex_stat = 0; |
174 | dma_base += hwif->channel ? 8 : 0; | ||
175 | 179 | ||
176 | switch(dev->device) { | 180 | switch(dev->device) { |
177 | case PCI_DEVICE_ID_AL_M5219: | 181 | case PCI_DEVICE_ID_AL_M5219: |