Received: by 2002:ab2:6f44:0:b0:1fd:c486:4f03 with SMTP id l4csp238252lqq; Thu, 13 Jun 2024 01:19:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWC096LbXK3Je86Jjsu6LMbI+DvSNQ3DXKSMf7H876BpjXQuyUUwOwj2yck/1EznpH2UsGPnVN2U32HLdAkFzVwLw/pKOEBoVwpuXRaIg== X-Google-Smtp-Source: AGHT+IHTzXPH1klZEtrCYX947dFgLD/BryRCL9Pk7W1CV8DHOH3Lwqh+2Gypas2es7flyWGCp1ni X-Received: by 2002:a05:6a00:1891:b0:702:38e9:f1d with SMTP id d2e1a72fcca58-705bce4f92cmr4274817b3a.10.1718266784125; Thu, 13 Jun 2024 01:19:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718266784; cv=pass; d=google.com; s=arc-20160816; b=KEEYDQ6Ws/aEEccglsaWUxfel4kiBYy+pOPpd7nxC8uW8KQDcz0PKgq2WWHp3Pvj7T M4G6nIZDweiCIH8APgocvZq0qc1uJnvPN/p+p3o0H/0vvb9t8BrAN2ywwDnP/T22WfcK 3FCHJd84ohevN66aeO6MPQ9mqSMndlKMluQVxokvT08fMBvTnBryLwqOr+8yw2Qb0Ocx vNcjyUQ43LOVbwtYbYrSpAqo5lgg0ZsDRs0TduLqAonG4AjDTzhU/hQzJmFv4Ad1pXto qw7U2fMszdvTAuyiNTCS3gbA1fVLShfPZI22w51ClY+15O87drnq8n1x/g4JOCVZzUw0 ctfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=1jRQhSOhh5bya0Ey5BNd2VltBD1CvEs98ZQu9kfiU8E=; fh=PeKW958AwgKzhYscmIoJcU7loVjPSvO/ztxzruXrjC0=; b=ZVZiJuBV0c7VclwUX9cdzbWkkCoikLCf58uuNBUtLrB86F4KQ7llSxZ74RMrIape17 WJKFfwD/Oe861hw2bd54X3uKQjzVK36Xq6JnGpjbm58iVQQK5Dd1KYtRUjchSBOiTlDb NA1upox0bro4VJrwF1K+UGuSAAiYMuCOcU3ct470Hnj9wjFl5Y372d5wKrHXo28OQ2gm t/+XIRlAs9FJLaCmvbRmzdpDrkJtZZHmzd++A483lneWyiTRLbvT/DxfgwwJ6JCClpa9 wUxdjvk4Zx7CUJflFD/rFy6b3hXdyi0huQDlrUWEPr6pVNM51zIb8ZBMBB1m9e8AZRpC NAxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-212785-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212785-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-705cc962566si962022b3a.114.2024.06.13.01.19.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 01:19:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212785-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-212785-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212785-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0E147B24E7A for ; Thu, 13 Jun 2024 08:15:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D161213D2A3; Thu, 13 Jun 2024 08:15:27 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 B355C13C9D2 for ; Thu, 13 Jun 2024 08:15:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718266527; cv=none; b=KyB4BPOU24cqCzD5JzurjGmnMo3xnRfz/jJ05ezUJ6SAha3a0ZjXk0BR2a1b4ncj8ZOk+BkxoSLj6op2sGHXdizE33igimFxA2iwq+ONbodviEnTJgWqrtSuRFkU20q0gEHjMGd+eWcK4RxrvE20vn2SMfZ3ZSYqaBYiEIIFzik= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718266527; c=relaxed/simple; bh=rXEKRMvId4ve84z8AItG3uwUw0AENm9bXkidn6KfjDk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ka9efXrdRsTUIwz+W+DluI+UUprDQQXGO/NfYMycvj3Dl4LtW35cKKYe0R1HhD0dsddGHUcKqqi+hpw3pmAToQ2BBFLxibUtBE8tOJEB5fq5jKiIonNVkAub8XxMAaez8PQzbYV0DXie7MLoUZcZhI0r4b9f151WthbxLZvdbQw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sHfbn-00036N-8G; Thu, 13 Jun 2024 10:14:59 +0200 Received: from [2a0a:edc0:2:b01:1d::c5] (helo=pty.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sHfbm-001yyc-B2; Thu, 13 Jun 2024 10:14:58 +0200 Received: from mfe by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1sHfbm-008PUZ-0m; Thu, 13 Jun 2024 10:14:58 +0200 Date: Thu, 13 Jun 2024 10:14:58 +0200 From: Marco Felsch To: Shengjiu Wang Cc: p.zabel@pengutronix.de, 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, shengjiu.wang@gmail.com Subject: Re: [PATCH v7 3/5] reset: imx8mp-audiomix: Add AudioMix Block Control reset driver Message-ID: <20240613081458.idnrarxjwoau2eoa@pengutronix.de> References: <1718243482-18552-1-git-send-email-shengjiu.wang@nxp.com> <1718243482-18552-4-git-send-email-shengjiu.wang@nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1718243482-18552-4-git-send-email-shengjiu.wang@nxp.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Hi, On 24-06-13, Shengjiu Wang wrote: > Add support for the resets on i.MX8MP Audio Block Control module, > which includes the EARC PHY software reset and EARC controller > software reset. The reset controller is created using the auxiliary > device framework and set up in the clock driver. thanks a lot for converting it to the single purpose driver. > Signed-off-by: Shengjiu Wang > --- > drivers/reset/Kconfig | 8 ++ > drivers/reset/Makefile | 1 + > drivers/reset/reset-imx8mp-audiomix.c | 103 ++++++++++++++++++++++++++ > 3 files changed, 112 insertions(+) > create mode 100644 drivers/reset/reset-imx8mp-audiomix.c > > diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig > index 7112f5932609..b3c0e528d08c 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 CLK_IMX8MP > + select AUXILIARY_BUS > + default CLK_IMX8MP > + 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..f3f9f5420c14 > --- /dev/null > +++ b/drivers/reset/reset-imx8mp-audiomix.c > @@ -0,0 +1,103 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright 2024 NXP > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define EARC 0x200 > +#define EARC_RESET_MASK 0x3 > + > +struct imx8mp_audiomix_reset_priv { ^ Nit: the _priv can be dropped. > + struct reset_controller_dev rcdev; > + void __iomem *base; > +}; > + > +static int imx8mp_audiomix_reset_assert(struct reset_controller_dev *rcdev, > + unsigned long id) > +{ > + struct imx8mp_audiomix_reset_priv *priv = container_of(rcdev, > + struct imx8mp_audiomix_reset_priv, rcdev); Nit: static struct imx8mp_audiomix_reset *to_imx8mp_audiomix_reset(struct reset_controller_dev *rcdev) { return container_of(rcdev, struct imx8mp_audiomix_reset, rcdev); } struct imx8mp_audiomix_reset *priv = to_imx8mp_audiomix_reset(rcdev); Since both nits are cosmetic feel free to add my: Reviewed-by: Marco Felsch Regards, Marco > + void __iomem *reg_addr = priv->base; > + unsigned int mask, reg; > + > + if (id >= fls(EARC_RESET_MASK)) > + return -EINVAL; > + > + mask = BIT(id); > + reg = readl(reg_addr + EARC); > + writel(reg & ~mask, reg_addr + EARC); > + > + return 0; > +} > + > +static int imx8mp_audiomix_reset_deassert(struct reset_controller_dev *rcdev, > + unsigned long id) > +{ > + struct imx8mp_audiomix_reset_priv *priv = container_of(rcdev, > + struct imx8mp_audiomix_reset_priv, rcdev); > + void __iomem *reg_addr = priv->base; > + unsigned int mask, reg; > + > + if (id >= fls(EARC_RESET_MASK)) > + return -EINVAL; > + > + mask = BIT(id); > + reg = readl(reg_addr + EARC); > + writel(reg | mask, reg_addr + EARC); > + > + return 0; > +} > + > +static const struct reset_control_ops imx8mp_audiomix_reset_ops = { > + .assert = imx8mp_audiomix_reset_assert, > + .deassert = imx8mp_audiomix_reset_deassert, > +}; > + > +static int imx8mp_audiomix_reset_probe(struct auxiliary_device *adev, > + const struct auxiliary_device_id *id) > +{ > + struct imx8mp_audiomix_reset_priv *priv; > + struct device *dev = &adev->dev; > + > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + > + priv->rcdev.owner = THIS_MODULE; > + priv->rcdev.nr_resets = fls(EARC_RESET_MASK); > + priv->rcdev.ops = &imx8mp_audiomix_reset_ops; > + priv->rcdev.of_node = dev->parent->of_node; > + priv->rcdev.dev = dev; > + priv->rcdev.of_reset_n_cells = 1; > + priv->base = of_iomap(dev->parent->of_node, 0); > + > + return devm_reset_controller_register(dev, &priv->rcdev); > +} > + > +static const struct auxiliary_device_id imx8mp_audiomix_reset_ids[] = { > + { > + .name = "clk_imx8mp_audiomix.reset", > + }, > + { } > +}; > +MODULE_DEVICE_TABLE(auxiliary, imx8mp_audiomix_reset_ids); > + > +static struct auxiliary_driver imx8mp_audiomix_reset_driver = { > + .probe = imx8mp_audiomix_reset_probe, > + .id_table = imx8mp_audiomix_reset_ids, > +}; > + > +module_auxiliary_driver(imx8mp_audiomix_reset_driver); > + > +MODULE_AUTHOR("Shengjiu Wang "); > +MODULE_DESCRIPTION("Freescale i.MX8MP Audio Block Controller reset driver"); > +MODULE_LICENSE("GPL"); > -- > 2.34.1 > > >