From patchwork Tue May 14 09:33:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 13663933 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C30655C1A; Tue, 14 May 2024 09:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=92.121.34.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715680392; cv=none; b=TA1P9afcgRfimvCOJP0EnpkqS6KBhWtWph2oLAXSCq1VFtgvqDv3VKi538mQ2BFlEu0IgpxSTZ9cNdgjLOe18oglQklRUEonBsigsaTXLOC0rbTDich7jlKfk2NWFni/t3hp5tQpCWM52m9p7UUqrhGWk3PJY3PP7VVMGbHFzzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715680392; c=relaxed/simple; bh=BpkOooU1s4m3CWExxo5Bz93jiYM7/cI8NedWu2YZ93I=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=C1CPTWGo2o29Yc1X/fz1Y12yf6q+8Wr1GC+5FcxdNRwRqBHnRUFEMZxJnI3uWGdhssAIVN7ZZNMajfp/uiqyuOQVwpQ4tLMWxDMf2ar4StBFKabOks8XqXniMYJ4SdfJO4ieZigik6PAwKonhLFZLxz4Cucr4vzgLLJ59QK/AZk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; arc=none smtp.client-ip=92.121.34.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 220B5200938; Tue, 14 May 2024 11:52:57 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id CD4C42005E2; Tue, 14 May 2024 11:52:56 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 87D931820F77; Tue, 14 May 2024 17:52:54 +0800 (+08) From: Shengjiu Wang To: abelvesa@kernel.org, peng.fan@nxp.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, marex@denx.de, linux-clk@vger.kernel.org, imx@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, p.zabel@pengutronix.de, shengjiu.wang@gmail.com Subject: [PATCH v3 1/6] dt-bindings: reset: fsl,imx8mp-audiomix-reset: add bindings Date: Tue, 14 May 2024 17:33:25 +0800 Message-Id: <1715679210-9588-2-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> References: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The Audio Block Control contains clock distribution and gating controls, as well as reset handling to several of the AUDIOMIX peripherals. Especially the reset controls for Enhanced Audio Return Channel (EARC) PHY and Controller. Add DT-Schema bindings for the reset function in i.MX8MP audiomix block controller. Signed-off-by: Shengjiu Wang --- .../reset/fsl,imx8mp-audiomix-reset.yaml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/fsl,imx8mp-audiomix-reset.yaml diff --git a/Documentation/devicetree/bindings/reset/fsl,imx8mp-audiomix-reset.yaml b/Documentation/devicetree/bindings/reset/fsl,imx8mp-audiomix-reset.yaml new file mode 100644 index 000000000000..71a10646ab2b --- /dev/null +++ b/Documentation/devicetree/bindings/reset/fsl,imx8mp-audiomix-reset.yaml @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2024 NXP +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/fsl,imx8mp-audiomix-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP i.MX8MP AudioMix reset controller + +maintainers: + - Shengjiu Wang + +description: The reset controller node must be a sub-node of the i.MX8MP + AudioMix Block Control node + +properties: + $nodename: + const: reset-controller + + compatible: + const: fsl,imx8mp-audiomix-reset + + '#reset-cells': + const: 1 + +required: + - compatible + - '#reset-cells' + +additionalProperties: false + +examples: + - | + reset-controller { + compatible = "fsl,imx8mp-audiomix-reset"; + #reset-cells = <1>; + }; From patchwork Tue May 14 09:33:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 13663937 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDA8157880; Tue, 14 May 2024 09:54:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=92.121.34.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715680476; cv=none; b=ilyXTDNRND7IBkd80DtpkVlqa6C0hVEBJyxGNvQsoiSBD9FtdIyBoyM1m8hk9VloflDeqIOKMbHUO3vFt8SS6zlq5eRKDbZ4bXsz5zmAcjRcXZ693/zGHZe7pAeIBn6GYgiK6ddcEYWfzUO0BhQ6iDdJWCFN0AZ8qXFUjzgAiRA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715680476; c=relaxed/simple; bh=GsrDLzJ8yr8yaREvNeORn0JlgmRhR20FlHA3DcMbeI8=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=YYPega9c7UVG5CjMkxPaGsjA0JAeSpW1Ba28wD72/aWc0W1FByhCFD3qUNe5g9/PbwlvvLjQSJKcwPGKoDp+8It7D2YCPpou/lR0XPOrg3kXdyBNUjVRAlvS0mKOtqkiCRqyV7Rjw8ySZWfDz5UkkOxoJQE4ozgR/LLv2FdQlAg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; arc=none smtp.client-ip=92.121.34.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id F3779200B9F; Tue, 14 May 2024 11:52:58 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 6FE67200BC5; Tue, 14 May 2024 11:52:58 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 28378180222C; Tue, 14 May 2024 17:52:56 +0800 (+08) From: Shengjiu Wang To: abelvesa@kernel.org, peng.fan@nxp.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, marex@denx.de, linux-clk@vger.kernel.org, imx@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, p.zabel@pengutronix.de, shengjiu.wang@gmail.com Subject: [PATCH v3 2/6] reset: imx8mp-audiomix: Add AudioMix Block Control reset driver Date: Tue, 14 May 2024 17:33:26 +0800 Message-Id: <1715679210-9588-3-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> References: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Audiomix block control can be a reset controller for Enhanced Audio Return Channel (EARC), which is one of modules in this audiomix subsystem. The EARC PHY software reset and EARC controller software reset need to be supported. Signed-off-by: Shengjiu Wang --- drivers/reset/Kconfig | 8 ++ drivers/reset/Makefile | 1 + drivers/reset/reset-imx8mp-audiomix.c | 117 ++++++++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 drivers/reset/reset-imx8mp-audiomix.c diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 7112f5932609..0e7da0bb0a21 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -91,6 +91,14 @@ config RESET_IMX7 help This enables the reset controller driver for i.MX7 SoCs. +config RESET_IMX8MP_AUDIOMIX + tristate "i.MX8MP AudioMix Reset Driver" + depends on HAS_IOMEM + depends on (ARM64 && ARCH_MXC) || COMPILE_TEST + select MFD_SYSCON + help + This enables the reset controller driver for i.MX8MP AudioMix. + config RESET_INTEL_GW bool "Intel Reset Controller Driver" depends on X86 || COMPILE_TEST diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index fd8b49fa46fc..a6796e83900b 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o obj-$(CONFIG_RESET_GPIO) += reset-gpio.o obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o obj-$(CONFIG_RESET_IMX7) += reset-imx7.o +obj-$(CONFIG_RESET_IMX8MP_AUDIOMIX) += reset-imx8mp-audiomix.o obj-$(CONFIG_RESET_INTEL_GW) += reset-intel-gw.o obj-$(CONFIG_RESET_K210) += reset-k210.o obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o diff --git a/drivers/reset/reset-imx8mp-audiomix.c b/drivers/reset/reset-imx8mp-audiomix.c new file mode 100644 index 000000000000..8ba0d4406b36 --- /dev/null +++ b/drivers/reset/reset-imx8mp-audiomix.c @@ -0,0 +1,117 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2024 NXP + */ + +#include +#include +#include +#include +#include +#include +#include + +#define EARC 0x200 +#define EARC_RESET_MASK 0x3 + +struct imx8mp_audiomix_rst_priv { + struct regmap *regmap; + struct reset_controller_dev rcdev; +}; + +static int imx8mp_audiomix_reset_set(struct reset_controller_dev *rcdev, + unsigned long id, bool assert) +{ + struct imx8mp_audiomix_rst_priv *priv = container_of(rcdev, + struct imx8mp_audiomix_rst_priv, rcdev); + unsigned int mask = BIT(id); + + /* bit = 0 reset, bit = 1 unreset */ + if (assert) + regmap_update_bits(priv->regmap, EARC, mask, 0); + else + regmap_update_bits(priv->regmap, EARC, mask, mask); + + return 0; +} + +static int imx8mp_audiomix_reset_reset(struct reset_controller_dev *rcdev, + unsigned long id) +{ + imx8mp_audiomix_reset_set(rcdev, id, true); + + return imx8mp_audiomix_reset_set(rcdev, id, false); +} + +static int imx8mp_audiomix_reset_assert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + return imx8mp_audiomix_reset_set(rcdev, id, true); +} + +static int imx8mp_audiomix_reset_deassert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + return imx8mp_audiomix_reset_set(rcdev, id, false); +} + +static int imx8mp_audiomix_reset_xlate(struct reset_controller_dev *rcdev, + const struct of_phandle_args *reset_spec) +{ + unsigned long id = reset_spec->args[0]; + + if (!(BIT(id) & EARC_RESET_MASK)) + return -EINVAL; + + return id; +} + +static const struct reset_control_ops imx8mp_audiomix_reset_ops = { + .reset = imx8mp_audiomix_reset_reset, + .assert = imx8mp_audiomix_reset_assert, + .deassert = imx8mp_audiomix_reset_deassert, +}; + +static int imx8mp_audiomix_reset_probe(struct platform_device *pdev) +{ + struct device_node *parent_np = of_get_parent(pdev->dev.of_node); + struct imx8mp_audiomix_rst_priv *priv; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->regmap = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); + if (IS_ERR(priv->regmap)) + return PTR_ERR(priv->regmap); + + priv->rcdev.owner = THIS_MODULE; + priv->rcdev.nr_resets = fls(EARC_RESET_MASK); + priv->rcdev.ops = &imx8mp_audiomix_reset_ops; + priv->rcdev.of_node = pdev->dev.of_node; + priv->rcdev.dev = &pdev->dev; + priv->rcdev.of_reset_n_cells = 1; + priv->rcdev.of_xlate = imx8mp_audiomix_reset_xlate; + + return devm_reset_controller_register(&pdev->dev, &priv->rcdev); +} + +static const struct of_device_id imx8mp_audiomix_reset_dt_match[] = { + { .compatible = "fsl,imx8mp-audiomix-reset" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, imx8mp_audiomix_reset_dt_match); + +static struct platform_driver imx8mp_audiomix_reset_driver = { + .probe = imx8mp_audiomix_reset_probe, + .driver = { + .name = "imx8mp-audiomix-reset", + .of_match_table = imx8mp_audiomix_reset_dt_match, + }, +}; +module_platform_driver(imx8mp_audiomix_reset_driver); + +MODULE_AUTHOR("Shengjiu Wang "); +MODULE_DESCRIPTION("Freescale i.MX8MP Audio Block Controller reset driver"); +MODULE_LICENSE("GPL"); From patchwork Tue May 14 09:33:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 13663934 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE2A413A242; Tue, 14 May 2024 09:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=92.121.34.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715680395; cv=none; b=HImkhkv6fV7C3339SMISNndiTy1ktxnWM4Uqmgt8ewWH6Hj9jILJspTp8K9spDuG1gMteL6CrxlOR216HrNZioROT7ZVZZBCuCd1MWfK419dnaM34EugES/GoLkLLdvhZ6H8T2RpJ7DNdVg+Hy07C2dSCxNJOxN4XORSRWNIVt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715680395; c=relaxed/simple; bh=N1Be/lHX9le8mgGi3YYkU+QV7lUMRQix+T57VbFccns=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=KjL8mm7E7EfCs7xVFNokU5y8ueLDcQqRuS5xA8GiaVYsB8dk8WClIYe7M5munIOk+GGM4/nzq16w2ZPie4yZgr6ood2va3o4cN1MWeF2B5rEF1x2mJxndkA2sBsGWTUy5puYPjLX+Dwr6ylN4/2/7Yodb1FP97ZB1WKWKoKiCzA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; arc=none smtp.client-ip=92.121.34.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 4DBD320192A; Tue, 14 May 2024 11:53:00 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 0F267200BC5; Tue, 14 May 2024 11:53:00 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id BCA39180226C; Tue, 14 May 2024 17:52:57 +0800 (+08) From: Shengjiu Wang To: abelvesa@kernel.org, peng.fan@nxp.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, marex@denx.de, linux-clk@vger.kernel.org, imx@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, p.zabel@pengutronix.de, shengjiu.wang@gmail.com Subject: [PATCH v3 3/6] dt-bindings: clock: imx8mp: Add reset-controller sub-node Date: Tue, 14 May 2024 17:33:27 +0800 Message-Id: <1715679210-9588-4-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> References: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The Audio Block Control contains clock distribution and gating controls, as well as reset handling to several of the AUDIOMIX peripherals. Especially the reset controls for Enhanced Audio Return Channel (EARC) PHY and Controller. So Audio Block Control is a Multi-Function Devices. Add reset-controller sub node which is a reset provider for EARC. Add compatible string "syscon", "simple-mfd" which make Audio Block Control device support reset-controller sub-node. Signed-off-by: Shengjiu Wang --- .../bindings/clock/imx8mp-audiomix.yaml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/clock/imx8mp-audiomix.yaml b/Documentation/devicetree/bindings/clock/imx8mp-audiomix.yaml index 0a6dc1a6e122..a403ace4d11f 100644 --- a/Documentation/devicetree/bindings/clock/imx8mp-audiomix.yaml +++ b/Documentation/devicetree/bindings/clock/imx8mp-audiomix.yaml @@ -15,7 +15,10 @@ description: | properties: compatible: - const: fsl,imx8mp-audio-blk-ctrl + items: + - const: fsl,imx8mp-audio-blk-ctrl + - const: syscon + - const: simple-mfd reg: maxItems: 1 @@ -44,6 +47,11 @@ properties: ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8mp-clock.h for the full list of i.MX8MP IMX8MP_CLK_AUDIOMIX_ clock IDs. + reset-controller: + type: object + $ref: /schemas/reset/fsl,imx8mp-audiomix-reset.yaml# + description: The child reset devices of AudioMIX Block Control. + required: - compatible - reg @@ -60,7 +68,7 @@ examples: #include clock-controller@30e20000 { - compatible = "fsl,imx8mp-audio-blk-ctrl"; + compatible = "fsl,imx8mp-audio-blk-ctrl", "syscon", "simple-mfd"; reg = <0x30e20000 0x10000>; #clock-cells = <1>; clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>, @@ -74,6 +82,11 @@ examples: "sai1", "sai2", "sai3", "sai5", "sai6", "sai7"; power-domains = <&pgc_audio>; + + reset-controller { + compatible = "fsl,imx8mp-audiomix-reset"; + #reset-cells = <1>; + }; }; ... From patchwork Tue May 14 09:33:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 13663939 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57BF258AC4; Tue, 14 May 2024 10:08:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=92.121.34.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715681286; cv=none; b=o5g+z3a3k5lbUR513lL3tC4SCH4fv7SQIPZSdx+g3orQSFheKdxZ2kCQBC66XGufPhM2FfGAVKWLHtn7MQ/9gg/KgaLDOFQvtoqYHnUioHC7pBLCF/VhlNI68C/Y4C2IZ9SmQbknuIH3WzbP380N9Nl8qdRV7HKZFmyXdFNoOq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715681286; c=relaxed/simple; bh=SECeU/hWqv/TiUa66e4a5CsD04TBkyJmeXiGLL2YMfk=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=BvHXHo7ujonxC5LUXDLvRyoFvfdRA1OotRU5KnA6X/Yf+oWmsXyqQoHEWwwLYIiGfoRUrVXzbOZLEk0Z+ukzrgEhyvkNF+r3YtnwYZusLrrCBveT97m/AjatVaE1VJzAopHoi5LAPrwn1DRO3xYBrCj2SgaIJn/qAH46XrqCn8c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; arc=none smtp.client-ip=92.121.34.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id EC3DD1A18FA; Tue, 14 May 2024 11:53:01 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id A4AE01A191F; Tue, 14 May 2024 11:53:01 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 5D7F5180222C; Tue, 14 May 2024 17:52:59 +0800 (+08) From: Shengjiu Wang To: abelvesa@kernel.org, peng.fan@nxp.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, marex@denx.de, linux-clk@vger.kernel.org, imx@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, p.zabel@pengutronix.de, shengjiu.wang@gmail.com Subject: [PATCH v3 4/6] clk: imx: clk-audiomix: Add CLK_SET_RATE_PARENT flags for clocks Date: Tue, 14 May 2024 17:33:28 +0800 Message-Id: <1715679210-9588-5-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> References: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Add CLK_SET_RATE_PARENT flags that when the device driver sets the child clock rate, parent clock frequency can be refined accordingly. Signed-off-by: Shengjiu Wang --- drivers/clk/imx/clk-imx8mp-audiomix.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mp-audiomix.c b/drivers/clk/imx/clk-imx8mp-audiomix.c index b381d6f784c8..466b5b0d665c 100644 --- a/drivers/clk/imx/clk-imx8mp-audiomix.c +++ b/drivers/clk/imx/clk-imx8mp-audiomix.c @@ -269,12 +269,12 @@ static int clk_imx8mp_audiomix_probe(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(sels); i++) { if (sels[i].num_parents == 1) { hw = devm_clk_hw_register_gate_parent_data(dev, - sels[i].name, &sels[i].parent, 0, + sels[i].name, &sels[i].parent, CLK_SET_RATE_PARENT, base + sels[i].reg, sels[i].shift, 0, NULL); } else { hw = devm_clk_hw_register_mux_parent_data_table(dev, sels[i].name, sels[i].parents, - sels[i].num_parents, 0, + sels[i].num_parents, CLK_SET_RATE_PARENT, base + sels[i].reg, sels[i].shift, sels[i].width, 0, NULL, NULL); @@ -317,7 +317,8 @@ static int clk_imx8mp_audiomix_probe(struct platform_device *pdev) clk_hw_data->hws[IMX8MP_CLK_AUDIOMIX_SAI_PLL_BYPASS] = hw; hw = devm_clk_hw_register_gate(dev, "sai_pll_out", "sai_pll_bypass", - 0, base + SAI_PLL_GNRL_CTL, 13, + CLK_SET_RATE_PARENT, + base + SAI_PLL_GNRL_CTL, 13, 0, NULL); if (IS_ERR(hw)) { ret = PTR_ERR(hw); @@ -326,7 +327,8 @@ static int clk_imx8mp_audiomix_probe(struct platform_device *pdev) clk_hw_data->hws[IMX8MP_CLK_AUDIOMIX_SAI_PLL_OUT] = hw; hw = devm_clk_hw_register_fixed_factor(dev, "sai_pll_out_div2", - "sai_pll_out", 0, 1, 2); + "sai_pll_out", + CLK_SET_RATE_PARENT, 1, 2); if (IS_ERR(hw)) { ret = PTR_ERR(hw); goto err_clk_register; From patchwork Tue May 14 09:33:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 13663936 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81577548FD; Tue, 14 May 2024 09:54:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=92.121.34.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715680466; cv=none; b=Dshqlt1r61/XX5LKtDBWz7rdbVbhH8ZbRtFduXR40und4nGjkE8Et2ejzaAfKrFAHOsfvufX84051BOUrbnE8p3t70uuJMb/c8453RshNby+kc3A7XAmEzSGZHo7FhEeTUSXqXeM1RxNDDtetU2/sowMWqkUSZiDfS/krpmCjMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715680466; c=relaxed/simple; bh=BFBMRM2lGg2wDx/pSbXYe8CjMwM8hP7SsCbNTvVCX1g=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=c61HazQyiV3GV2yHcbCt5WI5F129+BgBb/o7j+CVG2Pu+S5H4z8ZvVwRmHThuIz2upBPHDQVHk9tYlxnPxVfUwwnkOH07puVbMvTroOzvHbOkVRZnTwsMUPBL95y07CtRIY9MFlkQuJwpufW+3o8NgO6nS5ad3z4MDB3rVSTtMQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; arc=none smtp.client-ip=92.121.34.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8CB941A0C0A; Tue, 14 May 2024 11:53:03 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 451FF1A07AE; Tue, 14 May 2024 11:53:03 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id F36D1180226C; Tue, 14 May 2024 17:53:00 +0800 (+08) From: Shengjiu Wang To: abelvesa@kernel.org, peng.fan@nxp.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, marex@denx.de, linux-clk@vger.kernel.org, imx@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, p.zabel@pengutronix.de, shengjiu.wang@gmail.com Subject: [PATCH v3 5/6] clk: imx: clk-audiomix: Corrent parent clock for earc_phy and audpll Date: Tue, 14 May 2024 17:33:29 +0800 Message-Id: <1715679210-9588-6-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> References: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: According to Reference Manual of i.MX8MP The parent clock of "earc_phy" is "sai_pll_out_div2", The parent clock of "audpll" is "osc_24m". Add CLK_GATE_PARENT() macro for usage of specifying parent clock. Fixes: 6cd95f7b151c ("clk: imx: imx8mp: Add audiomix block control") Signed-off-by: Shengjiu Wang --- drivers/clk/imx/clk-imx8mp-audiomix.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mp-audiomix.c b/drivers/clk/imx/clk-imx8mp-audiomix.c index 466b5b0d665c..f4a02ae7e64f 100644 --- a/drivers/clk/imx/clk-imx8mp-audiomix.c +++ b/drivers/clk/imx/clk-imx8mp-audiomix.c @@ -154,6 +154,15 @@ static const struct clk_parent_data clk_imx8mp_audiomix_pll_bypass_sels[] = { PDM_SEL, 2, 0 \ } +#define CLK_GATE_PARENT(gname, cname, pname) \ + { \ + gname"_cg", \ + IMX8MP_CLK_AUDIOMIX_##cname, \ + { .fw_name = pname, .name = pname }, NULL, 1, \ + CLKEN0 + 4 * !!(IMX8MP_CLK_AUDIOMIX_##cname / 32), \ + 1, IMX8MP_CLK_AUDIOMIX_##cname % 32 \ + } + struct clk_imx8mp_audiomix_sel { const char *name; int clkid; @@ -171,14 +180,14 @@ static struct clk_imx8mp_audiomix_sel sels[] = { CLK_GATE("earc", EARC_IPG), CLK_GATE("ocrama", OCRAMA_IPG), CLK_GATE("aud2htx", AUD2HTX_IPG), - CLK_GATE("earc_phy", EARC_PHY), + CLK_GATE_PARENT("earc_phy", EARC_PHY, "sai_pll_out_div2"), CLK_GATE("sdma2", SDMA2_ROOT), CLK_GATE("sdma3", SDMA3_ROOT), CLK_GATE("spba2", SPBA2_ROOT), CLK_GATE("dsp", DSP_ROOT), CLK_GATE("dspdbg", DSPDBG_ROOT), CLK_GATE("edma", EDMA_ROOT), - CLK_GATE("audpll", AUDPLL_ROOT), + CLK_GATE_PARENT("audpll", AUDPLL_ROOT, "osc_24m"), CLK_GATE("mu2", MU2_ROOT), CLK_GATE("mu3", MU3_ROOT), CLK_PDM, From patchwork Tue May 14 09:33:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 13663940 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E91764CCC; Tue, 14 May 2024 10:08:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=92.121.34.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715681287; cv=none; b=Fa5RZAOkveMdiIMzRI4/whnjMQW+6i/AHwsXV3basJidtGy5hK66pbwVkJpkVnaPFFT87y7J8+yjG8m6vTJsHV84z7ZAk8/WflllJwaieNtgZ89kSiKpJej1J27xpdiYhhQCTh3tUzNelY3lTK31gOy+Z1nLh2uBTORWI9ewy9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715681287; c=relaxed/simple; bh=xjDz2Izt0vEcEs30HE8QpAJZW65ZIRs1wI1ol9QNFdU=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=HNqH4sM5gDYYTzUqqhYAScmi0SwklvMLjWdess8tyO4wPyHxaE6i1dgTX4haH5jBpYgNkQzWhltS9/JsxQfpMNHCvx0UcZKi7AczJ68CWFVz2jO4V9QW6RMZSIzu63ys+RkrFXHSyNV0r1c9JXkMJUOZyrHeekuvE44EiiYxAlA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; arc=none smtp.client-ip=92.121.34.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 38CCD1A1D45; Tue, 14 May 2024 11:53:05 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E53A51A1910; Tue, 14 May 2024 11:53:04 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 93FDF180222F; Tue, 14 May 2024 17:53:02 +0800 (+08) From: Shengjiu Wang To: abelvesa@kernel.org, peng.fan@nxp.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, marex@denx.de, linux-clk@vger.kernel.org, imx@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, p.zabel@pengutronix.de, shengjiu.wang@gmail.com Subject: [PATCH v3 6/6] arm64: dts: imx8mp: Add reset-controller sub node for audio_blk_ctrl Date: Tue, 14 May 2024 17:33:30 +0800 Message-Id: <1715679210-9588-7-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> References: <1715679210-9588-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The Audio Block Control contains clock distribution and gating controls, as well as reset handling to several of the AUDIOMIX peripherals. Especially the reset controls for Enhanced Audio Return Channel (EARC) PHY and Controller Add reset-controller sub-node for audio_blk_ctrl. Signed-off-by: Shengjiu Wang --- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi index 459c4a54d30e..f94702ad4210 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi @@ -1565,7 +1565,7 @@ sdma2: dma-controller@30e10000 { }; audio_blk_ctrl: clock-controller@30e20000 { - compatible = "fsl,imx8mp-audio-blk-ctrl"; + compatible = "fsl,imx8mp-audio-blk-ctrl", "syscon", "simple-mfd"; reg = <0x30e20000 0x10000>; #clock-cells = <1>; clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>, @@ -1582,6 +1582,11 @@ audio_blk_ctrl: clock-controller@30e20000 { assigned-clocks = <&clk IMX8MP_AUDIO_PLL1>, <&clk IMX8MP_AUDIO_PLL2>; assigned-clock-rates = <393216000>, <361267200>; + + audio_blk_ctrl_rst: reset-controller { + compatible = "fsl,imx8mp-audiomix-reset"; + #reset-cells = <1>; + }; }; };