aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2010-03-03 12:17:42 -0500
committerJeff Garzik <jgarzik@redhat.com>2010-05-14 17:08:01 -0400
commit781d655083f8fb0a343bb694e83b96f04e934b4f (patch)
treebaf8156cbb5558c8863850e889373314f8651da3 /drivers
parent97cfbfe60018ffa9198cf78848a9abc4b8d316cc (diff)
ahci: Factor out PCI specifics from ahci_init_controller()
Move PCI stuff into ahci_pci_init_controller(). Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ahci.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index d75b7c9ea323..ac875c506740 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1684,11 +1684,34 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap,
1684static void ahci_init_controller(struct ata_host *host) 1684static void ahci_init_controller(struct ata_host *host)
1685{ 1685{
1686 struct ahci_host_priv *hpriv = host->private_data; 1686 struct ahci_host_priv *hpriv = host->private_data;
1687 struct pci_dev *pdev = to_pci_dev(host->dev);
1688 void __iomem *mmio = hpriv->mmio; 1687 void __iomem *mmio = hpriv->mmio;
1689 int i; 1688 int i;
1690 void __iomem *port_mmio; 1689 void __iomem *port_mmio;
1691 u32 tmp; 1690 u32 tmp;
1691
1692 for (i = 0; i < host->n_ports; i++) {
1693 struct ata_port *ap = host->ports[i];
1694
1695 port_mmio = ahci_port_base(ap);
1696 if (ata_port_is_dummy(ap))
1697 continue;
1698
1699 ahci_port_init(host->dev, ap, i, mmio, port_mmio);
1700 }
1701
1702 tmp = readl(mmio + HOST_CTL);
1703 VPRINTK("HOST_CTL 0x%x\n", tmp);
1704 writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL);
1705 tmp = readl(mmio + HOST_CTL);
1706 VPRINTK("HOST_CTL 0x%x\n", tmp);
1707}
1708
1709static void ahci_pci_init_controller(struct ata_host *host)
1710{
1711 struct ahci_host_priv *hpriv = host->private_data;
1712 struct pci_dev *pdev = to_pci_dev(host->dev);
1713 void __iomem *port_mmio;
1714 u32 tmp;
1692 int mv; 1715 int mv;
1693 1716
1694 if (hpriv->flags & AHCI_HFLAG_MV_PATA) { 1717 if (hpriv->flags & AHCI_HFLAG_MV_PATA) {
@@ -1707,21 +1730,7 @@ static void ahci_init_controller(struct ata_host *host)
1707 writel(tmp, port_mmio + PORT_IRQ_STAT); 1730 writel(tmp, port_mmio + PORT_IRQ_STAT);
1708 } 1731 }
1709 1732
1710 for (i = 0; i < host->n_ports; i++) { 1733 ahci_init_controller(host);
1711 struct ata_port *ap = host->ports[i];
1712
1713 port_mmio = ahci_port_base(ap);
1714 if (ata_port_is_dummy(ap))
1715 continue;
1716
1717 ahci_port_init(host->dev, ap, i, mmio, port_mmio);
1718 }
1719
1720 tmp = readl(mmio + HOST_CTL);
1721 VPRINTK("HOST_CTL 0x%x\n", tmp);
1722 writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL);
1723 tmp = readl(mmio + HOST_CTL);
1724 VPRINTK("HOST_CTL 0x%x\n", tmp);
1725} 1734}
1726 1735
1727static void ahci_dev_config(struct ata_device *dev) 1736static void ahci_dev_config(struct ata_device *dev)
@@ -2709,7 +2718,7 @@ static int ahci_pci_device_resume(struct pci_dev *pdev)
2709 if (rc) 2718 if (rc)
2710 return rc; 2719 return rc;
2711 2720
2712 ahci_init_controller(host); 2721 ahci_pci_init_controller(host);
2713 } 2722 }
2714 2723
2715 ata_host_resume(host); 2724 ata_host_resume(host);
@@ -3449,7 +3458,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3449 if (rc) 3458 if (rc)
3450 return rc; 3459 return rc;
3451 3460
3452 ahci_init_controller(host); 3461 ahci_pci_init_controller(host);
3453 ahci_print_info(host); 3462 ahci_print_info(host);
3454 3463
3455 pci_set_master(pdev); 3464 pci_set_master(pdev);