[PATCH v13 2/3] soc: sophgo: cv1800: rtcsys: New driver (handling RTC only)

Alexander Sverdlin posted 3 patches 11 months ago
There is a newer version of this series
[PATCH v13 2/3] soc: sophgo: cv1800: rtcsys: New driver (handling RTC only)
Posted by Alexander Sverdlin 11 months ago
Add driver for Sophgo CV1800 series SoC RTC subsystem. 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@gmail.com>
---
Changelog:
v13:
- Moved the driver from MFD into SOC subsystem
- Dropped unused "cv1800_rtcsys_rtc_subdev"
v12:
- new patch

 MAINTAINERS                        |  1 +
 drivers/soc/Kconfig                |  1 +
 drivers/soc/Makefile               |  1 +
 drivers/soc/sophgo/Kconfig         | 24 ++++++++++++
 drivers/soc/sophgo/Makefile        |  3 ++
 drivers/soc/sophgo/cv1800-rtcsys.c | 63 ++++++++++++++++++++++++++++++
 6 files changed, 93 insertions(+)
 create mode 100644 drivers/soc/sophgo/Kconfig
 create mode 100644 drivers/soc/sophgo/Makefile
 create mode 100644 drivers/soc/sophgo/cv1800-rtcsys.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 3eee238c2ea2..ac15e448fffb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22354,6 +22354,7 @@ L:	sophgo@lists.linux.dev
 W:	https://github.com/sophgo/linux/wiki
 T:	git https://github.com/sophgo/linux.git
 S:	Maintained
+F:	drivers/soc/sophgo/cv1800-rtcsys.c
 N:	sophgo
 K:	sophgo
 
diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index 6a8daeb8c4b9..11e2383c0654 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -23,6 +23,7 @@ source "drivers/soc/qcom/Kconfig"
 source "drivers/soc/renesas/Kconfig"
 source "drivers/soc/rockchip/Kconfig"
 source "drivers/soc/samsung/Kconfig"
+source "drivers/soc/sophgo/Kconfig"
 source "drivers/soc/sunxi/Kconfig"
 source "drivers/soc/tegra/Kconfig"
 source "drivers/soc/ti/Kconfig"
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index 2037a8695cb2..0381a0abdec8 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -29,6 +29,7 @@ obj-y				+= qcom/
 obj-y				+= renesas/
 obj-y				+= rockchip/
 obj-$(CONFIG_SOC_SAMSUNG)	+= samsung/
+obj-y				+= sophgo/
 obj-y				+= sunxi/
 obj-$(CONFIG_ARCH_TEGRA)	+= tegra/
 obj-y				+= ti/
diff --git a/drivers/soc/sophgo/Kconfig b/drivers/soc/sophgo/Kconfig
new file mode 100644
index 000000000000..e50666e423a9
--- /dev/null
+++ b/drivers/soc/sophgo/Kconfig
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Sophgo/Cvitek SoC drivers
+#
+
+if ARCH_SOPHGO || COMPILE_TEST
+menu "Sophgo/Cvitek SoC drivers"
+
+config SOPHGO_CV1800_RTCSYS
+	tristate "Sophgo CV1800 RTC MFD"
+	default y if 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.
+
+endmenu
+endif
diff --git a/drivers/soc/sophgo/Makefile b/drivers/soc/sophgo/Makefile
new file mode 100644
index 000000000000..8f22b4e79311
--- /dev/null
+++ b/drivers/soc/sophgo/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_SOPHGO_CV1800_RTCSYS)	+= cv1800-rtcsys.o
diff --git a/drivers/soc/sophgo/cv1800-rtcsys.c b/drivers/soc/sophgo/cv1800-rtcsys.c
new file mode 100644
index 000000000000..cb271f02afcc
--- /dev/null
+++ b/drivers/soc/sophgo/cv1800-rtcsys.c
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Driver for Sophgo CV1800 series SoC RTC subsystem
+ *
+ * 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@gmail.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 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@gmail.com>");
+MODULE_DESCRIPTION("Sophgo CV1800 series SoC RTC subsystem driver");
+MODULE_LICENSE("GPL");
-- 
2.48.1
Re: [PATCH v13 2/3] soc: sophgo: cv1800: rtcsys: New driver (handling RTC only)
Posted by Inochi Amaoto 11 months ago
On Sun, Mar 09, 2025 at 09:26:24PM +0100, Alexander Sverdlin wrote:
> Add driver for Sophgo CV1800 series SoC RTC subsystem. 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@gmail.com>
> ---
> Changelog:
> v13:
> - Moved the driver from MFD into SOC subsystem
> - Dropped unused "cv1800_rtcsys_rtc_subdev"
> v12:
> - new patch
> 
>  MAINTAINERS                        |  1 +
>  drivers/soc/Kconfig                |  1 +
>  drivers/soc/Makefile               |  1 +
>  drivers/soc/sophgo/Kconfig         | 24 ++++++++++++
>  drivers/soc/sophgo/Makefile        |  3 ++
>  drivers/soc/sophgo/cv1800-rtcsys.c | 63 ++++++++++++++++++++++++++++++
>  6 files changed, 93 insertions(+)
>  create mode 100644 drivers/soc/sophgo/Kconfig
>  create mode 100644 drivers/soc/sophgo/Makefile
>  create mode 100644 drivers/soc/sophgo/cv1800-rtcsys.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3eee238c2ea2..ac15e448fffb 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -22354,6 +22354,7 @@ L:	sophgo@lists.linux.dev
>  W:	https://github.com/sophgo/linux/wiki
>  T:	git https://github.com/sophgo/linux.git
>  S:	Maintained

