Browse Source

Merge branch 'clockevents/4.15' of https://git.linaro.org/people/daniel.lezcano/linux into timers/core

Pull clockevent updates from Daniel Lezcano:

 - Improve the generic clockevents dependency by factoring out the option
   in the Kconfig menu option (Arnd Bergmann)

 - Add missing "\n" in pr_err messages for fttmr010, owl and rockchip
   (Arvind Yadav)

 - Add missing timer_of_exit function to rollback timer_of_init (Benjamin
   Gaignard)

 - Fix path and add bindings to timers (Daniel Lezcano)

 - Cleanup and remove support for renesas,cmt-32* (Geert Uytterhoeven)

 - Add support for separate R-Car Gen2 (Magnus Damm)

 - Fix DEFINE_PER_CPU length definition to prevent warning at expansion
   time for the arm_arch_timer (Mark Rutland)

 - Remove pointless irq_save,restore in an already irq-disabled callback
   and add a shortcut optimization for the local cpu on mips-gic-timer
   (Matt Redfearn)
Thomas Gleixner 7 years ago
parent
commit
eccbf5fbb4

+ 12 - 12
Documentation/devicetree/bindings/timer/renesas,cmt.txt

@@ -20,16 +20,16 @@ Required Properties:
 		(CMT1 on sh73a0 and r8a7740)
 		(CMT1 on sh73a0 and r8a7740)
 		This is a fallback for the above renesas,cmt-48-* entries.
 		This is a fallback for the above renesas,cmt-48-* entries.
 
 
-    - "renesas,cmt0-r8a73a4" for the 32-bit CMT0 device included in r8a73a4.
-    - "renesas,cmt1-r8a73a4" for the 48-bit CMT1 device included in r8a73a4.
-    - "renesas,cmt0-r8a7790" for the 32-bit CMT0 device included in r8a7790.
-    - "renesas,cmt1-r8a7790" for the 48-bit CMT1 device included in r8a7790.
-    - "renesas,cmt0-r8a7791" for the 32-bit CMT0 device included in r8a7791.
-    - "renesas,cmt1-r8a7791" for the 48-bit CMT1 device included in r8a7791.
-    - "renesas,cmt0-r8a7793" for the 32-bit CMT0 device included in r8a7793.
-    - "renesas,cmt1-r8a7793" for the 48-bit CMT1 device included in r8a7793.
-    - "renesas,cmt0-r8a7794" for the 32-bit CMT0 device included in r8a7794.
-    - "renesas,cmt1-r8a7794" for the 48-bit CMT1 device included in r8a7794.
+    - "renesas,r8a73a4-cmt0" for the 32-bit CMT0 device included in r8a73a4.
+    - "renesas,r8a73a4-cmt1" for the 48-bit CMT1 device included in r8a73a4.
+    - "renesas,r8a7790-cmt0" for the 32-bit CMT0 device included in r8a7790.
+    - "renesas,r8a7790-cmt1" for the 48-bit CMT1 device included in r8a7790.
+    - "renesas,r8a7791-cmt0" for the 32-bit CMT0 device included in r8a7791.
+    - "renesas,r8a7791-cmt1" for the 48-bit CMT1 device included in r8a7791.
+    - "renesas,r8a7793-cmt0" for the 32-bit CMT0 device included in r8a7793.
+    - "renesas,r8a7793-cmt1" for the 48-bit CMT1 device included in r8a7793.
+    - "renesas,r8a7794-cmt0" for the 32-bit CMT0 device included in r8a7794.
+    - "renesas,r8a7794-cmt1" for the 48-bit CMT1 device included in r8a7794.
 
 
     - "renesas,rcar-gen2-cmt0" for 32-bit CMT0 devices included in R-Car Gen2.
     - "renesas,rcar-gen2-cmt0" for 32-bit CMT0 devices included in R-Car Gen2.
     - "renesas,rcar-gen2-cmt1" for 48-bit CMT1 devices included in R-Car Gen2.
     - "renesas,rcar-gen2-cmt1" for 48-bit CMT1 devices included in R-Car Gen2.
