From patchwork Tue Jun 25 16:47:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 167737 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp5779404ilk; Tue, 25 Jun 2019 09:47:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwM+bOflYmBGcU4r6c5SW7Y/7qtxZcLSEEOBpu1MF9mSYlLqJaz/Q4dNqp0VlSvNP+X5KIc X-Received: by 2002:a17:90a:2627:: with SMTP id l36mr33898712pje.71.1561481271107; Tue, 25 Jun 2019 09:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561481271; cv=none; d=google.com; s=arc-20160816; b=q3DT67D+6qS50MgySUQnZESI8oiQI19+PFsX0QoxFk+T+/VBGO6f0mZRkInIedB0o1 rce3Chg456E3PaLxkVzM0OLFa19GsuORfgiON5nWc1kM7VpUS6LmmpZJuiHv6fy9BBBw gGyUfUQPQKFP2YZbcwvwiYdKaX7LsieTBmfVEAUfNbmrG1ZzbplJRZXHPWWscRQfWXcR SHOjM9Oy1IV9nGv7Yny0YTC0UW3rZ5kQm4ILmdVsJxUirrAONgkDDYwV3C9OkzLMW5Js 9cGbuEml8i/IyfRNLbZiF4MbVmgMC6y/uZvTHr7RdsQ+Zl2+UFnOeb5O1fAnCW1wEAjy gjcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9dd7VfnDPDvx2vEwLGJ7RznkwWv5Ux/A/r7vpBAXcyw=; b=ABPIau9Lb4REVdcIgQRd6321NzVpfyyD+JBgs29NYuqTb4Bc2VjJ68IMugiE6nA4el 5uJX3Q3PgWzfCo/9dkBiFxn4+5wyd2m+B2Hcm1wCAfYdjnNAQm3qOSNOYLvNRDAIOTJz txkKbmFnm+14aENQIYVuOIuCpusD5C0k5lFXs3sve9B6/aPuUdiZD2hiNHz5W9CaEAld DAHN6i4F1KvRHnzjuxE+5kikAJUCRsl5mjM4lHuEgSHQHTIwMEHN3g+t51ZCQhY2BBh7 k84M0+jI9cceXtul1YAGyakNd+5o3/SwM7u2+XO7l2Qb27Nydw2xJqwFaGpN8rYR5e4e 9S5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OrnMtF5K; 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=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 k9si14735758pfh.56.2019.06.25.09.47.50; Tue, 25 Jun 2019 09:47:51 -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=pass header.i=@linaro.org header.s=google header.b=OrnMtF5K; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731712AbfFYQru (ORCPT + 8 others); Tue, 25 Jun 2019 12:47:50 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42196 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731325AbfFYQrs (ORCPT ); Tue, 25 Jun 2019 12:47:48 -0400 Received: by mail-wr1-f68.google.com with SMTP id x17so18646298wrl.9 for ; Tue, 25 Jun 2019 09:47:46 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=9dd7VfnDPDvx2vEwLGJ7RznkwWv5Ux/A/r7vpBAXcyw=; b=OrnMtF5KkknOxMO4HEIDwyQjyl0zrLgZXm8uI7cIqAfyS/Gecd3mdZ/D75IgqhNZJq lmvRq75sAhzmxQYYqgA9bQfBYppESBBqFKNRLnye3S0WXREjvJzDwnpUKwl9y467wiRs IT9MYvXyvJDcZPbRJD41iEFLuGbwrDHGQVo5fgl8cYkXt9lN7bqCy+1C0CmjZqs1EMcB T+Iq/GhvHvRiH4oUsL3mgj472MsxWcUd1eeFqJxJ87QML294aLT95zD3hTsYv9cDzMLl rMLH7qyQEgaFPgpt149uJNlle24WbrWY0BEUOXWDvWh1DzRx7sAvFTf5HI5fBkVo2ZHb j56w== 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=9dd7VfnDPDvx2vEwLGJ7RznkwWv5Ux/A/r7vpBAXcyw=; b=Sa7WrbYmJ1oLL5nM+cBgx8R6/vTilO/TjoNIaQwZ4yBhKBOu9PiuLL6P6RbEes6cu8 G2AfAJVUDHoj50gpkrnUrhn0PRA9am8qVqfXet0YXL76zyQjjjZVWA+rRqMiVjQwGMYb kFI174ECF25geM35pfKxy5XDDjCGBjueUaX16r+H/4ykB6T65tmRIX7LDBVYoC9pVu3H mYPrQJpCnNrH+4KCiiCR8RQ6R+PsPwcNPGIzLc0bbITPV7+Pf1/7Fx+tmAoBMIUOjLC0 /aRWrIXpBP9i7+H1/y0CuIu6VjTmDZi4m87q6tsCDvwHNe9qg9bvoFr0dbH5qAwPm+KW SulQ== X-Gm-Message-State: APjAAAWpybf3wQnC4PsrdqwvDAjwgXYiHZwllH6cgDjWldpm7T8lsBzJ rLUnWFCYydOkzRYQNLuzUgeuPQ== X-Received: by 2002:adf:afe8:: with SMTP id y40mr34623139wrd.328.1561481266251; Tue, 25 Jun 2019 09:47:46 -0700 (PDT) Received: from localhost.localdomain (30.red-83-34-200.dynamicip.rima-tde.net. [83.34.200.30]) by smtp.gmail.com with ESMTPSA id d18sm42594476wrb.90.2019.06.25.09.47.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jun 2019 09:47:45 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, sboyd@kernel.org, bjorn.andersson@linaro.org, david.brown@linaro.org, jassisinghbrar@gmail.com, mark.rutland@arm.com, mturquette@baylibre.com, robh+dt@kernel.org, will.deacon@arm.com, arnd@arndb.de, horms+renesas@verge.net.au, heiko@sntech.de, sibis@codeaurora.org, enric.balletbo@collabora.com, jagan@amarulasolutions.com, olof@lixom.net Cc: vkoul@kernel.org, niklas.cassel@linaro.org, georgi.djakov@linaro.org, amit.kucheria@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-msm@vger.kernel.org, khasim.mohammed@linaro.org Subject: [PATCH v3 05/14] clk: qcom: apcs-msm8916: get parent clock names from DT Date: Tue, 25 Jun 2019 18:47:24 +0200 Message-Id: <20190625164733.11091-6-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625164733.11091-1-jorge.ramirez-ortiz@linaro.org> References: <20190625164733.11091-1-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Allow accessing the parent clock names required for the driver operation by using the device tree node. This permits extending the driver to other platforms without having to modify its source code. For backwards compatibility leave previous values as default. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz --- drivers/clk/qcom/apcs-msm8916.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) -- 2.21.0 Reviewed-by: Bjorn Andersson diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c index a6c89a310b18..dd82eb1e5202 100644 --- a/drivers/clk/qcom/apcs-msm8916.c +++ b/drivers/clk/qcom/apcs-msm8916.c @@ -19,7 +19,7 @@ static const u32 gpll0_a53cc_map[] = { 4, 5 }; -static const char * const gpll0_a53cc[] = { +static const char *gpll0_a53cc[] = { "gpll0_vote", "a53pll", }; @@ -50,6 +50,8 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) struct regmap *regmap; struct clk_init_data init = { }; int ret = -ENODEV; + const char *parents[2]; + int pll_index = 0; regmap = dev_get_regmap(parent, NULL); if (!regmap) { @@ -61,6 +63,16 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) if (!a53cc) return -ENOMEM; + /* legacy bindings only defined the pll parent clock (index = 0) with no + * name; when both of the parents are specified in the bindings, the + * pll is the second one (index = 1). + */ + if (of_clk_parent_fill(parent->of_node, parents, 2) == 2) { + gpll0_a53cc[0] = parents[0]; + gpll0_a53cc[1] = parents[1]; + pll_index = 1; + } + init.name = "a53mux"; init.parent_names = gpll0_a53cc; init.num_parents = ARRAY_SIZE(gpll0_a53cc); @@ -76,10 +88,11 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) a53cc->src_shift = 8; a53cc->parent_map = gpll0_a53cc_map; - a53cc->pclk = devm_clk_get(parent, NULL); + a53cc->pclk = of_clk_get(parent->of_node, pll_index); if (IS_ERR(a53cc->pclk)) { ret = PTR_ERR(a53cc->pclk); - dev_err(dev, "failed to get clk: %d\n", ret); + if (ret != -EPROBE_DEFER) + dev_err(dev, "failed to get clk: %d\n", ret); return ret; } @@ -87,6 +100,7 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) ret = clk_notifier_register(a53cc->pclk, &a53cc->clk_nb); if (ret) { dev_err(dev, "failed to register clock notifier: %d\n", ret); + clk_put(a53cc->pclk); return ret; } @@ -109,6 +123,8 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) err: clk_notifier_unregister(a53cc->pclk, &a53cc->clk_nb); + clk_put(a53cc->pclk); + return ret; } @@ -117,6 +133,7 @@ static int qcom_apcs_msm8916_clk_remove(struct platform_device *pdev) struct clk_regmap_mux_div *a53cc = platform_get_drvdata(pdev); clk_notifier_unregister(a53cc->pclk, &a53cc->clk_nb); + clk_put(a53cc->pclk); return 0; }