Skip to contentSkip to conversation

A fix for StarFive JH7110 clock drivers

PATCH Applied Hal Feng 3 participants 11 messages Apr 17, 2023 – Apr 18, 2023

Subsystems (3)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore

Hal Feng

author maintainer
#0 lore raw

cover A fix for StarFive JH7110 clock drivers

Hi, Stephen,

This series fix some issues of StarFive JH7110 sys and aon clock drivers.

The first patch fix two issues [1] [2] reported by kernel test robot.

The second patch is an addition to patch [3]. It removes the redundant dev_set_drvdata().

[1] https://lore.kernel.org/oe-kbuild-all/[email protected]/
[2] https://lore.kernel.org/oe-kbuild-all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/

Hal Feng (2):
clk: starfive: Fix RESET_STARFIVE_JH7110 can't be selected in a
specified case
clk: starfive: Delete the redundant dev_set_drvdata() in JH7110 clock
drivers

 drivers/clk/starfive/Kconfig                   | 5 +----
 drivers/clk/starfive/clk-starfive-jh7110-aon.c | 2 --
 drivers/clk/starfive/clk-starfive-jh7110-sys.c | 2 --
 3 files changed, 1 insertion(+), 8 deletions(-)
Signature · 1 line
2.38.1
author maintainer
#1 lore raw

PATCH 1/2 clk: starfive: Fix RESET_STARFIVE_JH7110 can't be selected in a specified case

When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]), RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS and CLK_STARFIVE_JH7110_AON.

Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant selected options of CLK_STARFIVE_JH7110_AON because these options are already selected by the dependency.

Fixes edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
Fixes b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
---
 drivers/clk/starfive/Kconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/clk/starfive/Kconfig +1 -4
index 71c1148ee5f6..3fad4adee841 100644
@@ -26,7 +26,7 @@ config CLK_STARFIVE_JH7110_SYS
 	depends on ARCH_STARFIVE || COMPILE_TEST
 	select AUXILIARY_BUS
 	select CLK_STARFIVE_JH71X0
-	select RESET_STARFIVE_JH7110
+	select RESET_STARFIVE_JH7110 if ARCH_STARFIVE
 	default ARCH_STARFIVE
 	help
 	  Say yes here to support the system clock controller on the
@@ -35,9 +35,6 @@ config CLK_STARFIVE_JH7110_SYS
 config CLK_STARFIVE_JH7110_AON
 	tristate "StarFive JH7110 always-on clock support"
 	depends on CLK_STARFIVE_JH7110_SYS
-	select AUXILIARY_BUS
-	select CLK_STARFIVE_JH71X0
-	select RESET_STARFIVE_JH7110
 	default m if ARCH_STARFIVE
 	help
 	  Say yes here to support the always-on clock controller on the
Signature · 1 line
2.38.1
#2 lore raw

Re: [PATCH v1 1/2] clk: starfive: Fix RESET_STARFIVE_JH7110 can't be selected in a specified case

Quoted 21 lines · Hal Feng

When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]), RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS and CLK_STARFIVE_JH7110_AON.

Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant selected options of CLK_STARFIVE_JH7110_AON because these options are already selected by the dependency.

Fixes edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
Fixes b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
---
 drivers/clk/starfive/Kconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/clk/starfive/Kconfig +0 -0
index 71c1148ee5f6..3fad4adee841 100644

drivers/clk/starfive/Kconfig config CLK_STARFIVE_JH7110_SYS · line 29

Quoted 5 lines
drivers/clk/starfive/Kconfig +1 -1
@@ -26,7 +26,7 @@ config CLK_STARFIVE_JH7110_SYS
 	depends on ARCH_STARFIVE || COMPILE_TEST
 	select AUXILIARY_BUS
 	select CLK_STARFIVE_JH71X0
-	select RESET_STARFIVE_JH7110
+	select RESET_STARFIVE_JH7110 if ARCH_STARFIVE

Hmm, I don't really follow the logic above.
Why not just make the if be if RESET_CONTROLLER rather than ARCH_STARFIVE?
I'm probably missing some obvious reason why not.

Cheers,
Conor.

