clocksource: Consolidate SH and ARM mach-shmobile Kconfig bits
Subsystems (5)
Magnus Damm
maintainerv4 cover clocksource: Consolidate SH and ARM mach-shmobile Kconfig bits
clocksource: Consolidate SH and ARM mach-shmobile Kconfig bits (v4)
[PATCH v4 01/03] clocksource: Add Kconfig entries for CMT, MTU2, TMU and STI [PATCH v4 02/03] ARM: shmobile: Remove CMT, TMU and STI Kconfig entries [PATCH v2 03/03] sh: Remove Kconfig entries for TMU, CMT and MTU2
This is V4 of the SH and ARM mach-shmobile clocksource Kconfig consolidation series.
By sharing Kconfig entires in drivers/clocksource/Kconfig we can get rid of duplicated bits that do not belong under arch/.
With this series applied it is possible to build the timer drivers for CMT, MTU2, TMU and STI in case of SH or ARM. The timer drivers are automatically selected by default. It is also possible to select and/or deselect freely when COMPILE_TEST has been selected.
Many thanks to John, Daniel and Arnd for feedback!
Changes since V3:
- Updated patch 1/3 with more detailed help texts
- Updated patch 2/3 to fit latest renesas-devel tag, see below
- Included acks from John Stultz for patch 2/3 and 3/3
---
Written against renesas.git tag renesas-devel-v3.13-rc2-20131211
arch/arm/mach-shmobile/Kconfig | 35 +++++++++++++++---------------- arch/sh/Kconfig | 21 ------------------- drivers/clocksource/Kconfig | 44 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 39 deletions(-)
Magnus Damm
maintainerPATCH v4 1/3 clocksource: Add Kconfig entries for CMT, MTU2, TMU and STI
From: Magnus Damm <[email protected]>
Add Kconfig entries for CMT, MTU2, TMU and STI to drivers/clocksource/Kconfig. This will allow us to get rid of duplicated entires in architecture code such as arch/sh and arch/arm/mach-shmobile.
---
drivers/clocksource/Kconfig | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
drivers/clocksource/Kconfig +44 -0
@@ -134,3 +134,47 @@ config VF_PIT_TIMER bool help Support for Period Interrupt Timer on Freescale Vybrid Family SoCs. + +config SYS_SUPPORTS_CMT + bool + +config SYS_SUPPORTS_TMU + bool + +config SYS_SUPPORTS_MTU2 + bool + +config SYS_SUPPORTS_STI + bool + +config SH_TIMER_CMT + bool "Renesas CMT timer driver" if COMPILE_TEST + default SYS_SUPPORTS_CMT + help + This enables build of a clocksource and clockevent driver for + the Compare Match Timer (CMT) hardware available in 16/32/48 bit + variants on a wide range of Mobile and Automotive SoCs from Renesas. + +config SH_TIMER_MTU2 + bool "Renesas MTU2 timer driver" if COMPILE_TEST + default SYS_SUPPORTS_MTU2 + help + This enables build of a clockevent driver for the Multi-Function + Timer Pulse Unit 2 (TMU2) hardware available on SoCs from Renesas. + This hardware comes with 16 bit timer registers. + +config SH_TIMER_TMU + bool "Renesas TMU timer driver" if COMPILE_TEST + default SYS_SUPPORTS_TMU + help + This enables build of a clocksource and clockevent driver for + the 32-bit Timer Unit (TMU) hardware available on a wide range + SoCs from Renesas. + +config EM_TIMER_STI + bool "Renesas STI timer driver" if COMPILE_TEST + default SYS_SUPPORTS_STI + help + This enables build of a clocksource and clockevent driver for + the 48-bit System Timer (STI) hardware available on a SoCs + such as EMEV2 from former NEC Electronics.
Re: [PATCH v4 01/03] clocksource: Add Kconfig entries for CMT, MTU2, TMU and STI
Hi,
A couple of small comments below.
Quoted 21 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Add
Kconfigentries for CMT, MTU2, TMU and STI todrivers/clocksource/Kconfig. This will allow us to get rid of duplicated entires in architecture code such asarch/shandarch/arm/mach-shmobile.Signed-off-by Magnus Damm <[email protected]>---
drivers/clocksource/Kconfig | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)drivers/clocksource/Kconfig +2
-0@@ -134,3 +134,47 @@ config VF_PIT_TIMER bool help Support for Period Interrupt Timer on Freescale Vybrid Family SoCs. + +config SYS_SUPPORTS_CMT
drivers/clocksource/Kconfig config VF_PIT_TIMER · line 148
Quoted 10 lines
drivers/clocksource/Kconfig +10
-0+ bool + +config SYS_SUPPORTS_TMU + bool + +config SYS_SUPPORTS_MTU2 + bool + +config SYS_SUPPORTS_STI + bool
Maybe a prefix to avoid namespace collissions here?
drivers/clocksource/Kconfig config VF_PIT_TIMER · line 152
Quoted 4 lines
drivers/clocksource/Kconfig +4
-0+ +config SH_TIMER_CMT + bool "Renesas CMT timer driver" if COMPILE_TEST + default SYS_SUPPORTS_CMT
It might be useful to have an explicit depends on ARCH_SH || ARCH_SHMOBILE || COMPILE_TEST on these, just to make it easier for someone reading the code later on.
-Olof
Magnus Damm
maintainerRe: [PATCH v4 01/03] clocksource: Add Kconfig entries for CMT, MTU2, TMU and STI
Hi Olof,
Quoted 3 lines · Olof Johansson
Hi,
A couple of small comments below.
Thanks for your feedback!
Quoted 26 lines · Magnus Damm
Quoted 25 lines
From: Magnus Damm <[email protected]>
Add
Kconfigentries for CMT, MTU2, TMU and STI todrivers/clocksource/Kconfig. This will allow us to get rid of duplicated entires in architecture code such asarch/shandarch/arm/mach-shmobile.Signed-off-by Magnus Damm <[email protected]>---
drivers/clocksource/Kconfig | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 renamed from drivers/clocksource/Kconfig +6
-0@@ -134,3 +134,47 @@ config VF_PIT_TIMER bool help Support for Period Interrupt Timer on Freescale Vybrid Family SoCs. + +config SYS_SUPPORTS_CMT + bool + +config SYS_SUPPORTS_TMU + bool
Quoted 8 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 config VF_PIT_TIMER · line 148
Quoted 6 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 renamed from drivers/clocksource/Kconfig +6
-0+ +config SYS_SUPPORTS_MTU2 + bool + +config SYS_SUPPORTS_STI + boolMaybe a prefix to avoid namespace collissions here?
Sure, that is fine with me. I based the ones above on already existing ones used by SH but I don't mind reworking those.
How about SYS_SUPPORTS_CLKSRC_xxx?
Quoted 7 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 config VF_PIT_TIMER · line 151
Quoted 3 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 renamed from drivers/clocksource/Kconfig +3
-0+config SH_TIMER_CMT + bool "Renesas CMT timer driver" if COMPILE_TEST + default SYS_SUPPORTS_CMTIt might be useful to have an explicit depends on
ARCH_SH||ARCH_SHMOBILE||COMPILE_TESTon these, just to make it easier for someone reading the code later on.
I have any strong feelings one way or the other about that myself, but I got the impression that John Stultz preferred to not allow manual selection at all, and my compromise here is to allow it only when COMPILE_TEST is selected.
Would you be ok to keep it as-is for now? If needed then we can add an incremental patch later to enable more flexible selection.
Thanks,
/ magnus
Re: [PATCH v4 01/03] clocksource: Add Kconfig entries for CMT, MTU2, TMU and STI
Quoted 44 lines · Magnus Damm
Hi Olof,
Quoted 3 lines · Olof Johansson
Hi,
A couple of small comments below.
Thanks for your feedback!
Quoted 26 lines · Magnus Damm
Quoted 25 lines
From: Magnus Damm <[email protected]>
Add
Kconfigentries for CMT, MTU2, TMU and STI todrivers/clocksource/Kconfig. This will allow us to get rid of duplicated entires in architecture code such asarch/shandarch/arm/mach-shmobile.Signed-off-by Magnus Damm <[email protected]>---
drivers/clocksource/Kconfig | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 renamed from drivers/clocksource/Kconfig +6
-0@@ -134,3 +134,47 @@ config VF_PIT_TIMER bool help Support for Period Interrupt Timer on Freescale Vybrid Family SoCs. + +config SYS_SUPPORTS_CMT + bool + +config SYS_SUPPORTS_TMU + boolQuoted 8 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 config VF_PIT_TIMER · line 148
Quoted 6 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 renamed from drivers/clocksource/Kconfig +6
-0+ +config SYS_SUPPORTS_MTU2 + bool + +config SYS_SUPPORTS_STI + boolMaybe a prefix to avoid namespace collissions here?
Quoted 4 lines
Sure, that is fine with me. I based the ones above on already existing ones used by SH but I don't mind reworking those.
How about
SYS_SUPPORTS_CLKSRC_xxx?
Oh, I was hoping for something shmobile-specific. Other platforms might have some other clock source that they name STI or MTU, for example.
Quoted 8 lines
Quoted 7 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 config VF_PIT_TIMER · line 151
Quoted 3 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 renamed from drivers/clocksource/Kconfig +3
-0+config SH_TIMER_CMT + bool "Renesas CMT timer driver" if COMPILE_TEST + default SYS_SUPPORTS_CMTIt might be useful to have an explicit depends on
ARCH_SH||ARCH_SHMOBILE||COMPILE_TESTon these, just to make it easier for someone reading the code later on.
Quoted 7 lines
I have any strong feelings one way or the other about that myself, but I got the impression that John Stultz preferred to not allow manual selection at all, and my compromise here is to allow it only when
COMPILE_TESTis selected.Would you be ok to keep it as-is for now? If needed then we can add an incremental patch later to enable more flexible selection.
Yeah, if there's no manual selection at all we might be fine.
-Olof
Magnus Damm
maintainerRe: [PATCH v4 01/03] clocksource: Add Kconfig entries for CMT, MTU2, TMU and STI
Hi Olof,
Quoted 45 lines · Olof Johansson
Quoted 44 lines · Magnus Damm
Hi Olof,
Quoted 3 lines · Olof Johansson
Hi,
A couple of small comments below.
Thanks for your feedback!
Quoted 34 lines · Magnus Damm
Quoted 21 lines
From: Magnus Damm <[email protected]>
Add
Kconfigentries for CMT, MTU2, TMU and STI todrivers/clocksource/Kconfig. This will allow us to get rid of duplicated entires in architecture code such asarch/shandarch/arm/mach-shmobile.Signed-off-by Magnus Damm <[email protected]>---
drivers/clocksource/Kconfig | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 renamed from drivers/clocksource/Kconfig +2
-0@@ -134,3 +134,47 @@ config VF_PIT_TIMER bool help Support for Period Interrupt Timer on Freescale Vybrid Family SoCs. + +config SYS_SUPPORTS_CMTdrivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 config VF_PIT_TIMER · line 148
Quoted 10 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 renamed from drivers/clocksource/Kconfig +10
-0+ bool + +config SYS_SUPPORTS_TMU + bool + +config SYS_SUPPORTS_MTU2 + bool + +config SYS_SUPPORTS_STI + boolMaybe a prefix to avoid namespace collissions here?
Quoted 7 lines
Quoted 4 lines
Sure, that is fine with me. I based the ones above on already existing ones used by SH but I don't mind reworking those.
How about
SYS_SUPPORTS_CLKSRC_xxx?Oh, I was hoping for something shmobile-specific. Other platforms might have some other clock source that they name STI or MTU, for example.
Thanks for the clarification. So how about the following?
SYS_SUPPORTS_SH_CMTSYS_SUPPORTS_SH_MTU2SYS_SUPPORTS_SH_TMUSYS_SUPPORTS_EM_STI
The above match the style of the existing CONFIG_ SH/EM _TIMER_ CMT/MTU2/TMU/STI. Regarding the SH vs EM prefix, the SH ones are present on arch/sh while EM_STI is only present on Emma Mobile SoCs.
Quoted 13 lines
Quoted 13 lines
Quoted 7 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 config VF_PIT_TIMER · line 151
Quoted 3 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 renamed from drivers/clocksource/Kconfig +3
-0+config SH_TIMER_CMT + bool "Renesas CMT timer driver" if COMPILE_TEST + default SYS_SUPPORTS_CMTIt might be useful to have an explicit depends on
ARCH_SH||ARCH_SHMOBILE||COMPILE_TESTon these, just to make it easier for someone reading the code later on.I have any strong feelings one way or the other about that myself, but I got the impression that John Stultz preferred to not allow manual selection at all, and my compromise here is to allow it only when
COMPILE_TESTis selected.
Quoted 4 lines
Quoted 2 lines
Would you be ok to keep it as-is for now? If needed then we can add an incremental patch later to enable more flexible selection.
Yeah, if there's no manual selection at all we might be fine.
Ok, I will keep it as-is then.
Thanks,
/ magnus
Re: [PATCH v4 01/03] clocksource: Add Kconfig entries for CMT, MTU2, TMU and STI
Quoted 58 lines · Magnus Damm
Hi Olof,
Quoted 45 lines · Olof Johansson
Quoted 44 lines · Magnus Damm
Hi Olof,
Quoted 3 lines · Olof Johansson
Hi,
A couple of small comments below.
Thanks for your feedback!
Quoted 34 lines · Magnus Damm
Quoted 21 lines
From: Magnus Damm <[email protected]>
Add
Kconfigentries for CMT, MTU2, TMU and STI todrivers/clocksource/Kconfig. This will allow us to get rid of duplicated entires in architecture code such asarch/shandarch/arm/mach-shmobile.Signed-off-by Magnus Damm <[email protected]>---
drivers/clocksource/Kconfig | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 renamed from drivers/clocksource/Kconfig +2
-0@@ -134,3 +134,47 @@ config VF_PIT_TIMER bool help Support for Period Interrupt Timer on Freescale Vybrid Family SoCs. + +config SYS_SUPPORTS_CMTdrivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 config VF_PIT_TIMER · line 148
Quoted 10 lines
drivers/clocksource/Kconfig 2013-12-12 08:41:55.000000000 +0900 renamed from drivers/clocksource/Kconfig +10
-0+ bool + +config SYS_SUPPORTS_TMU + bool + +config SYS_SUPPORTS_MTU2 + bool + +config SYS_SUPPORTS_STI + boolMaybe a prefix to avoid namespace collissions here?
Quoted 7 lines
Quoted 4 lines
Sure, that is fine with me. I based the ones above on already existing ones used by SH but I don't mind reworking those.
How about
SYS_SUPPORTS_CLKSRC_xxx?Oh, I was hoping for something shmobile-specific. Other platforms might have some other clock source that they name STI or MTU, for example.
Thanks for the clarification. So how about the following?
Quoted 8 lines
SYS_SUPPORTS_SH_CMTSYS_SUPPORTS_SH_MTU2SYS_SUPPORTS_SH_TMUSYS_SUPPORTS_EM_STIThe above match the style of the existing
CONFIG_SH/EM _TIMER_ CMT/MTU2/TMU/STI. Regarding the SH vs EM prefix, the SH ones are present onarch/shwhileEM_STIis only present on Emma Mobile SoCs.
Yep, that sounds good.
-Olof
Magnus Damm
maintainerPATCH v2 3/3 sh: Remove Kconfig entries for TMU, CMT and MTU2
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Now when drivers/clocksource/Kconfig has been updated with entires for CMT, TMU and MTU2 it is safe to remove these from SH.
---
arch/sh/Kconfig | 21 --------------------- 1 file changed, 21 deletions(-)
arch/sh/Kconfig +0 -21
@@ -565,27 +565,6 @@ source "arch/sh/boards/Kconfig" menu "Timer and clock configuration" -config SH_TIMER_TMU - bool "TMU timer driver" - depends on SYS_SUPPORTS_TMU - default y - help - This enables the build of the TMU timer driver. - -config SH_TIMER_CMT - bool "CMT timer driver" - depends on SYS_SUPPORTS_CMT - default y - help - This enables build of the CMT timer driver. - -config SH_TIMER_MTU2 - bool "MTU2 timer driver" - depends on SYS_SUPPORTS_MTU2 - default y - help - This enables build of the MTU2 timer driver. - config SH_PCLK_FREQ int "Peripheral clock frequency (in Hz)" depends on SH_CLK_CPG_LEGACY
Magnus Damm
maintainerPATCH v4 2/3 ARM: shmobile: Remove CMT, TMU and STI Kconfig entries
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Now when drivers/clocksource/Kconfig has been updated with entires for CMT, TMU and STI it is safe to remove these from mach-shmobile.
Also select timers per SoC via SYS_SUPPORTS_xxx.
---
arch/arm/mach-shmobile/Kconfig | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
arch/arm/mach-shmobile/Kconfig +17 -18
@@ -23,13 +23,16 @@ comment "Renesas ARM SoCs System Type" config ARCH_EMEV2 bool "Emma Mobile EV2" + select SYS_SUPPORTS_STI config ARCH_R7S72100 bool "RZ/A1H (R7S72100)" + select SYS_SUPPORTS_MTU2 config ARCH_R8A7791 bool "R-Car M2 (R8A77910)" select RENESAS_IRQC + select SYS_SUPPORTS_CMT comment "Renesas ARM SoCs Board Type"
@@ -59,6 +62,8 @@ config ARCH_SH7372 select ARM_CPU_SUSPEND if PM || CPU_IDLE select CPU_V7 select SH_CLK_CPG + select SYS_SUPPORTS_CMT + select SYS_SUPPORTS_TMU config ARCH_SH73A0 bool "SH-Mobile AG5 (R8A73A00)"
@@ -68,6 +73,8 @@ config ARCH_SH73A0 select I2C select SH_CLK_CPG select RENESAS_INTC_IRQPIN + select SYS_SUPPORTS_CMT + select SYS_SUPPORTS_TMU config ARCH_R8A73A4 bool "R-Mobile APE6 (R8A73A40)"
@@ -78,6 +85,8 @@ config ARCH_R8A73A4 select RENESAS_IRQC select ARCH_HAS_CPUFREQ select ARCH_HAS_OPP + select SYS_SUPPORTS_CMT + select SYS_SUPPORTS_TMU config ARCH_R8A7740 bool "R-Mobile A1 (R8A77400)"
@@ -86,6 +95,8 @@ config ARCH_R8A7740 select CPU_V7 select SH_CLK_CPG select RENESAS_INTC_IRQPIN + select SYS_SUPPORTS_CMT + select SYS_SUPPORTS_TMU config ARCH_R8A7778 bool "R-Car M1A (R8A77781)"
@@ -95,6 +106,7 @@ config ARCH_R8A7778 select ARM_GIC select USB_ARCH_HAS_EHCI select USB_ARCH_HAS_OHCI + select SYS_SUPPORTS_TMU config ARCH_R8A7779 bool "R-Car H1 (R8A77790)"
@@ -105,6 +117,7 @@ config ARCH_R8A7779 select USB_ARCH_HAS_EHCI select USB_ARCH_HAS_OHCI select RENESAS_INTC_IRQPIN + select SYS_SUPPORTS_TMU config ARCH_R8A7790 bool "R-Car H2 (R8A77900)"
@@ -113,6 +126,7 @@ config ARCH_R8A7790 select CPU_V7 select SH_CLK_CPG select RENESAS_IRQC + select SYS_SUPPORTS_CMT config ARCH_R8A7791 bool "R-Car M2 (R8A77910)"
@@ -121,6 +135,7 @@ config ARCH_R8A7791 select CPU_V7 select SH_CLK_CPG select RENESAS_IRQC + select SYS_SUPPORTS_CMT config ARCH_EMEV2 bool "Emma Mobile EV2"
@@ -129,6 +144,7 @@ config ARCH_EMEV2 select CPU_V7 select USE_OF select AUTO_ZRELADDR + select SYS_SUPPORTS_STI config ARCH_R7S72100 bool "RZ/A1H (R7S72100)"
@@ -136,6 +152,7 @@ config ARCH_R7S72100 select ARM_GIC select CPU_V7 select SH_CLK_CPG + select SYS_SUPPORTS_MTU2 comment "Renesas ARM SoCs Board Type"
@@ -330,24 +347,6 @@ config SHMOBILE_TIMER_HZ want to select a HZ value such as 128 that can evenly divide RCLK. A HZ value that does not divide evenly may cause timer drift. -config SH_TIMER_CMT - bool "CMT timer driver" - default y - help - This enables build of the CMT timer driver. - -config SH_TIMER_TMU - bool "TMU timer driver" - default y - help - This enables build of the TMU timer driver. - -config EM_TIMER_STI - bool "STI timer driver" - default y - help - This enables build of the STI timer driver. - endmenu endif