diff options
author | Tejun Heo <htejun@gmail.com> | 2007-02-01 01:06:36 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-09 17:39:38 -0500 |
commit | 0d5ff566779f894ca9937231a181eb31e4adff0e (patch) | |
tree | d1c7495c932581c1d41aa7f0fdb303348da49106 /drivers/ata/sata_inic162x.c | |
parent | 1a68ff13c8a9b517de3fd4187dc525412a6eba1b (diff) |
libata: convert to iomap
Convert libata core layer and LLDs to use iomap.
* managed iomap is used. Pointer to pcim_iomap_table() is cached at
host->iomap and used through out LLDs. This basically replaces
host->mmio_base.
* if possible, pcim_iomap_regions() is used
Most iomap operation conversions are taken from Jeff Garzik
<jgarzik@pobox.com>'s iomap branch.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_inic162x.c')
-rw-r--r-- | drivers/ata/sata_inic162x.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index c98e0227a60c..b2a6f77b38d6 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
@@ -147,7 +147,7 @@ static const int scr_map[] = { | |||
147 | 147 | ||
148 | static void __iomem * inic_port_base(struct ata_port *ap) | 148 | static void __iomem * inic_port_base(struct ata_port *ap) |
149 | { | 149 | { |
150 | return ap->host->mmio_base + ap->port_no * PORT_SIZE; | 150 | return ap->host->iomap[MMIO_BAR] + ap->port_no * PORT_SIZE; |
151 | } | 151 | } |
152 | 152 | ||
153 | static void __inic_set_pirq_mask(struct ata_port *ap, u8 mask) | 153 | static void __inic_set_pirq_mask(struct ata_port *ap, u8 mask) |
@@ -324,7 +324,7 @@ static void inic_host_intr(struct ata_port *ap) | |||
324 | static irqreturn_t inic_interrupt(int irq, void *dev_instance) | 324 | static irqreturn_t inic_interrupt(int irq, void *dev_instance) |
325 | { | 325 | { |
326 | struct ata_host *host = dev_instance; | 326 | struct ata_host *host = dev_instance; |
327 | void __iomem *mmio_base = host->mmio_base; | 327 | void __iomem *mmio_base = host->iomap[MMIO_BAR]; |
328 | u16 host_irq_stat; | 328 | u16 host_irq_stat; |
329 | int i, handled = 0;; | 329 | int i, handled = 0;; |
330 | 330 | ||
@@ -566,7 +566,7 @@ static struct ata_port_operations inic_port_ops = { | |||
566 | 566 | ||
567 | .qc_prep = ata_qc_prep, | 567 | .qc_prep = ata_qc_prep, |
568 | .qc_issue = inic_qc_issue, | 568 | .qc_issue = inic_qc_issue, |
569 | .data_xfer = ata_pio_data_xfer, | 569 | .data_xfer = ata_data_xfer, |
570 | 570 | ||
571 | .freeze = inic_freeze, | 571 | .freeze = inic_freeze, |
572 | .thaw = inic_thaw, | 572 | .thaw = inic_thaw, |
@@ -638,7 +638,7 @@ static int inic_pci_device_resume(struct pci_dev *pdev) | |||
638 | { | 638 | { |
639 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 639 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
640 | struct inic_host_priv *hpriv = host->private_data; | 640 | struct inic_host_priv *hpriv = host->private_data; |
641 | void __iomem *mmio_base = host->mmio_base; | 641 | void __iomem *mmio_base = host->iomap[MMIO_BAR]; |
642 | int rc; | 642 | int rc; |
643 | 643 | ||
644 | ata_pci_device_do_resume(pdev); | 644 | ata_pci_device_do_resume(pdev); |
@@ -661,7 +661,7 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
661 | struct ata_port_info *pinfo = &inic_port_info; | 661 | struct ata_port_info *pinfo = &inic_port_info; |
662 | struct ata_probe_ent *probe_ent; | 662 | struct ata_probe_ent *probe_ent; |
663 | struct inic_host_priv *hpriv; | 663 | struct inic_host_priv *hpriv; |
664 | void __iomem *mmio_base; | 664 | void __iomem * const *iomap; |
665 | int i, rc; | 665 | int i, rc; |
666 | 666 | ||
667 | if (!printed_version++) | 667 | if (!printed_version++) |
@@ -675,9 +675,10 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
675 | if (rc) | 675 | if (rc) |
676 | return rc; | 676 | return rc; |
677 | 677 | ||
678 | mmio_base = pci_iomap(pdev, MMIO_BAR, 0); | 678 | rc = pcim_iomap_regions(pdev, 0x3f, DRV_NAME); |
679 | if (!mmio_base) | 679 | if (rc) |
680 | return -ENOMEM; | 680 | return rc; |
681 | iomap = pcim_iomap_table(pdev); | ||
681 | 682 | ||
682 | /* Set dma_mask. This devices doesn't support 64bit addressing. */ | 683 | /* Set dma_mask. This devices doesn't support 64bit addressing. */ |
683 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 684 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
@@ -713,26 +714,25 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
713 | probe_ent->irq = pdev->irq; | 714 | probe_ent->irq = pdev->irq; |
714 | probe_ent->irq_flags = SA_SHIRQ; | 715 | probe_ent->irq_flags = SA_SHIRQ; |
715 | 716 | ||
716 | probe_ent->mmio_base = mmio_base; | 717 | probe_ent->iomap = iomap; |
717 | 718 | ||
718 | for (i = 0; i < NR_PORTS; i++) { | 719 | for (i = 0; i < NR_PORTS; i++) { |
719 | struct ata_ioports *port = &probe_ent->port[i]; | 720 | struct ata_ioports *port = &probe_ent->port[i]; |
720 | unsigned long port_base = | 721 | void __iomem *port_base = iomap[MMIO_BAR] + i * PORT_SIZE; |
721 | (unsigned long)mmio_base + i * PORT_SIZE; | ||
722 | 722 | ||
723 | port->cmd_addr = pci_resource_start(pdev, 2 * i); | 723 | port->cmd_addr = iomap[2 * i]; |
724 | port->altstatus_addr = | 724 | port->altstatus_addr = |
725 | port->ctl_addr = | 725 | port->ctl_addr = (void __iomem *) |
726 | pci_resource_start(pdev, 2 * i + 1) | ATA_PCI_CTL_OFS; | 726 | ((unsigned long)iomap[2 * i + 1] | ATA_PCI_CTL_OFS); |
727 | port->scr_addr = port_base + PORT_SCR; | 727 | port->scr_addr = port_base + PORT_SCR; |
728 | 728 | ||
729 | ata_std_ports(port); | 729 | ata_std_ports(port); |
730 | } | 730 | } |
731 | 731 | ||
732 | probe_ent->private_data = hpriv; | 732 | probe_ent->private_data = hpriv; |
733 | hpriv->cached_hctl = readw(mmio_base + HOST_CTL); | 733 | hpriv->cached_hctl = readw(iomap[MMIO_BAR] + HOST_CTL); |
734 | 734 | ||
735 | rc = init_controller(mmio_base, hpriv->cached_hctl); | 735 | rc = init_controller(iomap[MMIO_BAR], hpriv->cached_hctl); |
736 | if (rc) { | 736 | if (rc) { |
737 | dev_printk(KERN_ERR, &pdev->dev, | 737 | dev_printk(KERN_ERR, &pdev->dev, |
738 | "failed to initialize controller\n"); | 738 | "failed to initialize controller\n"); |