Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp473491imm; Fri, 21 Sep 2018 03:26:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaFGydmS+7bGKH68gxmVxYb+astJwBQicirhMuLJ4+kt8t+aQukvsQN7l+IVYQzuOv/bOK5 X-Received: by 2002:a63:26c4:: with SMTP id m187-v6mr5871753pgm.268.1537525567060; Fri, 21 Sep 2018 03:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537525567; cv=none; d=google.com; s=arc-20160816; b=NgRpscHTPd/BBovM+E2KBPX8ionV7aUFmVadgFjNtazvdN7KwF/Ak2RXi9gohwm6T2 iV3ZLIRI0A59M7JFRT27AuQ7PSyJ7ycjQkk10ouemeU2sSkjFJYIMkNMyKKapVaFIM5i 9j1aooW/q2pOqrVkrGlUbqTXRjyykD3/TKS5W4C4cHLjQ60U5fz24eMmLyxFIr0XqgR2 WrWLQbBFPzlCGP/si7GBz37mBZdftq+jnNzPinC1IeahnwhpEv0NBuY4UEVF5j988Edr 3WWZkAlR2zCgvIlLDZPmpe29IE3MDuUh4Ux+GHRtFb9ATM3Au+e67+yH8IkRLY0UDo4l 0hoA== 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 o6-v6si25730986plk.31.2018.09.21.03.25.48; Fri, 21 Sep 2018 03:26:07 -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 S2389901AbeIUQMN (ORCPT + 99 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 Content-Type: text/plain 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(-) 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]); -- 2.17.1