[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250306003211.GA8350@google.com>
Date: Wed, 5 Mar 2025 16:32:11 -0800
From: Lee Jones <lee@...nel.org>
To: Alexander Sverdlin <alexander.sverdlin@...il.com>
Cc: devicetree@...r.kernel.org, linux-riscv@...ts.infradead.org,
linux-rtc@...r.kernel.org, Inochi Amaoto <inochiama@...il.com>,
dlan@...too.org, linux-kernel@...r.kernel.org,
Jingbao Qiu <qiujingbao.dlmu@...il.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Chen Wang <unicorn_wang@...look.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
sophgo@...ts.linux.dev
Subject: Re: [PATCH v12 2/3] mfd: sophgo: cv1800: rtcsys: New driver
(handling RTC only)
On Sun, 02 Mar 2025, Alexander Sverdlin wrote:
> Add driver for Sophgo CV1800 series SoC RTC MFD. The RTC module comprises
> a 32kHz oscillator, Power-on-Reset (PoR) sub-module, HW state machine to
> control chip power-on, power-off and reset. Furthermore, the 8051 subsystem
> is located within RTCSYS including associated SRAM block.
>
> This patch only populates RTC sub-device.
>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@...il.com>
> ---
> Changelog:
> v12:
> - new patch
>
> MAINTAINERS | 1 +
> drivers/mfd/Kconfig | 14 ++++++++
> drivers/mfd/Makefile | 1 +
> drivers/mfd/cv1800-rtcsys.c | 66 +++++++++++++++++++++++++++++++++++++
> 4 files changed, 82 insertions(+)
> create mode 100644 drivers/mfd/cv1800-rtcsys.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 92fc0eca7061..446156998380 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -22185,6 +22185,7 @@ M: Chen Wang <unicorn_wang@...look.com>
> M: Inochi Amaoto <inochiama@...look.com>
> T: git https://github.com/sophgo/linux.git
> S: Maintained
> +F: drivers/mfd/cv1800-rtcsys.c
> N: sophgo
> K: sophgo
>
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 6b0682af6e32..842cc4d95c4b 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -285,6 +285,20 @@ config MFD_CS42L43_SDW
> Select this to support the Cirrus Logic CS42L43 PC CODEC with
> headphone and class D speaker drivers over SoundWire.
>
> +config MFD_CV1800_RTCSYS
> + tristate "Sophgo CV1800 RTC MFD"
> + depends on ARCH_SOPHGO || COMPILE_TEST
> + select MFD_CORE
> + help
> + If you say yes here you get support the RTC MFD driver for Sophgo
> + CV1800 series SoC. The RTC module comprises a 32kHz oscillator,
> + Power-on-Reset (PoR) sub-module, HW state machine to control chip
> + power-on, power-off and reset. Furthermore, the 8051 subsystem is
> + located within RTCSYS including associated SRAM block.
> +
> + This driver can also be built as a module. If so, the module will be
> + called cv1800-rtcsys.
> +
> config MFD_MADERA
> tristate "Cirrus Logic Madera codecs"
> select MFD_CORE
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 9220eaf7cf12..3cf03ffeedbb 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -18,6 +18,7 @@ obj-$(CONFIG_MFD_CROS_EC_DEV) += cros_ec_dev.o
> obj-$(CONFIG_MFD_CS42L43) += cs42l43.o
> obj-$(CONFIG_MFD_CS42L43_I2C) += cs42l43-i2c.o
> obj-$(CONFIG_MFD_CS42L43_SDW) += cs42l43-sdw.o
> +obj-$(CONFIG_MFD_CV1800_RTCSYS) += cv1800-rtcsys.o
> obj-$(CONFIG_MFD_ENE_KB3930) += ene-kb3930.o
> obj-$(CONFIG_MFD_EXYNOS_LPASS) += exynos-lpass.o
> obj-$(CONFIG_MFD_GATEWORKS_GSC) += gateworks-gsc.o
> diff --git a/drivers/mfd/cv1800-rtcsys.c b/drivers/mfd/cv1800-rtcsys.c
> new file mode 100644
> index 000000000000..72d11284f1de
> --- /dev/null
> +++ b/drivers/mfd/cv1800-rtcsys.c
> @@ -0,0 +1,66 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Driver for Sophgo CV1800 series SoC RTC MFD
> + *
> + * The RTC module comprises a 32kHz oscillator, Power-on-Reset (PoR) sub-module,
> + * HW state machine to control chip power-on, power-off and reset. Furthermore,
> + * the 8051 subsystem is located within RTCSYS including associated SRAM block.
> + *
> + * Copyright (C) 2025 Alexander Sverdlin <alexander.sverdlin@...il.com>
> + *
> + */
> +
> +#include <linux/mfd/core.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/property.h>
> +
> +static struct resource cv1800_rtcsys_irq_resources[] = {
> + DEFINE_RES_IRQ_NAMED(0, "alarm"),
> +};
> +
> +static const struct mfd_cell cv1800_rtcsys_subdev[] = {
> + {
> + .name = "cv1800-rtc",
> + .num_resources = 1,
> + .resources = &cv1800_rtcsys_irq_resources[0],
> + },
> +};
> +
> +static const struct mfd_cell cv1800_rtcsys_rtc_subdev =
> + MFD_CELL_NAME("cv1800-rtc");
How is this different from the one above?
Adding a single device does not constitute an MFD.
> +static int cv1800_rtcsys_probe(struct platform_device *pdev)
> +{
> + int irq;
> +
> + irq = platform_get_irq_byname(pdev, "alarm");
> + if (irq < 0)
> + return irq;
> + cv1800_rtcsys_irq_resources[0].start = irq;
> + cv1800_rtcsys_irq_resources[0].end = irq;
> +
> + return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
> + cv1800_rtcsys_subdev,
> + ARRAY_SIZE(cv1800_rtcsys_subdev),
> + NULL, 0, NULL);
> +}
> +
> +static const struct of_device_id cv1800_rtcsys_of_match[] = {
> + { .compatible = "sophgo,cv1800b-rtc" },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, cv1800_rtcsys_of_match);
> +
> +static struct platform_driver cv1800_rtcsys_mfd = {
> + .probe = cv1800_rtcsys_probe,
> + .driver = {
> + .name = "cv1800_rtcsys",
> + .of_match_table = cv1800_rtcsys_of_match,
> + },
> +};
> +module_platform_driver(cv1800_rtcsys_mfd);
> +
> +MODULE_AUTHOR("Alexander Sverdlin <alexander.sverdlin@...il.com>");
> +MODULE_DESCRIPTION("Sophgo CV1800 series SoC RTC MFD driver");
> +MODULE_LICENSE("GPL");
> --
> 2.48.1
>
--
Lee Jones [李琼斯]
Powered by blists - more mailing lists