aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/tx4939ide.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/tx4939ide.c')
-rw-r--r--drivers/ide/tx4939ide.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index 8d155ec8cca9..39e3316ab63f 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -232,7 +232,7 @@ static u8 tx4939ide_clear_dma_status(void __iomem *base)
232 232
233#ifdef __BIG_ENDIAN 233#ifdef __BIG_ENDIAN
234/* custom ide_build_dmatable to handle swapped layout */ 234/* custom ide_build_dmatable to handle swapped layout */
235static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq) 235static int tx4939ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
236{ 236{
237 ide_hwif_t *hwif = drive->hwif; 237 ide_hwif_t *hwif = drive->hwif;
238 u32 *table = (u32 *)hwif->dmatable_cpu; 238 u32 *table = (u32 *)hwif->dmatable_cpu;
@@ -240,7 +240,7 @@ static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq)
240 int i; 240 int i;
241 struct scatterlist *sg; 241 struct scatterlist *sg;
242 242
243 for_each_sg(hwif->sg_table, sg, hwif->cmd.sg_nents, i) { 243 for_each_sg(hwif->sg_table, sg, cmd->sg_nents, i) {
244 u32 cur_addr, cur_len, bcount; 244 u32 cur_addr, cur_len, bcount;
245 245
246 cur_addr = sg_dma_address(sg); 246 cur_addr = sg_dma_address(sg);
@@ -287,23 +287,15 @@ use_pio_instead:
287#define tx4939ide_build_dmatable ide_build_dmatable 287#define tx4939ide_build_dmatable ide_build_dmatable
288#endif 288#endif
289 289
290static int tx4939ide_dma_setup(ide_drive_t *drive) 290static int tx4939ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
291{ 291{
292 ide_hwif_t *hwif = drive->hwif; 292 ide_hwif_t *hwif = drive->hwif;
293 void __iomem *base = TX4939IDE_BASE(hwif); 293 void __iomem *base = TX4939IDE_BASE(hwif);
294 struct request *rq = hwif->rq; 294 u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR;
295 u8 reading;
296 int nent;
297
298 if (rq_data_dir(rq))
299 reading = 0;
300 else
301 reading = ATA_DMA_WR;
302 295
303 /* fall back to PIO! */ 296 /* fall back to PIO! */
304 nent = tx4939ide_build_dmatable(drive, rq); 297 if (tx4939ide_build_dmatable(drive, cmd) == 0) {
305 if (!nent) { 298 ide_map_sg(drive, cmd);
306 ide_map_sg(drive, rq);
307 return 1; 299 return 1;
308 } 300 }
309 301
@@ -311,7 +303,7 @@ static int tx4939ide_dma_setup(ide_drive_t *drive)
311 tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr); 303 tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr);
312 304
313 /* specify r/w */ 305 /* specify r/w */
314 tx4939ide_writeb(reading, base, TX4939IDE_DMA_Cmd); 306 tx4939ide_writeb(rw, base, TX4939IDE_DMA_Cmd);
315 307
316 /* clear INTR & ERROR flags */ 308 /* clear INTR & ERROR flags */
317 tx4939ide_clear_dma_status(base); 309 tx4939ide_clear_dma_status(base);
@@ -320,7 +312,9 @@ static int tx4939ide_dma_setup(ide_drive_t *drive)
320 312
321 tx4939ide_writew(SECTOR_SIZE / 2, base, drive->dn ? 313 tx4939ide_writew(SECTOR_SIZE / 2, base, drive->dn ?
322 TX4939IDE_Xfer_Cnt_2 : TX4939IDE_Xfer_Cnt_1); 314 TX4939IDE_Xfer_Cnt_2 : TX4939IDE_Xfer_Cnt_1);
323 tx4939ide_writew(rq->nr_sectors, base, TX4939IDE_Sec_Cnt); 315
316 tx4939ide_writew(cmd->rq->nr_sectors, base, TX4939IDE_Sec_Cnt);
317
324 return 0; 318 return 0;
325} 319}
326 320