diff options
author | Tejun Heo <tj@kernel.org> | 2010-09-01 11:50:08 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2010-10-21 20:21:04 -0400 |
commit | a97c40068fab5d85c4241451fc312cb9025d7e6c (patch) | |
tree | 5a216a13a7b8d0960e3f934fc422fde121259f2a /drivers/ata | |
parent | 6c8ea89cecd780faa4f4c8ed8b3b6ab88f9fa841 (diff) |
ata_piix: implement LPM support
Now that DIPM can be used independently from HIPM, ata_piix can
support LPM too.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ata_piix.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index d712675d0a96..1b40684111c0 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -175,6 +175,8 @@ static int piix_sidpr_scr_read(struct ata_link *link, | |||
175 | unsigned int reg, u32 *val); | 175 | unsigned int reg, u32 *val); |
176 | static int piix_sidpr_scr_write(struct ata_link *link, | 176 | static int piix_sidpr_scr_write(struct ata_link *link, |
177 | unsigned int reg, u32 val); | 177 | unsigned int reg, u32 val); |
178 | static int piix_sidpr_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | ||
179 | unsigned hints); | ||
178 | static bool piix_irq_check(struct ata_port *ap); | 180 | static bool piix_irq_check(struct ata_port *ap); |
179 | #ifdef CONFIG_PM | 181 | #ifdef CONFIG_PM |
180 | static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | 182 | static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); |
@@ -348,11 +350,22 @@ static struct ata_port_operations ich_pata_ops = { | |||
348 | .set_dmamode = ich_set_dmamode, | 350 | .set_dmamode = ich_set_dmamode, |
349 | }; | 351 | }; |
350 | 352 | ||
353 | static struct device_attribute *piix_sidpr_shost_attrs[] = { | ||
354 | &dev_attr_link_power_management_policy, | ||
355 | NULL | ||
356 | }; | ||
357 | |||
358 | static struct scsi_host_template piix_sidpr_sht = { | ||
359 | ATA_BMDMA_SHT(DRV_NAME), | ||
360 | .shost_attrs = piix_sidpr_shost_attrs, | ||
361 | }; | ||
362 | |||
351 | static struct ata_port_operations piix_sidpr_sata_ops = { | 363 | static struct ata_port_operations piix_sidpr_sata_ops = { |
352 | .inherits = &piix_sata_ops, | 364 | .inherits = &piix_sata_ops, |
353 | .hardreset = sata_std_hardreset, | 365 | .hardreset = sata_std_hardreset, |
354 | .scr_read = piix_sidpr_scr_read, | 366 | .scr_read = piix_sidpr_scr_read, |
355 | .scr_write = piix_sidpr_scr_write, | 367 | .scr_write = piix_sidpr_scr_write, |
368 | .set_lpm = piix_sidpr_set_lpm, | ||
356 | }; | 369 | }; |
357 | 370 | ||
358 | static const struct piix_map_db ich5_map_db = { | 371 | static const struct piix_map_db ich5_map_db = { |
@@ -984,6 +997,12 @@ static int piix_sidpr_scr_write(struct ata_link *link, | |||
984 | return 0; | 997 | return 0; |
985 | } | 998 | } |
986 | 999 | ||
1000 | static int piix_sidpr_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | ||
1001 | unsigned hints) | ||
1002 | { | ||
1003 | return sata_link_scr_lpm(link, policy, false); | ||
1004 | } | ||
1005 | |||
987 | static bool piix_irq_check(struct ata_port *ap) | 1006 | static bool piix_irq_check(struct ata_port *ap) |
988 | { | 1007 | { |
989 | if (unlikely(!ap->ioaddr.bmdma_addr)) | 1008 | if (unlikely(!ap->ioaddr.bmdma_addr)) |
@@ -1543,6 +1562,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, | |||
1543 | struct device *dev = &pdev->dev; | 1562 | struct device *dev = &pdev->dev; |
1544 | struct ata_port_info port_info[2]; | 1563 | struct ata_port_info port_info[2]; |
1545 | const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] }; | 1564 | const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] }; |
1565 | struct scsi_host_template *sht = &piix_sht; | ||
1546 | unsigned long port_flags; | 1566 | unsigned long port_flags; |
1547 | struct ata_host *host; | 1567 | struct ata_host *host; |
1548 | struct piix_host_priv *hpriv; | 1568 | struct piix_host_priv *hpriv; |
@@ -1612,6 +1632,8 @@ static int __devinit piix_init_one(struct pci_dev *pdev, | |||
1612 | rc = piix_init_sidpr(host); | 1632 | rc = piix_init_sidpr(host); |
1613 | if (rc) | 1633 | if (rc) |
1614 | return rc; | 1634 | return rc; |
1635 | if (host->ports[0]->ops == &piix_sidpr_sata_ops) | ||
1636 | sht = &piix_sidpr_sht; | ||
1615 | } | 1637 | } |
1616 | 1638 | ||
1617 | /* apply IOCFG bit18 quirk */ | 1639 | /* apply IOCFG bit18 quirk */ |
@@ -1638,7 +1660,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, | |||
1638 | host->flags |= ATA_HOST_PARALLEL_SCAN; | 1660 | host->flags |= ATA_HOST_PARALLEL_SCAN; |
1639 | 1661 | ||
1640 | pci_set_master(pdev); | 1662 | pci_set_master(pdev); |
1641 | return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, &piix_sht); | 1663 | return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht); |
1642 | } | 1664 | } |
1643 | 1665 | ||
1644 | static void piix_remove_one(struct pci_dev *pdev) | 1666 | static void piix_remove_one(struct pci_dev *pdev) |