diff mbox series

[v2,2/4] reset: sophgo: add SG2042 reset generator driver

Message ID 34650036ea5f1c500da54c67c3a67b91c4419399.1706161530.git.unicorn_wang@outlook.com (mailing list archive)
State Superseded
Headers show
Series riscv: sophgo: add reset support for SG2042 | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR success PR summary
conchuod/patch-2-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh
conchuod/patch-2-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh
conchuod/patch-2-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh
conchuod/patch-2-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh
conchuod/patch-2-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh
conchuod/patch-2-test-6 warning .github/scripts/patches/tests/checkpatch.sh
conchuod/patch-2-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh
conchuod/patch-2-test-8 success .github/scripts/patches/tests/header_inline.sh
conchuod/patch-2-test-9 success .github/scripts/patches/tests/kdoc.sh
conchuod/patch-2-test-10 success .github/scripts/patches/tests/module_param.sh
conchuod/patch-2-test-11 success .github/scripts/patches/tests/verify_fixes.sh
conchuod/patch-2-test-12 success .github/scripts/patches/tests/verify_signedoff.sh

Commit Message

Chen Wang Jan. 25, 2024, 6:11 a.m. UTC
From: Chen Wang <unicorn_wang@outlook.com>

Reuse reset-simple driver for the Sophgo SG2042 reset generator.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
---
 drivers/reset/Kconfig        |  1 +
 drivers/reset/reset-simple.c |  2 ++
 drivers/reset/sophgo/Kconfig | 10 ++++++++++
 3 files changed, 13 insertions(+)
 create mode 100644 drivers/reset/sophgo/Kconfig

Comments

Philipp Zabel Jan. 25, 2024, 10:43 a.m. UTC | #1
On Do, 2024-01-25 at 14:11 +0800, Chen Wang wrote:
> From: Chen Wang <unicorn_wang@outlook.com>
> 
> Reuse reset-simple driver for the Sophgo SG2042 reset generator.

Subject prefix should be "reset: simple: "

> Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
> ---
>  drivers/reset/Kconfig        |  1 +
>  drivers/reset/reset-simple.c |  2 ++
>  drivers/reset/sophgo/Kconfig | 10 ++++++++++
>  3 files changed, 13 insertions(+)
>  create mode 100644 drivers/reset/sophgo/Kconfig
> 
[...]
> diff --git a/drivers/reset/sophgo/Kconfig b/drivers/reset/sophgo/Kconfig
> new file mode 100644
> index 000000000000..9ad96e49e1dd
> --- /dev/null
> +++ b/drivers/reset/sophgo/Kconfig
> @@ -0,0 +1,10 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +config RESET_SOPHGO_SG2042
> +	bool "Sophgo SG2042 Reset Driver"
> +	depends on ARCH_SOPHGO || COMPILE_TEST
> +	select RESET_SIMPLE
> +	default ARCH_SOPHGO
> +	help
> +	  This enables the reset controller driver for the Sophgo SG2042 SoC.
> +

Drop the Kconfig, just add a default y if ARCH_SOPHGO to RESET_SIMPLE.

regards
Philipp
Chen Wang Jan. 25, 2024, 12:07 p.m. UTC | #2
On 2024/1/25 18:43, Philipp Zabel wrote:
> On Do, 2024-01-25 at 14:11 +0800, Chen Wang wrote:
>> From: Chen Wang <unicorn_wang@outlook.com>
>>
>> Reuse reset-simple driver for the Sophgo SG2042 reset generator.
> Subject prefix should be "reset: simple: "
Ok.
>
>> Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
>> ---
>>   drivers/reset/Kconfig        |  1 +
>>   drivers/reset/reset-simple.c |  2 ++
>>   drivers/reset/sophgo/Kconfig | 10 ++++++++++
>>   3 files changed, 13 insertions(+)
>>   create mode 100644 drivers/reset/sophgo/Kconfig
>>
> [...]
>> diff --git a/drivers/reset/sophgo/Kconfig b/drivers/reset/sophgo/Kconfig
>> new file mode 100644
>> index 000000000000..9ad96e49e1dd
>> --- /dev/null
>> +++ b/drivers/reset/sophgo/Kconfig
>> @@ -0,0 +1,10 @@
>> +# SPDX-License-Identifier: GPL-2.0-only
>> +
>> +config RESET_SOPHGO_SG2042
>> +	bool "Sophgo SG2042 Reset Driver"
>> +	depends on ARCH_SOPHGO || COMPILE_TEST
>> +	select RESET_SIMPLE
>> +	default ARCH_SOPHGO
>> +	help
>> +	  This enables the reset controller driver for the Sophgo SG2042 SoC.
>> +
> Drop the Kconfig, just add a default y if ARCH_SOPHGO to RESET_SIMPLE.