> +F:	drivers/soc/sophgo/cv1800-rtcsys.c

Please change to the drivers/soc/sophgo/.
We should maintain all files under this.

>  N:	sophgo
>  K:	sophgo
>  
> diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
> index 6a8daeb8c4b9..11e2383c0654 100644
> --- a/drivers/soc/Kconfig
> +++ b/drivers/soc/Kconfig
> @@ -23,6 +23,7 @@ source "drivers/soc/qcom/Kconfig"
>  source "drivers/soc/renesas/Kconfig"
>  source "drivers/soc/rockchip/Kconfig"
>  source "drivers/soc/samsung/Kconfig"
> +source "drivers/soc/sophgo/Kconfig"
>  source "drivers/soc/sunxi/Kconfig"
>  source "drivers/soc/tegra/Kconfig"
>  source "drivers/soc/ti/Kconfig"
> diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
> index 2037a8695cb2..0381a0abdec8 100644
> --- a/drivers/soc/Makefile
> +++ b/drivers/soc/Makefile
> @@ -29,6 +29,7 @@ obj-y				+= qcom/
>  obj-y				+= renesas/
>  obj-y				+= rockchip/
>  obj-$(CONFIG_SOC_SAMSUNG)	+= samsung/
> +obj-y				+= sophgo/
>  obj-y				+= sunxi/
>  obj-$(CONFIG_ARCH_TEGRA)	+= tegra/
>  obj-y				+= ti/
> diff --git a/drivers/soc/sophgo/Kconfig b/drivers/soc/sophgo/Kconfig
> new file mode 100644
> index 000000000000..e50666e423a9
> --- /dev/null
> +++ b/drivers/soc/sophgo/Kconfig
> @@ -0,0 +1,24 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +#
> +# Sophgo/Cvitek SoC drivers
> +#
> +
> +if ARCH_SOPHGO || COMPILE_TEST

> +menu "Sophgo/Cvitek SoC drivers"

No Cvitek, only left Sophgo here.

> +
> +config SOPHGO_CV1800_RTCSYS
> +	tristate "Sophgo CV1800 RTC MFD"

> +	default y if COMPILE_TEST

I do not think it is necessary.

> +	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.
> +
> +endmenu
> +endif
> diff --git a/drivers/soc/sophgo/Makefile b/drivers/soc/sophgo/Makefile
> new file mode 100644
> index 000000000000..8f22b4e79311
> --- /dev/null
> +++ b/drivers/soc/sophgo/Makefile
> @@ -0,0 +1,3 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +obj-$(CONFIG_SOPHGO_CV1800_RTCSYS)	+= cv1800-rtcsys.o
> diff --git a/drivers/soc/sophgo/cv1800-rtcsys.c b/drivers/soc/sophgo/cv1800-rtcsys.c
> new file mode 100644
> index 000000000000..cb271f02afcc
> --- /dev/null
> +++ b/drivers/soc/sophgo/cv1800-rtcsys.c
> @@ -0,0 +1,63 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Driver for Sophgo CV1800 series SoC RTC subsystem
> + *
> + * 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@gmail.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",

Make this a specifc one, like "sophgo,cv1800b-rtc"

> +		.num_resources = 1,
> +		.resources = &cv1800_rtcsys_irq_resources[0],
> +	},
> +};
> +
> +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@gmail.com>");
> +MODULE_DESCRIPTION("Sophgo CV1800 series SoC RTC subsystem driver");
> +MODULE_LICENSE("GPL");
> -- 
> 2.48.1
>
Re: [PATCH v13 2/3] soc: sophgo: cv1800: rtcsys: New driver (handling RTC only)
Posted by Alexander Sverdlin 11 months ago
Hi Inochi!

