aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/trm290.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/trm290.c')
-rw-r--r--drivers/ide/trm290.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/ide/trm290.c b/drivers/ide/trm290.c
index 1c09e549c423..ed1496845a93 100644
--- a/drivers/ide/trm290.c
+++ b/drivers/ide/trm290.c
@@ -176,18 +176,12 @@ static void trm290_selectproc (ide_drive_t *drive)
176 trm290_prepare_drive(drive, !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); 176 trm290_prepare_drive(drive, !!(drive->dev_flags & IDE_DFLAG_USING_DMA));
177} 177}
178 178
179static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) 179static int trm290_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
180{
181 ide_execute_command(drive, command, &ide_dma_intr, WAIT_CMD, NULL);
182}
183
184static int trm290_dma_setup(ide_drive_t *drive)
185{ 180{
186 ide_hwif_t *hwif = drive->hwif; 181 ide_hwif_t *hwif = drive->hwif;
187 struct request *rq = hwif->rq;
188 unsigned int count, rw; 182 unsigned int count, rw;
189 183
190 if (rq_data_dir(rq)) { 184 if (cmd->tf_flags & IDE_TFLAG_WRITE) {
191#ifdef TRM290_NO_DMA_WRITES 185#ifdef TRM290_NO_DMA_WRITES
192 /* always use PIO for writes */ 186 /* always use PIO for writes */
193 trm290_prepare_drive(drive, 0); /* select PIO xfer */ 187 trm290_prepare_drive(drive, 0); /* select PIO xfer */
@@ -197,7 +191,9 @@ static int trm290_dma_setup(ide_drive_t *drive)
197 } else 191 } else
198 rw = 2; 192 rw = 2;
199 193
200 if (!(count = ide_build_dmatable(drive, rq))) { 194 count = ide_build_dmatable(drive, cmd);
195 if (count == 0) {
196 ide_map_sg(drive, cmd);
201 /* try PIO instead of DMA */ 197 /* try PIO instead of DMA */
202 trm290_prepare_drive(drive, 0); /* select PIO xfer */ 198 trm290_prepare_drive(drive, 0); /* select PIO xfer */
203 return 1; 199 return 1;
@@ -314,7 +310,6 @@ static const struct ide_port_ops trm290_port_ops = {
314static struct ide_dma_ops trm290_dma_ops = { 310static struct ide_dma_ops trm290_dma_ops = {
315 .dma_host_set = trm290_dma_host_set, 311 .dma_host_set = trm290_dma_host_set,
316 .dma_setup = trm290_dma_setup, 312 .dma_setup = trm290_dma_setup,
317 .dma_exec_cmd = trm290_dma_exec_cmd,
318 .dma_start = trm290_dma_start, 313 .dma_start = trm290_dma_start,
319 .dma_end = trm290_dma_end, 314 .dma_end = trm290_dma_end,
320 .dma_test_irq = trm290_dma_test_irq, 315 .dma_test_irq = trm290_dma_test_irq,