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: 136640 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp724910lji; Wed, 23 May 2018 03:46:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr8EZOACJVMaTKnSzjwNogSwZNjON+vkrvxC7XAhMrwBJ+t89WcMyCTLY2MRJr8s0KJzRuA X-Received: by 2002:a63:721b:: with SMTP id n27-v6mr1963750pgc.203.1527072399791; Wed, 23 May 2018 03:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527072399; cv=none; d=google.com; s=arc-20160816; b=NuL/hPjkbgM0YVuyxFIyvw5rhE5HK6zzJyYMMsh/Ah3O5oohIshV6pjw75s/o8wyzW jsJfQ3yAtPZhoDcor2MDYjPvGtCtJGhfUtzPJnpSYNGW9SkL3pZ7a7NstOKVcGKjsHF/ UoyOmXCIoeNdQ9KphnA3egICzI1PqvzKveQYSFuCgBQIHkgh34sAoWv92mJ0BqaKy8Pq q7PWwPOBnyw7J0jbms/c57mKmqewfgbuYMn4NuYDjVOzi48FDoc7EJt+mNib6jWYN2wn +PqL7SDT6SLKfPbFugdwEzBtsb8RkERpY7H00rAE3AFifQ6dZNVkhLOPkmIfzwH/Vb4F uAXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=oXfgACgvYc6V8nXRoSdtw/RIfD4meHfY61jRfSaJSCY=; b=vstWWI3snOWcFZ9zFLjUcGraVFU1iwQCRFbo/aE38LOcg1eVfReWebtVc9UUUXBgQc MRg/ww+rCiYMWy6XZx95DUSV5pHtOr2ClpfHZ+CydwmVFjxOMibHnfbFFT4QZdYomDMP k9h2IpHD/riXXBBlU3pQUEa2XhhC7CkYrZSJEL0/s+LUx70G3jqmGoBBjrf+T+e8nuuC WojYioVpQUuD991h68jNrl+tyQe8Myyyr35JPo7ssA16PiSRTVOFEgwFu2pKfm93sb3r l4jkUckhybOmJNY0J8VjpQGCdOQ17RnCDBnxQFK8nJ3YHCkTW2Ickp3Wtgca0okwSqp1 zYFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RLDUlB7M; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3-v6si18087080pfi.179.2018.05.23.03.46.39; Wed, 23 May 2018 03:46:39 -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 header.s=google header.b=RLDUlB7M; 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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932539AbeEWKqf (ORCPT + 30 others); Wed, 23 May 2018 06:46:35 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:51840 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932421AbeEWKqa (ORCPT ); Wed, 23 May 2018 06:46:30 -0400 Received: by mail-wm0-f65.google.com with SMTP id j4-v6so7708075wme.1 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=pcV8Ntb/4aOI8IPgAlhOTbgEC8mM4Wf7xcKafPAa8Ag2ohPCoUi2YIJZUTIRSnnh1P CuLaT4dVljoz3ScghlO+yrY5rfJv4fswNKsdnXAElKofNY20l8YOtcvUBnw4iy1usSuc Nnj8ygPv7YC9vob5qvmF5udEs0uJlcA0urr2UHvshT0g8tqEkhuyI0BhxRlM+Vgd6djF tU2ZlEtu6rVSRgD6DLE4/fwRk6LDUtI0+ldVld4flyERHEgrpyR06ZtzvgFfu8sDjM5X V0NT9jNvMZs+VDv1V8xlapH1zMCga899ZVb6S3gj4/6DNEjaHo94ax8dBIi4iQ8L2S1L 5WkQ== X-Gm-Message-State: ALKqPwfDSgWhcwMI/rIr9Ov5S5nVlszdg5pbPZr2FmzvslX57ZwTHU0x yrGcStqvBPY4q1WP1rH0Eu02sg== 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-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 Signed-off-by: Bjorn Andersson --- drivers/pci/dwc/pcie-qcom.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.16.2 Reviewed-by: Vinod Koul Acked-by: Stanimir Varbanov 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; }