From patchwork Fri May 18 07:07:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 10408291 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 E8D8560230 for ; Fri, 18 May 2018 07:07:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB08A28879 for ; Fri, 18 May 2018 07:07:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEFF12888D; Fri, 18 May 2018 07:07:43 +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=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 9354928879 for ; Fri, 18 May 2018 07:07:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751405AbeERHHl (ORCPT ); Fri, 18 May 2018 03:07:41 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35551 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751304AbeERHHk (ORCPT ); Fri, 18 May 2018 03:07:40 -0400 Received: by mail-pg0-f67.google.com with SMTP id 11-v6so1287273pge.2 for ; Fri, 18 May 2018 00:07:40 -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=3XmQSTo+zwLa/uWRaQZdyyijyRtX79+d6CkGhY+mtYk=; b=kpXNts2vu1bXbz1hF5KErmdjUoJTWurRKhgNhywc8yMyCCIfOlwBVdBm7ahRI+HiWa QIVC2ohJa0AqeZy58WERVj16MBmCucEGABEN4TOf6sXIIdq5tdnKDF1ZlvQMysQdXfKd z0JmybPBZkhpoDwcluR4S8dPVT1Kidh3CzIy0= 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=3XmQSTo+zwLa/uWRaQZdyyijyRtX79+d6CkGhY+mtYk=; b=A7UYe74cxfF2Fwm3QkyyB2YKI87ng/tjzxbA7ZY5DQ7JKsK8hNAA8fKeMV1V5F4nCo fKZY0+/mcvczAo7yY4bQMoRPIau1vGk1VOEPJoEnxRv3Nk6vjbE+8ukXpzNeqSSjUWK9 M2m2CUtxEYJtRxbc4bPUZXtV85JmqQ5iW1b++7AWX/KE9V8G7tjjUehvFwLaqdINLYrF CZ+Mnz6J7+oOcWIRz/HTgmqLOF9/wdLEeDKYoOYUBPkHHzuczSJOT3G9KGH+4f4IKo8E DOb05pckIhJl7sFwayij5drFZnjQr5XYuP1dCvX6F/PXo65a/MUgpjyaTMSe1u+EJ+2p M96g== X-Gm-Message-State: ALKqPwf4vtLtNiB6NU/d6KLR9DMeAsaS1X7PPTwW00P6IYVR3TREUkTZ zLricPPZQe6PXINXk8Viy0Ah1CKzffs= X-Google-Smtp-Source: AB8JxZqn/+ujSj+0q/DnIgmVUJfMg+sQ1jUjoJwwkwfKBpdFS9x5sDUajNFyaLsCJTZqNujp5NdBZA== X-Received: by 2002:a62:c103:: with SMTP id i3-v6mr8233356pfg.148.1526627259735; Fri, 18 May 2018 00:07:39 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id w134-v6sm10638391pfd.187.2018.05.18.00.07.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 May 2018 00:07:38 -0700 (PDT) From: Bjorn Andersson To: Stanimir Varbanov , Lorenzo Pieralisi , Bjorn Helgaas Cc: Srinivas Kandagatla , linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH] PCI: qcom: add runtime pm support to pcie_port Date: Fri, 18 May 2018 00:07:36 -0700 Message-Id: <20180518070736.3003-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.17.0 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 From: Srinivas Kandagatla 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 --- This patch was posted 18 months ago but was somehow lost. linux-next recently enabled PCIe on MSM8996 and DB820c, but the system stalls as the agnoc gdsc isn't enabled. This patch still fixes this problem for me. drivers/pci/dwc/pcie-qcom.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c index 5897af7d3355..3f35098b71b1 100644 --- a/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/dwc/pcie-qcom.c @@ -1088,6 +1088,8 @@ 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_sync(pci->dev); return ret; } @@ -1204,6 +1207,7 @@ static int qcom_pcie_probe(struct platform_device *pdev) struct qcom_pcie *pcie; int ret; + pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); if (!pcie) return -ENOMEM; @@ -1212,6 +1216,8 @@ 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;