Skip to contentSkip to conversation

clocksource: Consolidate SH and ARM mach-shmobile Kconfig bits

PATCH In review Magnus Damm 2 participants 6 messages Dec 17, 2013 – Dec 18, 2013

Subsystems (5)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

v5 cover clocksource: Consolidate SH and ARM mach-shmobile Kconfig bits

clocksource: Consolidate SH and ARM mach-shmobile Kconfig bits (v5)

[PATCH v5 01/03] clocksource: Add Kconfig entries for CMT, MTU2, TMU and STI [PATCH v5 02/03] ARM: shmobile: Remove CMT, TMU and STI Kconfig entries [PATCH v5 03/03] sh: Remove Kconfig entries for TMU, CMT and MTU2

This is V5 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 Olof, John, Daniel and Arnd for feedback!

Changes since V4:
- Use SYS_SUPPORTS_SH/EM to avoid name space pollution, thanks Olof!
- Remove old SH entries for SYS_SUPPORTS_xxx, use above SH prefix instead

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-rc3-20131214v2

 arch/arm/mach-shmobile/Kconfig |   35 ++++++++----------
 arch/sh/Kconfig                |   76 ++++++++++++----------------------------
 drivers/clocksource/Kconfig    |   44 +++++++++++++++++++++++
 3 files changed, 84 insertions(+), 71 deletions(-)
author maintainer
#1 lore raw

PATCH v5 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
@@ -135,3 +135,47 @@ config VF_PIT_TIMER
 	bool
 	help
 	  Support for Period Interrupt Timer on Freescale Vybrid Family SoCs.
+
+config SYS_SUPPORTS_SH_CMT
+        bool
+
+config SYS_SUPPORTS_SH_MTU2
+        bool
+
+config SYS_SUPPORTS_SH_TMU
+        bool
+
+config SYS_SUPPORTS_EM_STI
+        bool
+
+config SH_TIMER_CMT
+	bool "Renesas CMT timer driver" if COMPILE_TEST
+	default SYS_SUPPORTS_SH_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_SH_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_SH_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_EM_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.
author maintainer
#2 lore raw

PATCH v5 2/3 ARM: shmobile: Remove CMT, TMU and STI Kconfig entries

In reply to Magnus Damm

From: 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
@@ -24,13 +24,16 @@ comment "Renesas ARM SoCs System Type"
 
 config ARCH_EMEV2
 	bool "Emma Mobile EV2"
+	select SYS_SUPPORTS_EM_STI
 
 config ARCH_R7S72100
 	bool "RZ/A1H (R7S72100)"
+	select SYS_SUPPORTS_SH_MTU2
 
 config ARCH_R8A7791
 	bool "R-Car M2 (R8A77910)"
 	select RENESAS_IRQC
+	select SYS_SUPPORTS_SH_CMT
 
 comment "Renesas ARM SoCs Board Type"
 
@@ -60,6 +63,8 @@ config ARCH_SH7372
 	select ARM_CPU_SUSPEND if PM || CPU_IDLE
 	select CPU_V7
 	select SH_CLK_CPG
+	select SYS_SUPPORTS_SH_CMT
+	select SYS_SUPPORTS_SH_TMU
 
 config ARCH_SH73A0
 	bool "SH-Mobile AG5 (R8A73A00)"
@@ -69,6 +74,8 @@ config ARCH_SH73A0
 	select I2C
 	select SH_CLK_CPG
 	select RENESAS_INTC_IRQPIN
+	select SYS_SUPPORTS_SH_CMT
+	select SYS_SUPPORTS_SH_TMU
 
 config ARCH_R8A73A4
 	bool "R-Mobile APE6 (R8A73A40)"
@@ -79,6 +86,8 @@ config ARCH_R8A73A4
 	select RENESAS_IRQC
 	select ARCH_HAS_CPUFREQ
 	select ARCH_HAS_OPP
+	select SYS_SUPPORTS_SH_CMT
+	select SYS_SUPPORTS_SH_TMU
 
 config ARCH_R8A7740
 	bool "R-Mobile A1 (R8A77400)"
