From patchwork Mon May 22 06:31:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 13249807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2704C7EE23 for ; Mon, 22 May 2023 06:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bsAmjdv0iUiCoAZ99xkgfCArePGHUq0YydAiSFmPEks=; b=paKi7fKH9OIFJY nQ+pUE3QMHXu5uPezCSbsnoT9/6mznQuDl6LISvb/WBbDxqz1Ck1MzXtQXh4GTqq+PS4E55urAdGq meFMjpluW5fa0Kkf4+jCceogj+x/wM6RqMvar7zZkeIqUWlAdrK+3mqFwbvCuectP+onuCedX4ZYP skJduziz/C7Zn7gnOEATZ+9QJKIbrn/IZuII9KZuJuIjiNSnAIJtyXTEBxH6qPrRxX353GCOiGqLL iElkdVstjK4CtOoqMSPP6uyPg/WKdF5x2WcEEm52QmqqibjOefCGfy6eX+gbryWT0FMS4VYA6PVnC f0qLg5bAuPmZOCcaBxIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q0z5d-005Vpn-0r; Mon, 22 May 2023 06:32:17 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q0z5a-005Vo9-0X for linux-arm-kernel@lists.infradead.org; Mon, 22 May 2023 06:32:15 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 34M6W0Zl083222; Mon, 22 May 2023 01:32:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1684737120; bh=CiCfrMcb4BYFASqX11gojkZmjfK+qOQOzQ+Q6TDuTCQ=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=S5FS1GqwsyKfiUOZUFwr81Ckf6aFQUC8yOsEuEMJeTgudjGzKiROBIvLbLXiWW0Zh G2OPmy8da/3MMav+dJeHYVqbqZYi7IiT1m3YmQZUmneVwAnyZp6LOoKx148/IatpEh ZpCnCWZZIVqsjGoch2euqPdPqE9tr7v5X+As1bf0= Received: from DFLE107.ent.ti.com (dfle107.ent.ti.com [10.64.6.28]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 34M6W0db069258 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 22 May 2023 01:32:00 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 22 May 2023 01:32:00 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 22 May 2023 01:31:59 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 34M6VxKj124364; Mon, 22 May 2023 01:31:59 -0500 From: Jai Luthra Date: Mon, 22 May 2023 12:01:55 +0530 Subject: [PATCH v2 1/2] dt-bindings: clock: Add binding documentation for TI Audio REFCLK MIME-Version: 1.0 Message-ID: <20230515-refclk-v2-1-fc9ff08826f5@ti.com> References: <20230515-refclk-v2-0-fc9ff08826f5@ti.com> In-Reply-To: <20230515-refclk-v2-0-fc9ff08826f5@ti.com> To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Santosh Shilimkar CC: Vignesh Raghavendra , Andrew Davis , , , , Jai Luthra X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1473; i=j-luthra@ti.com; h=from:subject:message-id; bh=Et4mocBn4YPUAENbGwghw+m7cx59NgRRvJfkDMlpQXg=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBkawxegp1c4a9ZID7+jUDmD9dTFZgFO5HZ2Zlhb 6QMAZDZ0MKJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZGsMXgAKCRBD3pH5JJpx RY0UD/4vD7/4ImWAuBjukkX2uLtSfX3bC6cA2OxD+NeZVU9/DZgd1OWV7MpiijhQh3y002NXPUA B52I+t9X/PL4fg8C1FlyBzpZm6AA3DKd1Drs28Q9tBCcxtvZiqX8O7qnaFf3aVXYGXABoxKI1SQ W/QqOcXscNInPwZaPFeUyeMMwmyGXAkCrInwesD3Xf0tJRZhOT8GGI9rpE6XvZgudDTx7eRTK9/ kswxj/JhgtsVa+tXnXFUEGQ7rcL8OEkgNgSZ6N5QrNDQ8iv6Am99aNY8feWvicTZDwFhO/OmvX0 n8dAIgiJWekhbSeq7dUdaMI53Ps0MaNFJS9pbfl72yP1X+N74aHee++AslwzLjBz+S+ZnH5G18Q Ayd4ye6SiVMhlzZZSyNagPTrVMYhGHcacX8wn9H/vjIM0OKzTv5C5MYOfcFtiNkIvMokDdPRSfC qOPrHtmuAFlfUg03W/vUaRzeFYDGm2S8K2kVKhXVygX5cWIyRZt5w4s8jvqIUSV26eqPZnbVkUn 7Cs6wKQg2ITyA05VUy59Rv5m4V11TR+dhwaV82eHYT27QF50tkdKolWdnkJvjV+SuefBmQCONWH 0O2QNx/1AmyXBvkBCuzeLODL8kUjjIJuvTeKMScuULo/XOgefpA5iI2mvKnkRWk6iKmQKD+In2G VIgXCv14e/ZdVXA== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230521_233214_301739_21CC7558 X-CRM114-Status: GOOD ( 12.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add DT bindings for TI's audio reference clocks (REFCLK) present on AM62 SoC. Signed-off-by: Jai Luthra Reviewed-by: Conor Dooley --- .../bindings/clock/ti,am62-audio-refclk.yaml | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/ti,am62-audio-refclk.yaml b/Documentation/devicetree/bindings/clock/ti,am62-audio-refclk.yaml new file mode 100644 index 000000000000..b2e40bd39a3a --- /dev/null +++ b/Documentation/devicetree/bindings/clock/ti,am62-audio-refclk.yaml @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/ti,am62-audio-refclk.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TI Audio Reference Clock + +maintainers: + - Jai Luthra + +properties: + compatible: + items: + - const: ti,am62-audio-refclk + + reg: + maxItems: 1 + + "#clock-cells": + const: 0 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - "#clock-cells" + - clocks + +additionalProperties: false + +examples: + - | + audio_refclk0: clock@82e0 { + compatible = "ti,am62-audio-refclk"; + reg = <0x82e0 0x4>; + clocks = <&k3_clks 157 0>; + assigned-clocks = <&k3_clks 157 0>; + assigned-clock-parents = <&k3_clks 157 8>; + #clock-cells = <0>; + }; From patchwork Mon May 22 06:31:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 13249808 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 515EAC77B75 for ; Mon, 22 May 2023 06:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RCttVmoHuNM+gUGn6n1XjYSBanogD9Gigk74hZ8iips=; b=sOAvLmGQj8xCrS QaRddYeX5xwQHoi+49DsGPdb7AQS2Lsnsi1MZhr5/lN3Sybt4UX2DAPh6Te009t34rO5xGuvOxTpI wv7+ab/r4mSvmUaXDCeXw3PHNwbXu2K2ID/OJMmpNIbrj/ukL/mMXl31LfX4uLTsHcPisf+wPbetP 3u4btQ6G19KU2IVDk2bnDUzlAEcfPz3uaaSu6iBzvDxJiP6lsPHm4yJ8Cf2e6inqUrBf6Xn7/0n4N uZCN+0bvmsd8JtMJ+ewRvxHyT+Nxo7apbhUFKJO+XQOVjoYLXFcphz25zYxpUEH/w+c/o5WKYR3XC CGEr9rAK+NwgHkxDHeCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q0z5i-005Vqg-39; Mon, 22 May 2023 06:32:22 +0000 Received: from lelv0143.ext.ti.com ([198.47.23.248]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q0z5a-005Vo6-1N for linux-arm-kernel@lists.infradead.org; Mon, 22 May 2023 06:32:16 +0000 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 34M6W1jO087189; Mon, 22 May 2023 01:32:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1684737121; bh=ogPbVDCU54/sxqzMwna8jLDsQGKPOdbkB99e+HaBCQ8=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=rZuRqLUQ29HStom512qOF1e4EuF0Ll9yIEbWvY8R3rdecptjeWXbAJuqSbO8jPPCG iQ+OOKOt//32nm+o+VtryHJXuOyL2Wv8otVYpGJk1xv/ThTVaiDTHoCb3xJX3iCtsj 7Q6xvX5aCZXKhSBckC5Yz6TG7vr4mZCV6GbUdluY= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 34M6W1L1112686 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 22 May 2023 01:32:01 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 22 May 2023 01:32:01 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 22 May 2023 01:32:01 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 34M6W05T014378; Mon, 22 May 2023 01:32:01 -0500 From: Jai Luthra Date: Mon, 22 May 2023 12:01:56 +0530 Subject: [PATCH v2 2/2] clk: keystone: syscon-clk: Add support for audio refclk MIME-Version: 1.0 Message-ID: <20230515-refclk-v2-2-fc9ff08826f5@ti.com> References: <20230515-refclk-v2-0-fc9ff08826f5@ti.com> In-Reply-To: <20230515-refclk-v2-0-fc9ff08826f5@ti.com> To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Santosh Shilimkar CC: Vignesh Raghavendra , Andrew Davis , , , , Jai Luthra X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4211; i=j-luthra@ti.com; h=from:subject:message-id; bh=1OzTfUSpjR4REarTZh76zHNZ7RzUS4w0+ba0D9vqK7s=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBkawxfQnHmMzLFiY78JW5j1v1AX7PO7magNPFId Js5a0KWrAmJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZGsMXwAKCRBD3pH5JJpx RVUWD/9rUv52D/C/WSBmzCrn3o3TtU7wabRaGg62QL9M5tP4DgOkhKMCM1wKYxSI8TiNi5UC+Ri 0K3h17r53i5yW90bJ7/mp47+PpL2VNm3Ag/VKQx7YwiUkUIj28xhySmg9yFH93PJmcSHh5fSLD/ tPzfAGY/6VvzHk6KB4v8XNh6kjs7hXbDG5FxQbW/gqxcbSro7Jlg0n9ZPImc/qXHHt7k5tjkh/t mhZ6LSOA90szKELTbUaqjhGJ1zO3HypQZ1Mpw08Y0twBsdJS/qEcAzDrhSUFYcCRa3pctEddg+z Fvo05WuQ0UUFuH0KZZTKOR2qyWvLG2vnhf66z/3eoSxtQ50PPUtKvAoHLvz51NBmpro2Vkm5mjt cE8a0GaoZccX2yUxJE9iPLtRPiORHkkhyUPwVxfX5fbBQTWUFZmGx0hY7sgfw2QDstKT6KHxn5E dGmBORWKymb1NNk/pntzpsoU1f/Mn4nMcYhaTY101FU5CUIi1ritqYiFFJEDaMJ6Enl47f7g3MK Y+jLCstgVCftzoxE2VDLQmLtL617LiUvmeyo4YFCnIbL/VT/rPqeUOd+nF0o4BmvjnWotPSCQqy jz297uHYGBVp3pmnpwx4uHVna8mzsIP1/JIb5d8cYG9GfoZje3+RCENfXh1xyx9mJU4zjUcbyiU Z5+/YqdjUXKCCIw== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230521_233214_560357_86148ED0 X-CRM114-Status: GOOD ( 21.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org TI's AM62 SoC can optionally provide two audio reference clocks (AUDIO_REFCLKx) to external peripherals. By default this reference clock is looped-back inside the SoC to a mux that goes to McASP AHCLK, but can optionally be enabled as an output to peripherals outside the SoC by setting a bit through CTRL_MMR registers. This bit only controls the direction of the clock, while the parent is a muxed input from sci-clk [1] which may be a configurable PLL or a master clock from one of the McASP instances. Link: http://downloads.ti.com/tisci/esd/latest/5_soc_doc/am62x/clocks.html#clocks-for-board0-device [1] Signed-off-by: Jai Luthra --- drivers/clk/keystone/syscon-clk.c | 43 ++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/drivers/clk/keystone/syscon-clk.c b/drivers/clk/keystone/syscon-clk.c index bd5cec0bd12d..7f686c12a109 100644 --- a/drivers/clk/keystone/syscon-clk.c +++ b/drivers/clk/keystone/syscon-clk.c @@ -61,21 +61,31 @@ static const struct clk_ops ti_syscon_gate_clk_ops = { static struct clk_hw *ti_syscon_gate_clk_register(struct device *dev, struct regmap *regmap, + const char *parent_name, const struct ti_syscon_gate_clk_data *data) { struct ti_syscon_gate_clk_priv *priv; struct clk_init_data init; + char *name = NULL; int ret; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return ERR_PTR(-ENOMEM); - init.name = data->name; init.ops = &ti_syscon_gate_clk_ops; - init.parent_names = NULL; - init.num_parents = 0; - init.flags = 0; + if (parent_name) { + name = kasprintf(GFP_KERNEL, "%s:%s", data->name, parent_name); + init.name = name; + init.parent_names = &parent_name; + init.num_parents = 1; + init.flags = CLK_SET_RATE_PARENT; + } else { + init.name = data->name; + init.parent_names = NULL; + init.num_parents = 0; + init.flags = 0; + } priv->regmap = regmap; priv->reg = data->offset; @@ -83,6 +93,10 @@ static struct clk_hw priv->hw.init = &init; ret = devm_clk_hw_register(dev, &priv->hw); + + if (name) + kfree(init.name); + if (ret) return ERR_PTR(ret); @@ -94,8 +108,9 @@ static int ti_syscon_gate_clk_probe(struct platform_device *pdev) const struct ti_syscon_gate_clk_data *data, *p; struct clk_hw_onecell_data *hw_data; struct device *dev = &pdev->dev; + int num_clks, num_parents, i; + const char *parent_name; struct regmap *regmap; - int num_clks, i; data = device_get_match_data(dev); if (!data) @@ -110,6 +125,13 @@ static int ti_syscon_gate_clk_probe(struct platform_device *pdev) for (p = data; p->name; p++) num_clks++; + num_parents = of_clk_get_parent_count(dev->of_node); + if (of_device_is_compatible(dev->of_node, "ti,am62-audio-refclk") && + num_parents == 0) { + return dev_err_probe(dev, -EINVAL, + "must specify a parent clock\n"); + } + hw_data = devm_kzalloc(dev, struct_size(hw_data, hws, num_clks), GFP_KERNEL); if (!hw_data) @@ -117,8 +139,10 @@ static int ti_syscon_gate_clk_probe(struct platform_device *pdev) hw_data->num = num_clks; + parent_name = of_clk_get_parent_name(dev->of_node, 0); for (i = 0; i < num_clks; i++) { hw_data->hws[i] = ti_syscon_gate_clk_register(dev, regmap, + parent_name, &data[i]); if (IS_ERR(hw_data->hws[i])) dev_warn(dev, "failed to register %s\n", @@ -166,6 +190,11 @@ static const struct ti_syscon_gate_clk_data am62_clk_data[] = { { /* Sentinel */ }, }; +static const struct ti_syscon_gate_clk_data am62_audio_clk_data[] = { + TI_SYSCON_CLK_GATE("audio_refclk", 0x0, 15), + { /* Sentinel */ }, +}; + static const struct of_device_id ti_syscon_gate_clk_ids[] = { { .compatible = "ti,am654-ehrpwm-tbclk", @@ -179,6 +208,10 @@ static const struct of_device_id ti_syscon_gate_clk_ids[] = { .compatible = "ti,am62-epwm-tbclk", .data = &am62_clk_data, }, + { + .compatible = "ti,am62-audio-refclk", + .data = &am62_audio_clk_data, + }, { } }; MODULE_DEVICE_TABLE(of, ti_syscon_gate_clk_ids);