@@ -46,7 +46,7 @@ Required Properties:
 Example: R8A7790 (R-Car H2) CMT0 and CMT1 nodes
 Example: R8A7790 (R-Car H2) CMT0 and CMT1 nodes
 
 
 	cmt0: timer@ffca0000 {
 	cmt0: timer@ffca0000 {
-		compatible = "renesas,cmt0-r8a7790", "renesas,rcar-gen2-cmt0";
+		compatible = "renesas,r8a7790-cmt0", "renesas,rcar-gen2-cmt0";
 		reg = <0 0xffca0000 0 0x1004>;
 		reg = <0 0xffca0000 0 0x1004>;
 		interrupts = <0 142 IRQ_TYPE_LEVEL_HIGH>,
 		interrupts = <0 142 IRQ_TYPE_LEVEL_HIGH>,
 			     <0 142 IRQ_TYPE_LEVEL_HIGH>;
 			     <0 142 IRQ_TYPE_LEVEL_HIGH>;
@@ -55,7 +55,7 @@ Example: R8A7790 (R-Car H2) CMT0 and CMT1 nodes
 	};
 	};
 
 
 	cmt1: timer@e6130000 {
 	cmt1: timer@e6130000 {
-		compatible = "renesas,cmt1-r8a7790", "renesas,rcar-gen2-cmt1";
+		compatible = "renesas,r8a7790-cmt1", "renesas,rcar-gen2-cmt1";
 		reg = <0 0xe6130000 0 0x1004>;
 		reg = <0 0xe6130000 0 0x1004>;
 		interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>,
 		interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>,
 			     <0 121 IRQ_TYPE_LEVEL_HIGH>,
 			     <0 121 IRQ_TYPE_LEVEL_HIGH>,

+ 2 - 1
MAINTAINERS

@@ -3444,7 +3444,8 @@ M:	Thomas Gleixner <tglx@linutronix.de>
 L:	linux-kernel@vger.kernel.org
 L:	linux-kernel@vger.kernel.org
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
 S:	Supported
 S:	Supported
-F:	drivers/clocksource
+F:	drivers/clocksource/
+F:	Documentation/devicetree/bindings/timer/
 
 
 CMPC ACPI DRIVER
 CMPC ACPI DRIVER
 M:	Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
 M:	Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>

+ 9 - 41
drivers/clocksource/Kconfig

@@ -1,9 +1,8 @@
 menu "Clock Source drivers"
 menu "Clock Source drivers"
-	depends on !ARCH_USES_GETTIMEOFFSET
+	depends on GENERIC_CLOCKEVENTS
 
 
 config TIMER_OF
 config TIMER_OF
 	bool
 	bool
-	depends on GENERIC_CLOCKEVENTS
 	select TIMER_PROBE
 	select TIMER_PROBE
 
 
 config TIMER_ACPI
 config TIMER_ACPI
@@ -30,21 +29,18 @@ config CLKSRC_MMIO
 
 
 config BCM2835_TIMER
 config BCM2835_TIMER
 	bool "BCM2835 timer driver" if COMPILE_TEST
 	bool "BCM2835 timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
 	  Enables the support for the BCM2835 timer driver.
 	  Enables the support for the BCM2835 timer driver.
 
 
 config BCM_KONA_TIMER
 config BCM_KONA_TIMER
 	bool "BCM mobile timer driver" if COMPILE_TEST
 	bool "BCM mobile timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
 	  Enables the support for the BCM Kona mobile timer driver.
 	  Enables the support for the BCM Kona mobile timer driver.
 
 
 config DIGICOLOR_TIMER
 config DIGICOLOR_TIMER
 	bool "Digicolor timer driver" if COMPILE_TEST
 	bool "Digicolor timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	help
 	help
@@ -52,7 +48,6 @@ config DIGICOLOR_TIMER
 
 
 config DW_APB_TIMER
 config DW_APB_TIMER
 	bool "DW APB timer driver" if COMPILE_TEST
 	bool "DW APB timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	help
 	help
 	  Enables the support for the dw_apb timer.
 	  Enables the support for the dw_apb timer.
 
 
@@ -63,7 +58,6 @@ config DW_APB_TIMER_OF
 
 
 config FTTMR010_TIMER
 config FTTMR010_TIMER
 	bool "Faraday Technology timer driver" if COMPILE_TEST
 	bool "Faraday Technology timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	select TIMER_OF
 	select TIMER_OF
@@ -90,7 +84,6 @@ config ARMADA_370_XP_TIMER
 
 
 config MESON6_TIMER
 config MESON6_TIMER
 	bool "Meson6 timer driver" if COMPILE_TEST
 	bool "Meson6 timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
 	  Enables the support for the Meson6 timer driver.
 	  Enables the support for the Meson6 timer driver.
@@ -105,14 +98,12 @@ config ORION_TIMER
 
 
 config OWL_TIMER
 config OWL_TIMER
 	bool "Owl timer driver" if COMPILE_TEST
 	bool "Owl timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
 	  Enables the support for the Actions Semi Owl timer driver.
 	  Enables the support for the Actions Semi Owl timer driver.
 
 
 config SUN4I_TIMER
 config SUN4I_TIMER
 	bool "Sun4i timer driver" if COMPILE_TEST
 	bool "Sun4i timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	select TIMER_OF
 	select TIMER_OF
@@ -135,7 +126,6 @@ config TEGRA_TIMER
 
 
 config VT8500_TIMER
 config VT8500_TIMER
 	bool "VT8500 timer driver" if COMPILE_TEST
 	bool "VT8500 timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	help
 	help
 	  Enables support for the VT8500 driver.
 	  Enables support for the VT8500 driver.
@@ -148,7 +138,6 @@ config CADENCE_TTC_TIMER
 
 
 config ASM9260_TIMER
 config ASM9260_TIMER
 	bool "ASM9260 timer driver" if COMPILE_TEST
 	bool "ASM9260 timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	select TIMER_OF
 	select TIMER_OF
 	help
 	help
@@ -171,28 +160,24 @@ config CLKSRC_NOMADIK_MTU_SCHED_CLOCK
 
 
 config CLKSRC_DBX500_PRCMU
 config CLKSRC_DBX500_PRCMU
 	bool "Clocksource PRCMU Timer" if COMPILE_TEST
 	bool "Clocksource PRCMU Timer" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	help
 	help
 	  Use the always on PRCMU Timer as clocksource
 	  Use the always on PRCMU Timer as clocksource
 
 
 config CLPS711X_TIMER
 config CLPS711X_TIMER
 	bool "Cirrus logic timer driver" if COMPILE_TEST
 	bool "Cirrus logic timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
 	  Enables support for the Cirrus Logic PS711 timer.
 	  Enables support for the Cirrus Logic PS711 timer.
 
 
 config ATLAS7_TIMER
 config ATLAS7_TIMER
 	bool "Atlas7 timer driver" if COMPILE_TEST
 	bool "Atlas7 timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
 	  Enables support for the Atlas7 timer.
 	  Enables support for the Atlas7 timer.
 
 
 config MXS_TIMER
 config MXS_TIMER
 	bool "Mxs timer driver" if COMPILE_TEST
 	bool "Mxs timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	select STMP_DEVICE
 	select STMP_DEVICE
 	help
 	help
@@ -200,14 +185,12 @@ config MXS_TIMER
 
 
 config PRIMA2_TIMER
 config PRIMA2_TIMER
 	bool "Prima2 timer driver" if COMPILE_TEST
 	bool "Prima2 timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
 	  Enables support for the Prima2 timer.
 	  Enables support for the Prima2 timer.
 
 
 config U300_TIMER
 config U300_TIMER
 	bool "U300 timer driver" if COMPILE_TEST
 	bool "U300 timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on ARM
 	depends on ARM
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
@@ -215,14 +198,12 @@ config U300_TIMER
 
 
 config NSPIRE_TIMER
 config NSPIRE_TIMER
 	bool "NSpire timer driver" if COMPILE_TEST
 	bool "NSpire timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
 	  Enables support for the Nspire timer.
 	  Enables support for the Nspire timer.
 
 
 config KEYSTONE_TIMER
 config KEYSTONE_TIMER
 	bool "Keystone timer driver" if COMPILE_TEST
 	bool "Keystone timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on ARM || ARM64
 	depends on ARM || ARM64
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
@@ -230,7 +211,6 @@ config KEYSTONE_TIMER
 
 
 config INTEGRATOR_AP_TIMER
 config INTEGRATOR_AP_TIMER
 	bool "Integrator-ap timer driver" if COMPILE_TEST
 	bool "Integrator-ap timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
 	  Enables support for the Integrator-ap timer.
 	  Enables support for the Integrator-ap timer.
@@ -253,7 +233,7 @@ config CLKSRC_EFM32
 
 
 config CLKSRC_LPC32XX
 config CLKSRC_LPC32XX
 	bool "Clocksource for LPC32XX" if COMPILE_TEST
 	bool "Clocksource for LPC32XX" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS && HAS_IOMEM
+	depends on HAS_IOMEM
 	depends on ARM
 	depends on ARM
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	select TIMER_OF
 	select TIMER_OF
@@ -262,7 +242,7 @@ config CLKSRC_LPC32XX
 
 
 config CLKSRC_PISTACHIO
 config CLKSRC_PISTACHIO
 	bool "Clocksource for Pistachio SoC" if COMPILE_TEST
 	bool "Clocksource for Pistachio SoC" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS && HAS_IOMEM
+	depends on HAS_IOMEM
 	select TIMER_OF
 	select TIMER_OF
 	help
 	help
 	  Enables the clocksource for the Pistachio SoC.
 	  Enables the clocksource for the Pistachio SoC.
@@ -298,7 +278,6 @@ config CLKSRC_MPS2
 
 
 config ARC_TIMERS
 config ARC_TIMERS
 	bool "Support for 32-bit TIMERn counters in ARC Cores" if COMPILE_TEST
 	bool "Support for 32-bit TIMERn counters in ARC Cores" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select TIMER_OF
 	select TIMER_OF
 	help
 	help
 	  These are legacy 32-bit TIMER0 and TIMER1 counters found on all ARC cores
 	  These are legacy 32-bit TIMER0 and TIMER1 counters found on all ARC cores
@@ -307,7 +286,6 @@ config ARC_TIMERS
 
 
 config ARC_TIMERS_64BIT
 config ARC_TIMERS_64BIT
 	bool "Support for 64-bit counters in ARC HS38 cores" if COMPILE_TEST
 	bool "Support for 64-bit counters in ARC HS38 cores" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on ARC_TIMERS
 	depends on ARC_TIMERS
 	select TIMER_OF
 	select TIMER_OF
 	help
 	help
@@ -407,7 +385,6 @@ config ATMEL_PIT
 
 
 config ATMEL_ST
 config ATMEL_ST
 	bool "Atmel ST timer support" if COMPILE_TEST
 	bool "Atmel ST timer support" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select TIMER_OF
 	select TIMER_OF
 	select MFD_SYSCON
 	select MFD_SYSCON
 	help
 	help
@@ -426,7 +403,6 @@ config CLKSRC_EXYNOS_MCT
 
 
 config CLKSRC_SAMSUNG_PWM
 config CLKSRC_SAMSUNG_PWM
 	bool "PWM timer driver for Samsung S3C, S5P" if COMPILE_TEST
 	bool "PWM timer driver for Samsung S3C, S5P" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	help
 	help
 	  This is a new clocksource driver for the PWM timer found in
 	  This is a new clocksource driver for the PWM timer found in
@@ -436,7 +412,6 @@ config CLKSRC_SAMSUNG_PWM
 
 
 config FSL_FTM_TIMER
 config FSL_FTM_TIMER
 	bool "Freescale FlexTimer Module driver" if COMPILE_TEST
 	bool "Freescale FlexTimer Module driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
@@ -450,7 +425,6 @@ config VF_PIT_TIMER
 
 
 config OXNAS_RPS_TIMER
 config OXNAS_RPS_TIMER
 	bool "Oxford Semiconductor OXNAS RPS Timers driver" if COMPILE_TEST
 	bool "Oxford Semiconductor OXNAS RPS Timers driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select TIMER_OF
 	select TIMER_OF
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
@@ -461,7 +435,7 @@ config SYS_SUPPORTS_SH_CMT
 
 
 config MTK_TIMER
 config MTK_TIMER
 	bool "Mediatek timer driver" if COMPILE_TEST
 	bool "Mediatek timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS && HAS_IOMEM
+	depends on HAS_IOMEM
 	select TIMER_OF
 	select TIMER_OF
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
@@ -479,7 +453,6 @@ config SYS_SUPPORTS_EM_STI
 config CLKSRC_JCORE_PIT
 config CLKSRC_JCORE_PIT
 	bool "J-Core PIT timer driver" if COMPILE_TEST
 	bool "J-Core PIT timer driver" if COMPILE_TEST
 	depends on OF
 	depends on OF
-	depends on GENERIC_CLOCKEVENTS
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
@@ -488,7 +461,6 @@ config CLKSRC_JCORE_PIT
 
 
 config SH_TIMER_CMT
 config SH_TIMER_CMT
 	bool "Renesas CMT timer driver" if COMPILE_TEST
 	bool "Renesas CMT timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	default SYS_SUPPORTS_SH_CMT
 	default SYS_SUPPORTS_SH_CMT
 	help
 	help
@@ -498,7 +470,6 @@ config SH_TIMER_CMT
 
 
 config SH_TIMER_MTU2
 config SH_TIMER_MTU2
 	bool "Renesas MTU2 timer driver" if COMPILE_TEST
 	bool "Renesas MTU2 timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	default SYS_SUPPORTS_SH_MTU2
 	default SYS_SUPPORTS_SH_MTU2
 	help
 	help
@@ -508,14 +479,12 @@ config SH_TIMER_MTU2
 
 
 config RENESAS_OSTM
 config RENESAS_OSTM
 	bool "Renesas OSTM timer driver" if COMPILE_TEST
 	bool "Renesas OSTM timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
 	  Enables the support for the Renesas OSTM.
 	  Enables the support for the Renesas OSTM.
 
 
 config SH_TIMER_TMU
 config SH_TIMER_TMU
 	bool "Renesas TMU timer driver" if COMPILE_TEST
 	bool "Renesas TMU timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	default SYS_SUPPORTS_SH_TMU
 	default SYS_SUPPORTS_SH_TMU
 	help
 	help
@@ -525,7 +494,7 @@ config SH_TIMER_TMU
 
 
 config EM_TIMER_STI
 config EM_TIMER_STI
 	bool "Renesas STI timer driver" if COMPILE_TEST
 	bool "Renesas STI timer driver" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS && HAS_IOMEM
+	depends on HAS_IOMEM
 	default SYS_SUPPORTS_EM_STI
 	default SYS_SUPPORTS_EM_STI
 	help
 	help
 	  This enables build of a clocksource and clockevent driver for
 	  This enables build of a clocksource and clockevent driver for
@@ -566,7 +535,6 @@ config CLKSRC_TANGO_XTAL
 
 
 config CLKSRC_PXA
 config CLKSRC_PXA
 	bool "Clocksource for PXA or SA-11x0 platform" if COMPILE_TEST
 	bool "Clocksource for PXA or SA-11x0 platform" if COMPILE_TEST
-	depends on GENERIC_CLOCKEVENTS
 	depends on HAS_IOMEM
 	depends on HAS_IOMEM
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
@@ -575,20 +543,20 @@ config CLKSRC_PXA
 
 
 config H8300_TMR8
 config H8300_TMR8
         bool "Clockevent timer for the H8300 platform" if COMPILE_TEST
         bool "Clockevent timer for the H8300 platform" if COMPILE_TEST
-        depends on GENERIC_CLOCKEVENTS && HAS_IOMEM
+        depends on HAS_IOMEM
 	help
 	help
 	  This enables the 8 bits timer for the H8300 platform.
 	  This enables the 8 bits timer for the H8300 platform.
 
 
 config H8300_TMR16
 config H8300_TMR16
         bool "Clockevent timer for the H83069 platform" if COMPILE_TEST
         bool "Clockevent timer for the H83069 platform" if COMPILE_TEST
-        depends on GENERIC_CLOCKEVENTS && HAS_IOMEM
+        depends on HAS_IOMEM
 	help
 	help
 	  This enables the 16 bits timer for the H8300 platform with the
 	  This enables the 16 bits timer for the H8300 platform with the
 	  H83069 cpu.
 	  H83069 cpu.
 
 
 config H8300_TPU
 config H8300_TPU
         bool "Clocksource for the H8300 platform" if COMPILE_TEST
         bool "Clocksource for the H8300 platform" if COMPILE_TEST
-        depends on GENERIC_CLOCKEVENTS && HAS_IOMEM
+        depends on HAS_IOMEM
 	help
 	help
 	  This enables the clocksource for the H8300 platform with the
 	  This enables the clocksource for the H8300 platform with the
 	  H8S2678 cpu.
 	  H8S2678 cpu.
@@ -600,7 +568,7 @@ config CLKSRC_IMX_GPT
 
 
 config CLKSRC_IMX_TPM
 config CLKSRC_IMX_TPM
 	bool "Clocksource using i.MX TPM" if COMPILE_TEST
 	bool "Clocksource using i.MX TPM" if COMPILE_TEST
-	depends on ARM && CLKDEV_LOOKUP && GENERIC_CLOCKEVENTS
+	depends on ARM && CLKDEV_LOOKUP
 	select CLKSRC_MMIO
 	select CLKSRC_MMIO
 	help
 	help
 	  Enable this option to use IMX Timer/PWM Module (TPM) timer as
 	  Enable this option to use IMX Timer/PWM Module (TPM) timer as

+ 22 - 19
drivers/clocksource/arm_arch_timer.c

@@ -299,8 +299,7 @@ static u64 notrace arm64_858921_read_cntvct_el0(void)
 #endif
 #endif
 
 
 #ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
 #ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
-DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *,
-	       timer_unstable_counter_workaround);
+DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *, timer_unstable_counter_workaround);
 EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
 EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
 
 
 DEFINE_STATIC_KEY_FALSE(arch_timer_read_ool_enabled);
 DEFINE_STATIC_KEY_FALSE(arch_timer_read_ool_enabled);