@@ -87,6 +96,8 @@ config ARCH_R8A7740
 	select CPU_V7
 	select SH_CLK_CPG
 	select RENESAS_INTC_IRQPIN
+	select SYS_SUPPORTS_SH_CMT
+	select SYS_SUPPORTS_SH_TMU
 
 config ARCH_R8A7778
 	bool "R-Car M1A (R8A77781)"
@@ -96,6 +107,7 @@ config ARCH_R8A7778
 	select ARM_GIC
 	select USB_ARCH_HAS_EHCI
 	select USB_ARCH_HAS_OHCI
+	select SYS_SUPPORTS_SH_TMU
 
 config ARCH_R8A7779
 	bool "R-Car H1 (R8A77790)"
@@ -106,6 +118,7 @@ config ARCH_R8A7779
 	select USB_ARCH_HAS_EHCI
 	select USB_ARCH_HAS_OHCI
 	select RENESAS_INTC_IRQPIN
+	select SYS_SUPPORTS_SH_TMU
 
 config ARCH_R8A7790
 	bool "R-Car H2 (R8A77900)"
@@ -115,6 +128,7 @@ config ARCH_R8A7790
 	select MIGHT_HAVE_PCI
 	select SH_CLK_CPG
 	select RENESAS_IRQC
+	select SYS_SUPPORTS_SH_CMT
 
 config ARCH_R8A7791
 	bool "R-Car M2 (R8A77910)"
@@ -124,6 +138,7 @@ config ARCH_R8A7791
 	select MIGHT_HAVE_PCI
 	select SH_CLK_CPG
 	select RENESAS_IRQC
+	select SYS_SUPPORTS_SH_CMT
 
 config ARCH_EMEV2
 	bool "Emma Mobile EV2"
@@ -133,6 +148,7 @@ config ARCH_EMEV2
 	select MIGHT_HAVE_PCI
 	select USE_OF
 	select AUTO_ZRELADDR
+	select SYS_SUPPORTS_EM_STI
 
 config ARCH_R7S72100
 	bool "RZ/A1H (R7S72100)"
@@ -140,6 +156,7 @@ config ARCH_R7S72100
 	select ARM_GIC
 	select CPU_V7
 	select SH_CLK_CPG
+	select SYS_SUPPORTS_SH_MTU2
 
 comment "Renesas ARM SoCs Board Type"
 
@@ -334,24 +351,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
author maintainer
#3 lore raw

PATCH v5 3/3 sh: Remove Kconfig entries for TMU, CMT and MTU2

In reply to Magnus Damm

From: 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 |   76 ++++++++++++++++---------------------------------------
 1 file changed, 23 insertions(+), 53 deletions(-)
arch/sh/Kconfig +23 -53
@@ -122,15 +122,6 @@ config SYS_SUPPORTS_NUMA
 config SYS_SUPPORTS_PCI
 	bool
 
-config SYS_SUPPORTS_CMT
-	bool
-
-config SYS_SUPPORTS_MTU2
-	bool
-
-config SYS_SUPPORTS_TMU
-	bool
-
 config STACKTRACE_SUPPORT
 	def_bool y
 
@@ -190,14 +181,14 @@ config CPU_SH3
 	bool
 	select CPU_HAS_INTEVT
 	select CPU_HAS_SR_RB
-	select SYS_SUPPORTS_TMU
+	select SYS_SUPPORTS_SH_TMU
 
 config CPU_SH4
 	bool
 	select CPU_HAS_INTEVT
 	select CPU_HAS_SR_RB
 	select CPU_HAS_FPU if !CPU_SH4AL_DSP
-	select SYS_SUPPORTS_TMU
+	select SYS_SUPPORTS_SH_TMU
 	select SYS_SUPPORTS_HUGETLBFS if MMU
 
 config CPU_SH4A
@@ -212,7 +203,7 @@ config CPU_SH4AL_DSP
 config CPU_SH5
 	bool
 	select CPU_HAS_FPU
