Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1022915imu; Fri, 25 Jan 2019 15:47:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN4QEoLGGcocywwfxStVrHvqk2hQ1jT3BAITt1OxXasuRZXypkT9ApC+Fj+ZVoytbn/d7OQb X-Received: by 2002:a17:902:8484:: with SMTP id c4mr12753726plo.59.1548460078727; Fri, 25 Jan 2019 15:47:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548460078; cv=none; d=google.com; s=arc-20160816; b=jVHLBadRwOGQBMN0Et/MiyIulNGWD37ERp9kK4CYDsunUZkP1+Gwb1S/28iQoEjv1N fBA3z32UsF/ErE6vm3YJwPhpynI1VYsaVtvjCeF6wx+XPPBljKNvaxJ+eOXbOa9tgUxC 04ttE802WTMl4Hv0xovkvOr9i5A2yYvdtm67uHVrhz2A0HPlteZJiwQjFHhSyKUNk4OE HzMEJlJpkOPMXiTFSxHa4S7G+rI+nphG+mxRnubIGrz7BfPD70GGEJAQZicpcczTLYTX EihNJuajOvUykLUisFrtEEnZzrF44iuKCvz2Gu7dLwIfhbz1fJvttqlrntjR3JmqbabX B/7A== 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=WgfJr9SD2NKP1XIR/TPZ9BN9En1oe3FPFYg2VOOPBl0eQbI1DvZkolpWRbmhLE9n4d LFHRA0iIz1TkaqHMGUKHIt9lDJTwwRUtyCCsCDU6CrRJky6BGUGr1Zs6DlI3LdeWhl1W FlWRq3ImYM8iI/a5hcgUhNsI15zi9pxVm1d6tBBkE1kseOJyLwgGpVGkF6QXcZT3sD0c zNDpDH7ZqVmb3eP0d/cWeFEPvedzBAJzNoMbfiZsPffBwdgw0Nchg7Nk1B03l2wlbmm5 cG/gUCruHjCjEb8/olzBe+HHu7wIt4qvkC12DrgeFcaorlBsvr5hTnfdgBWLgTt/0rdT fUgg== 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-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 b5si25689019plr.355.2019.01.25.15.47.44; Fri, 25 Jan 2019 15:47:58 -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; dkim=pass header.i=@linaro.org header.s=google header.b="R/LMYkqy"; 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 S1729713AbfAYXqJ (ORCPT + 99 others); Fri, 25 Jan 2019 18:46:09 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44415 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729591AbfAYXpn (ORCPT ); Fri, 25 Jan 2019 18:45:43 -0500 Received: by mail-pf1-f193.google.com with SMTP id u6so5416763pfh.11 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=jCQJZ1GzjlNB4yJM+D7EfcHmQEuOBwC5IxuiS0ksv/bVbHa87X8tnHU3QtkoB8CCgw ZEc7T9JIJL2jsYP30OFywK0bUmBEo+u/jlzS7z3NT9UvJSdBKV8HCDmaVn8IBwJ05Wmg qNAYU9RjaNvfqQBvjXSvO5OrXAV8FFQ1Kpu0Jzta+RW+n8pE9d4bQB9eIObh9IDAhGjx IQLpu1io9XAONyy68Cu/6vI8k/JErouHherWVhnYUdG4Z9oX0QkUoy8tXGhd31oYjc7Y CstlxY+GerlnT5Z+yBuUC/PivbP7Lw5Vvruzl1aWg1Ns/Lvq+SR+rU5DKKeUJ15cw+Jj GrhA== X-Gm-Message-State: AJcUukeYwPTyA2Kne8WOuDKVxTicodo3AhS7mPbkYpbObFe8suxBDCSn j9yMSEY++da3EPmk6Q1yTE+/Ag== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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: -- 2.18.0