diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:23 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:23 -0400 |
commit | 04216fa1befbf8c737b7bf3bcc636009723f40d9 (patch) | |
tree | 6cbde56381a48623927259019839ebe8cb40cb25 /drivers | |
parent | 91432f48094db32579776bd0a9d8432b16dc0a09 (diff) |
sgiioc4: use ->init_dma method
* Move dma_base check from sgiioc4_ide_setup_pci_device()
to ide_dma_sgiioc4().
* Replace ide_dma_sgiioc4() 'unsigned long dma_base' argument
by 'const struct ide_port_info *d'.
* Move hwif->INB setup from ide_init_sgiioc4() to
sgiioc4_ide_setup_pci_device().
* Move ide_init_sgiioc4() call from sgiioc4_ide_setup_pci_device()
to ide_dma_sgiioc4().
* Convert the driver to use ->init_dma method.
Cc: Jeremy Higdon <jeremy@sgi.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/pci/sgiioc4.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index ec48decb1744..47d6e0492dda 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
@@ -327,15 +327,21 @@ sgiioc4_INB(unsigned long port) | |||
327 | return reg; | 327 | return reg; |
328 | } | 328 | } |
329 | 329 | ||
330 | static void __devinit ide_init_sgiioc4(ide_hwif_t *); | ||
331 | |||
330 | /* Creates a dma map for the scatter-gather list entries */ | 332 | /* Creates a dma map for the scatter-gather list entries */ |
331 | static int __devinit | 333 | static int __devinit |
332 | ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) | 334 | ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d) |
333 | { | 335 | { |
334 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 336 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
337 | unsigned long dma_base = pci_resource_start(dev, 0) + IOC4_DMA_OFFSET; | ||
335 | void __iomem *virt_dma_base; | 338 | void __iomem *virt_dma_base; |
336 | int num_ports = sizeof (ioc4_dma_regs_t); | 339 | int num_ports = sizeof (ioc4_dma_regs_t); |
337 | void *pad; | 340 | void *pad; |
338 | 341 | ||
342 | if (dma_base == 0) | ||
343 | return -1; | ||
344 | |||
339 | printk(KERN_INFO "%s: BM-DMA at 0x%04lx-0x%04lx\n", hwif->name, | 345 | printk(KERN_INFO "%s: BM-DMA at 0x%04lx-0x%04lx\n", hwif->name, |
340 | dma_base, dma_base + num_ports - 1); | 346 | dma_base, dma_base + num_ports - 1); |
341 | 347 | ||
@@ -371,6 +377,7 @@ ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) | |||
371 | 377 | ||
372 | if (pad) { | 378 | if (pad) { |
373 | ide_set_hwifdata(hwif, pad); | 379 | ide_set_hwifdata(hwif, pad); |
380 | ide_init_sgiioc4(hwif); | ||
374 | return 0; | 381 | return 0; |
375 | } | 382 | } |
376 | 383 | ||
@@ -551,11 +558,6 @@ static int sgiioc4_ide_dma_setup(ide_drive_t *drive) | |||
551 | static void __devinit | 558 | static void __devinit |
552 | ide_init_sgiioc4(ide_hwif_t * hwif) | 559 | ide_init_sgiioc4(ide_hwif_t * hwif) |
553 | { | 560 | { |
554 | hwif->INB = &sgiioc4_INB; | ||
555 | |||
556 | if (hwif->dma_base == 0) | ||
557 | return; | ||
558 | |||
559 | hwif->dma_host_set = &sgiioc4_dma_host_set; | 561 | hwif->dma_host_set = &sgiioc4_dma_host_set; |
560 | hwif->dma_setup = &sgiioc4_ide_dma_setup; | 562 | hwif->dma_setup = &sgiioc4_ide_dma_setup; |
561 | hwif->dma_start = &sgiioc4_ide_dma_start; | 563 | hwif->dma_start = &sgiioc4_ide_dma_start; |
@@ -575,16 +577,16 @@ static const struct ide_port_ops sgiioc4_port_ops = { | |||
575 | 577 | ||
576 | static const struct ide_port_info sgiioc4_port_info __devinitdata = { | 578 | static const struct ide_port_info sgiioc4_port_info __devinitdata = { |
577 | .chipset = ide_pci, | 579 | .chipset = ide_pci, |
580 | .init_dma = ide_dma_sgiioc4, | ||
578 | .port_ops = &sgiioc4_port_ops, | 581 | .port_ops = &sgiioc4_port_ops, |
579 | .host_flags = IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ | 582 | .host_flags = IDE_HFLAG_NO_AUTOTUNE, |
580 | IDE_HFLAG_NO_AUTOTUNE, | ||
581 | .mwdma_mask = ATA_MWDMA2_ONLY, | 583 | .mwdma_mask = ATA_MWDMA2_ONLY, |
582 | }; | 584 | }; |
583 | 585 | ||
584 | static int __devinit | 586 | static int __devinit |
585 | sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | 587 | sgiioc4_ide_setup_pci_device(struct pci_dev *dev) |
586 | { | 588 | { |
587 | unsigned long cmd_base, dma_base, irqport; | 589 | unsigned long cmd_base, irqport; |
588 | unsigned long bar0, cmd_phys_base, ctl; | 590 | unsigned long bar0, cmd_phys_base, ctl; |
589 | void __iomem *virt_base; | 591 | void __iomem *virt_base; |
590 | ide_hwif_t *hwif; | 592 | ide_hwif_t *hwif; |
@@ -610,7 +612,6 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
610 | cmd_base = (unsigned long) virt_base + IOC4_CMD_OFFSET; | 612 | cmd_base = (unsigned long) virt_base + IOC4_CMD_OFFSET; |
611 | ctl = (unsigned long) virt_base + IOC4_CTRL_OFFSET; | 613 | ctl = (unsigned long) virt_base + IOC4_CTRL_OFFSET; |
612 | irqport = (unsigned long) virt_base + IOC4_INTR_OFFSET; | 614 | irqport = (unsigned long) virt_base + IOC4_INTR_OFFSET; |
613 | dma_base = pci_resource_start(dev, 0) + IOC4_DMA_OFFSET; | ||
614 | 615 | ||
615 | cmd_phys_base = bar0 + IOC4_CMD_OFFSET; | 616 | cmd_phys_base = bar0 + IOC4_CMD_OFFSET; |
616 | if (!request_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE, | 617 | if (!request_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE, |
@@ -639,13 +640,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
639 | /* Initializing chipset IRQ Registers */ | 640 | /* Initializing chipset IRQ Registers */ |
640 | writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); | 641 | writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); |
641 | 642 | ||
642 | if (dma_base == 0 || ide_dma_sgiioc4(hwif, dma_base)) { | 643 | hwif->INB = &sgiioc4_INB; |
643 | printk(KERN_INFO "%s: %s Bus-Master DMA disabled\n", | ||
644 | hwif->name, DRV_NAME); | ||
645 | d.mwdma_mask = 0; | ||
646 | } | ||
647 | |||
648 | ide_init_sgiioc4(hwif); | ||
649 | 644 | ||
650 | idx[0] = hwif->index; | 645 | idx[0] = hwif->index; |
651 | 646 | ||