hi,Philipp,

The purpose of my adding Kconfig is to consider that other socs under 
sophgo may not use RESET_SIMPLE. I'm worried that the coverage is too 
large when default y if ARCH_SOPHGO? What do you think?

Thanks,

Chen

>
> regards
> Philipp
Philipp Zabel Jan. 25, 2024, 1:10 p.m. UTC | #3
On Do, 2024-01-25 at 20:07 +0800, Chen Wang wrote:
> On 2024/1/25 18:43, Philipp Zabel wrote:
> > On Do, 2024-01-25 at 14:11 +0800, Chen Wang wrote:
> > > From: Chen Wang <unicorn_wang@outlook.com>
> > > 
> > > Reuse reset-simple driver for the Sophgo SG2042 reset generator.
> > Subject prefix should be "reset: simple: "
> Ok.
> > 
> > > Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
> > > ---
> > >   drivers/reset/Kconfig        |  1 +
> > >   drivers/reset/reset-simple.c |  2 ++
> > >   drivers/reset/sophgo/Kconfig | 10 ++++++++++
> > >   3 files changed, 13 insertions(+)
> > >   create mode 100644 drivers/reset/sophgo/Kconfig
> > > 
> > [...]
> > > diff --git a/drivers/reset/sophgo/Kconfig b/drivers/reset/sophgo/Kconfig
> > > new file mode 100644
> > > index 000000000000..9ad96e49e1dd
> > > --- /dev/null
> > > +++ b/drivers/reset/sophgo/Kconfig
> > > @@ -0,0 +1,10 @@
> > > +# SPDX-License-Identifier: GPL-2.0-only
> > > +
> > > +config RESET_SOPHGO_SG2042
> > > +	bool "Sophgo SG2042 Reset Driver"
> > > +	depends on ARCH_SOPHGO || COMPILE_TEST
> > > +	select RESET_SIMPLE
> > > +	default ARCH_SOPHGO
> > > +	help
> > > +	  This enables the reset controller driver for the Sophgo SG2042 SoC.
> > > +
> > Drop the Kconfig, just add a default y if ARCH_SOPHGO to RESET_SIMPLE.
> 
> hi,Philipp,
> 
> The purpose of my adding Kconfig is to consider that other socs under 
> sophgo may not use RESET_SIMPLE. I'm worried that the coverage is too 
> large when default y if ARCH_SOPHGO? What do you think?

If ARCH_SOPHGO coverage is considered too wide, it's not correct to
make RESET_SOPHGO_SG2024 "default ARCH_SOPHGO" either, so there's no
significant difference.

The question is whether you need it at all. Can SG2042 boot, possibly
with reduced functionality, into a useful system without the reset
controller? If so, maybe it is enough to rely on a defconfig to enable
RESET_SIMPLE? Otherwise, reset-simple could be considered small enough
to accept carrying it around for non-SG2042 SoCs by default, it can be
disabled manually, after all.

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index ccd59ddd7610..09ba59cc4bc5 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -318,6 +318,7 @@  config RESET_ZYNQ
 	help
 	  This enables the reset controller driver for Xilinx Zynq SoCs.
 
+source "drivers/reset/sophgo/Kconfig"
 source "drivers/reset/starfive/Kconfig"
 source "drivers/reset/sti/Kconfig"
 source "drivers/reset/hisilicon/Kconfig"
diff --git a/drivers/reset/reset-simple.c b/drivers/reset/reset-simple.c
index 818cabcc9fb7..276067839830 100644
--- a/drivers/reset/reset-simple.c
+++ b/drivers/reset/reset-simple.c
@@ -151,6 +151,8 @@  static const struct of_device_id reset_simple_dt_ids[] = {
 	{ .compatible = "snps,dw-high-reset" },
 	{ .compatible = "snps,dw-low-reset",
 		.data = &reset_simple_active_low },
+	{ .compatible = "sophgo,sg2042-reset",
+		.data = &reset_simple_active_low },
 	{ /* sentinel */ },
 };
 
diff --git a/drivers/reset/sophgo/Kconfig b/drivers/reset/sophgo/Kconfig
new file mode 100644
index 000000000000..9ad96e49e1dd
--- /dev/null
+++ b/drivers/reset/sophgo/Kconfig
@@ -0,0 +1,10 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+
+config RESET_SOPHGO_SG2042
+	bool "Sophgo SG2042 Reset Driver"
+	depends on ARCH_SOPHGO || COMPILE_TEST
+	select RESET_SIMPLE
+	default ARCH_SOPHGO
+	help
+	  This enables the reset controller driver for the Sophgo SG2042 SoC.
+