@@ -1268,10 +1267,6 @@ arch_timer_mem_find_best_frame(struct arch_timer_mem *timer_mem)
 
 
 	iounmap(cntctlbase);
 	iounmap(cntctlbase);
 
 
-	if (!best_frame)
-		pr_err("Unable to find a suitable frame in timer @ %pa\n",
-			&timer_mem->cntctlbase);
-
 	return best_frame;
 	return best_frame;
 }
 }
 
 
@@ -1372,6 +1367,8 @@ static int __init arch_timer_mem_of_init(struct device_node *np)
 
 
 	frame = arch_timer_mem_find_best_frame(timer_mem);
 	frame = arch_timer_mem_find_best_frame(timer_mem);
 	if (!frame) {
 	if (!frame) {
+		pr_err("Unable to find a suitable frame in timer @ %pa\n",
+			&timer_mem->cntctlbase);
 		ret = -EINVAL;
 		ret = -EINVAL;
 		goto out;
 		goto out;
 	}
 	}
@@ -1420,7 +1417,7 @@ arch_timer_mem_verify_cntfrq(struct arch_timer_mem *timer_mem)
 static int __init arch_timer_mem_acpi_init(int platform_timer_count)
 static int __init arch_timer_mem_acpi_init(int platform_timer_count)
 {
 {
 	struct arch_timer_mem *timers, *timer;
 	struct arch_timer_mem *timers, *timer;
-	struct arch_timer_mem_frame *frame;
+	struct arch_timer_mem_frame *frame, *best_frame = NULL;
 	int timer_count, i, ret = 0;
 	int timer_count, i, ret = 0;
 
 
 	timers = kcalloc(platform_timer_count, sizeof(*timers),
 	timers = kcalloc(platform_timer_count, sizeof(*timers),
@@ -1432,14 +1429,6 @@ static int __init arch_timer_mem_acpi_init(int platform_timer_count)
 	if (ret || !timer_count)
 	if (ret || !timer_count)
 		goto out;
 		goto out;
 
 
-	for (i = 0; i < timer_count; i++) {
-		ret = arch_timer_mem_verify_cntfrq(&timers[i]);
-		if (ret) {
-			pr_err("Disabling MMIO timers due to CNTFRQ mismatch\n");
-			goto out;
-		}
-	}
-
 	/*
 	/*
 	 * While unlikely, it's theoretically possible that none of the frames
 	 * While unlikely, it's theoretically possible that none of the frames
 	 * in a timer expose the combination of feature we want.
 	 * in a timer expose the combination of feature we want.
@@ -1448,12 +1437,26 @@ static int __init arch_timer_mem_acpi_init(int platform_timer_count)
 		timer = &timers[i];
 		timer = &timers[i];
 
 
 		frame = arch_timer_mem_find_best_frame(timer);
 		frame = arch_timer_mem_find_best_frame(timer);
-		if (frame)
-			break;
+		if (!best_frame)
+			best_frame = frame;
+
+		ret = arch_timer_mem_verify_cntfrq(timer);
+		if (ret) {
+			pr_err("Disabling MMIO timers due to CNTFRQ mismatch\n");
+			goto out;
+		}
+
+		if (!best_frame) /* implies !frame */
+			/*
+			 * Only complain about missing suitable frames if we
+			 * haven't already found one in a previous iteration.
+			 */
+			pr_err("Unable to find a suitable frame in timer @ %pa\n",
+				&timer->cntctlbase);
 	}
 	}
 
 
-	if (frame)
-		ret = arch_timer_mem_frame_register(frame);
+	if (best_frame)
+		ret = arch_timer_mem_frame_register(best_frame);
 out:
 out:
 	kfree(timers);
 	kfree(timers);
 	return ret;
 	return ret;

+ 7 - 5
drivers/clocksource/mips-gic-timer.c

@@ -39,16 +39,18 @@ static u64 notrace gic_read_count(void)
 
 
 static int gic_next_event(unsigned long delta, struct clock_event_device *evt)
 static int gic_next_event(unsigned long delta, struct clock_event_device *evt)
 {
 {
-	unsigned long flags;
+	int cpu = cpumask_first(evt->cpumask);
 	u64 cnt;
 	u64 cnt;
 	int res;
 	int res;
 
 
 	cnt = gic_read_count();
 	cnt = gic_read_count();
 	cnt += (u64)delta;
 	cnt += (u64)delta;
-	local_irq_save(flags);
-	write_gic_vl_other(mips_cm_vp_id(cpumask_first(evt->cpumask)));
-	write_gic_vo_compare(cnt);
-	local_irq_restore(flags);
+	if (cpu == raw_smp_processor_id()) {
+		write_gic_vl_compare(cnt);
+	} else {
+		write_gic_vl_other(mips_cm_vp_id(cpu));
+		write_gic_vo_compare(cnt);
+	}
 	res = ((int)(gic_read_count() - cnt) >= 0) ? -ETIME : 0;
 	res = ((int)(gic_read_count() - cnt) >= 0) ? -ETIME : 0;
 	return res;
 	return res;
 }
 }

+ 2 - 2
drivers/clocksource/owl-timer.c

@@ -125,7 +125,7 @@ static int __init owl_timer_init(struct device_node *node)
 
 
 	owl_timer_base = of_io_request_and_map(node, 0, "owl-timer");
 	owl_timer_base = of_io_request_and_map(node, 0, "owl-timer");
 	if (IS_ERR(owl_timer_base)) {
 	if (IS_ERR(owl_timer_base)) {
-		pr_err("Can't map timer registers");
+		pr_err("Can't map timer registers\n");
 		return PTR_ERR(owl_timer_base);
 		return PTR_ERR(owl_timer_base);
 	}
 	}
 
 
@@ -134,7 +134,7 @@ static int __init owl_timer_init(struct device_node *node)
 
 
 	timer1_irq = of_irq_get_byname(node, "timer1");
 	timer1_irq = of_irq_get_byname(node, "timer1");
 	if (timer1_irq <= 0) {
 	if (timer1_irq <= 0) {
-		pr_err("Can't parse timer1 IRQ");
+		pr_err("Can't parse timer1 IRQ\n");
 		return -EINVAL;
 		return -EINVAL;
 	}
 	}
 
 

+ 1 - 1
drivers/clocksource/rockchip_timer.c

@@ -274,7 +274,7 @@ static int __init rk_clksrc_init(struct device_node *np)
 		TIMER_NAME, rk_clksrc->freq, 250, 32,
 		TIMER_NAME, rk_clksrc->freq, 250, 32,
 		clocksource_mmio_readl_down);
 		clocksource_mmio_readl_down);
 	if (ret) {
 	if (ret) {
-		pr_err("Failed to register clocksource");
+		pr_err("Failed to register clocksource\n");
 		goto out_clocksource;
 		goto out_clocksource;
 	}
 	}
 
 