-	select SYS_SUPPORTS_TMU
+	select SYS_SUPPORTS_SH_TMU
 	select SYS_SUPPORTS_HUGETLBFS if MMU
 
 config CPU_SHX2
@@ -249,7 +240,7 @@ choice
 config CPU_SUBTYPE_SH7619
 	bool "Support SH7619 processor"
 	select CPU_SH2
-	select SYS_SUPPORTS_CMT
+	select SYS_SUPPORTS_SH_CMT
 
 # SH-2A Processor Support
 
@@ -257,50 +248,50 @@ config CPU_SUBTYPE_SH7201
 	bool "Support SH7201 processor"
 	select CPU_SH2A
 	select CPU_HAS_FPU
-	select SYS_SUPPORTS_MTU2
+	select SYS_SUPPORTS_SH_MTU2
  
 config CPU_SUBTYPE_SH7203
 	bool "Support SH7203 processor"
 	select CPU_SH2A
 	select CPU_HAS_FPU
-	select SYS_SUPPORTS_CMT
-	select SYS_SUPPORTS_MTU2
+	select SYS_SUPPORTS_SH_CMT
+	select SYS_SUPPORTS_SH_MTU2
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select PINCTRL
 
 config CPU_SUBTYPE_SH7206
 	bool "Support SH7206 processor"
 	select CPU_SH2A
-	select SYS_SUPPORTS_CMT
-	select SYS_SUPPORTS_MTU2
+	select SYS_SUPPORTS_SH_CMT
+	select SYS_SUPPORTS_SH_MTU2
 
 config CPU_SUBTYPE_SH7263
 	bool "Support SH7263 processor"
 	select CPU_SH2A
 	select CPU_HAS_FPU
-	select SYS_SUPPORTS_CMT
-	select SYS_SUPPORTS_MTU2
+	select SYS_SUPPORTS_SH_CMT
+	select SYS_SUPPORTS_SH_MTU2
 
 config CPU_SUBTYPE_SH7264
 	bool "Support SH7264 processor"
 	select CPU_SH2A
 	select CPU_HAS_FPU
-	select SYS_SUPPORTS_CMT
-	select SYS_SUPPORTS_MTU2
+	select SYS_SUPPORTS_SH_CMT
+	select SYS_SUPPORTS_SH_MTU2
 	select PINCTRL
 
 config CPU_SUBTYPE_SH7269
 	bool "Support SH7269 processor"
 	select CPU_SH2A
 	select CPU_HAS_FPU
-	select SYS_SUPPORTS_CMT
-	select SYS_SUPPORTS_MTU2
+	select SYS_SUPPORTS_SH_CMT
+	select SYS_SUPPORTS_SH_MTU2
 	select PINCTRL
 
 config CPU_SUBTYPE_MXG
 	bool "Support MX-G processor"
 	select CPU_SH2A
-	select SYS_SUPPORTS_MTU2
+	select SYS_SUPPORTS_SH_MTU2
 	help
 	  Select MX-G if running on an R8A03022BG part.
 
@@ -353,7 +344,7 @@ config CPU_SUBTYPE_SH7720
 	bool "Support SH7720 processor"
 	select CPU_SH3
 	select CPU_HAS_DSP
-	select SYS_SUPPORTS_CMT
+	select SYS_SUPPORTS_SH_CMT
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select USB_ARCH_HAS_OHCI
 	select USB_OHCI_SH if USB_OHCI_HCD
@@ -365,7 +356,7 @@ config CPU_SUBTYPE_SH7721
 	bool "Support SH7721 processor"
 	select CPU_SH3
 	select CPU_HAS_DSP
-	select SYS_SUPPORTS_CMT
+	select SYS_SUPPORTS_SH_CMT
 	select USB_ARCH_HAS_OHCI
 	select USB_OHCI_SH if USB_OHCI_HCD
 	help
@@ -421,7 +412,7 @@ config CPU_SUBTYPE_SH7723
 	select CPU_SHX2
 	select ARCH_SHMOBILE
 	select ARCH_SPARSEMEM_ENABLE