Quoted 16 lines
drivers/clk/starfive/Kconfig +0 -3
 	default ARCH_STARFIVE
 	help
 	  Say yes here to support the system clock controller on the
@@ -35,9 +35,6 @@ config CLK_STARFIVE_JH7110_SYS
 config CLK_STARFIVE_JH7110_AON
 	tristate "StarFive JH7110 always-on clock support"
 	depends on CLK_STARFIVE_JH7110_SYS
-	select AUXILIARY_BUS
-	select CLK_STARFIVE_JH71X0
-	select RESET_STARFIVE_JH7110
 	default m if ARCH_STARFIVE
 	help
 	  Say yes here to support the always-on clock controller on the
Signature · 1 line
2.38.1
author maintainer
#3 lore raw

Re: [PATCH v1 1/2] clk: starfive: Fix RESET_STARFIVE_JH7110 can't be selected in a specified case

Quoted 17 lines · Conor Dooley
Quoted 16 lines · Hal Feng

When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]), RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS and CLK_STARFIVE_JH7110_AON.

Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant selected options of CLK_STARFIVE_JH7110_AON because these options are already selected by the dependency.

Fixes edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
Fixes b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
---
 drivers/clk/starfive/Kconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
Quoted 15 lines

drivers/clk/starfive/Kconfig config CLK_STARFIVE_JH7110_SYS · line 29

Quoted 10 lines
drivers/clk/starfive/Kconfig +1 -1
index 71c1148ee5f6..3fad4adee841 100644
@@ -26,7 +26,7 @@ config CLK_STARFIVE_JH7110_SYS
 	depends on ARCH_STARFIVE || COMPILE_TEST
 	select AUXILIARY_BUS
 	select CLK_STARFIVE_JH71X0
-	select RESET_STARFIVE_JH7110
+	select RESET_STARFIVE_JH7110 if ARCH_STARFIVE

Hmm, I don't really follow the logic above.
Why not just make the if be if RESET_CONTROLLER rather than ARCH_STARFIVE?
I'm probably missing some obvious reason why not.

Note that RESET_CONTROLLER is selected by ARCH_STARFIVE. Thanks.

Best regards,
Hal

#4 lore raw

Re: [PATCH v1 1/2] clk: starfive: Fix RESET_STARFIVE_JH7110 can't be selected in a specified case

Quoted 34 lines · Hal Feng
Quoted 17 lines · Conor Dooley
Quoted 16 lines · Hal Feng

When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]), RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS and CLK_STARFIVE_JH7110_AON.

Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant selected options of CLK_STARFIVE_JH7110_AON because these options are already selected by the dependency.

Fixes edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
Fixes b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
---
 drivers/clk/starfive/Kconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
Quoted 15 lines

drivers/clk/starfive/Kconfig config CLK_STARFIVE_JH7110_SYS · line 29

Quoted 10 lines
drivers/clk/starfive/Kconfig +1 -1
index 71c1148ee5f6..3fad4adee841 100644
@@ -26,7 +26,7 @@ config CLK_STARFIVE_JH7110_SYS
 	depends on ARCH_STARFIVE || COMPILE_TEST
 	select AUXILIARY_BUS
 	select CLK_STARFIVE_JH71X0
-	select RESET_STARFIVE_JH7110
+	select RESET_STARFIVE_JH7110 if ARCH_STARFIVE

Hmm, I don't really follow the logic above.
Why not just make the if be if RESET_CONTROLLER rather than ARCH_STARFIVE?
I'm probably missing some obvious reason why not.

Quoted 1 line

Note that RESET_CONTROLLER is selected by ARCH_STARFIVE. Thanks.

Aye, just the explicit dependency seems like it'd be less fragile and more obvious in the future.

maintainer
#5 lore raw

Re: [PATCH v1 1/2] clk: starfive: Fix RESET_STARFIVE_JH7110 can't be selected in a specified case

Quoting Conor Dooley (2023-04-17 03:18:35)

Quoted 35 lines · Hal Feng
Quoted 34 lines · Conor Dooley
Quoted 32 lines · Hal Feng
Quoted 21 lines

When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]), RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS and CLK_STARFIVE_JH7110_AON.

Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant selected options of CLK_STARFIVE_JH7110_AON because these options are already selected by the dependency.