+ 33 - 43
drivers/clocksource/sh_cmt.c

@@ -25,6 +25,7 @@
 #include <linux/irq.h>
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
 #include <linux/pm_domain.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm_runtime.h>
@@ -39,16 +40,16 @@ struct sh_cmt_device;
  * SoC but also on the particular instance. The following table lists the main
  * SoC but also on the particular instance. The following table lists the main
  * characteristics of those flavours.
  * characteristics of those flavours.
  *
  *
- *			16B	32B	32B-F	48B	48B-2
+ *			16B	32B	32B-F	48B	R-Car Gen2
  * -----------------------------------------------------------------------------
  * -----------------------------------------------------------------------------
  * Channels		2	1/4	1	6	2/8
  * Channels		2	1/4	1	6	2/8
  * Control Width	16	16	16	16	32
  * Control Width	16	16	16	16	32
  * Counter Width	16	32	32	32/48	32/48
  * Counter Width	16	32	32	32/48	32/48
  * Shared Start/Stop	Y	Y	Y	Y	N
  * Shared Start/Stop	Y	Y	Y	Y	N
  *
  *
- * The 48-bit gen2 version has a per-channel start/stop register located in the
- * channel registers block. All other versions have a shared start/stop register
- * located in the global space.
+ * The r8a73a4 / R-Car Gen2 version has a per-channel start/stop register
+ * located in the channel registers block. All other versions have a shared
+ * start/stop register located in the global space.
  *
  *
  * Channels are indexed from 0 to N-1 in the documentation. The channel index
  * Channels are indexed from 0 to N-1 in the documentation. The channel index
  * infers the start/stop bit position in the control register and the channel
  * infers the start/stop bit position in the control register and the channel
