From patchwork Mon Jan 28 18:32:51 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: 156874 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3749593jaa; Mon, 28 Jan 2019 10:34:30 -0800 (PST) X-Google-Smtp-Source: ALg8bN45ctMbzC8HX9q/EfmSfZ0IFjGkMIkJtlNTQPHgWznsj+xOnxkATN6NyYlQkIPJ8AzEan4A X-Received: by 2002:a17:902:f082:: with SMTP id go2mr22886393plb.115.1548700470233; Mon, 28 Jan 2019 10:34:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548700470; cv=none; d=google.com; s=arc-20160816; b=RoYOgQ4YLoX8aDyUue9Xdky2yy0Vl4hggTEvCLmcJ51csy61tGJenou0EQ9MjEy+oi q3PaGN+jAFi7TJn2PMIDmX7B0kjj3j571L/V4nCgJv6/Bcr90PGD/1rWH/vyUGb/3/HQ s2t4Iq+A1gMTiNyknbFle1khG/gDO6ebiSvSIkOKdKPDHv8CgISKvRb+WSnEinFNNTWZ Dl+f69XG39ybG142v8ksD7RiC5uILgR62XO0MQgz7u7GbMjgMWUfvG/1G03cWv3cdYYQ hpZjxvncFPibPwhmFy4km/Ygav+UHalIOcJEz3jYfxExLNVrV/VKnVDEFm3GAPWjoXQt 0tSg== 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=FIFLlUi8drrhCNTy3FqCtrXujaAw4Y9ofI00ORq7Auk=; b=VD0r7IvhSR0Wv1aoSZVVw3llo9dTYvIYgn0lPNsG2PIGfbzVujl9VZCHH90GtsHxw/ DAHI9waAUAwIL/7ePeRxhE+7oUMh3NcvC2/wEQwuC5sKPt83g6ErB1KN4sFiI5HtkDA6 LsGei2UD6D6QC0WxuokzN5+q1lg9v/dH6BtklNklm1VTyo7t3lOBMX+OW3RaH321hRGa 8n8rxHahjdSDc9OptGrqW18GGaRrRdFZAzv38yJVoL8rd674xYe6eKTdhKCZ5tj+nViQ rq29UjDMR/NxXuEDwlDbx5zDRs72YUrIP75WLX7nm5+ezD/owO4JwKB8QaQxPGJURgqQ iUYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b6Ldp0I3; 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 bh5si1763792plb.42.2019.01.28.10.34.30; Mon, 28 Jan 2019 10:34:30 -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=b6Ldp0I3; 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 S1727894AbfA1Sd0 (ORCPT + 7 others); Mon, 28 Jan 2019 13:33:26 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53231 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727861AbfA1SdZ (ORCPT ); Mon, 28 Jan 2019 13:33:25 -0500 Received: by mail-wm1-f66.google.com with SMTP id m1so15114134wml.2 for ; Mon, 28 Jan 2019 10:33:23 -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=FIFLlUi8drrhCNTy3FqCtrXujaAw4Y9ofI00ORq7Auk=; b=b6Ldp0I3RPws0bLT95JFNpvw76wG74hw+6/PgQ+T41Qa8oNK+XLjTZ6buT5NPiYHUc q+U9eKO10Tvrzvpnw1hkX/EmEPRxnsv2+mVnwmqqTVBDCq2oqX9OxC0nAv9ML7iAZ2i5 tomOdp46RvvGVncKz7AEC+UnNyUd3lAnxhgPE= 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=FIFLlUi8drrhCNTy3FqCtrXujaAw4Y9ofI00ORq7Auk=; b=QdE1PQTUL3JWRLXORSW7G1gvPAUl8tM4FNUdSTqrD24/jCO0tSfcvX/eiIrJzuaIxR oWvY5cWmC3ynnLEHsF2V3yKvgI9G/fBuNAOH0Biv4wumPvTi+xkHef4G6RNJChpuxGXJ 73Z4CRQ63k4J+26kKxVEdUCDkXFlCinQwIN+eytcdWVYk5cnRRzyFfuMXJyNmXAi6ftB 89ulj8cGH7XH1KGeT9Q5hAcNpiogP/uJ77zPsy1LGCF0RVoYO0xvSF1ntK0+wgVhNlN6 6fFEqoBkqEHGgUKFk1cVSZntUwVjmSyoS+/Kbtd2UynrWP+g/9oQ+H5xxkN2J0rfGHQn M8dw== X-Gm-Message-State: AJcUukdbu6efybAW92oN3qeZbo5B9vJ+VAIUT9cxksca6EyHWRCGZG1T CoJjebEY52aGxq88jmxbPUtQVA== X-Received: by 2002:a1c:ad45:: with SMTP id w66mr17892760wme.60.1548700403197; Mon, 28 Jan 2019 10:33:23 -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.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 10:33:22 -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 04/14] dt-bindings: mailbox: qcom: Add clock-name optional property Date: Mon, 28 Jan 2019 19:32:51 +0100 Message-Id: <1548700381-22376-5-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 When the APCS clock is registered (platform dependent), it retrieves its parent names from hardcoded values in the driver. The following commit allows the DT node to provide such clock names to the platform data based clock driver therefore avoiding having to explicitly embed those names in the clock driver source code. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz --- .../bindings/mailbox/qcom,apcs-kpss-global.txt | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt b/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt index 1232fc9..b693103 100644 --- a/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt +++ b/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt @@ -18,10 +18,11 @@ platforms. Usage: required Value type: Definition: must specify the base address and size of the global block + - clocks: - Usage: required if #clocks-cells property is present - Value type: - Definition: phandle to the input PLL, which feeds the APCS mux/divider + Usage: required if #clock-names property is present + Value type: + Definition: phandles to the two parent clocks of the clock driver. - #mbox-cells: Usage: required @@ -33,6 +34,12 @@ platforms. Value type: Definition: as described in clock.txt, must be 0 +- clock-names: + Usage: required if the platform data based clock driver needs to + retrieve the parent clock names from device tree. + This will requires two mandatory clocks to be defined. + Value type: + Definition: must be "aux" and "pll" = EXAMPLE The following example describes the APCS HMSS found in MSM8996 and part of the @@ -65,3 +72,14 @@ Below is another example of the APCS binding on MSM8916 platforms: clocks = <&a53pll>; #clock-cells = <0>; }; + +Below is another example of the APCS binding on QCS404 platforms: + + apcs_glb: mailbox@b011000 { + compatible = "qcom,qcs404-apcs-apps-global", "syscon"; + reg = <0x0b011000 0x1000>; + #mbox-cells = <1>; + clocks = <&gcc GCC_GPLL0_AO_OUT_MAIN>, <&apcs_hfpll>; + clock-names = "aux", "pll"; + #clock-cells = <0>; + }; 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) {