From patchwork Fri Nov 4 12:59:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 80853 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1137229qge; Fri, 4 Nov 2016 06:00:30 -0700 (PDT) X-Received: by 10.98.33.133 with SMTP id o5mr11840917pfj.32.1478264430490; Fri, 04 Nov 2016 06:00:30 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n19si16387961pgk.202.2016.11.04.06.00.29; Fri, 04 Nov 2016 06:00:30 -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=@linaro.org; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934770AbcKDNAQ (ORCPT + 27 others); Fri, 4 Nov 2016 09:00:16 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:38205 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934676AbcKDM74 (ORCPT ); Fri, 4 Nov 2016 08:59:56 -0400 Received: by mail-wm0-f49.google.com with SMTP id n67so48386596wme.1 for ; Fri, 04 Nov 2016 05:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XKGo/WvZEwkHdlAzgG04tCKMipDLEW+XKFcNtEfL5TI=; b=NZyBYc1nYN8Y7bx1DIopuUlHjMx1N2nJ1JDpo4HRD9bxqDER+0U6LGVMXzFEdV+B+k /z6PAUyADLmYMajwqfS3nBPBSoXXCvh55wpJx7SjIi2sEZIeYsfzP6ApEsZpKsGqv8dW bq2pd23y1kIFIsksk5n0XniL0JgJgjIY3qCyI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XKGo/WvZEwkHdlAzgG04tCKMipDLEW+XKFcNtEfL5TI=; b=R1nncYtnaG/HyNqEyqIkYBxY/3j7ND5NyuU5e2axooFK+XlpL3ymC7jfBKsiBKgKp0 p1WPz9Zk8dUcvyBQBg47TtJPTx0sjhWhCIcD4lWeEqKsJCsBlxOlyx4mb2K6kofevA9L yrDtSRYhTrSb7mUoojRwe617RYl6UNPi764J4w/lq/+Y/ZG/aIG2zFtNYtYqP93O43W+ uBGF4bGZKlMDizc5I7mzht93OOu3d3dacya5D8t6QmskC7F6i80gQJTmTe/E7rz90oPi 8y7nKZHZKZ27P2pNnrYLxRozhQzqcHlu/IvfkuHys5k2RrNLobDA2sD4ianjv9kGRRpB brGA== X-Gm-Message-State: ABUngvd4cwYX+TApsjm+e03G4UKMGaZCojs0Ds2g5pVy7yXgp4rr5UPazuxDO+g0zKm13inX X-Received: by 10.28.52.76 with SMTP id b73mr3178966wma.8.1478264394876; Fri, 04 Nov 2016 05:59:54 -0700 (PDT) Received: from localhost.localdomain (host-2-98-102-117.as13285.net. [2.98.102.117]) by smtp.gmail.com with ESMTPSA id e5sm4486220wma.10.2016.11.04.05.59.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Nov 2016 05:59:54 -0700 (PDT) From: Srinivas Kandagatla To: svarbanov@mm-sol.com, Bjorn Helgaas , linux-pci@vger.kernel.org Cc: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 3/3] PCI: qcom: add runtime pm support to pcie_port Date: Fri, 4 Nov 2016 12:59:47 +0000 Message-Id: <1478264387-17914-4-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478264387-17914-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1478264387-17914-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch is required when the pcie controller sits on a bus with its own power domain and clocks which are controlled via a bus driver like simple pm bus. As these bus driver have runtime pm enabled, it makes sense to update the usage counter so that the runtime pm does not suspend the clks or power domain associated with the bus driver. Signed-off-by: Srinivas Kandagatla --- drivers/pci/host/pcie-qcom.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.10.1 diff --git a/drivers/pci/host/pcie-qcom.c b/drivers/pci/host/pcie-qcom.c index f37c690..3751635 100644 --- a/drivers/pci/host/pcie-qcom.c +++ b/drivers/pci/host/pcie-qcom.c @@ -587,6 +587,9 @@ static void qcom_pcie_host_init(struct pcie_port *pp) struct qcom_pcie *pcie = to_qcom_pcie(pp); int ret; + + pm_runtime_get_sync(pp->dev); + qcom_ep_reset_assert(pcie); ret = pcie->ops->init(pcie); @@ -617,6 +620,7 @@ static void qcom_pcie_host_init(struct pcie_port *pp) phy_power_off(pcie->phy); err_deinit: pcie->ops->deinit(pcie); + pm_runtime_put_sync(pp->dev); } static int qcom_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, @@ -669,10 +673,12 @@ static int qcom_pcie_probe(struct platform_device *pdev) struct pcie_port *pp; int ret; + pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); if (!pcie) return -ENOMEM; + pm_runtime_enable(dev); pp = &pcie->pp; pcie->ops = (struct qcom_pcie_ops *)of_device_get_match_data(dev);