diff mbox series

[v4,02/10] clk: renesas: prepare for non-RCAR clock drivers

Message ID 20230308202653.1926303-3-ralph.siemsen@linaro.org
State New
Headers show
Series Renesas RZ/N1 SoC initial support | expand

Commit Message

Ralph Siemsen March 8, 2023, 8:26 p.m. UTC
Allow CONFIG_CLK_RENESAS to be set without bringing in RCAR-GEN2/3 code.

CONFIG_RENESAS is used in drivers/clk/Makefile to control recursion into
the drivers/clk/renesas subdirectory. It also controls compilation of
renesas-cpg-mssr.c support code for the RCAR-GEN2 and RCAR-GEN3 devices.

The support code contains platform specific hardware access (TMU_BASE),
and it is not needed for other Renesas devices such as RZ/N1. Therefore,
alter Makefile to build renesas-cpg-mssr.c only for RCAR-GEN2/3.

Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
---

(no changes since v3)

Changes in v3:
- added tags

 drivers/clk/renesas/Kconfig  | 2 +-
 drivers/clk/renesas/Makefile | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

Comments

Marek Vasut April 17, 2023, 5:02 p.m. UTC | #1
On 3/8/23 21:26, Ralph Siemsen wrote:
> Allow CONFIG_CLK_RENESAS to be set without bringing in RCAR-GEN2/3 code.
> 
> CONFIG_RENESAS is used in drivers/clk/Makefile to control recursion into
> the drivers/clk/renesas subdirectory. It also controls compilation of
> renesas-cpg-mssr.c support code for the RCAR-GEN2 and RCAR-GEN3 devices.
> 
> The support code contains platform specific hardware access (TMU_BASE),
> and it is not needed for other Renesas devices such as RZ/N1. Therefore,
> alter Makefile to build renesas-cpg-mssr.c only for RCAR-GEN2/3.
> 
> Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
> Reviewed-by: Sean Anderson <seanga2@gmail.com>
> ---
> 
> (no changes since v3)
> 
> Changes in v3:
> - added tags
> 
>   drivers/clk/renesas/Kconfig  | 2 +-
>   drivers/clk/renesas/Makefile | 5 ++---
>   2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/renesas/Kconfig b/drivers/clk/renesas/Kconfig
> index 1686410d6d..6788415eed 100644
> --- a/drivers/clk/renesas/Kconfig
> +++ b/drivers/clk/renesas/Kconfig
> @@ -1,6 +1,6 @@
>   config CLK_RENESAS
>   	bool "Renesas clock drivers"
> -	depends on CLK && ARCH_RMOBILE
> +	depends on CLK && (ARCH_RMOBILE || ARCH_RZN1)
>   	help
>   	  Enable support for clock present on Renesas RCar SoCs.
>   
> diff --git a/drivers/clk/renesas/Makefile b/drivers/clk/renesas/Makefile
> index 8f82a7aa3e..a0d8c10bdb 100644
> --- a/drivers/clk/renesas/Makefile
> +++ b/drivers/clk/renesas/Makefile
> @@ -1,6 +1,5 @@
> -obj-$(CONFIG_CLK_RENESAS) += renesas-cpg-mssr.o
>   obj-$(CONFIG_CLK_RCAR_CPG_LIB) += rcar-cpg-lib.o
> -obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o
> +obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o renesas-cpg-mssr.o

Why not move the renesas-cpg-mssr.o into obj-$(CONFIG_CLK_RCAR_CPG_LIB) 
line instead ? I suspect RZN1 is not using the CPG lib anyway ?
Ralph Siemsen April 17, 2023, 6:22 p.m. UTC | #2
Hi Marek,

On Mon, Apr 17, 2023 at 07:02:34PM +0200, Marek Vasut wrote:
>On 3/8/23 21:26, Ralph Siemsen wrote:
>>diff --git a/drivers/clk/renesas/Makefile 
>>b/drivers/clk/renesas/Makefile
>>index 8f82a7aa3e..a0d8c10bdb 100644
>>--- a/drivers/clk/renesas/Makefile
>>+++ b/drivers/clk/renesas/Makefile
>>@@ -1,6 +1,5 @@
>>-obj-$(CONFIG_CLK_RENESAS) += renesas-cpg-mssr.o
>>  obj-$(CONFIG_CLK_RCAR_CPG_LIB) += rcar-cpg-lib.o
>>-obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o
>>+obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o renesas-cpg-mssr.o
>
>Why not move the renesas-cpg-mssr.o into obj-$(CONFIG_CLK_RCAR_CPG_LIB) 
>line instead ? 

I think this would break the build for gen2 devices, because they make 
calls to CPG functions (eg. renesas_clk_endisable from clk-rcar-gen2.c), 
however Kconfig only selects CPG lib for gen3.

Perhaps we could change Kconfig to select CPG also for gen2. I can make 
this patch, but how to test that this does not introduce any new 
problems?  Might there be an autobuilder for R-Car somewhere?

>I suspect RZN1 is not using the CPG lib anyway ?

You are correct, RZN1 does not use the CPG lib.

