aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/scc_pata.c
diff options
context:
space:
mode:
authorAkira Iguchi <akira2.iguchi@toshiba.co.jp>2008-04-17 18:46:25 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-17 18:46:25 -0400
commit3d53ba87f079c078f608729120ada862cb0896e0 (patch)
tree74b927e7ed36847dedb96a732c16e4fa62477b90 /drivers/ide/pci/scc_pata.c
parente6bfa38a4803646e212ef542b957344e790c3733 (diff)
scc_pata.c: do setup itself instead of ide_setup_pci_device()
scc_pata has the different BAR configuration and using ide_setup_pci_device() is inappropriate. (ide_setup_pci_device() expects a normal PCI IDE controller with BAR0..BAR3 either non-existant or being primary/secondary port bases in I/O space.) This patch do all needed setup itself instead of calling ide_setup_pci_device(). [bart: minor checkpatch.pl fixes] Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp> Signed-off-by: Akira Iguchi <akira2.iguchi@toshiba.co.jp> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/scc_pata.c')
-rw-r--r--drivers/ide/pci/scc_pata.c62
1 files changed, 47 insertions, 15 deletions
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index 085c1b58a99c..1a560dc1eac1 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -523,6 +523,43 @@ static int setup_mmio_scc (struct pci_dev *dev, const char *name)
523 return -ENOMEM; 523 return -ENOMEM;
524} 524}
525 525
526static int scc_ide_setup_pci_device(struct pci_dev *dev,
527 const struct ide_port_info *d)
528{
529 struct scc_ports *ports = pci_get_drvdata(dev);
530 ide_hwif_t *hwif = NULL;
531 hw_regs_t hw;
532 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
533 int i;
534
535 for (i = 0; i < MAX_HWIFS; i++) {
536 hwif = &ide_hwifs[i];
537 if (hwif->chipset == ide_unknown)
538 break; /* pick an unused entry */
539 }
540 if (i == MAX_HWIFS) {
541 printk(KERN_ERR "%s: too many IDE interfaces, "
542 "no room in table\n", SCC_PATA_NAME);
543 return -ENOMEM;
544 }
545
546 memset(&hw, 0, sizeof(hw));
547 for (i = IDE_DATA_OFFSET; i <= IDE_CONTROL_OFFSET; i++)
548 hw.io_ports[i] = ports->dma + 0x20 + i * 4;
549 hw.irq = dev->irq;
550 hw.dev = &dev->dev;
551 hw.chipset = ide_pci;
552 ide_init_port_hw(hwif, &hw);
553 hwif->dev = &dev->dev;
554 hwif->cds = d;
555
556 idx[0] = hwif->index;
557
558 ide_device_add(idx, d);
559
560 return 0;
561}
562
526/** 563/**
527 * init_setup_scc - set up an SCC PATA Controller 564 * init_setup_scc - set up an SCC PATA Controller
528 * @dev: PCI device 565 * @dev: PCI device
@@ -545,10 +582,13 @@ static int __devinit init_setup_scc(struct pci_dev *dev,
545 struct scc_ports *ports; 582 struct scc_ports *ports;
546 int rc; 583 int rc;
547 584
585 rc = pci_enable_device(dev);
586 if (rc)
587 goto end;
588
548 rc = setup_mmio_scc(dev, d->name); 589 rc = setup_mmio_scc(dev, d->name);
549 if (rc < 0) { 590 if (rc < 0)
550 return rc; 591 goto end;
551 }
552 592
553 ports = pci_get_drvdata(dev); 593 ports = pci_get_drvdata(dev);
554 ctl_base = ports->ctl; 594 ctl_base = ports->ctl;
@@ -583,7 +623,10 @@ static int __devinit init_setup_scc(struct pci_dev *dev,
583 out_be32((void*)mode_port, MODE_JCUSFEN); 623 out_be32((void*)mode_port, MODE_JCUSFEN);
584 out_be32((void*)intmask_port, INTMASK_MSK); 624 out_be32((void*)intmask_port, INTMASK_MSK);
585 625
586 return ide_setup_pci_device(dev, d); 626 rc = scc_ide_setup_pci_device(dev, d);
627
628 end:
629 return rc;
587} 630}
588 631
589/** 632/**
@@ -610,17 +653,6 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif)
610 hwif->OUTSW = scc_ide_outsw; 653 hwif->OUTSW = scc_ide_outsw;
611 hwif->OUTSL = scc_ide_outsl; 654 hwif->OUTSL = scc_ide_outsl;
612 655
613 hwif->io_ports[IDE_DATA_OFFSET] = dma_base + 0x20;
614 hwif->io_ports[IDE_ERROR_OFFSET] = dma_base + 0x24;
615 hwif->io_ports[IDE_NSECTOR_OFFSET] = dma_base + 0x28;
616 hwif->io_ports[IDE_SECTOR_OFFSET] = dma_base + 0x2c;
617 hwif->io_ports[IDE_LCYL_OFFSET] = dma_base + 0x30;
618 hwif->io_ports[IDE_HCYL_OFFSET] = dma_base + 0x34;
619 hwif->io_ports[IDE_SELECT_OFFSET] = dma_base + 0x38;
620 hwif->io_ports[IDE_STATUS_OFFSET] = dma_base + 0x3c;
621 hwif->io_ports[IDE_CONTROL_OFFSET] = dma_base + 0x40;
622
623 hwif->irq = dev->irq;
624 hwif->dma_base = dma_base; 656 hwif->dma_base = dma_base;
625 hwif->config_data = ports->ctl; 657 hwif->config_data = ports->ctl;
626 hwif->mmio = 1; 658 hwif->mmio = 1;