diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2011-10-13 06:57:51 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2011-10-14 13:32:52 -0400 |
commit | adacaf1449ebb69f68075ba197495e3a61946fc2 (patch) | |
tree | 3824335aa08896728232dd8f908599af2fda5013 /drivers/ata/pata_pdc2027x.c | |
parent | b2f104bba39e16f48b7e0ac6447cc167c54505b8 (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.c | 30 |
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 | ||
65 | static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 65 | static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
66 | static int pdc2027x_reinit_one(struct pci_dev *pdev); | ||
66 | static int pdc2027x_prereset(struct ata_link *link, unsigned long deadline); | 67 | static int pdc2027x_prereset(struct ata_link *link, unsigned long deadline); |
67 | static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev); | 68 | static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev); |
68 | static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev); | 69 | static 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 | ||
131 | static struct scsi_host_template pdc2027x_sht = { | 136 | static 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 | ||
763 | static 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 | */ |