From patchwork Fri Jan 25 23:45:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 156661 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp938443jaa; Fri, 25 Jan 2019 15:46:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN7GSrjEFJGcr63Fz+hDBPnFa8L9TGcHgLirIDGfltu9AtgLFkeYIhOgG9ooT7uS/wOLTFRZ X-Received: by 2002:a62:7504:: with SMTP id q4mr12701953pfc.180.1548459969540; Fri, 25 Jan 2019 15:46:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548459969; cv=none; d=google.com; s=arc-20160816; b=CRZks+t7JDVfZ9M8nP1FqbmyjLk6Y7XCWBsbhSZWz2CRDIyjNDaK7NdPbxBd3Pa+pE dSEio5TxYjdIghQfwECHMjvMjx0UyvnFBRsesmizhr0xgNzkkqEcgVOZre+z5e5beGQa CIfOpPmQHWkQblicKKmbr+FSe9MEq+wjg8Eu2NkSgyFMeFZz05OdVnpROWrS6xjilVWe HfpGt1dRnOg1quwWUkL9lSMEESnEkLk+DoKTE7uf5M8C+NI5zAIyvQEWTXgmZfjaMytg 706GZaXw14CZQm0rwHXlgkMWmEReJVw9XArhUw6/Uaa5jeqUP27hah80l65CCtg3IBlw SAvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=zQrB5UHvwcxXHJ7bkEL+mhC1DvLfJAjrlhsTBR91TCw=; b=R+hwRc2fDQu7Hrr6L0JnFLDf/AWjOxSGj+jHofLPM4lK6PTSdU2XldAmAeUyfYB7Ld rekC+KTFjnnJqCBr9nEMn4/+fr0yoAxqHex9szpD/pQ98TANgnUcarcKdunrsQSaOwoR KB7rgg51a0qFStJskJAuf3BsCFmmhMTnt1feyVf/fB71bTPU6hQRu6APBo/XqIE7S5AS SM8UQ52kdqoWayjOhvT3syN8Zs1iHD3eXYTpF45mRAChYBRmz8ZiIuL96oTgAVAjMPRb 3sszigRaaXZNZleHZQ/HClM8soFqV6qaqLubWej7HAxFlOwBcGkDFcvtpbIwuuSq2TGP wDwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="R/LMYkqy"; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 a12si28697774pll.112.2019.01.25.15.46.09; Fri, 25 Jan 2019 15:46:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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="R/LMYkqy"; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1729354AbfAYXqI (ORCPT + 15 others); Fri, 25 Jan 2019 18:46:08 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:41699 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729593AbfAYXpn (ORCPT ); Fri, 25 Jan 2019 18:45:43 -0500 Received: by mail-pf1-f194.google.com with SMTP id b7so5434305pfi.8 for ; Fri, 25 Jan 2019 15:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zQrB5UHvwcxXHJ7bkEL+mhC1DvLfJAjrlhsTBR91TCw=; b=R/LMYkqyF0jZUQrVlCFbEReop77coHX8n6DSrLzu3Y3877OD1DCLSPl9M3sItyRRAH 4iz32rLhx5cKwAEnrlQujqN1XKm8yU8fB1Zzc8NdfPCNsEwiptmS44P++4tQqfb+imCh glNsU5aW2GQwpGX+xaNyG7+CyVXvqJYwWxcJc= 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; bh=zQrB5UHvwcxXHJ7bkEL+mhC1DvLfJAjrlhsTBR91TCw=; b=W9dsT0ulM4vlkKtTrgo7wh85VNax7Y+f3GH3Hy70fSQ8xwM0qWFgppcto4wUfu9Zf9 bvNDV0jTd/xO7LzLKqYvoS9McLPgwoX0nqSmZecWAd0RADnnKQgYdXtp3TilGrlUJw7M hbQMT42PP9KG6aI0kP6lSTJnQdhX5fQDdvjOCCsAmzcbij4fWA83cr4rA2oSAnUX+U20 ZRSXRl3tb7g/rvR+ZkYe8g+LTngXYq6QwQXdbM27mHVrORmePyD8EiaZoi7oYcrx5O/W IWjpVT5VTlh8vOo6/Immwr8VhU2E7+zMyWjvHiZdrE+o7rqxgw350Ovp0GxF3GGdAh9z ApHA== X-Gm-Message-State: AJcUukdIuwlDlPH8RufyfbcDOj6BDbbRsCSxEKCAWHVR/Pr58syJdI9z cgUffmJwHtu63Y0DfTw0X/EjCQ== X-Received: by 2002:a62:109b:: with SMTP id 27mr12710072pfq.227.1548459942075; Fri, 25 Jan 2019 15:45:42 -0800 (PST) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id y9sm32950302pfi.74.2019.01.25.15.45.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jan 2019 15:45:41 -0800 (PST) From: Bjorn Andersson To: Bjorn Helgaas , Lorenzo Pieralisi , Stanimir Varbanov Cc: Andy Gross , David Brown , Khasim Syed Mohammed , Kishon Vijay Abraham I , Mark Rutland , Michael Turquette , Niklas Cassel , Rob Herring , Stephen Boyd , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH 4/7] PCI: qcom: Use clk_bulk API for 2.4.0 controllers Date: Fri, 25 Jan 2019 15:45:06 -0800 Message-Id: <20190125234509.26419-5-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190125234509.26419-1-bjorn.andersson@linaro.org> References: <20190125234509.26419-1-bjorn.andersson@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Before introducing the QCS404 platform, which uses the same PCIe controller as IPQ4019, migrate this to use the bulk clock API, in order to make the error paths slighly cleaner. Signed-off-by: Bjorn Andersson --- drivers/pci/controller/dwc/pcie-qcom.c | 48 +++++++------------------- 1 file changed, 13 insertions(+), 35 deletions(-) -- 2.18.0 Reviewed-by: Niklas Cassel diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index a7f703556790..9d366fad2b7f 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -113,9 +113,8 @@ struct qcom_pcie_resources_2_3_2 { }; struct qcom_pcie_resources_2_4_0 { - struct clk *aux_clk; - struct clk *master_clk; - struct clk *slave_clk; + struct clk_bulk_data clks[3]; + int num_clks; struct reset_control *axi_m_reset; struct reset_control *axi_s_reset; struct reset_control *pipe_reset; @@ -638,18 +637,17 @@ static int qcom_pcie_get_resources_2_4_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_4_0 *res = &pcie->res.v2_4_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; + int ret; - res->aux_clk = devm_clk_get(dev, "aux"); - if (IS_ERR(res->aux_clk)) - return PTR_ERR(res->aux_clk); + res->clks[0].id = "aux"; + res->clks[1].id = "master_bus"; + res->clks[2].id = "slave_bus"; - res->master_clk = devm_clk_get(dev, "master_bus"); - if (IS_ERR(res->master_clk)) - return PTR_ERR(res->master_clk); + res->num_clks = 3; - res->slave_clk = devm_clk_get(dev, "slave_bus"); - if (IS_ERR(res->slave_clk)) - return PTR_ERR(res->slave_clk); + ret = devm_clk_bulk_get(dev, res->num_clks, res->clks); + if (ret < 0) + return ret; res->axi_m_reset = devm_reset_control_get_exclusive(dev, "axi_m"); if (IS_ERR(res->axi_m_reset)) @@ -719,9 +717,7 @@ static void qcom_pcie_deinit_2_4_0(struct qcom_pcie *pcie) reset_control_assert(res->axi_m_sticky_reset); reset_control_assert(res->pwr_reset); reset_control_assert(res->ahb_reset); - clk_disable_unprepare(res->aux_clk); - clk_disable_unprepare(res->master_clk); - clk_disable_unprepare(res->slave_clk); + clk_bulk_disable_unprepare(res->num_clks, res->clks); } static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie) @@ -850,23 +846,9 @@ static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie) usleep_range(10000, 12000); - ret = clk_prepare_enable(res->aux_clk); - if (ret) { - dev_err(dev, "cannot prepare/enable iface clock\n"); + ret = clk_bulk_prepare_enable(res->num_clks, res->clks); + if (ret) goto err_clk_aux; - } - - ret = clk_prepare_enable(res->master_clk); - if (ret) { - dev_err(dev, "cannot prepare/enable core clock\n"); - goto err_clk_axi_m; - } - - ret = clk_prepare_enable(res->slave_clk); - if (ret) { - dev_err(dev, "cannot prepare/enable phy clock\n"); - goto err_clk_axi_s; - } /* enable PCIe clocks and resets */ val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL); @@ -891,10 +873,6 @@ static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie) return 0; -err_clk_axi_s: - clk_disable_unprepare(res->master_clk); -err_clk_axi_m: - clk_disable_unprepare(res->aux_clk); err_clk_aux: reset_control_assert(res->ahb_reset); err_rst_ahb: