From patchwork Thu Oct 13 10:57:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 119445 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id AEF31B6F89 for ; Thu, 13 Oct 2011 22:19:11 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754857Ab1JMLSx (ORCPT ); Thu, 13 Oct 2011 07:18:53 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:39208 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754725Ab1JMLRH (ORCPT ); Thu, 13 Oct 2011 07:17:07 -0400 Received: by ywb5 with SMTP id 5so1034395ywb.19 for ; Thu, 13 Oct 2011 04:17:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:mime-version:message-id :content-type:content-transfer-encoding; bh=incYg2hWx5ybDQLp4il3tfP6tcOCYp2GgqqtP1u3bE4=; b=g8rPIEf2TFwF02swEcSid6rCO8rTBsg1uDQl47BFoB/1PZPYNY0mwJqrDmzIQKPH9D 3Wv+7AIGvc7Cr9v+B5bhF1qeK3ZTO4qNs77vRp3LFwmOae50gFz+EgRK+eFNQQACr5Lm ySNrQ1xy5bj/oT/G8bDERik6wybT3KrKBZOJU= Received: by 10.223.7.18 with SMTP id b18mr5398374fab.31.1318504625838; Thu, 13 Oct 2011 04:17:05 -0700 (PDT) Received: from linux-mhg7.site (89-74-122-41.dynamic.chello.pl. [89.74.122.41]) by mx.google.com with ESMTPS id f10sm9358755fac.14.2011.10.13.04.17.04 (version=SSLv3 cipher=OTHER); Thu, 13 Oct 2011 04:17:04 -0700 (PDT) From: Bartlomiej Zolnierkiewicz To: Jeff Garzik Subject: [PATCH] pata_pdc2027x: add Power Management support Date: Thu, 13 Oct 2011 12:57:51 +0200 User-Agent: KMail/1.13.6 (Linux/2.6.37.6-0.7-desktop-dirty; KDE/4.6.0; x86_64; ; ) Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-Id: <201110131257.51837.bzolnier@gmail.com> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org From: Bartlomiej Zolnierkiewicz Subject: [PATCH] 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 --- earlier references: https://lkml.org/lkml/2009/11/25/369 drivers/ata/pata_pdc2027x.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: b/drivers/ata/pata_pdc2027x.c =================================================================== --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c @@ -63,6 +63,7 @@ enum { }; static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); +static int pdc2027x_reinit_one(struct pci_dev *pdev); static int pdc2027x_prereset(struct ata_link *link, unsigned long deadline); static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev); static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev); @@ -126,6 +127,10 @@ static struct pci_driver pdc2027x_pci_dr .id_table = pdc2027x_pci_tbl, .probe = pdc2027x_init_one, .remove = ata_pci_remove_one, +#ifdef CONFIG_PM + .suspend = ata_pci_device_suspend, + .resume = pdc2027x_reinit_one, +#endif }; static struct scsi_host_template pdc2027x_sht = { @@ -758,6 +763,31 @@ static int __devinit pdc2027x_init_one(s IRQF_SHARED, &pdc2027x_sht); } +#ifdef CONFIG_PM +static int pdc2027x_reinit_one(struct pci_dev *pdev) +{ + struct ata_host *host = dev_get_drvdata(&pdev->dev); + unsigned int board_idx; + int rc; + + rc = ata_pci_device_do_resume(pdev); + if (rc) + return rc; + + if (pdev->device == PCI_DEVICE_ID_PROMISE_20268 || + pdev->device == PCI_DEVICE_ID_PROMISE_20270) + board_idx = PDC_UDMA_100; + else + board_idx = PDC_UDMA_133; + + if (pdc_hardware_init(host, board_idx)) + return -EIO; + + ata_host_resume(host); + return 0; +} +#endif + /** * pdc2027x_init - Called after this module is loaded into the kernel. */