Fixes edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
Fixes b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
---
 drivers/clk/starfive/Kconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/clk/starfive/Kconfig +0 -0
index 71c1148ee5f6..3fad4adee841 100644

drivers/clk/starfive/Kconfig config CLK_STARFIVE_JH7110_SYS · line 29

Quoted 5 lines
drivers/clk/starfive/Kconfig +1 -1
@@ -26,7 +26,7 @@ config CLK_STARFIVE_JH7110_SYS
   depends on ARCH_STARFIVE || COMPILE_TEST
   select AUXILIARY_BUS
   select CLK_STARFIVE_JH71X0
-  select RESET_STARFIVE_JH7110
+  select RESET_STARFIVE_JH7110 if ARCH_STARFIVE

Hmm, I don't really follow the logic above.
Why not just make the if be if RESET_CONTROLLER rather than ARCH_STARFIVE?
I'm probably missing some obvious reason why not.

Quoted 4 lines
Quoted 1 line

Note that RESET_CONTROLLER is selected by ARCH_STARFIVE. Thanks.

Aye, just the explicit dependency seems like it'd be less fragile and more obvious in the future.

Agreed. Be explicit so we don't have to hunt down select dependencies.

author maintainer
#6 lore raw

Re: [PATCH v1 1/2] clk: starfive: Fix RESET_STARFIVE_JH7110 can't be selected in a specified case

Quoted 36 lines · Stephen Boyd

Quoting Conor Dooley (2023-04-17 03:18:35)

Quoted 35 lines · Hal Feng
Quoted 34 lines · Conor Dooley
Quoted 32 lines · Hal Feng
Quoted 21 lines

When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]), RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS and CLK_STARFIVE_JH7110_AON.

Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant selected options of CLK_STARFIVE_JH7110_AON because these options are already selected by the dependency.

Fixes edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
Fixes b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
---
 drivers/clk/starfive/Kconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/clk/starfive/Kconfig +0 -0
index 71c1148ee5f6..3fad4adee841 100644

drivers/clk/starfive/Kconfig config CLK_STARFIVE_JH7110_SYS · line 29

Quoted 5 lines
drivers/clk/starfive/Kconfig +1 -1
@@ -26,7 +26,7 @@ config CLK_STARFIVE_JH7110_SYS
   depends on ARCH_STARFIVE || COMPILE_TEST
   select AUXILIARY_BUS
   select CLK_STARFIVE_JH71X0
-  select RESET_STARFIVE_JH7110
+  select RESET_STARFIVE_JH7110 if ARCH_STARFIVE

Hmm, I don't really follow the logic above.
Why not just make the if be if RESET_CONTROLLER rather than ARCH_STARFIVE?
I'm probably missing some obvious reason why not.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Note that RESET_CONTROLLER is selected by ARCH_STARFIVE. Thanks.

Aye, just the explicit dependency seems like it'd be less fragile and more obvious in the future.

Agreed. Be explicit so we don't have to hunt down select dependencies.

With further consideration, on the other hand, if we set if ARCH_STARFIVE here, it can point out that we need the reset driver to boot up JH7110 besides the clock drivers, and the reset driver is not a necessary option for compilation test. So the reset driver is independent to the clock drivers when you doing a compilation test.

If we set if RESET_CONTROLLER here, the reset driver will be compiled automatically when (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=y] && CLK_STARFIVE_JH7110_SYS [=y]).

Best regards,
Hal

#7 lore raw

Re: [PATCH v1 1/2] clk: starfive: Fix RESET_STARFIVE_JH7110 can't be selected in a specified case

Quoted 6 lines · Hal Feng
Quoted 5 lines · Stephen Boyd

Quoting Conor Dooley (2023-04-17 03:18:35)

Quoted 2 lines

Aye, just the explicit dependency seems like it'd be less fragile and more obvious in the future.

Quoted 7 lines
Quoted 1 line

Agreed. Be explicit so we don't have to hunt down select dependencies.

With further consideration, on the other hand, if we set if ARCH_STARFIVE here, it can point out that we need the reset driver to boot up JH7110 besides the clock drivers, and the reset driver is not a necessary option for compilation test. So the reset driver is independent to the clock drivers when you doing a compilation test.

