From patchwork Wed Sep 6 10:39:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 9940337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A87BF60224 for ; Wed, 6 Sep 2017 10:40:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B13BE28B95 for ; Wed, 6 Sep 2017 10:40:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F45428B9A; Wed, 6 Sep 2017 10:40:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3544928B9F for ; Wed, 6 Sep 2017 10:40:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752802AbdIFKj7 (ORCPT ); Wed, 6 Sep 2017 06:39:59 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:56220 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752508AbdIFKj6 (ORCPT ); Wed, 6 Sep 2017 06:39:58 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v86AdbCa013919; Wed, 6 Sep 2017 05:39:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1504694377; bh=MDMmLZYBijuCNW2SP0ljtek6qJF1YRH6jIygR18v8hE=; h=From:To:CC:Subject:Date; b=vM8rBN4vpyAvdZmmC1IUX6N2pz42vDEYfClHzd3aht5o1CO2EEFfzG5mZ9yxSWBEh /IAe9IJgFMXRogUtEcYhbkmk++8sXsHDDiuwaTtefxXkFEo/xCVcSABun5/B0wCK7Q xJELWWAsb7aVtL0npu8B+3WvnB5tu48j9mOIftG0= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v86AdW9S017207; Wed, 6 Sep 2017 05:39:32 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Wed, 6 Sep 2017 05:39:31 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Wed, 6 Sep 2017 05:39:31 -0500 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v86AdToF009828; Wed, 6 Sep 2017 05:39:29 -0500 From: Keerthy To: , CC: , , , , Subject: [PATCH] pci: dwc: dra7xx: Add shutdown handler to cleanly turn off clocks Date: Wed, 6 Sep 2017 16:09:11 +0530 Message-ID: <1504694351-32358-1-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add shutdown handler to cleanly turn off clocks. Signed-off-by: Keerthy Acked-by: Kishon Vijay Abraham I --- drivers/pci/dwc/pci-dra7xx.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/pci/dwc/pci-dra7xx.c b/drivers/pci/dwc/pci-dra7xx.c index d4e98f3..66d1cfe 100644 --- a/drivers/pci/dwc/pci-dra7xx.c +++ b/drivers/pci/dwc/pci-dra7xx.c @@ -874,6 +874,19 @@ static int dra7xx_pcie_suspend_noirq(struct device *dev) return 0; } +void dra7xx_pcie_shutdown(struct platform_device *pdev) +{ + struct dra7xx_pcie *dra7xx = dev_get_drvdata(&pdev->dev); + int ret; + + ret = pm_runtime_put_sync(&pdev->dev); + if (ret < 0) + dev_dbg(&pdev->dev, "pm_runtime_put_sync failed\n"); + + pm_runtime_disable(&pdev->dev); + dra7xx_pcie_disable_phy(dra7xx); +} + static int dra7xx_pcie_resume_noirq(struct device *dev) { struct dra7xx_pcie *dra7xx = dev_get_drvdata(dev); @@ -902,5 +915,6 @@ static int dra7xx_pcie_resume_noirq(struct device *dev) .suppress_bind_attrs = true, .pm = &dra7xx_pcie_pm_ops, }, + .shutdown = dra7xx_pcie_shutdown, }; builtin_platform_driver_probe(dra7xx_pcie_driver, dra7xx_pcie_probe);