From patchwork Mon Dec 17 09:46:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 153963 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2265828ljp; Mon, 17 Dec 2018 01:46:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/UsfdfEp14l03x8ldngab4wuOO3ymoAdnLMDsxpLt/Fj0PgnnofcgadGyzuJlEi4XQohoqN X-Received: by 2002:a63:8d44:: with SMTP id z65mr11640372pgd.57.1545040008939; Mon, 17 Dec 2018 01:46:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545040008; cv=none; d=google.com; s=arc-20160816; b=Udo1jMYVpRFLSvgHRzXyaKefUJH8uTmzDePclx1qaYI9rUKiabI8xsTMFiYdOpRx4p hMusQkL4KQiB3Ll6SGLyMfAfL5D+MSLm+bGj7FYbQ9pfBAtGDLLup3Pk4FfJXI8ZwhCP O0QzAnNSZq8/A8UJWlqtHZDjaUyevnUQyHLMZSHm/OYk05SWLgPX2OfTO/oC9x9jx/TJ YhZ/yWkoQeyQENNu3BtRz/0g2bH+Aw2oqxNJvb1L38Ogz/06QNQSNwGTv6i0AN4Krpg3 fb0qKglT4N5UPNOuWEIibdf9HgM+RJeG74WK6VbTCN6kdtdjK3YSdJGYwFF5DG+85hze vhhw== 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=rPu/KTYynL2hZ7Udac90NfGfOmFb5CPU0go+pwum/Ko=; b=i8MBNLWRzc8YC4nX9WPaWv7BnIVmLiGOrnubwY01rP1I3AibmSgP+nfAVwPmJkHpQf eoHyRrpULj16/HCT2HFM7EB5oQHURpfhAH78P61AcxkufFTSdIGKXxWLIwWEPAcmIpfp HOSeuj78tLc1h4goiuW9BBAdsmQnPESapY/elrLL90g6qILI3FsTwfV+k2UmDDLMNI0q UxiCNZ6YE4DRkYdRGeSn+S90MxTtrff5L9fXYijkvuR57JC1pdSonPOTtNeRP4QXPJ1q /RJNzYW3aunC/8XAWI8hrDX6hXuylcmTLCGK5hwHU86BlTNvMJ40ygZeZV25ZLIpRYlo jGjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GJ94LMcb; 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 m1si11041993pfi.286.2018.12.17.01.46.48; Mon, 17 Dec 2018 01:46:48 -0800 (PST) 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=GJ94LMcb; 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 S1732154AbeLQJqr (ORCPT + 6 others); Mon, 17 Dec 2018 04:46:47 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46428 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732157AbeLQJqr (ORCPT ); Mon, 17 Dec 2018 04:46:47 -0500 Received: by mail-wr1-f67.google.com with SMTP id l9so11499051wrt.13 for ; Mon, 17 Dec 2018 01:46:45 -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=rPu/KTYynL2hZ7Udac90NfGfOmFb5CPU0go+pwum/Ko=; b=GJ94LMcb2mXK/ECVCU6TpApvTHWweBWfPuTlBANuxKYmT4xaLEEdPjiPieHmsBgCCJ z4ECesqUmXpzpaYofaj1LKaF+l2Je+bQxM9psvo3s1WnbjqTzYEQWA5v+p8daXFv4J9Z Z8UZHjZ9x5J6+ubZs+m3Rzsq2Al5FdcnarC60= 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=rPu/KTYynL2hZ7Udac90NfGfOmFb5CPU0go+pwum/Ko=; b=DgtdjaKmPhML6Yh5VGNUapJKbyevy5yMGNg2s+AKqjqPlcxYg4Did4FJbOpb70Akxc kMzzDhOVMM/SiV7FYjiGW6nexp/fqRdEkCFKul8JrVn7rkdil1tfHAJKbXIE3mFGaYW/ Dk0FzsBzLGpLZizRLwHJbARoWHZvaX6mPl+0UTryzUsmEu5zVHX/FrxXFoWNbZxkcQU2 MsU5HcO+XKvRrytPZXZpHrlGHmKTWhJc3rvr+ClfYXWam4wTTR+9wLsFebyOoAaNK6vI TEJLHwm6B9Fk7OrDWyMijKdXjpvAtEZbuZZvG11k5NHGhTkkylAayDADEPgeJ5/SC01I GAdA== X-Gm-Message-State: AA+aEWYIaLkhREeUWETaQMWWZlihYicxtGmZHuChBS53yV+4AoBmOt44 wHJerntqB6R4sbSxuo/IhBDj2w== X-Received: by 2002:a5d:4b01:: with SMTP id v1mr9480128wrq.5.1545040005201; Mon, 17 Dec 2018 01:46:45 -0800 (PST) Received: from localhost.localdomain (58.red-81-47-145.staticip.rima-tde.net. [81.47.145.58]) by smtp.gmail.com with ESMTPSA id h12sm28878113wma.48.2018.12.17.01.46.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Dec 2018 01:46:44 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, andy.gross@linaro.org, david.brown@linaro.org, sboyd@kernel.org, will.deacon@arm.com, mturquette@baylibre.com, jassisinghbrar@gmail.com Cc: bjorn.andersson@linaro.org, vkoul@kernel.org, niklas.cassel@linaro.org, sibis@codeaurora.org, georgi.djakov@linaro.org, arnd@arndb.de, horms+renesas@verge.net.au, heiko@sntech.de, enric.balletbo@collabora.com, jagan@amarulasolutions.com, olof@lixom.net, amit.kucheria@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org Subject: [PATCH 05/13] clk: qcom: apcs-msm8916: get parent clock names from DT Date: Mon, 17 Dec 2018 10:46:22 +0100 Message-Id: <1545039990-19984-6-git-send-email-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545039990-19984-1-git-send-email-jorge.ramirez-ortiz@linaro.org> References: <1545039990-19984-1-git-send-email-jorge.ramirez-ortiz@linaro.org> 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 | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c index a6c89a3..2453242 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,17 +50,39 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) struct regmap *regmap; struct clk_init_data init = { }; int ret = -ENODEV; + struct clk_bulk_data pclks[] = { + [0] = { .id = "aux", .clk = NULL }, + [1] = { .id = "pll", .clk = NULL }, + }; regmap = dev_get_regmap(parent, NULL); if (!regmap) { dev_err(dev, "failed to get regmap: %d\n", ret); return ret; } - a53cc = devm_kzalloc(dev, sizeof(*a53cc), GFP_KERNEL); if (!a53cc) return -ENOMEM; + /* check if the parent names are present in the device tree */ + ret = devm_clk_bulk_get(parent, ARRAY_SIZE(pclks), pclks); + if (ret == -EPROBE_DEFER) + return ret; + + if (!ret) { + gpll0_a53cc[0] = __clk_get_name(pclks[0].clk); + gpll0_a53cc[1] = __clk_get_name(pclks[1].clk); + a53cc->pclk = pclks[1].clk; + } else { + /* support old binding where only pll was explicitily defined */ + a53cc->pclk = devm_clk_get(parent, NULL); + if (IS_ERR(a53cc->pclk)) { + ret = PTR_ERR(a53cc->pclk); + dev_err(dev, "failed to get clk: %d\n", ret); + return ret; + } + } + init.name = "a53mux"; init.parent_names = gpll0_a53cc; init.num_parents = ARRAY_SIZE(gpll0_a53cc); @@ -76,13 +98,6 @@ 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); - if (IS_ERR(a53cc->pclk)) { - ret = PTR_ERR(a53cc->pclk); - dev_err(dev, "failed to get clk: %d\n", ret); - return ret; - } - a53cc->clk_nb.notifier_call = a53cc_notifier_cb; ret = clk_notifier_register(a53cc->pclk, &a53cc->clk_nb); if (ret) {