From patchwork Thu Mar 15 14:41:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 131798 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp1205086ljb; Thu, 15 Mar 2018 07:43:47 -0700 (PDT) X-Google-Smtp-Source: AG47ELs8QU2MpNmNPCnvmdocRLM1+X9Cor4fV2nHvUgIRUoVoMbYBNLlP0GQiQNVbU/b/vZhtEby X-Received: by 10.101.64.9 with SMTP id f9mr562832pgp.247.1521125027048; Thu, 15 Mar 2018 07:43:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521125027; cv=none; d=google.com; s=arc-20160816; b=fnDunhGJQlMdtoggHMye82XZqk5BPg5E+tSzSs9hO1pvahAx9S4P+HjOsuIupeYMnx R0iE+s3nfM+7+Sx9048fm+0MDMmrTlPToMrNip2SJJG0IDIPjif0DfdpNHzPz9A8suwk YykpwlKJG/kFrTLOaQwDOlIJp3c+UdqVu3DhzUHV4clVsoSPFZ7ivzhdxb0r+8TAungp G/JEO5qduxgISKXqI7AQHQuZR+aed9hz34qr19YfaT9CnaJicondB7dh9h0bzbaca6V4 dJp2xUHpM5yjfoQTC11J5XRcYVXmGxx8Lmrr7p5xrnYn4KfI17EosN4jPYNULbPY1sqU m7+g== 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=nhNYD7cI5scSEru1z3wteByeS63x/ha447Qpfw3zfQQ=; b=YLe2OCQG2dBAaA1PN2hvPuFoJmWbuYjoClmmGm7pJ4iWQJZjoCmYZp14kIM6luxfck 01uYIkiWDf9GH57ntr67K8GdfmT6dcFVD2+q5kTtTd8aJsKfasR2cUxZ4xnhMlLjl/D5 3Rw94dodtfuRHvpORFvbsUDeBMsnUYTPRjXYfXsCum0PNJh4NArgJpKOYvBJP4aAHpWP jw6ATuw9gFH794GS2WJFeR1+V69UTd+MHUM7FSL6AgHpQGwSF1xCPDnSGRJQnsJc0ewS 25gcBUhvcpJXpD43vG7RR9MAOHaHYa2ferGgutOdX4RQTv3i21GDFvN7DQu6Ahf7mGCm xxUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CAs27yaR; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (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 e15si3940008pfl.284.2018.03.15.07.43.46; Thu, 15 Mar 2018 07:43:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CAs27yaR; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752606AbeCOOnp (ORCPT + 6 others); Thu, 15 Mar 2018 10:43:45 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:34987 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752443AbeCOOno (ORCPT ); Thu, 15 Mar 2018 10:43:44 -0400 Received: by mail-wr0-f196.google.com with SMTP id n12so8594909wra.2 for ; Thu, 15 Mar 2018 07:43:43 -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=X5jJ5i0lW0s79q+rjUKLmqVO8PNOPd/KSEvs5Y+G/P8=; b=CAs27yaROQ8sUar45U90XOdyLoVCvytvurLwfX4rW+BCK8ObHTlvqU32Ipy/ZQNMhp D+BoY1XSQsHWK1F2htWqnRU381L5m0FSIAQX8MxZv48KSSfKcuk6Hcu9ilwMIXU5ox5D 8XCmXF0lwKbk4oZdpC7rbcmZlkRnZd8aytIAY= 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=X5jJ5i0lW0s79q+rjUKLmqVO8PNOPd/KSEvs5Y+G/P8=; b=hPFciMGrzRu0CDNU4wV/lqFmqf8ARTpUUbKxLd1Eq5tR2p1FxhlaVVJ8I+dk33y/Jw R+r6KP0KIEqSItdIaM+xOMxJlm77npA62+HwJgbwYxxEnBtRCvtg8xamMxVoC7cRkRb7 dN+oEoP3lGP3QTtsLWl86yckEtu058RpKT51YMxETaNAJ51NjFFKUYCEkr+3P32aRvUg BomCe2I7bkdVgveQhrCK77kuGe0OkxdRQTnWSbXC8djEsXyfdT2N6U8wsodIKoIiqcxo /EaIZCAMQ7n552oglWoMPlo2GrhOZRQQB9NughnZ34AmEct2v1QIWKCB8uknox3cPtr+ THOQ== X-Gm-Message-State: AElRT7FsMtb7/hbUZkOJtPnEVYBt97uAUBVTYnqUaqN1xG2a3IjNkAs/ AuNX4coSvyuuvt9t14MCqGpVag== X-Received: by 10.223.179.194 with SMTP id x2mr7769126wrd.94.1521125023168; Thu, 15 Mar 2018 07:43:43 -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 1sm4526626wmj.35.2018.03.15.07.43.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Mar 2018 07:43:42 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: bhelgaas@google.com, svarbanov@mm-sol.com, linux-pci@vger.kernel.org, robh+dt@kernel.org Cc: mark.rutland@arm.com, lorenzo.pieralisi@arm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH] pcie: qcom: Add support to enable pcie refclk Date: Thu, 15 Mar 2018 14:41:33 +0000 Message-Id: <20180315144133.14031-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Srinivas Kandagatla This patch adds support to enable 100MHz pcie refclk, On some boards like DB600c this clock is not enabled by default. Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/pci/qcom,pcie.txt | 1 + drivers/pci/dwc/pcie-qcom.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Stanimir Varbanov diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.txt b/Documentation/devicetree/bindings/pci/qcom,pcie.txt index 3c9d321b3d3b..7f001f5913cf 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.txt +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.txt @@ -88,6 +88,7 @@ Definition: Should contain the following entries - "core" Clocks the pcie hw block - "phy" Clocks the pcie PHY block + - "ref" Clocks the pcie refclk - clock-names: Usage: required for apq8084/ipq4019 Value type: diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c index 6310c66e265c..c316b0b7c614 100644 --- a/drivers/pci/dwc/pcie-qcom.c +++ b/drivers/pci/dwc/pcie-qcom.c @@ -82,6 +82,7 @@ struct qcom_pcie_resources_2_1_0 { struct clk *iface_clk; struct clk *core_clk; + struct clk *ref_clk; struct clk *phy_clk; struct reset_control *pci_reset; struct reset_control *axi_reset; @@ -233,6 +234,15 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) if (IS_ERR(res->iface_clk)) return PTR_ERR(res->iface_clk); + res->ref_clk = devm_clk_get(dev, "ref"); + + if (IS_ERR(res->ref_clk)) { + if (PTR_ERR(res->ref_clk) == -EPROBE_DEFER) + return PTR_ERR(res->ref_clk); + + res->ref_clk = NULL; + } + res->core_clk = devm_clk_get(dev, "core"); if (IS_ERR(res->core_clk)) return PTR_ERR(res->core_clk); @@ -271,6 +281,7 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) reset_control_assert(res->por_reset); reset_control_assert(res->pci_reset); clk_disable_unprepare(res->iface_clk); + clk_disable_unprepare(res->ref_clk); clk_disable_unprepare(res->core_clk); clk_disable_unprepare(res->phy_clk); regulator_disable(res->vdda); @@ -310,10 +321,16 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) goto err_assert_ahb; } + ret = clk_prepare_enable(res->ref_clk); + if (ret) { + dev_err(dev, "cannot prepare/enable ref clock\n"); + goto err_assert_ahb; + } + ret = clk_prepare_enable(res->iface_clk); if (ret) { dev_err(dev, "cannot prepare/enable iface clock\n"); - goto err_assert_ahb; + goto err_clk_iface; } ret = clk_prepare_enable(res->phy_clk); @@ -386,6 +403,8 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) clk_disable_unprepare(res->phy_clk); err_clk_phy: clk_disable_unprepare(res->iface_clk); +err_clk_iface: + clk_disable_unprepare(res->ref_clk); err_assert_ahb: regulator_disable(res->vdda_phy); err_vdda_phy: