aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/mips
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-26 16:44:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-26 16:44:19 -0400
commita52b0d25a722e84da999005b75f972aa4824253c (patch)
tree4a3a48305f744e6bde2e3fd663a4473dd712049c /drivers/ide/mips
parent539a5fe22620a1665cce504167953a71a43232ad (diff)
parentf37afdaca711838b50ecd89b9c15fc745270d77c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (46 commits) ide: constify struct ide_dma_ops ide: add struct ide_dma_ops (take 3) ide: add IDE_HFLAG_SERIALIZE_DMA host flag sl82c105: check bridge revision in sl82c105_init_one() au1xxx-ide: use ->init_dma method palm_bk3710: use ->init_dma method sgiioc4: use ->init_dma method icside: use ->init_dma method ide-pmac: use ->init_dma method ide: do complete DMA setup in ->init_dma method (take 2) au1xxx-ide: fix MWDMA support ide: cleanup ide_setup_dma() ide: factor out setting PCI bus-mastering from ide_hwif_setup_dma() ide: export ide_allocate_dma_engine() ide: move ide_setup_dma() call out from ->init_dma method alim15x3: skip DMA initialization completely on revs < 0x20 pdc202xx_old: remove init_dma_pdc202xx() ide: don't display "BIOS" settings in ide_setup_dma() ide: remove ->cds field from ide_hwif_t (take 2) ide: remove ide_dma_iobase() ...
Diffstat (limited to 'drivers/ide/mips')
-rw-r--r--drivers/ide/mips/au1xxx-ide.c115
-rw-r--r--drivers/ide/mips/swarm.c4
2 files changed, 36 insertions, 83 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
49static _auide_hwif auide_hwif; 49static _auide_hwif auide_hwif;
50static int dbdma_init_done;
51 50
52static int auide_ddma_init(_auide_hwif *auide); 51static 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
318static 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
347static int auide_dma_test_irq(ide_drive_t *drive) 317static 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
402static void auide_dma_timeout(ide_drive_t *drive) 371static 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
415static int auide_ddma_init(_auide_hwif *auide) { 383static 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
394static 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 455static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d)
486static 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
516static 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
546static const struct ide_port_info au1xxx_port_info = { 521static 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);
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
index bbe8d5853348..112fe566bb93 100644
--- a/drivers/ide/mips/swarm.c
+++ b/drivers/ide/mips/swarm.c
@@ -110,10 +110,8 @@ static int __devinit swarm_ide_probe(struct device *dev)
110 110
111 /* Setup MMIO ops. */ 111 /* Setup MMIO ops. */
112 default_hwif_mmiops(hwif); 112 default_hwif_mmiops(hwif);
113 /* Prevent resource map manipulation. */ 113
114 hwif->mmio = 1;
115 hwif->chipset = ide_generic; 114 hwif->chipset = ide_generic;
116 hwif->noprobe = 0;
117 115
118 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) 116 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
119 hwif->io_ports[i] = 117 hwif->io_ports[i] =