From mboxrd@z Thu Jan 1 00:00:00 1970 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 2928FC3DA61 for ; Wed, 24 Jul 2024 14:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YHUDUJgFQkk56M3tPhaG8iM80Gr/MTDg6+/+3FYya8c=; b=deC0KlHvnCwwemlnpQYMmax279 iVID6FmR9I+UofhUiLsaxgh+kbaV9nFo6y8ZL8PLYt3HFSLz+UUaZAEymM9p9Fp8N+w6WKL2BREU2 z9wH90lHi9aY+rNaoK3qjMdW7KTqFlmMW3Tn8BtC8vjWP3qrH5WvFGp/O10Oqe0SHcNcMhONWn1u5 BPGM6hpAObSBwzls8xlAN48rf7IZpVKe1qGphbgOWoO7kl8cr67ggZ85cHOFwrHk2/NiLLGAoo5wP UYvhDPofeOmXtFxTk0GYSioLvyAfkf1OWuX/mP4eGuTmpzZ5M2hfENaT9pp/FeYxGN5WBcyP0i1Am q7Huj9FA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWdNd-0000000FgtJ-24lp; Wed, 24 Jul 2024 14:54:13 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWdNF-0000000FgmZ-0NAG for linux-arm-kernel@lists.infradead.org; Wed, 24 Jul 2024 14:53:50 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 84B0E60CF9; Wed, 24 Jul 2024 14:53:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE0E0C32781; Wed, 24 Jul 2024 14:53:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721832827; bh=EhGs3QHFWEAF4yCV+iWV8W/2NsVyT7nTpnaTm8KpojA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Y8w/ulxe88J1URS6wQyFwZkVk96GQDqEdMvZ/kNvD5gdyiNEYnmjJpdp3UfGhJaO1 ep0Wa8g0j2Rcto37s2A1/9Vsh4PodRY3AelZyYEARm5OOIH4OSWPLgaElb9FYPgRYA wf2gEc8rjccb2jqMqDvjnzjKe5Zr0G1fU5aHjfCv1rlsLJ3V1gINaoc1+2Ku6b6YUM lc1UiY3+ugOFBLyDazhUrEB5XtjAdAwZjfuh9UEI+N4VQElhqL1RQEzkOJTRqyusj5 Ss28XcUpzbYB4BrvWqE7syKnqiySR/RjW1SBbJO8bYUEMm3dNSyYBtrfoD35h91M0h TwkxB5OIhh1SA== Date: Wed, 24 Jul 2024 15:53:40 +0100 From: Lee Jones To: Claudiu Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, alexandre.belloni@bootlin.com, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Claudiu Beznea Subject: Re: [PATCH v2 02/11] mfd: renesas-vbattb: Add a MFD driver for the Renesas VBATTB IP Message-ID: <20240724145340.GZ501857@google.com> References: <20240716103025.1198495-1-claudiu.beznea.uj@bp.renesas.com> <20240716103025.1198495-3-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240716103025.1198495-3-claudiu.beznea.uj@bp.renesas.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240724_075349_284125_2C39893C X-CRM114-Status: GOOD ( 30.47 ) 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 On Tue, 16 Jul 2024, Claudiu wrote: > From: Claudiu Beznea > > Renesas VBATTB IP has logic to control the RTC clock, tamper detection > and a small 128B memory. Add a MFD driver to do the basic initialization > of the VBATTB IP for the inner components to work. > > Signed-off-by: Claudiu Beznea > --- > > Changes in v2: > - none; this driver is new > > drivers/mfd/Kconfig | 8 ++++ > drivers/mfd/Makefile | 1 + > drivers/mfd/renesas-vbattb.c | 78 ++++++++++++++++++++++++++++++++++++ > 3 files changed, 87 insertions(+) > create mode 100644 drivers/mfd/renesas-vbattb.c > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index bc8be2e593b6..df93e8b05065 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -1383,6 +1383,14 @@ config MFD_SC27XX_PMIC > This driver provides common support for accessing the SC27xx PMICs, > and it also adds the irq_chip parts for handling the PMIC chip events. > > +config MFD_RENESAS_VBATTB > + tristate "Renesas VBATTB driver" > + depends on (ARCH_RZG2L && OF) || COMPILE_TEST > + select MFD_CORE > + help > + Select this option to enable Renesas RZ/G3S VBATTB driver which > + provides support for the RTC clock, tamper detector and 128B SRAM. > + > config RZ_MTU3 > tristate "Renesas RZ/G2L MTU3a core driver" > depends on (ARCH_RZG2L && OF) || COMPILE_TEST > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > index 02b651cd7535..cd2f27492df2 100644 > --- a/drivers/mfd/Makefile > +++ b/drivers/mfd/Makefile > @@ -186,6 +186,7 @@ pcf50633-objs := pcf50633-core.o pcf50633-irq.o > obj-$(CONFIG_MFD_PCF50633) += pcf50633.o > obj-$(CONFIG_PCF50633_ADC) += pcf50633-adc.o > obj-$(CONFIG_PCF50633_GPIO) += pcf50633-gpio.o > +obj-$(CONFIG_MFD_RENESAS_VBATTB) += renesas-vbattb.o > obj-$(CONFIG_RZ_MTU3) += rz-mtu3.o > obj-$(CONFIG_ABX500_CORE) += abx500-core.o > obj-$(CONFIG_MFD_DB8500_PRCMU) += db8500-prcmu.o > diff --git a/drivers/mfd/renesas-vbattb.c b/drivers/mfd/renesas-vbattb.c > new file mode 100644 > index 000000000000..5d71565b8cbf > --- /dev/null > +++ b/drivers/mfd/renesas-vbattb.c > @@ -0,0 +1,78 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * VBATTB driver > + * > + * Copyright (C) 2024 Renesas Electronics Corp. > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +static int vbattb_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct reset_control *rstc; > + int ret; > + > + rstc = devm_reset_control_array_get_exclusive(dev); > + if (IS_ERR(rstc)) > + return PTR_ERR(rstc); > + > + ret = devm_pm_runtime_enable(dev); > + if (ret) > + return ret; > + > + ret = pm_runtime_resume_and_get(dev); > + if (ret) > + return ret; > + > + ret = reset_control_deassert(rstc); > + if (ret) > + goto rpm_put; > + > + platform_set_drvdata(pdev, rstc); Where is this consumed? > + ret = devm_of_platform_populate(dev); Which devices will this probe? > + if (ret) > + goto reset_assert; > + > + return 0; > + > +reset_assert: > + reset_control_assert(rstc); > +rpm_put: > + pm_runtime_put(dev); > + return ret; > +} > + > +static void vbattb_remove(struct platform_device *pdev) > +{ > + struct reset_control *rstc = platform_get_drvdata(pdev); > + > + reset_control_assert(rstc); > + pm_runtime_put(&pdev->dev); > +} > + > +static const struct of_device_id vbattb_match[] = { > + { .compatible = "renesas,r9a08g045-vbattb" }, > + { /* sentinel */ }, > +}; > +MODULE_DEVICE_TABLE(of, vbattb_match); > + > +static struct platform_driver vbattb_driver = { > + .probe = vbattb_probe, > + .remove_new = vbattb_remove, > + .driver = { > + .name = "renesas-vbattb", > + .of_match_table = vbattb_match, > + }, > +}; > +module_platform_driver(vbattb_driver); > + > +MODULE_ALIAS("platform:renesas-vbattb"); > +MODULE_AUTHOR("Claudiu Beznea "); > +MODULE_DESCRIPTION("Renesas VBATTB driver"); > +MODULE_LICENSE("GPL"); > -- > 2.39.2 > -- Lee Jones [李琼斯]