From patchwork Thu Apr 2 12:11:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11470587 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26BF6159A for ; Thu, 2 Apr 2020 12:12:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EEABA20757 for ; Thu, 2 Apr 2020 12:12:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TQxW9jZa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388233AbgDBMMB (ORCPT ); Thu, 2 Apr 2020 08:12:01 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43767 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387937AbgDBMMA (ORCPT ); Thu, 2 Apr 2020 08:12:00 -0400 Received: by mail-ed1-f66.google.com with SMTP id bd14so3768705edb.10; Thu, 02 Apr 2020 05:11:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LRlrYBCdZcwWb03ZprO8ychzrcB476+VJ1UlnxZ2m10=; b=TQxW9jZaa+wrh9KjiHx179fg9oGdn4GxO+8hkR7A5O77/1lguXBzDIGKMy2QtZFkr7 oPsNGTDlqbNES1TGkDjhOVgRXTxopGu9LKpnf+3RnC3rrwOlb6ChrPWTNp6cDki1FeiY LYXx/FZVbN9HsGCHnnPpDIMhFKOoj5qzOacyz6F49Dv5CJRFouSScdHY0zNRWCOfYIFu xh4ipTGayZpAlquTuTUEZymfHHrP6twIFegpkwQgv9OcUgJ5stH1/ofDicEy5Kvjm/Sg VSQIt9Zonjv05IcBKJbEakrXUolg7LkXdCBa07ACnKczupACaKTJ9lriXeUtnf8nk1kY itQA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=LRlrYBCdZcwWb03ZprO8ychzrcB476+VJ1UlnxZ2m10=; b=r6QmcMUFEPaNtZovlDf3YGfR5t9S1VwJmSFcQXTDuSTec0H3Hd37HnnalHw/pXcFXd ryuPtpG9KUSLBLE8yiNrjPqXt0K0A2vrQ8IMFXTWRedK3CO0uj8ls7hiR+RLg/qeAAMR pQm2OeMBxIv1h7+J0PMlk8Bvc35+szeRyTPOmHztW/cDgmN4X1f33+QST+pna7gaZdZ1 VBkopgJygZnLBMoOSkrbaAgIrfMA8JTfAYg6C3UiUd2dfqO8IisqWbEau5MGKOvS9yEj KsMPaAEwT/jjWORESYPYNdXfLch36CnAxyhWIBK5IuNmBkH594E0HPkNgAsX3p4nmsxN uDqQ== X-Gm-Message-State: AGi0PuYAEGDUCla0JOmRgQqTcBAtNbObOr0rr9Vizdrd5B+w/WYucY5h tJVqmra4gdq9fsB7eDno2CE= X-Google-Smtp-Source: APiQypIVPsuxwUmgrlYcT74yZAWLYg4LgP32sTqKUWFQ5nLWkPN8O2DDt3wLLO2I85DElok5l5lFIw== X-Received: by 2002:a50:e007:: with SMTP id e7mr2532354edl.361.1585829518018; Thu, 02 Apr 2020 05:11:58 -0700 (PDT) Received: from Ansuel-XPS.localdomain (host250-251-dynamic.250-95-r.retail.telecomitalia.it. [95.250.251.250]) by smtp.googlemail.com with ESMTPSA id w20sm1083611ejv.40.2020.04.02.05.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 05:11:57 -0700 (PDT) From: Ansuel Smith To: Andy Gross Cc: Ansuel Smith , Sham Muthayyan , Bjorn Andersson , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 01/10] PCIe: qcom: add missing ipq806x clocks in PCIe driver Date: Thu, 2 Apr 2020 14:11:38 +0200 Message-Id: <20200402121148.1767-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402121148.1767-1-ansuelsmth@gmail.com> References: <20200402121148.1767-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Aux and Ref clk are missing in pcie qcom driver. Add support in the driver to fix pcie inizialization in ipq806x. Fixes: 82a82383 PCI: qcom: Add Qualcomm PCIe controller driver Signed-off-by: Sham Muthayyan Signed-off-by: Ansuel Smith --- drivers/pci/controller/dwc/pcie-qcom.c | 38 ++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 5ea527a6bd9f..f958c535de6e 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -88,6 +88,8 @@ struct qcom_pcie_resources_2_1_0 { struct clk *iface_clk; struct clk *core_clk; struct clk *phy_clk; + struct clk *aux_clk; + struct clk *ref_clk; struct reset_control *pci_reset; struct reset_control *axi_reset; struct reset_control *ahb_reset; @@ -246,6 +248,14 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) if (IS_ERR(res->phy_clk)) return PTR_ERR(res->phy_clk); + res->aux_clk = devm_clk_get(dev, "aux"); + if (IS_ERR(res->aux_clk)) + return PTR_ERR(res->aux_clk); + + res->ref_clk = devm_clk_get(dev, "ref"); + if (IS_ERR(res->ref_clk)) + return PTR_ERR(res->ref_clk); + res->pci_reset = devm_reset_control_get_exclusive(dev, "pci"); if (IS_ERR(res->pci_reset)) return PTR_ERR(res->pci_reset); @@ -278,6 +288,8 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->core_clk); clk_disable_unprepare(res->phy_clk); + clk_disable_unprepare(res->aux_clk); + clk_disable_unprepare(res->ref_clk); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); } @@ -307,16 +319,28 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) goto err_assert_ahb; } + ret = clk_prepare_enable(res->core_clk); + if (ret) { + dev_err(dev, "cannot prepare/enable core clock\n"); + goto err_clk_core; + } + ret = clk_prepare_enable(res->phy_clk); if (ret) { dev_err(dev, "cannot prepare/enable phy clock\n"); goto err_clk_phy; } - ret = clk_prepare_enable(res->core_clk); + ret = clk_prepare_enable(res->aux_clk); if (ret) { - dev_err(dev, "cannot prepare/enable core clock\n"); - goto err_clk_core; + dev_err(dev, "cannot prepare/enable aux clock\n"); + goto err_clk_aux; + } + + ret = clk_prepare_enable(res->ref_clk); + if (ret) { + dev_err(dev, "cannot prepare/enable ref clock\n"); + goto err_clk_ref; } ret = reset_control_deassert(res->ahb_reset); @@ -372,10 +396,14 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) return 0; err_deassert_ahb: - clk_disable_unprepare(res->core_clk); -err_clk_core: + clk_disable_unprepare(res->ref_clk); +err_clk_ref: + clk_disable_unprepare(res->aux_clk); +err_clk_aux: clk_disable_unprepare(res->phy_clk); err_clk_phy: + clk_disable_unprepare(res->core_clk); +err_clk_core: clk_disable_unprepare(res->iface_clk); err_assert_ahb: regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);