aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_pdc2027x.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2011-10-13 06:57:51 -0400
committerJeff Garzik <jgarzik@redhat.com>2011-10-14 13:32:52 -0400
commitadacaf1449ebb69f68075ba197495e3a61946fc2 (patch)
tree3824335aa08896728232dd8f908599af2fda5013 /drivers/ata/pata_pdc2027x.c
parentb2f104bba39e16f48b7e0ac6447cc167c54505b8 (diff)
pata_pdc2027x: add Power Management support
Fixes IDE -> libata regression. There shouldn't be any problems with it as corresponding IDE's host driver (pdc202xx_new) has been supporting PCI Power Management since Oct 10 2008 (commit feb22b7f "ide: add proper PCI PM support (v2)") and IDE PM since Jun 14 2003 (patch v2.5.73 "ide: Power Management"). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/pata_pdc2027x.c')
-rw-r--r--drivers/ata/pata_pdc2027x.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index b1511f38b0e8..7d63f24179c7 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -63,6 +63,7 @@ enum {
63}; 63};
64 64
65static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 65static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
66static int pdc2027x_reinit_one(struct pci_dev *pdev);
66static int pdc2027x_prereset(struct ata_link *link, unsigned long deadline); 67static int pdc2027x_prereset(struct ata_link *link, unsigned long deadline);
67static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev); 68static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev);
68static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev); 69static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev);
@@ -126,6 +127,10 @@ static struct pci_driver pdc2027x_pci_driver = {
126 .id_table = pdc2027x_pci_tbl, 127 .id_table = pdc2027x_pci_tbl,
127 .probe = pdc2027x_init_one, 128 .probe = pdc2027x_init_one,
128 .remove = ata_pci_remove_one, 129 .remove = ata_pci_remove_one,
130#ifdef CONFIG_PM
131 .suspend = ata_pci_device_suspend,
132 .resume = pdc2027x_reinit_one,
133#endif
129}; 134};
130 135
131static struct scsi_host_template pdc2027x_sht = { 136static struct scsi_host_template pdc2027x_sht = {
@@ -754,6 +759,31 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de
754 IRQF_SHARED, &pdc2027x_sht); 759 IRQF_SHARED, &pdc2027x_sht);
755} 760}
756 761
762#ifdef CONFIG_PM
763static int pdc2027x_reinit_one(struct pci_dev *pdev)
764{
765 struct ata_host *host = dev_get_drvdata(&pdev->dev);
766 unsigned int board_idx;
767 int rc;
768
769 rc = ata_pci_device_do_resume(pdev);
770 if (rc)
771 return rc;
772
773 if (pdev->device == PCI_DEVICE_ID_PROMISE_20268 ||
774 pdev->device == PCI_DEVICE_ID_PROMISE_20270)
775 board_idx = PDC_UDMA_100;
776 else
777 board_idx = PDC_UDMA_133;
778
779 if (pdc_hardware_init(host, board_idx))
780 return -EIO;
781
782 ata_host_resume(host);
783 return 0;
784}
785#endif
786
757/** 787/**
758 * pdc2027x_init - Called after this module is loaded into the kernel. 788 * pdc2027x_init - Called after this module is loaded into the kernel.
759 */ 789 */