From patchwork Mon Jan 28 18:32:52 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: 156863 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3748572jaa; Mon, 28 Jan 2019 10:33:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IZrOtTTbSiRnfhSpmLfALtsykAJ2pR9ZCbTo9B/4J54PraOjyVE70RzqVX2mIr3KraZU9fs X-Received: by 2002:a62:9305:: with SMTP id b5mr2463469pfe.10.1548700409177; Mon, 28 Jan 2019 10:33:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548700409; cv=none; d=google.com; s=arc-20160816; b=dXWGQ8rKicHVdcDK8smO32OBkpGwVadk28GezqMw9FZ75QJPqd9muju+rOvORIhdzP hQBPdBdI1LptDMRAw0ePtgvgB1y9ooYNrYgztWVIggeaQsMfqGi7Jp0Z2Ap0eEi1a9yk cPpxcoM0BUsDKlieA07UX9U9Duw0gTNzm9oofTY2bTdqCjETwaPLbVE7inXV175C0gX0 VW5FgAa/RHQRDfGC++ZrqDpAiKRasLeAmfG4DAuSWuZXbB3WxJ5Il8XQK8+uVOLe3w3U OZv3bLYa13NJW63gPZumXqQhmcGFns422RxKKGWAWNwsv9O3Z3viS7PifA2ZHr9ItRAZ UiFw== 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=0hHd3izZjkE/zbr93sjgSJI16UQMbc5YRiXdFWOT/jk=; b=Z3gtqZXfPXzIDPaHhP395vm3OvIuAb9SwWP4J7bb9idiC69dYuhX6Av8OTaMB6XqLa IM+14rbpnSppAqA1wnnMHdXTHr6yU2jePPEr/3xrFb7r5TrRCqzk7vMtAvNEBiyBApv1 CM5eKOFBfiQAdoe4rKJPG7ueHayAEXbdmDhGvPtUQga80r0B2sYxk0wOfkKrKzjft8KH NfvR+kxsbbLAqJNpm9FozoX33eX0nccp2VijTPF+LLid2DymOgEZZZM+32VcJoPSnUlv sDdBZQjHZG1od2DDpglHM7ME14UBNdjaM9SbnqJ5v1GxuXrlXsqxdbEDcNKxAJn06g7J ZsdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kI8S6Adu; 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 20si18824003pft.177.2019.01.28.10.33.29; Mon, 28 Jan 2019 10:33:29 -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=kI8S6Adu; 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 S1727914AbfA1Sd2 (ORCPT + 7 others); Mon, 28 Jan 2019 13:33:28 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40108 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727885AbfA1Sd1 (ORCPT ); Mon, 28 Jan 2019 13:33:27 -0500 Received: by mail-wm1-f66.google.com with SMTP id f188so14973474wmf.5 for ; Mon, 28 Jan 2019 10:33:25 -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=0hHd3izZjkE/zbr93sjgSJI16UQMbc5YRiXdFWOT/jk=; b=kI8S6AduKzz9wxl/MDzKM3malF+7UGzYK1zbeBoG8GSNdFgohonCQflEcSHdoTPASw lzFxi7YYPRdbm7u9A4i4mwfq7Z9NQoDBZcCOmUfxZcA5EEpZPKd7qZL7D3Y4XG/dCscu it9CLMygETIGCMm0PJbLFRg787N1t84tffxIs= 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=0hHd3izZjkE/zbr93sjgSJI16UQMbc5YRiXdFWOT/jk=; b=jmzFFqpWMAtwVD3A0UnfBbkij3DhAVTUkRR3NJI0jeYVg/DGIjI04GAree1Sw3g/Gj dT0hbDl0S2f35XF6FGNSyVZ46blsWuHnC3n896pdmT0wKgU6Wb3zfUt15cxIyiPw9tG2 +sPghW3RmGr3NUygkVyJ0cM4Z8Q6SfJ/M0zqPMGDv3lywoIYu1AV8B16yjI1Rkframlp DLd3DGUHHdToPW1xMvaE2kzwq7XqMnX/BOwdMTbPh7tN8wQ6KXrstFkICjfcDboGiVO6 zMnqykYqcsw79TYExyp//apOGpUN3sEdnXu+5YpJJZ5FCsHvOCvfj1jIvzPUeyRkifUN iHrA== X-Gm-Message-State: AJcUukdQ2khT+tsPd+NmFgSOG75/m7SWtuZUpTp/nPbeoFt5HluQ4c7T 7PTMhbtXjdNPngyHZXIO5hnIUg== X-Received: by 2002:a1c:968a:: with SMTP id y132mr17912179wmd.107.1548700405028; Mon, 28 Jan 2019 10:33:25 -0800 (PST) Received: from localhost.localdomain (233.red-81-47-145.staticip.rima-tde.net. [81.47.145.233]) by smtp.gmail.com with ESMTPSA id l19sm270082wme.21.2019.01.28.10.33.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 10:33:24 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, sboyd@kernel.org, bjorn.andersson@linaro.org, andy.gross@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 v2 05/14] clk: qcom: apcs-msm8916: get parent clock names from DT Date: Mon, 28 Jan 2019 19:32:52 +0100 Message-Id: <1548700381-22376-6-git-send-email-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548700381-22376-1-git-send-email-jorge.ramirez-ortiz@linaro.org> References: <1548700381-22376-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 | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c index a6c89a3..987ee00 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,10 @@ 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) { @@ -61,6 +65,25 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) 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 +99,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) {