On Fri, 2025-03-14 at 08:51 +0800, Inochi Amaoto wrote:
> On Sun, Mar 09, 2025 at 09:26:24PM +0100, Alexander Sverdlin wrote:
> > Add driver for Sophgo CV1800 series SoC RTC subsystem. 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@gmail.com>

...

> > +++ b/drivers/soc/sophgo/Kconfig
> > @@ -0,0 +1,24 @@
> > +# SPDX-License-Identifier: GPL-2.0-only
> > +#
> > +# Sophgo/Cvitek SoC drivers
> > +#
> > +
> > +if ARCH_SOPHGO || COMPILE_TEST
> 
> > +menu "Sophgo/Cvitek SoC drivers"
> 
> No Cvitek, only left Sophgo here.
> 
> > +
> > +config SOPHGO_CV1800_RTCSYS
> > +	tristate "Sophgo CV1800 RTC MFD"
> 
> > +	default y if COMPILE_TEST
> 
> I do not think it is necessary.

Maybe it should have been

tristate "Sophgo CV1800 RTC MFD" if COMPILE_TEST

like others do?

-- 
Alexander Sverdlin.
Re: [PATCH v13 2/3] soc: sophgo: cv1800: rtcsys: New driver (handling RTC only)
Posted by Inochi Amaoto 11 months ago
On Sat, Mar 15, 2025 at 04:55:57PM +0100, Alexander Sverdlin wrote:
> Hi Inochi!
> 
> On Fri, 2025-03-14 at 08:51 +0800, Inochi Amaoto wrote:
> > On Sun, Mar 09, 2025 at 09:26:24PM +0100, Alexander Sverdlin wrote:
> > > Add driver for Sophgo CV1800 series SoC RTC subsystem. 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@gmail.com>
> 
> ...
> 
> > > +++ b/drivers/soc/sophgo/Kconfig
> > > @@ -0,0 +1,24 @@
> > > +# SPDX-License-Identifier: GPL-2.0-only
> > > +#
> > > +# Sophgo/Cvitek SoC drivers
> > > +#
> > > +
> > > +if ARCH_SOPHGO || COMPILE_TEST
> > 
> > > +menu "Sophgo/Cvitek SoC drivers"
> > 
> > No Cvitek, only left Sophgo here.
> > 
> > > +
> > > +config SOPHGO_CV1800_RTCSYS
> > > +	tristate "Sophgo CV1800 RTC MFD"
> > 
> > > +	default y if COMPILE_TEST
> > 
> > I do not think it is necessary.
> 
> Maybe it should have been
> 
> tristate "Sophgo CV1800 RTC MFD" if COMPILE_TEST
> 
> like others do?
> 

No, you needn't. The first line "if ARCH_SOPHGO || COMPILE_TEST"
already does the expected things. This is equal to remove this 
"if" and add a line "depends on ARCH_SOPHGO || COMPILE_TEST" to
this entry. Just remove the default line, and everything is OK.

Regards,
Inochi
Re: [PATCH v13 2/3] soc: sophgo: cv1800: rtcsys: New driver (handling RTC only)
Posted by Alexander Sverdlin 11 months ago
Hi Inochi!

On Fri, 2025-03-14 at 08:51 +0800, Inochi Amaoto wrote:
> On Sun, Mar 09, 2025 at 09:26:24PM +0100, Alexander Sverdlin wrote:
> > Add driver for Sophgo CV1800 series SoC RTC subsystem. 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@gmail.com>

...

> > 
> >   MAINTAINERS                        |  1 +
> >   drivers/soc/Kconfig                |  1 +
> >   drivers/soc/Makefile               |  1 +
> >   drivers/soc/sophgo/Kconfig         | 24 ++++++++++++
> >   drivers/soc/sophgo/Makefile        |  3 ++
> >   drivers/soc/sophgo/cv1800-rtcsys.c | 63 ++++++++++++++++++++++++++++++
> >   6 files changed, 93 insertions(+)
> >   create mode 100644 drivers/soc/sophgo/Kconfig
> >   create mode 100644 drivers/soc/sophgo/Makefile
> >   create mode 100644 drivers/soc/sophgo/cv1800-rtcsys.c
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 3eee238c2ea2..ac15e448fffb 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -22354,6 +22354,7 @@ L:	sophgo@lists.linux.dev
> >   W:	https://github.com/sophgo/linux/wiki
> >   T:	git https://github.com/sophgo/linux.git
> >   S:	Maintained
> 
> > +F:	drivers/soc/sophgo/cv1800-rtcsys.c
> 
> Please change to the drivers/soc/sophgo/.
> We should maintain all files under this.
> 
> >   N:	sophgo

I suppose my F: entry is actually superfluous because of the above
N: entry and can be removed altogether?

