From patchwork Wed Jan 13 06:47:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 59648 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp3179882lbb; Tue, 12 Jan 2016 22:48:54 -0800 (PST) X-Received: by 10.98.70.90 with SMTP id t87mr40464402pfa.110.1452667733939; Tue, 12 Jan 2016 22:48:53 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ez9si32325305pab.20.2016.01.12.22.48.53; Tue, 12 Jan 2016 22:48:53 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754525AbcAMGse (ORCPT + 29 others); Wed, 13 Jan 2016 01:48:34 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:43849 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751145AbcAMGsb (ORCPT ); Wed, 13 Jan 2016 01:48:31 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id u0D6m1gV025424; Wed, 13 Jan 2016 00:48:01 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u0D6m1Q7030838; Wed, 13 Jan 2016 00:48:01 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Wed, 13 Jan 2016 00:48:01 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u0D6lldx004749; Wed, 13 Jan 2016 00:47:58 -0600 From: Kishon Vijay Abraham I To: Tony Lindgren , Bjorn Helgaas , CC: Russell King , Suman Anna , , , , , Subject: [PATCH v2 3/3] pci: dra7xx: use pdata callbacks to perform reset Date: Wed, 13 Jan 2016 12:17:46 +0530 Message-ID: <1452667666-17533-4-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1452667666-17533-1-git-send-email-kishon@ti.com> References: <1452667666-17533-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use platform populated reset assert and deassert callbacks to perform reset of PCIe. Use these callbacks until a reset interface using drivers/reset is available for the purpose. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Sekhar Nori --- drivers/pci/host/pci-dra7xx.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) -- 1.7.9.5 diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c index 8c36880..049083d 100644 --- a/drivers/pci/host/pci-dra7xx.c +++ b/drivers/pci/host/pci-dra7xx.c @@ -25,6 +25,8 @@ #include #include +#include + #include "pcie-designware.h" /* PCIe controller wrapper DRA7XX configuration registers */ @@ -329,6 +331,32 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx, return 0; } +static int dra7xx_pcie_reset(struct platform_device *pdev) +{ + int ret; + struct device *dev = &pdev->dev; + struct pci_dra7xx_platform_data *pdata = pdev->dev.platform_data; + + if (!(pdata && pdata->deassert_reset && pdata->assert_reset)) { + dev_err(dev, "platform data for reset not found!\n"); + return -EINVAL; + } + + ret = pdata->assert_reset(pdev, pdata->reset_name); + if (ret) { + dev_err(dev, "assert_reset failed: %d\n", ret); + return ret; + } + + ret = pdata->deassert_reset(pdev, pdata->reset_name); + if (ret) { + dev_err(dev, "deassert_reset failed: %d\n", ret); + return ret; + } + + return 0; +} + static int __init dra7xx_pcie_probe(struct platform_device *pdev) { u32 reg; @@ -347,6 +375,10 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) enum of_gpio_flags flags; unsigned long gpio_flags; + ret = dra7xx_pcie_reset(pdev); + if (ret) + return ret; + dra7xx = devm_kzalloc(dev, sizeof(*dra7xx), GFP_KERNEL); if (!dra7xx) return -ENOMEM;