From patchwork Fri Sep 21 10:21:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 147198 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp628576ljw; Fri, 21 Sep 2018 03:24:04 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYw+Y2aO2jL7+lBWuZo6TaHt3xedyXWVsBdV+nFCCy8sb8Ip4lACkrcDPfZCWy0pyD7OXeh X-Received: by 2002:a17:902:7e45:: with SMTP id a5-v6mr44055097pln.151.1537525444163; Fri, 21 Sep 2018 03:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537525444; cv=none; d=google.com; s=arc-20160816; b=ngIqh8kKurPffVpiW0R7hdgakcq7nVmbv1r5Lk/pwnwzoIsx1AM/BOC6+1LQ/tUsbq Rf3r+LYUIs9iQXy2wlnYlcPdZ9pcxGUiRcRVxSVS8b/0DRwYsPywaOWCR/I5/AkEWuEo zx2nrlrh6lpCfpDwx9g4Zu/GeS3JxgIBILuy6L95VijZVQP0kIZSiIKBqx3l1I/Es8gz G6Ol0VGib5Ux+QeG0/uktpwcOm4RlAIsZkWgmumO1CWg+z2iau/1EUkwiU6J1A8+I3+8 q88wIQ0OQatdTtUsaflCRxvXrAcwoTpZpvjg9IBwZwAZGTJKLwz12TBwuPHCsgvBCJrS VykQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=foMA9sXY1vSacErr421Q9aMno8mL1g6LWM8DFq/dpjM=; b=GUHR6KsvznSzntjV1b3HhhE+MooddKSMC9CElS9FQLOSqbecR26zCZI389uIDvLyu9 5IDYoxW1Qf1c7HSVKSz9prrj1WRbFWj9Pj/4glt0hYBzuK/e3qEfUrzq2U/anBxZyf1g 9XNIG+O9VIpC9p9sIYT0VuJVyaabimRtsYji5OTJA0qW5+IvRmpEmNKy+/ULOowzoxip Bzry8FKoiWzLwJBwUa06lADBAPacZngPfktTvNzzhCxq5wDvm6QRltCAGz6scy53bXGB Vaoze9f1iWa3LDaHWpTbapoC58S451aprDZd6j/DSs+RjV+jQKAPc4SO1ON0YMNdViw/ Zyqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ZTaVyzVo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o11-v6si5357431pgl.16.2018.09.21.03.24.03; Fri, 21 Sep 2018 03:24:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ZTaVyzVo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389906AbeIUQMN (ORCPT + 32 others); Fri, 21 Sep 2018 12:12:13 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:51360 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389870AbeIUQML (ORCPT ); Fri, 21 Sep 2018 12:12:11 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id w8LANZ6S033283; Fri, 21 Sep 2018 05:23:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1537525415; bh=foMA9sXY1vSacErr421Q9aMno8mL1g6LWM8DFq/dpjM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZTaVyzVoc7eqaZ47d1prlUYPAJr58HuwN2IaRCJNjoOmL9HVeHW/CRBz8uZ4XxchB t59bPDm+EnIVadP6fRBkFGpL9tqPP0uI0sMcjkl+tFFzaQqO6IM2bbmmk0b/fi/HkI Y3TgMVM0lJsCQtk7ynLsk4xdYI2AqxarK5f2aMwk= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8LANZid018768; Fri, 21 Sep 2018 05:23:35 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 21 Sep 2018 05:23:35 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 21 Sep 2018 05:23:35 -0500 Received: from a0393678ub.dal.design.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 w8LAMEtK032280; Fri, 21 Sep 2018 05:23:30 -0500 From: Kishon Vijay Abraham I To: Jingoo Han , Joao Pinto , Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , Murali Karicheri , Kishon Vijay Abraham I , CC: Mark Rutland , Santosh Shilimkar , Tero Kristo , Nishanth Menon , , , , Subject: [RFC PATCH 16/40] PCI: keystone: Invoke pm_runtime APIs to enable clock Date: Fri, 21 Sep 2018 15:51:31 +0530 Message-ID: <20180921102155.22839-17-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921102155.22839-1-kishon@ti.com> References: <20180921102155.22839-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Invoke pm_runtime APIs to enable clocks and remove explicit clock enabling using clk_prepare_enable(). Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/controller/dwc/pci-keystone.c | 29 +++++++++++------------ 1 file changed, 14 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index b013776d9256..f230344e1f4e 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -95,7 +95,6 @@ static void ks_pcie_stop_link(struct dw_pcie *pci); struct keystone_pcie { struct dw_pcie *pci; - struct clk *clk; int num_lanes; struct phy **phy; struct device_link **link; @@ -879,26 +878,25 @@ static int __init ks_pcie_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, ks_pcie); - ks_pcie->clk = devm_clk_get(dev, "pcie"); - if (IS_ERR(ks_pcie->clk)) { - dev_err(dev, "Failed to get pcie rc clock\n"); - ret = PTR_ERR(ks_pcie->clk); - goto err_get_irq; - } - ret = clk_prepare_enable(ks_pcie->clk); - if (ret) - goto err_get_irq; + pm_runtime_enable(dev); + ret = pm_runtime_get_sync(dev); + if (ret < 0) { + dev_err(dev, "pm_runtime_get_sync failed\n"); + goto err_get_sync; + } ret = ks_pcie_add_pcie_port(ks_pcie, pdev); if (ret < 0) - goto fail_clk; + goto err_get_sync; ks_pcie_enable_error_irq(ks_pcie); return 0; -fail_clk: - clk_disable_unprepare(ks_pcie->clk); + +err_get_sync: + pm_runtime_put(dev); + pm_runtime_disable(dev); err_get_irq: ks_pcie_disable_phy(ks_pcie); @@ -915,10 +913,11 @@ static int __exit ks_pcie_remove(struct platform_device *pdev) struct keystone_pcie *ks_pcie = platform_get_drvdata(pdev); struct device_link **link = ks_pcie->link; int num_lanes = ks_pcie->num_lanes; + struct device *dev = &pdev->dev; - clk_disable_unprepare(ks_pcie->clk); + pm_runtime_put(dev); + pm_runtime_disable(dev); ks_pcie_disable_phy(ks_pcie); - while (num_lanes--) device_link_del(link[num_lanes]);