-	select SYS_SUPPORTS_CMT
+	select SYS_SUPPORTS_SH_CMT
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select PINCTRL
 	help
@@ -433,7 +424,7 @@ config CPU_SUBTYPE_SH7724
 	select CPU_SHX2
 	select ARCH_SHMOBILE
 	select ARCH_SPARSEMEM_ENABLE
-	select SYS_SUPPORTS_CMT
+	select SYS_SUPPORTS_SH_CMT
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select PINCTRL
 	help
@@ -513,7 +504,7 @@ config CPU_SUBTYPE_SH7343
 	bool "Support SH7343 processor"
 	select CPU_SH4AL_DSP
 	select ARCH_SHMOBILE
-	select SYS_SUPPORTS_CMT
+	select SYS_SUPPORTS_SH_CMT
 
 config CPU_SUBTYPE_SH7722
 	bool "Support SH7722 processor"
@@ -522,7 +513,7 @@ config CPU_SUBTYPE_SH7722
 	select ARCH_SHMOBILE
 	select ARCH_SPARSEMEM_ENABLE
 	select SYS_SUPPORTS_NUMA
-	select SYS_SUPPORTS_CMT
+	select SYS_SUPPORTS_SH_CMT
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select PINCTRL
 
@@ -533,7 +524,7 @@ config CPU_SUBTYPE_SH7366
 	select ARCH_SHMOBILE
 	select ARCH_SPARSEMEM_ENABLE
 	select SYS_SUPPORTS_NUMA
-	select SYS_SUPPORTS_CMT
+	select SYS_SUPPORTS_SH_CMT
 
 endchoice
 
@@ -566,27 +557,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
#4 lore raw
In reply to Magnus Damm
Quoted 28 lines · Magnus Damm

clocksource: Consolidate SH and ARM mach-shmobile Kconfig bits (v5)

[PATCH v5 01/03] clocksource: Add Kconfig entries for CMT, MTU2, TMU and STI [PATCH v5 02/03] ARM: shmobile: Remove CMT, TMU and STI Kconfig entries [PATCH v5 03/03] sh: Remove Kconfig entries for TMU, CMT and MTU2

This is V5 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 Olof, John, Daniel and Arnd for feedback!

Changes since V4:
- Use SYS_SUPPORTS_SH/EM to avoid name space pollution, thanks Olof!
- Remove old SH entries for SYS_SUPPORTS_xxx, use above SH prefix instead

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

Quoted 4 lines

---

Written against renesas.git tag renesas-devel-v3.13-rc3-20131214v2

Do you want me to take the patchset ? If so, could you respin it against timers/core ?

Thanks
-- Daniel

Quoted 6 lines
  arch/arm/mach-shmobile/Kconfig |   35 ++++++++----------
  arch/sh/Kconfig                |   76 ++++++++++++----------------------------
  drivers/clocksource/Kconfig    |   44 +++++++++++++++++++++++
  3 files changed, 84 insertions(+), 71 deletions(-)
Signature · 5 lines
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
author maintainer
#5 lore raw

Hi Daniel,

Quoted 32 lines · Daniel Lezcano
Quoted 31 lines · Magnus Damm

clocksource: Consolidate SH and ARM mach-shmobile Kconfig bits (v5)

[PATCH v5 01/03] clocksource: Add Kconfig entries for CMT, MTU2, TMU and STI
[PATCH v5 02/03] ARM: shmobile: Remove CMT, TMU and STI Kconfig entries [PATCH v5 03/03] sh: Remove Kconfig entries for TMU, CMT and MTU2

This is V5 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 Olof, John, Daniel and Arnd for feedback!

Changes since V4:
- Use SYS_SUPPORTS_SH/EM to avoid name space pollution, thanks Olof!
- Remove old SH entries for SYS_SUPPORTS_xxx, use above SH prefix
instead

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

Quoted 8 lines
Quoted 4 lines

---

Written against renesas.git tag renesas-devel-v3.13-rc3-20131214v2

Do you want me to take the patchset ? If so, could you respin it against timers/core ?

That would be great, thanks! I will respin it!

Cheers,

/ magnus