diff options
Diffstat (limited to 'drivers/ide/mips/au1xxx-ide.c')
-rw-r--r-- | drivers/ide/mips/au1xxx-ide.c | 115 |
1 files changed, 35 insertions, 80 deletions
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index a8cd0035936d..3485a310c95b 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
@@ -47,7 +47,6 @@ | |||
47 | #define IDE_AU1XXX_BURSTMODE 1 | 47 | #define IDE_AU1XXX_BURSTMODE 1 |
48 | 48 | ||
49 | static _auide_hwif auide_hwif; | 49 | static _auide_hwif auide_hwif; |
50 | static int dbdma_init_done; | ||
51 | 50 | ||
52 | static int auide_ddma_init(_auide_hwif *auide); | 51 | static int auide_ddma_init(_auide_hwif *auide); |
53 | 52 | ||
@@ -61,7 +60,7 @@ void auide_insw(unsigned long port, void *addr, u32 count) | |||
61 | 60 | ||
62 | if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1, | 61 | if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1, |
63 | DDMA_FLAGS_NOIE)) { | 62 | DDMA_FLAGS_NOIE)) { |
64 | printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__); | 63 | printk(KERN_ERR "%s failed %d\n", __func__, __LINE__); |
65 | return; | 64 | return; |
66 | } | 65 | } |
67 | ctp = *((chan_tab_t **)ahwif->rx_chan); | 66 | ctp = *((chan_tab_t **)ahwif->rx_chan); |
@@ -79,7 +78,7 @@ void auide_outsw(unsigned long port, void *addr, u32 count) | |||
79 | 78 | ||
80 | if(!put_source_flags(ahwif->tx_chan, (void*)addr, | 79 | if(!put_source_flags(ahwif->tx_chan, (void*)addr, |
81 | count << 1, DDMA_FLAGS_NOIE)) { | 80 | count << 1, DDMA_FLAGS_NOIE)) { |
82 | printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__); | 81 | printk(KERN_ERR "%s failed %d\n", __func__, __LINE__); |
83 | return; | 82 | return; |
84 | } | 83 | } |
85 | ctp = *((chan_tab_t **)ahwif->tx_chan); | 84 | ctp = *((chan_tab_t **)ahwif->tx_chan); |
@@ -250,7 +249,7 @@ static int auide_build_dmatable(ide_drive_t *drive) | |||
250 | (void*) sg_virt(sg), | 249 | (void*) sg_virt(sg), |
251 | tc, flags)) { | 250 | tc, flags)) { |
252 | printk(KERN_ERR "%s failed %d\n", | 251 | printk(KERN_ERR "%s failed %d\n", |
253 | __FUNCTION__, __LINE__); | 252 | __func__, __LINE__); |
254 | } | 253 | } |
255 | } else | 254 | } else |
256 | { | 255 | { |
@@ -258,7 +257,7 @@ static int auide_build_dmatable(ide_drive_t *drive) | |||
258 | (void*) sg_virt(sg), | 257 | (void*) sg_virt(sg), |
259 | tc, flags)) { | 258 | tc, flags)) { |
260 | printk(KERN_ERR "%s failed %d\n", | 259 | printk(KERN_ERR "%s failed %d\n", |
261 | __FUNCTION__, __LINE__); | 260 | __func__, __LINE__); |
262 | } | 261 | } |
263 | } | 262 | } |
264 | 263 | ||
@@ -315,35 +314,6 @@ static int auide_dma_setup(ide_drive_t *drive) | |||
315 | return 0; | 314 | return 0; |
316 | } | 315 | } |
317 | 316 | ||
318 | static u8 auide_mdma_filter(ide_drive_t *drive) | ||
319 | { | ||
320 | /* | ||
321 | * FIXME: ->white_list and ->black_list are based on completely bogus | ||
322 | * ->ide_dma_check implementation which didn't set neither the host | ||
323 | * controller timings nor the device for the desired transfer mode. | ||
324 | * | ||
325 | * They should be either removed or 0x00 MWDMA mask should be | ||
326 | * returned for devices on the ->black_list. | ||
327 | */ | ||
328 | |||
329 | if (dbdma_init_done == 0) { | ||
330 | auide_hwif.white_list = ide_in_drive_list(drive->id, | ||
331 | dma_white_list); | ||
332 | auide_hwif.black_list = ide_in_drive_list(drive->id, | ||
333 | dma_black_list); | ||
334 | auide_hwif.drive = drive; | ||
335 | auide_ddma_init(&auide_hwif); | ||
336 | dbdma_init_done = 1; | ||
337 | } | ||
338 | |||
339 | /* Is the drive in our DMA black list? */ | ||
340 | if (auide_hwif.black_list) | ||
341 | printk(KERN_WARNING "%s: Disabling DMA for %s (blacklisted)\n", | ||
342 | drive->name, drive->id->model); | ||
343 | |||
344 | return drive->hwif->mwdma_mask; | ||
345 | } | ||
346 | |||
347 | static int auide_dma_test_irq(ide_drive_t *drive) | 317 | static int auide_dma_test_irq(ide_drive_t *drive) |
348 | { | 318 | { |
349 | if (drive->waiting_for_dma == 0) | 319 | if (drive->waiting_for_dma == 0) |
@@ -396,41 +366,41 @@ static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 de | |||
396 | dev->dev_devwidth = devwidth; | 366 | dev->dev_devwidth = devwidth; |
397 | dev->dev_flags = flags; | 367 | dev->dev_flags = flags; |
398 | } | 368 | } |
399 | |||
400 | #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) | ||
401 | 369 | ||
370 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | ||
402 | static void auide_dma_timeout(ide_drive_t *drive) | 371 | static void auide_dma_timeout(ide_drive_t *drive) |
403 | { | 372 | { |
404 | ide_hwif_t *hwif = HWIF(drive); | 373 | ide_hwif_t *hwif = HWIF(drive); |
405 | 374 | ||
406 | printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name); | 375 | printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name); |
407 | 376 | ||
408 | if (hwif->ide_dma_test_irq(drive)) | 377 | if (auide_dma_test_irq(drive)) |
409 | return; | 378 | return; |
410 | 379 | ||
411 | hwif->ide_dma_end(drive); | 380 | auide_dma_end(drive); |
412 | } | 381 | } |
413 | |||
414 | 382 | ||
415 | static int auide_ddma_init(_auide_hwif *auide) { | 383 | static const struct ide_dma_ops au1xxx_dma_ops = { |
416 | 384 | .dma_host_set = auide_dma_host_set, | |
385 | .dma_setup = auide_dma_setup, | ||
386 | .dma_exec_cmd = auide_dma_exec_cmd, | ||
387 | .dma_start = auide_dma_start, | ||
388 | .dma_end = auide_dma_end, | ||
389 | .dma_test_irq = auide_dma_test_irq, | ||
390 | .dma_lost_irq = auide_dma_lost_irq, | ||
391 | .dma_timeout = auide_dma_timeout, | ||
392 | }; | ||
393 | |||
394 | static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d) | ||
395 | { | ||
396 | _auide_hwif *auide = (_auide_hwif *)hwif->hwif_data; | ||
417 | dbdev_tab_t source_dev_tab, target_dev_tab; | 397 | dbdev_tab_t source_dev_tab, target_dev_tab; |
418 | u32 dev_id, tsize, devwidth, flags; | 398 | u32 dev_id, tsize, devwidth, flags; |
419 | ide_hwif_t *hwif = auide->hwif; | ||
420 | 399 | ||
421 | dev_id = AU1XXX_ATA_DDMA_REQ; | 400 | dev_id = AU1XXX_ATA_DDMA_REQ; |
422 | 401 | ||
423 | if (auide->white_list || auide->black_list) { | 402 | tsize = 8; /* 1 */ |
424 | tsize = 8; | 403 | devwidth = 32; /* 16 */ |
425 | devwidth = 32; | ||
426 | } | ||
427 | else { | ||
428 | tsize = 1; | ||
429 | devwidth = 16; | ||
430 | |||
431 | printk(KERN_ERR "au1xxx-ide: %s is not on ide driver whitelist.\n",auide_hwif.drive->id->model); | ||
432 | printk(KERN_ERR " please read 'Documentation/mips/AU1xxx_IDE.README'"); | ||
433 | } | ||
434 | 404 | ||
435 | #ifdef IDE_AU1XXX_BURSTMODE | 405 | #ifdef IDE_AU1XXX_BURSTMODE |
436 | flags = DEV_FLAGS_SYNC | DEV_FLAGS_BURSTABLE; | 406 | flags = DEV_FLAGS_SYNC | DEV_FLAGS_BURSTABLE; |
@@ -482,9 +452,9 @@ static int auide_ddma_init(_auide_hwif *auide) { | |||
482 | return 0; | 452 | return 0; |
483 | } | 453 | } |
484 | #else | 454 | #else |
485 | 455 | static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d) | |
486 | static int auide_ddma_init( _auide_hwif *auide ) | ||
487 | { | 456 | { |
457 | _auide_hwif *auide = (_auide_hwif *)hwif->hwif_data; | ||
488 | dbdev_tab_t source_dev_tab; | 458 | dbdev_tab_t source_dev_tab; |
489 | int flags; | 459 | int flags; |
490 | 460 | ||
@@ -543,9 +513,18 @@ static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif) | |||
543 | *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET); | 513 | *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET); |
544 | } | 514 | } |
545 | 515 | ||
516 | static const struct ide_port_ops au1xxx_port_ops = { | ||
517 | .set_pio_mode = au1xxx_set_pio_mode, | ||
518 | .set_dma_mode = auide_set_dma_mode, | ||
519 | }; | ||
520 | |||
546 | static const struct ide_port_info au1xxx_port_info = { | 521 | static const struct ide_port_info au1xxx_port_info = { |
522 | .init_dma = auide_ddma_init, | ||
523 | .port_ops = &au1xxx_port_ops, | ||
524 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | ||
525 | .dma_ops = &au1xxx_dma_ops, | ||
526 | #endif | ||
547 | .host_flags = IDE_HFLAG_POST_SET_MODE | | 527 | .host_flags = IDE_HFLAG_POST_SET_MODE | |
548 | IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ | ||
549 | IDE_HFLAG_NO_IO_32BIT | | 528 | IDE_HFLAG_NO_IO_32BIT | |
550 | IDE_HFLAG_UNMASK_IRQS, | 529 | IDE_HFLAG_UNMASK_IRQS, |
551 | .pio_mask = ATA_PIO4, | 530 | .pio_mask = ATA_PIO4, |
@@ -615,8 +594,6 @@ static int au_ide_probe(struct device *dev) | |||
615 | 594 | ||
616 | hwif->dev = dev; | 595 | hwif->dev = dev; |
617 | 596 | ||
618 | hwif->mmio = 1; | ||
619 | |||
620 | /* If the user has selected DDMA assisted copies, | 597 | /* If the user has selected DDMA assisted copies, |
621 | then set up a few local I/O function entry points | 598 | then set up a few local I/O function entry points |
622 | */ | 599 | */ |
@@ -625,34 +602,12 @@ static int au_ide_probe(struct device *dev) | |||
625 | hwif->INSW = auide_insw; | 602 | hwif->INSW = auide_insw; |
626 | hwif->OUTSW = auide_outsw; | 603 | hwif->OUTSW = auide_outsw; |
627 | #endif | 604 | #endif |
628 | |||
629 | hwif->set_pio_mode = &au1xxx_set_pio_mode; | ||
630 | hwif->set_dma_mode = &auide_set_dma_mode; | ||
631 | |||
632 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | ||
633 | hwif->dma_timeout = &auide_dma_timeout; | ||
634 | |||
635 | hwif->mdma_filter = &auide_mdma_filter; | ||
636 | |||
637 | hwif->dma_host_set = &auide_dma_host_set; | ||
638 | hwif->dma_exec_cmd = &auide_dma_exec_cmd; | ||
639 | hwif->dma_start = &auide_dma_start; | ||
640 | hwif->ide_dma_end = &auide_dma_end; | ||
641 | hwif->dma_setup = &auide_dma_setup; | ||
642 | hwif->ide_dma_test_irq = &auide_dma_test_irq; | ||
643 | hwif->dma_lost_irq = &auide_dma_lost_irq; | ||
644 | #endif | ||
645 | hwif->select_data = 0; /* no chipset-specific code */ | 605 | hwif->select_data = 0; /* no chipset-specific code */ |
646 | hwif->config_data = 0; /* no chipset-specific code */ | 606 | hwif->config_data = 0; /* no chipset-specific code */ |
647 | 607 | ||
648 | auide_hwif.hwif = hwif; | 608 | auide_hwif.hwif = hwif; |
649 | hwif->hwif_data = &auide_hwif; | 609 | hwif->hwif_data = &auide_hwif; |
650 | 610 | ||
651 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA | ||
652 | auide_ddma_init(&auide_hwif); | ||
653 | dbdma_init_done = 1; | ||
654 | #endif | ||
655 | |||
656 | idx[0] = hwif->index; | 611 | idx[0] = hwif->index; |
657 | 612 | ||
658 | ide_device_add(idx, &au1xxx_port_info); | 613 | ide_device_add(idx, &au1xxx_port_info); |