[libata] ahci: Factor out SATA port init into a separate function
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
@@ -814,20 +814,13 @@ static int ahci_reset_controller(struct ata_host *host)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ahci_init_controller(struct ata_host *host)
|
static void ahci_port_init(struct pci_dev *pdev, struct ata_port *ap,
|
||||||
|
int port_no, void __iomem *mmio,
|
||||||
|
void __iomem *port_mmio)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(host->dev);
|
|
||||||
void __iomem *mmio = host->iomap[AHCI_PCI_BAR];
|
|
||||||
int i, rc;
|
|
||||||
u32 tmp;
|
|
||||||
|
|
||||||
for (i = 0; i < host->n_ports; i++) {
|
|
||||||
struct ata_port *ap = host->ports[i];
|
|
||||||
void __iomem *port_mmio = ahci_port_base(ap);
|
|
||||||
const char *emsg = NULL;
|
const char *emsg = NULL;
|
||||||
|
int rc;
|
||||||
if (ata_port_is_dummy(ap))
|
u32 tmp;
|
||||||
continue;
|
|
||||||
|
|
||||||
/* make sure port is not active */
|
/* make sure port is not active */
|
||||||
rc = ahci_deinit_port(ap, &emsg);
|
rc = ahci_deinit_port(ap, &emsg);
|
||||||
@@ -846,7 +839,24 @@ static void ahci_init_controller(struct ata_host *host)
|
|||||||
if (tmp)
|
if (tmp)
|
||||||
writel(tmp, port_mmio + PORT_IRQ_STAT);
|
writel(tmp, port_mmio + PORT_IRQ_STAT);
|
||||||
|
|
||||||
writel(1 << i, mmio + HOST_IRQ_STAT);
|
writel(1 << port_no, mmio + HOST_IRQ_STAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ahci_init_controller(struct ata_host *host)
|
||||||
|
{
|
||||||
|
struct pci_dev *pdev = to_pci_dev(host->dev);
|
||||||
|
void __iomem *mmio = host->iomap[AHCI_PCI_BAR];
|
||||||
|
int i;
|
||||||
|
u32 tmp;
|
||||||
|
|
||||||
|
for (i = 0; i < host->n_ports; i++) {
|
||||||
|
struct ata_port *ap = host->ports[i];
|
||||||
|
void __iomem *port_mmio = ahci_port_base(ap);
|
||||||
|
|
||||||
|
if (ata_port_is_dummy(ap))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ahci_port_init(pdev, ap, i, mmio, port_mmio);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = readl(mmio + HOST_CTL);
|
tmp = readl(mmio + HOST_CTL);
|
||||||
|
Reference in New Issue
Block a user