From patchwork Wed May 23 10:44:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10420913 X-Patchwork-Delegate: bhelgaas@google.com 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 C221960545 for ; Wed, 23 May 2018 10:46:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B36BD28E37 for ; Wed, 23 May 2018 10:46:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6B7B28E43; Wed, 23 May 2018 10:46:42 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 5776C24603 for ; Wed, 23 May 2018 10:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932424AbeEWKqd (ORCPT ); Wed, 23 May 2018 06:46:33 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:53415 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932417AbeEWKqa (ORCPT ); Wed, 23 May 2018 06:46:30 -0400 Received: by mail-wm0-f66.google.com with SMTP id a67-v6so7615825wmf.3 for ; Wed, 23 May 2018 03:46:29 -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; bh=oXfgACgvYc6V8nXRoSdtw/RIfD4meHfY61jRfSaJSCY=; b=RLDUlB7MKeENsdW5wxe0qr0ABTsGTEsHl4x/gKcxfT1Y7MId5nZ4IlC0tl6vwmlEQw OKBZ7+t8P4UK0ds1ybCQiFekQQQ9FMXXNJx0kOrbiYmQsanv1aFs0OIy5XxluRZkex0+ 3Pd2GCK/jGMdhI8Rg1F+WRR3UjNC4GrcXqmsA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oXfgACgvYc6V8nXRoSdtw/RIfD4meHfY61jRfSaJSCY=; b=clNEGzX3sQ0xKjknng46KZhV7uKQgxpwxaKq06XxnCScMS8XeQ95w6Ix3QHeZoJOCa BqpZ/9tsZlUQerSZUKDfwdHcEJC/p3AvaUZqJhLHrhlQ9H15lT4Q6UZ14G1GXpnhEPjO YrGJYhG8q9NKZ6qZ6+DwOhdAloR4yz8WQci1a9q+e3VrTjgJ52Kzl9rTBsT33crzTLVB B3EJKZHWS518ee40oz9h2tPW1cU27j97BRFxdspeLV2O5em7TB0uX8J3qghFx6h+IpYZ 7OmCDg5a/gP9LUVxBmNEcxT5SWlBQ8tUJmxv/Q/Y4EDUDeRVct9k/dr3DZjrQkuAOrOU Lq4A== X-Gm-Message-State: ALKqPwe9vwX7L4uSxpKr9VtTvFXhsX+QFDI3PxfL4W6cyeccJE9FjySA F6MnOaXVWLUCpj4vq0l+hNONfA== X-Google-Smtp-Source: AB8JxZoz5mOe92knqv0Wiy2gyFDYZ9DBfiBrKuKMXP+hHF4ApKniWossE8j4ENSfMd4xtb79c8+bCA== X-Received: by 2002:a1c:c2d5:: with SMTP id s204-v6mr3695125wmf.40.1527072389123; Wed, 23 May 2018 03:46:29 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id g105-v6sm29674600wrd.45.2018.05.23.03.46.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 May 2018 03:46:28 -0700 (PDT) From: Srinivas Kandagatla To: svarbanov@mm-sol.com, lorenzo.pieralisi@arm.com, bhelgaas@google.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, vkoul@kernel.org, Srinivas Kandagatla Subject: [PATCH v2] PCI: qcom: add runtime pm support to pcie_port Date: Wed, 23 May 2018 11:44:25 +0100 Message-Id: <20180523104425.6650-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Bjorn Andersson Reviewed-by: Vinod Koul Acked-by: Stanimir Varbanov --- drivers/pci/dwc/pcie-qcom.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c index 5897af7d3355..d6ed5aeeae9c 100644 --- a/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/dwc/pcie-qcom.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1088,6 +1089,7 @@ static int qcom_pcie_host_init(struct pcie_port *pp) struct qcom_pcie *pcie = to_qcom_pcie(pci); int ret; + pm_runtime_get_sync(pci->dev); qcom_ep_reset_assert(pcie); ret = pcie->ops->init(pcie); @@ -1124,6 +1126,7 @@ static int qcom_pcie_host_init(struct pcie_port *pp) phy_power_off(pcie->phy); err_deinit: pcie->ops->deinit(pcie); + pm_runtime_put(pci->dev); return ret; } @@ -1212,6 +1215,7 @@ static int qcom_pcie_probe(struct platform_device *pdev) if (!pci) return -ENOMEM; + pm_runtime_enable(dev); pci->dev = dev; pci->ops = &dw_pcie_ops; pp = &pci->pp; @@ -1257,14 +1261,17 @@ static int qcom_pcie_probe(struct platform_device *pdev) } ret = phy_init(pcie->phy); - if (ret) + if (ret) { + pm_runtime_disable(&pdev->dev); return ret; + } platform_set_drvdata(pdev, pcie); ret = dw_pcie_host_init(pp); if (ret) { dev_err(dev, "cannot initialize host\n"); + pm_runtime_disable(&pdev->dev); return ret; }