Regards
Ralph
Marek Vasut April 17, 2023, 8:33 p.m. UTC | #3
On 4/17/23 20:22, Ralph Siemsen wrote:
> Hi Marek,
> 
> On Mon, Apr 17, 2023 at 07:02:34PM +0200, Marek Vasut wrote:
>> On 3/8/23 21:26, Ralph Siemsen wrote:
>>> diff --git a/drivers/clk/renesas/Makefile b/drivers/clk/renesas/Makefile
>>> index 8f82a7aa3e..a0d8c10bdb 100644
>>> --- a/drivers/clk/renesas/Makefile
>>> +++ b/drivers/clk/renesas/Makefile
>>> @@ -1,6 +1,5 @@
>>> -obj-$(CONFIG_CLK_RENESAS) += renesas-cpg-mssr.o
>>>  obj-$(CONFIG_CLK_RCAR_CPG_LIB) += rcar-cpg-lib.o
>>> -obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o
>>> +obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o renesas-cpg-mssr.o
>>
>> Why not move the renesas-cpg-mssr.o into 
>> obj-$(CONFIG_CLK_RCAR_CPG_LIB) line instead ? 
> 
> I think this would break the build for gen2 devices, because they make 
> calls to CPG functions (eg. renesas_clk_endisable from clk-rcar-gen2.c), 
> however Kconfig only selects CPG lib for gen3.

Good point

> Perhaps we could change Kconfig to select CPG also for gen2. I can make 
> this patch, but how to test that this does not introduce any new 
> problems?  Might there be an autobuilder for R-Car somewhere?

You could introduce CONFIG_CLK_RCAR Kconfig symbol and use that for 
renesas-cpg-mssr.o . Would that work ?
Ralph Siemsen April 17, 2023, 8:48 p.m. UTC | #4
On Mon, Apr 17, 2023 at 10:33:18PM +0200, Marek Vasut wrote:
>On 4/17/23 20:22, Ralph Siemsen wrote:
>>Perhaps we could change Kconfig to select CPG also for gen2. I can 
>>make this patch, but how to test that this does not introduce any new 
>>problems?  Might there be an autobuilder for R-Car somewhere?
>
>You could introduce CONFIG_CLK_RCAR Kconfig symbol and use that for 
>renesas-cpg-mssr.o . Would that work ?

I can certainly make the patch, and hopefully also do at least a 
compile-test. Though I will need to figure out which defconfigs I need 
to test...

Ralph
Marek Vasut April 17, 2023, 10:24 p.m. UTC | #5
On 4/17/23 22:48, Ralph Siemsen wrote:
> On Mon, Apr 17, 2023 at 10:33:18PM +0200, Marek Vasut wrote:
>> On 4/17/23 20:22, Ralph Siemsen wrote:
>>> Perhaps we could change Kconfig to select CPG also for gen2. I can 
>>> make this patch, but how to test that this does not introduce any new 
>>> problems?  Might there be an autobuilder for R-Car somewhere?
>>
>> You could introduce CONFIG_CLK_RCAR Kconfig symbol and use that for 
>> renesas-cpg-mssr.o . Would that work ?
> 
> I can certainly make the patch, and hopefully also do at least a 
> compile-test. Though I will need to figure out which defconfigs I need 
> to test...

Try 'grep RENESAS configs/*' , that should give you a decent list.
diff mbox series

Patch

diff --git a/drivers/clk/renesas/Kconfig b/drivers/clk/renesas/Kconfig
index 1686410d6d..6788415eed 100644
--- a/drivers/clk/renesas/Kconfig
+++ b/drivers/clk/renesas/Kconfig
@@ -1,6 +1,6 @@ 
 config CLK_RENESAS
 	bool "Renesas clock drivers"
-	depends on CLK && ARCH_RMOBILE
+	depends on CLK && (ARCH_RMOBILE || ARCH_RZN1)
 	help
 	  Enable support for clock present on Renesas RCar SoCs.
 
diff --git a/drivers/clk/renesas/Makefile b/drivers/clk/renesas/Makefile
index 8f82a7aa3e..a0d8c10bdb 100644
--- a/drivers/clk/renesas/Makefile
+++ b/drivers/clk/renesas/Makefile
@@ -1,6 +1,5 @@ 
-obj-$(CONFIG_CLK_RENESAS) += renesas-cpg-mssr.o
 obj-$(CONFIG_CLK_RCAR_CPG_LIB) += rcar-cpg-lib.o
-obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o
+obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o renesas-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A774A1) += r8a774a1-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A774B1) += r8a774b1-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A774C0) += r8a774c0-cpg-mssr.o
@@ -10,7 +9,7 @@  obj-$(CONFIG_CLK_R8A7791) += r8a7791-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7792) += r8a7792-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7793) += r8a7791-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7794) += r8a7794-cpg-mssr.o
-obj-$(CONFIG_CLK_RCAR_GEN3) += clk-rcar-gen3.o
+obj-$(CONFIG_CLK_RCAR_GEN3) += clk-rcar-gen3.o renesas-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7795) += r8a7795-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A77960) += r8a7796-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A77961) += r8a7796-cpg-mssr.o