@@ -66,14 +67,16 @@ struct sh_cmt_device;
 enum sh_cmt_model {
 enum sh_cmt_model {
 	SH_CMT_16BIT,
 	SH_CMT_16BIT,
 	SH_CMT_32BIT,
 	SH_CMT_32BIT,
-	SH_CMT_32BIT_FAST,
 	SH_CMT_48BIT,
 	SH_CMT_48BIT,
-	SH_CMT_48BIT_GEN2,
+	SH_CMT0_RCAR_GEN2,
+	SH_CMT1_RCAR_GEN2,
 };
 };
 
 
 struct sh_cmt_info {
 struct sh_cmt_info {
 	enum sh_cmt_model model;
 	enum sh_cmt_model model;
 
 
+	unsigned int channels_mask;
+
 	unsigned long width; /* 16 or 32 bit version of hardware block */
 	unsigned long width; /* 16 or 32 bit version of hardware block */
 	unsigned long overflow_bit;
 	unsigned long overflow_bit;
 	unsigned long clear_bits;
 	unsigned long clear_bits;
@@ -200,18 +203,20 @@ static const struct sh_cmt_info sh_cmt_info[] = {
 		.read_count = sh_cmt_read32,
 		.read_count = sh_cmt_read32,
 		.write_count = sh_cmt_write32,
 		.write_count = sh_cmt_write32,
 	},
 	},
-	[SH_CMT_32BIT_FAST] = {
-		.model = SH_CMT_32BIT_FAST,
+	[SH_CMT_48BIT] = {
+		.model = SH_CMT_48BIT,
+		.channels_mask = 0x3f,
 		.width = 32,
 		.width = 32,
 		.overflow_bit = SH_CMT32_CMCSR_CMF,
 		.overflow_bit = SH_CMT32_CMCSR_CMF,
 		.clear_bits = ~(SH_CMT32_CMCSR_CMF | SH_CMT32_CMCSR_OVF),
 		.clear_bits = ~(SH_CMT32_CMCSR_CMF | SH_CMT32_CMCSR_OVF),
-		.read_control = sh_cmt_read16,
-		.write_control = sh_cmt_write16,
+		.read_control = sh_cmt_read32,
+		.write_control = sh_cmt_write32,
 		.read_count = sh_cmt_read32,
 		.read_count = sh_cmt_read32,
 		.write_count = sh_cmt_write32,
 		.write_count = sh_cmt_write32,
 	},
 	},
-	[SH_CMT_48BIT] = {
-		.model = SH_CMT_48BIT,
+	[SH_CMT0_RCAR_GEN2] = {
+		.model = SH_CMT0_RCAR_GEN2,
+		.channels_mask = 0x60,
 		.width = 32,
 		.width = 32,
 		.overflow_bit = SH_CMT32_CMCSR_CMF,
 		.overflow_bit = SH_CMT32_CMCSR_CMF,
 		.clear_bits = ~(SH_CMT32_CMCSR_CMF | SH_CMT32_CMCSR_OVF),
 		.clear_bits = ~(SH_CMT32_CMCSR_CMF | SH_CMT32_CMCSR_OVF),
@@ -220,8 +225,9 @@ static const struct sh_cmt_info sh_cmt_info[] = {
 		.read_count = sh_cmt_read32,
 		.read_count = sh_cmt_read32,
 		.write_count = sh_cmt_write32,
 		.write_count = sh_cmt_write32,
 	},
 	},
-	[SH_CMT_48BIT_GEN2] = {
-		.model = SH_CMT_48BIT_GEN2,
+	[SH_CMT1_RCAR_GEN2] = {
+		.model = SH_CMT1_RCAR_GEN2,
+		.channels_mask = 0xff,
 		.width = 32,
 		.width = 32,
 		.overflow_bit = SH_CMT32_CMCSR_CMF,
 		.overflow_bit = SH_CMT32_CMCSR_CMF,
 		.clear_bits = ~(SH_CMT32_CMCSR_CMF | SH_CMT32_CMCSR_OVF),
 		.clear_bits = ~(SH_CMT32_CMCSR_CMF | SH_CMT32_CMCSR_OVF),
@@ -859,6 +865,7 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
 	ch->cmt = cmt;
 	ch->cmt = cmt;
 	ch->index = index;
 	ch->index = index;
 	ch->hwidx = hwidx;
 	ch->hwidx = hwidx;
+	ch->timer_bit = hwidx;
 
 
 	/*
 	/*
 	 * Compute the address of the channel control register block. For the
 	 * Compute the address of the channel control register block. For the
@@ -873,16 +880,11 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
 	case SH_CMT_48BIT:
 	case SH_CMT_48BIT:
 		ch->ioctrl = cmt->mapbase + 0x10 + ch->hwidx * 0x10;
 		ch->ioctrl = cmt->mapbase + 0x10 + ch->hwidx * 0x10;
 		break;
 		break;
-	case SH_CMT_32BIT_FAST:
-		/*
-		 * The 32-bit "fast" timer has a single channel at hwidx 5 but
-		 * is located at offset 0x40 instead of 0x60 for some reason.
-		 */
-		ch->ioctrl = cmt->mapbase + 0x40;
-		break;
-	case SH_CMT_48BIT_GEN2:
+	case SH_CMT0_RCAR_GEN2:
+	case SH_CMT1_RCAR_GEN2:
 		ch->iostart = cmt->mapbase + ch->hwidx * 0x100;
 		ch->iostart = cmt->mapbase + ch->hwidx * 0x100;
 		ch->ioctrl = ch->iostart + 0x10;
 		ch->ioctrl = ch->iostart + 0x10;
+		ch->timer_bit = 0;
 		break;
 		break;
 	}
 	}
 
 
@@ -894,8 +896,6 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
 	ch->match_value = ch->max_match_value;
 	ch->match_value = ch->max_match_value;
 	raw_spin_lock_init(&ch->lock);
 	raw_spin_lock_init(&ch->lock);
 
 
-	ch->timer_bit = cmt->info->model == SH_CMT_48BIT_GEN2 ? 0 : ch->hwidx;
-
 	ret = sh_cmt_register(ch, dev_name(&cmt->pdev->dev),
 	ret = sh_cmt_register(ch, dev_name(&cmt->pdev->dev),
 			      clockevent, clocksource);
 			      clockevent, clocksource);
 	if (ret) {
 	if (ret) {
@@ -935,22 +935,18 @@ static const struct platform_device_id sh_cmt_id_table[] = {
 MODULE_DEVICE_TABLE(platform, sh_cmt_id_table);
 MODULE_DEVICE_TABLE(platform, sh_cmt_id_table);
 
 
 static const struct of_device_id sh_cmt_of_table[] __maybe_unused = {
 static const struct of_device_id sh_cmt_of_table[] __maybe_unused = {
-	{ .compatible = "renesas,cmt-32", .data = &sh_cmt_info[SH_CMT_32BIT] },
-	{ .compatible = "renesas,cmt-32-fast", .data = &sh_cmt_info[SH_CMT_32BIT_FAST] },
 	{ .compatible = "renesas,cmt-48", .data = &sh_cmt_info[SH_CMT_48BIT] },
 	{ .compatible = "renesas,cmt-48", .data = &sh_cmt_info[SH_CMT_48BIT] },
-	{ .compatible = "renesas,cmt-48-gen2", .data = &sh_cmt_info[SH_CMT_48BIT_GEN2] },
+	{
+		/* deprecated, preserved for backward compatibility */
+		.compatible = "renesas,cmt-48-gen2",
+		.data = &sh_cmt_info[SH_CMT0_RCAR_GEN2]
+	},
+	{ .compatible = "renesas,rcar-gen2-cmt0", .data = &sh_cmt_info[SH_CMT0_RCAR_GEN2] },
+	{ .compatible = "renesas,rcar-gen2-cmt1", .data = &sh_cmt_info[SH_CMT1_RCAR_GEN2] },
 	{ }
 	{ }
 };
 };
 MODULE_DEVICE_TABLE(of, sh_cmt_of_table);
 MODULE_DEVICE_TABLE(of, sh_cmt_of_table);
 
 
-static int sh_cmt_parse_dt(struct sh_cmt_device *cmt)
-{
-	struct device_node *np = cmt->pdev->dev.of_node;
-
-	return of_property_read_u32(np, "renesas,channels-mask",
-				    &cmt->hw_channels);
-}
-
 static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
 static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
 {
 {
 	unsigned int mask;
 	unsigned int mask;
@@ -961,14 +957,8 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
 	raw_spin_lock_init(&cmt->lock);
 	raw_spin_lock_init(&cmt->lock);
 
 
 	if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
 	if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
-		const struct of_device_id *id;
-
-		id = of_match_node(sh_cmt_of_table, pdev->dev.of_node);
-		cmt->info = id->data;
-
-		ret = sh_cmt_parse_dt(cmt);
-		if (ret < 0)
-			return ret;
+		cmt->info = of_device_get_match_data(&pdev->dev);
+		cmt->hw_channels = cmt->info->channels_mask;
 	} else if (pdev->dev.platform_data) {
 	} else if (pdev->dev.platform_data) {
 		struct sh_timer_config *cfg = pdev->dev.platform_data;
 		struct sh_timer_config *cfg = pdev->dev.platform_data;
 		const struct platform_device_id *id = pdev->id_entry;
 		const struct platform_device_id *id = pdev->id_entry;

+ 2 - 2
drivers/clocksource/timer-fttmr010.c

@@ -263,14 +263,14 @@ static int __init fttmr010_common_init(struct device_node *np, bool is_aspeed)
 
 
 	fttmr010->base = of_iomap(np, 0);
 	fttmr010->base = of_iomap(np, 0);
 	if (!fttmr010->base) {
 	if (!fttmr010->base) {
-		pr_err("Can't remap registers");
+		pr_err("Can't remap registers\n");
 		ret = -ENXIO;
 		ret = -ENXIO;
 		goto out_free;
 		goto out_free;
 	}
 	}
 	/* IRQ for timer 1 */
 	/* IRQ for timer 1 */
 	irq = irq_of_parse_and_map(np, 0);
 	irq = irq_of_parse_and_map(np, 0);
 	if (irq <= 0) {
 	if (irq <= 0) {
-		pr_err("Can't parse IRQ");
+		pr_err("Can't parse IRQ\n");
 		ret = -EINVAL;
 		ret = -EINVAL;
 		goto out_unmap;
 		goto out_unmap;
 	}
 	}

+ 12 - 0
drivers/clocksource/timer-of.c

@@ -176,3 +176,15 @@ out_fail:
 		timer_base_exit(&to->of_base);
 		timer_base_exit(&to->of_base);
 	return ret;
 	return ret;
 }
 }
+
+void timer_of_exit(struct timer_of *to)
+{
+	if (to->flags & TIMER_OF_IRQ)
+		timer_irq_exit(&to->of_irq);
+
+	if (to->flags & TIMER_OF_CLOCK)
+		timer_clk_exit(&to->of_clk);
+
+	if (to->flags & TIMER_OF_BASE)
+		timer_base_exit(&to->of_base);
+}

+ 3 - 0
drivers/clocksource/timer-of.h

@@ -66,4 +66,7 @@ static inline unsigned long timer_of_period(struct timer_of *to)
 
 
 extern int __init timer_of_init(struct device_node *np,
 extern int __init timer_of_init(struct device_node *np,
 				struct timer_of *to);
 				struct timer_of *to);
+
+extern void timer_of_exit(struct timer_of *to);
+
 #endif
 #endif