If ARCH_STARFIVE is enabled, both options (RESET_CONTROLLER & RESET_STARFIVE_JH7110) will be selected & you don't need to worry about people not realising this. Try it out & look at the option in menuconfig.

Quoted 3 lines

If we set if RESET_CONTROLLER here, the reset driver will be compiled automatically when (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=y] && CLK_STARFIVE_JH7110_SYS [=y]).

This is what we want, right? The more often it gets built by randconfig etc the better, especially for archs that are not RISC-V.

Cheers,
Conor.

author maintainer
#8 lore raw

Re: [PATCH v1 1/2] clk: starfive: Fix RESET_STARFIVE_JH7110 can't be selected in a specified case

Quoted 20 lines · Conor Dooley
Quoted 6 lines · Hal Feng
Quoted 5 lines · Stephen Boyd

Quoting Conor Dooley (2023-04-17 03:18:35)

Quoted 2 lines

Aye, just the explicit dependency seems like it'd be less fragile and more obvious in the future.

Quoted 7 lines
Quoted 1 line

Agreed. Be explicit so we don't have to hunt down select dependencies.

With further consideration, on the other hand, if we set if ARCH_STARFIVE here, it can point out that we need the reset driver to boot up JH7110 besides the clock drivers, and the reset driver is not a necessary option for compilation test. So the reset driver is independent to the clock drivers when you doing a compilation test.

If ARCH_STARFIVE is enabled, both options (RESET_CONTROLLER & RESET_STARFIVE_JH7110) will be selected & you don't need to worry about people not realising this. Try it out & look at the option in menuconfig.

Quoted 6 lines
Quoted 3 lines

If we set if RESET_CONTROLLER here, the reset driver will be compiled automatically when (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=y] && CLK_STARFIVE_JH7110_SYS [=y]).

This is what we want, right? The more often it gets built by randconfig etc the better, especially for archs that are not RISC-V.

OK, will fix it in v2.

Best regards,
Hal

author maintainer
#9 lore raw

PATCH 2/2 clk: starfive: Delete the redundant dev_set_drvdata() in JH7110 clock drivers

In reply to Hal Feng

The dev_set_drvdata() is no longer needed after we used a wrapper struct to get the data in auxiliary driver.

Cc Xingyu Wu <[email protected]>
Fixes d1aae0663023 ("clk: starfive: Avoid casting iomem pointers")
---
 drivers/clk/starfive/clk-starfive-jh7110-aon.c | 2 --
 drivers/clk/starfive/clk-starfive-jh7110-sys.c | 2 --
 2 files changed, 4 deletions(-)
drivers/clk/starfive/clk-starfive-jh7110-aon.c +0 -2
index a2799fe8a234..62954eb7b50a 100644
@@ -83,8 +83,6 @@ static int jh7110_aoncrg_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->base))
 		return PTR_ERR(priv->base);
 
-	dev_set_drvdata(priv->dev, (void *)(&priv->base));
-
 	for (idx = 0; idx < JH7110_AONCLK_END; idx++) {
 		u32 max = jh7110_aonclk_data[idx].max;
 		struct clk_parent_data parents[4] = {};
drivers/clk/starfive/clk-starfive-jh7110-sys.c +0 -2
index 851b93d0f371..e6031345ef05 100644
@@ -402,8 +402,6 @@ static int __init jh7110_syscrg_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->base))
 		return PTR_ERR(priv->base);
 
-	dev_set_drvdata(priv->dev, (void *)(&priv->base));
-
 	/*
 	 * These PLL clocks are not actually fixed factor clocks and can be
 	 * controlled by the syscon registers of JH7110. They will be dropped
Signature · 1 line
2.38.1
maintainer Applied
#10 lore raw

Re: [PATCH v1 2/2] clk: starfive: Delete the redundant dev_set_drvdata() in JH7110 clock drivers

Quoting Hal Feng (2023-04-17 00:41:15)

Quoted 7 lines

The dev_set_drvdata() is no longer needed after we used a wrapper struct to get the data in auxiliary driver.

Cc Xingyu Wu <[email protected]>
Fixes d1aae0663023 ("clk: starfive: Avoid casting iomem pointers")

---

Applied to clk-next