-- 
Alexander Sverdlin.
Re: [PATCH v13 2/3] soc: sophgo: cv1800: rtcsys: New driver (handling RTC only)
Posted by Inochi Amaoto 11 months ago
On Sat, Mar 15, 2025 at 12:43:19PM +0100, Alexander Sverdlin wrote:
> Hi Inochi!
> 
> On Fri, 2025-03-14 at 08:51 +0800, Inochi Amaoto wrote:
> > On Sun, Mar 09, 2025 at 09:26:24PM +0100, Alexander Sverdlin wrote:
> > > Add driver for Sophgo CV1800 series SoC RTC subsystem. 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@gmail.com>
> 
> ...
> 
> > > 
> > >   MAINTAINERS                        |  1 +
> > >   drivers/soc/Kconfig                |  1 +
> > >   drivers/soc/Makefile               |  1 +
> > >   drivers/soc/sophgo/Kconfig         | 24 ++++++++++++
> > >   drivers/soc/sophgo/Makefile        |  3 ++
> > >   drivers/soc/sophgo/cv1800-rtcsys.c | 63 ++++++++++++++++++++++++++++++
> > >   6 files changed, 93 insertions(+)
> > >   create mode 100644 drivers/soc/sophgo/Kconfig
> > >   create mode 100644 drivers/soc/sophgo/Makefile
> > >   create mode 100644 drivers/soc/sophgo/cv1800-rtcsys.c
> > > 
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index 3eee238c2ea2..ac15e448fffb 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -22354,6 +22354,7 @@ L:	sophgo@lists.linux.dev
> > >   W:	https://github.com/sophgo/linux/wiki
> > >   T:	git https://github.com/sophgo/linux.git
> > >   S:	Maintained
> > 
> > > +F:	drivers/soc/sophgo/cv1800-rtcsys.c
> > 
> > Please change to the drivers/soc/sophgo/.
> > We should maintain all files under this.
> > 
> > >   N:	sophgo
> 
> I suppose my F: entry is actually superfluous because of the above
> N: entry and can be removed altogether?
> 

It is fine to tell others we do maintain these files, so it 
is fine for me to keep the entry point to "drivers/soc/sophgo/".

Regards,
Inochi
Re: [PATCH v13 2/3] soc: sophgo: cv1800: rtcsys: New driver (handling RTC only)
Posted by Alexander Sverdlin 11 months ago
Hi Inochi!

On Fri, 2025-03-14 at 08:51 +0800, Inochi Amaoto wrote:
> On Sun, Mar 09, 2025 at 09:26:24PM +0100, Alexander Sverdlin wrote:
> > Add driver for Sophgo CV1800 series SoC RTC subsystem. 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.
> > 

...

> > +++ b/drivers/soc/sophgo/cv1800-rtcsys.c
> > @@ -0,0 +1,63 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Driver for Sophgo CV1800 series SoC RTC subsystem
> > + *
> > + * 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@gmail.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",
> 
> Make this a specifc one, like "sophgo,cv1800b-rtc"

Could it be that you mixed up device instance name and "compatible"?

Please refer to all other MFD cells with `grep -C3 -R -F "struct mfd_cell"`
either in drivers/soc or in drivers/mfd, there are no vendor prefixes in the
names.

-- 
Alexander Sverdlin.
Re: [PATCH v13 2/3] soc: sophgo: cv1800: rtcsys: New driver (handling RTC only)
Posted by Inochi Amaoto 11 months ago
On Fri, Mar 14, 2025 at 10:31:09AM +0100, Alexander Sverdlin wrote:
> Hi Inochi!
> 
> On Fri, 2025-03-14 at 08:51 +0800, Inochi Amaoto wrote:
> > On Sun, Mar 09, 2025 at 09:26:24PM +0100, Alexander Sverdlin wrote:
> > > Add driver for Sophgo CV1800 series SoC RTC subsystem. 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.
> > > 
> 
> ...
> 
> > > +++ b/drivers/soc/sophgo/cv1800-rtcsys.c
> > > @@ -0,0 +1,63 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + * Driver for Sophgo CV1800 series SoC RTC subsystem
> > > + *
> > > + * 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@gmail.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",
> > 
> > Make this a specifc one, like "sophgo,cv1800b-rtc"
> 
> Could it be that you mixed up device instance name and "compatible"?
> 
> Please refer to all other MFD cells with `grep -C3 -R -F "struct mfd_cell"`
> either in drivers/soc or in drivers/mfd, there are no vendor prefixes in the
> names.
> 

Yeah, I misunderstand this, but at least please specific name as 
"cv1800b-rtc". This is more accuracy.

Regards,
Inochi