diff options
Diffstat (limited to 'drivers/ide/au1xxx-ide.c')
| -rw-r--r-- | drivers/ide/au1xxx-ide.c | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 154ec2cf734f..d3a9d6c15328 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c | |||
| @@ -86,13 +86,13 @@ void auide_outsw(unsigned long port, void *addr, u32 count) | |||
| 86 | ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp); | 86 | ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static void au1xxx_input_data(ide_drive_t *drive, struct request *rq, | 89 | static void au1xxx_input_data(ide_drive_t *drive, struct ide_cmd *cmd, |
| 90 | void *buf, unsigned int len) | 90 | void *buf, unsigned int len) |
| 91 | { | 91 | { |
| 92 | auide_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); | 92 | auide_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | static void au1xxx_output_data(ide_drive_t *drive, struct request *rq, | 95 | static void au1xxx_output_data(ide_drive_t *drive, struct ide_cmd *cmd, |
| 96 | void *buf, unsigned int len) | 96 | void *buf, unsigned int len) |
| 97 | { | 97 | { |
| 98 | auide_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); | 98 | auide_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); |
| @@ -209,23 +209,17 @@ static void auide_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
| 209 | */ | 209 | */ |
| 210 | 210 | ||
| 211 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 211 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
| 212 | static int auide_build_dmatable(ide_drive_t *drive) | 212 | static int auide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) |
| 213 | { | 213 | { |
| 214 | int i, iswrite, count = 0; | ||
| 215 | ide_hwif_t *hwif = drive->hwif; | 214 | ide_hwif_t *hwif = drive->hwif; |
| 216 | struct request *rq = hwif->rq; | ||
| 217 | _auide_hwif *ahwif = &auide_hwif; | 215 | _auide_hwif *ahwif = &auide_hwif; |
| 218 | struct scatterlist *sg; | 216 | struct scatterlist *sg; |
| 217 | int i = cmd->sg_nents, count = 0; | ||
| 218 | int iswrite = !!(cmd->tf_flags & IDE_TFLAG_WRITE); | ||
| 219 | 219 | ||
| 220 | iswrite = (rq_data_dir(rq) == WRITE); | ||
| 221 | /* Save for interrupt context */ | 220 | /* Save for interrupt context */ |
| 222 | ahwif->drive = drive; | 221 | ahwif->drive = drive; |
| 223 | 222 | ||
| 224 | hwif->sg_nents = i = ide_build_sglist(drive, rq); | ||
| 225 | |||
| 226 | if (!i) | ||
| 227 | return 0; | ||
| 228 | |||
| 229 | /* fill the descriptors */ | 223 | /* fill the descriptors */ |
| 230 | sg = hwif->sg_table; | 224 | sg = hwif->sg_table; |
| 231 | while (i && sg_dma_len(sg)) { | 225 | while (i && sg_dma_len(sg)) { |
| @@ -286,12 +280,7 @@ static int auide_build_dmatable(ide_drive_t *drive) | |||
| 286 | 280 | ||
| 287 | static int auide_dma_end(ide_drive_t *drive) | 281 | static int auide_dma_end(ide_drive_t *drive) |
| 288 | { | 282 | { |
| 289 | ide_hwif_t *hwif = drive->hwif; | 283 | ide_destroy_dmatable(drive); |
| 290 | |||
| 291 | if (hwif->sg_nents) { | ||
| 292 | ide_destroy_dmatable(drive); | ||
| 293 | hwif->sg_nents = 0; | ||
| 294 | } | ||
| 295 | 284 | ||
| 296 | return 0; | 285 | return 0; |
| 297 | } | 286 | } |
| @@ -301,19 +290,10 @@ static void auide_dma_start(ide_drive_t *drive ) | |||
| 301 | } | 290 | } |
| 302 | 291 | ||
| 303 | 292 | ||
| 304 | static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command) | 293 | static int auide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) |
| 305 | { | 294 | { |
| 306 | /* issue cmd to drive */ | 295 | if (auide_build_dmatable(drive, cmd) == 0) { |
| 307 | ide_execute_command(drive, command, &ide_dma_intr, | 296 | ide_map_sg(drive, cmd); |
| 308 | (2*WAIT_CMD), NULL); | ||
| 309 | } | ||
| 310 | |||
| 311 | static int auide_dma_setup(ide_drive_t *drive) | ||
| 312 | { | ||
| 313 | struct request *rq = drive->hwif->rq; | ||
| 314 | |||
| 315 | if (!auide_build_dmatable(drive)) { | ||
| 316 | ide_map_sg(drive, rq); | ||
| 317 | return 1; | 297 | return 1; |
| 318 | } | 298 | } |
| 319 | 299 | ||
| @@ -369,7 +349,6 @@ static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 de | |||
| 369 | static const struct ide_dma_ops au1xxx_dma_ops = { | 349 | static const struct ide_dma_ops au1xxx_dma_ops = { |
| 370 | .dma_host_set = auide_dma_host_set, | 350 | .dma_host_set = auide_dma_host_set, |
| 371 | .dma_setup = auide_dma_setup, | 351 | .dma_setup = auide_dma_setup, |
| 372 | .dma_exec_cmd = auide_dma_exec_cmd, | ||
| 373 | .dma_start = auide_dma_start, | 352 | .dma_start = auide_dma_start, |
| 374 | .dma_end = auide_dma_end, | 353 | .dma_end = auide_dma_end, |
| 375 | .dma_test_irq = auide_dma_test_irq, | 354 | .dma_test_irq = auide_dma_test_irq, |
