Skip to contentSkip to conversation

move arm dual timer into drivers/clocksource

PATCH New Kefeng Wang 2 participants 5 messages Aug 1, 2014 – Sep 9, 2014

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover move arm dual timer into drivers/clocksource

Kefeng Wang (3):
ARM: remove unnecessary include arm_timer.h and timer-sp.h
clocksource: move arm dual timer into drivers/clocksource
clocksouce: sp804: use pr_fmt for logging

 arch/arm/Kconfig                          |   5 -
 arch/arm/common/Makefile                  |   1 -
 arch/arm/common/timer-sp.c                | 304 -----------------------------
 arch/arm/include/asm/hardware/arm_timer.h |  35 ----
 arch/arm/include/asm/hardware/timer-sp.h  |  23 ---
 arch/arm/mach-integrator/integrator_ap.c  |   2 +-
 arch/arm/mach-nspire/nspire.c             |   2 -
 arch/arm/mach-realview/core.c             |   5 +-
 arch/arm/mach-versatile/core.c            |   5 +-
 arch/arm/mach-vexpress/ct-ca9x4.c         |   3 -
 arch/arm/mach-vexpress/v2m.c              |   5 +-
 drivers/clocksource/Kconfig               |   7 +
 drivers/clocksource/Makefile              |   1 +
 drivers/clocksource/timer-sp.c            | 307 ++++++++++++++++++++++++++++++
 include/clocksource/arm_timer.h           |  35 ++++
 include/clocksource/timer-sp.h            |  23 +++
 16 files changed, 383 insertions(+), 380 deletions(-)
 delete mode 100644 arch/arm/common/timer-sp.c
 delete mode 100644 arch/arm/include/asm/hardware/arm_timer.h
 delete mode 100644 arch/arm/include/asm/hardware/timer-sp.h
 create mode 100644 drivers/clocksource/timer-sp.c
 create mode 100644 include/clocksource/arm_timer.h
 create mode 100644 include/clocksource/timer-sp.h
Signature · 1 line
1.7.12.4
#1 lore raw

PATCH 1/3 ARM: remove unnecessary include arm_timer.h and timer-sp.h

---
 arch/arm/mach-nspire/nspire.c     | 2 --
 arch/arm/mach-vexpress/ct-ca9x4.c | 3 ---
 2 files changed, 5 deletions(-)
arch/arm/mach-nspire/nspire.c +0 -2
index 3d24ebf..ba3607e 100644
@@ -22,8 +22,6 @@
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
 
-#include <asm/hardware/timer-sp.h>
-
 #include "mmio.h"
 #include "clcd.h"
 
arch/arm/mach-vexpress/ct-ca9x4.c +0 -3
index 86150d7..18a6907 100644
@@ -12,15 +12,12 @@
 #include <linux/vexpress.h>
 #include <linux/irqchip/arm-gic.h>
 
-#include <asm/hardware/arm_timer.h>
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/smp_scu.h>
 #include <asm/smp_twd.h>
 
 #include <mach/ct-ca9x4.h>
 
-#include <asm/hardware/timer-sp.h>
-
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 
Signature · 1 line
1.7.12.4
#2 lore raw

PATCH 2/3 clocksource: move arm dual timer into drivers/clocksource

In reply to Kefeng Wang

Move arm dual timer sp804 into drivers/clocksource, update the Kconfig, makefile, so the code is co-located with other clocksource drivers, and the sp804 can be enabled by ARM/ARM64.

---
 arch/arm/Kconfig                          |   5 -
 arch/arm/common/Makefile                  |   1 -
 arch/arm/common/timer-sp.c                | 304 ------------------------------
 arch/arm/include/asm/hardware/arm_timer.h |  35 ----
 arch/arm/include/asm/hardware/timer-sp.h  |  23 ---
 arch/arm/mach-integrator/integrator_ap.c  |   2 +-
 arch/arm/mach-realview/core.c             |   5 +-
 arch/arm/mach-versatile/core.c            |   5 +-
 arch/arm/mach-vexpress/v2m.c              |   5 +-
 drivers/clocksource/Kconfig               |   7 +
 drivers/clocksource/Makefile              |   1 +
 drivers/clocksource/timer-sp.c            | 304 ++++++++++++++++++++++++++++++
 include/clocksource/arm_timer.h           |  35 ++++
 include/clocksource/timer-sp.h            |  23 +++
 14 files changed, 380 insertions(+), 375 deletions(-)
 delete mode 100644 arch/arm/common/timer-sp.c
 delete mode 100644 arch/arm/include/asm/hardware/arm_timer.h
 delete mode 100644 arch/arm/include/asm/hardware/timer-sp.h
 create mode 100644 drivers/clocksource/timer-sp.c
 create mode 100644 include/clocksource/arm_timer.h
 create mode 100644 include/clocksource/timer-sp.h
arch/arm/Kconfig +0 -5
index 88acf8b..f7c62b8 100644
@@ -1062,11 +1062,6 @@ config PLAT_PXA
 config PLAT_VERSATILE
 	bool
 
-config ARM_TIMER_SP804
-	bool
-	select CLKSRC_MMIO
-	select CLKSRC_OF if OF
-
 source "arch/arm/firmware/Kconfig"
 
 source arch/arm/mm/Kconfig
arch/arm/common/Makefile +0 -1
index 70b1eff..6ee5959 100644
@@ -11,7 +11,6 @@ obj-$(CONFIG_SHARP_LOCOMO)	+= locomo.o
 obj-$(CONFIG_SHARP_PARAM)	+= sharpsl_param.o
 obj-$(CONFIG_SHARP_SCOOP)	+= scoop.o
 obj-$(CONFIG_PCI_HOST_ITE8152)  += it8152.o
-obj-$(CONFIG_ARM_TIMER_SP804)	+= timer-sp.o
 obj-$(CONFIG_MCPM)		+= mcpm_head.o mcpm_entry.o mcpm_platsmp.o vlock.o
 CFLAGS_REMOVE_mcpm_entry.o	= -pg
 AFLAGS_mcpm_head.o		:= -march=armv7-a
arch/arm/common/timer-sp.c deleted +0 -304

304 lines not on this page · raw message

arch/arm/include/asm/hardware/arm_timer.h deleted +0 -35
deleted file mode 100644
index d6030ff..0000000
@@ -1,35 +0,0 @@
-#ifndef __ASM_ARM_HARDWARE_ARM_TIMER_H
-#define __ASM_ARM_HARDWARE_ARM_TIMER_H
-
-/*
- * ARM timer implementation, found in Integrator, Versatile and Realview
- * platforms.  Not all platforms support all registers and bits in these
- * registers, so we mark them with A for Integrator AP, C for Integrator
- * CP, V for Versatile and R for Realview.
- *
- * Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview
- * can have 16-bit or 32-bit selectable via a bit in the control register.
- *
- * Every SP804 contains two identical timers.
- */
-#define TIMER_1_BASE	0x00
-#define TIMER_2_BASE	0x20
-
-#define TIMER_LOAD	0x00			/* ACVR rw */
-#define TIMER_VALUE	0x04			/* ACVR ro */
-#define TIMER_CTRL	0x08			/* ACVR rw */
-#define TIMER_CTRL_ONESHOT	(1 << 0)	/*  CVR */
-#define TIMER_CTRL_32BIT	(1 << 1)	/*  CVR */
-#define TIMER_CTRL_DIV1		(0 << 2)	/* ACVR */
-#define TIMER_CTRL_DIV16	(1 << 2)	/* ACVR */
-#define TIMER_CTRL_DIV256	(2 << 2)	/* ACVR */
-#define TIMER_CTRL_IE		(1 << 5)	/*   VR */
-#define TIMER_CTRL_PERIODIC	(1 << 6)	/* ACVR */
-#define TIMER_CTRL_ENABLE	(1 << 7)	/* ACVR */
-
-#define TIMER_INTCLR	0x0c			/* ACVR wo */
-#define TIMER_RIS	0x10			/*  CVR ro */
-#define TIMER_MIS	0x14			/*  CVR ro */
-#define TIMER_BGLOAD	0x18			/*  CVR rw */
-
-#endif
arch/arm/include/asm/hardware/timer-sp.h deleted +0 -23
deleted file mode 100644
index bb28af7..0000000
@@ -1,23 +0,0 @@
-struct clk;
-
-void __sp804_clocksource_and_sched_clock_init(void __iomem *,
-					      const char *, struct clk *, int);
-void __sp804_clockevents_init(void __iomem *, unsigned int,
-			      struct clk *, const char *);
-
-static inline void sp804_clocksource_init(void __iomem *base, const char *name)
-{
-	__sp804_clocksource_and_sched_clock_init(base, name, NULL, 0);
-}
-
-static inline void sp804_clocksource_and_sched_clock_init(void __iomem *base,
-							  const char *name)
-{
-	__sp804_clocksource_and_sched_clock_init(base, name, NULL, 1);
-}
-
-static inline void sp804_clockevents_init(void __iomem *base, unsigned int irq, const char *name)
-{
-	__sp804_clockevents_init(base, irq, NULL, name);
-
-}
arch/arm/mach-integrator/integrator_ap.c +1 -1
index 660ca6f..4b42d8a 100644
@@ -44,7 +44,7 @@
 #include <linux/sched_clock.h>
 #include <linux/clk-provider.h>
 
-#include <asm/hardware/arm_timer.h>
+#include <clocksource/arm_timer.h>
 #include <asm/setup.h>
 #include <asm/param.h>		/* HZ */
 #include <asm/mach-types.h>
arch/arm/mach-realview/core.c +3 -2
index 8c1b39a..e221838 100644
@@ -36,7 +36,6 @@
 #include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
-#include <asm/hardware/arm_timer.h>
 #include <asm/hardware/icst.h>
 
 #include <asm/mach/arch.h>
@@ -46,7 +45,9 @@
 
 #include <mach/platform.h>
 #include <mach/irqs.h>
-#include <asm/hardware/timer-sp.h>
+
+#include <clocksource/arm_timer.h>
+#include <clocksource/timer-sp.h>
 
 #include <plat/clcd.h>
 #include <plat/sched_clock.h>
arch/arm/mach-versatile/core.c +3 -2
index be83ba2..21234a8 100644
@@ -41,7 +41,6 @@
 #include <linux/reboot.h>
 
 #include <asm/irq.h>
-#include <asm/hardware/arm_timer.h>
 #include <asm/hardware/icst.h>
 #include <asm/mach-types.h>
 
@@ -51,7 +50,9 @@
 #include <asm/mach/map.h>
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include <asm/hardware/timer-sp.h>
+
+#include <clocksource/arm_timer.h>
+#include <clocksource/timer-sp.h>
 
 #include <plat/clcd.h>
 #include <plat/sched_clock.h>
arch/arm/mach-vexpress/v2m.c +3 -2
index 6ff681a..161a8e4 100644
@@ -27,9 +27,10 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
-#include <asm/hardware/arm_timer.h>
 #include <asm/hardware/cache-l2x0.h>
-#include <asm/hardware/timer-sp.h>
+
+#include <clocksource/arm_timer.h>
+#include <clocksource/timer-sp.h>
 
 #include <mach/ct-ca9x4.h>
 #include <mach/motherboard.h>
drivers/clocksource/Kconfig +7 -0
index 065131c..80ca5f7 100644
@@ -111,6 +111,13 @@ config ARM_GLOBAL_TIMER
 	help
 	  This options enables support for the ARM global timer unit
 
+config ARM_TIMER_SP804
+	bool
+	select CLKSRC_MMIO
+	select CLKSRC_OF if OF
+	help
+	  This options enables support for the ARM dual timer sp804
+
 config CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
 	bool
 	depends on ARM_GLOBAL_TIMER
drivers/clocksource/Makefile +1 -0
index 800b130..5934b3b 100644
@@ -37,6 +37,7 @@ obj-$(CONFIG_CLKSRC_QCOM)	+= qcom-timer.o
 
 obj-$(CONFIG_ARM_ARCH_TIMER)		+= arm_arch_timer.o
 obj-$(CONFIG_ARM_GLOBAL_TIMER)		+= arm_global_timer.o
+obj-$(CONFIG_ARM_TIMER_SP804)		+= timer-sp.o
 obj-$(CONFIG_CLKSRC_METAG_GENERIC)	+= metag_generic.o
 obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST)	+= dummy_timer.o
 obj-$(CONFIG_ARCH_KEYSTONE)		+= timer-keystone.o
drivers/clocksource/timer-sp.c new file +304 -0

304 lines not on this page · raw message

include/clocksource/arm_timer.h new file +35 -0
new file mode 100644
index 0000000..b94da5d
@@ -0,0 +1,35 @@
+#ifndef __CLKSOURCE_ARM_TIMER_H
+#define __CLKSOURCE_ARM_TIMER_H
+
+/*
+ * ARM timer implementation, found in Integrator, Versatile and Realview
+ * platforms.  Not all platforms support all registers and bits in these
+ * registers, so we mark them with A for Integrator AP, C for Integrator
+ * CP, V for Versatile and R for Realview.
+ *
+ * Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview
+ * can have 16-bit or 32-bit selectable via a bit in the control register.
+ *
+ * Every SP804 contains two identical timers.
+ */
+#define TIMER_1_BASE	0x00
+#define TIMER_2_BASE	0x20
+
+#define TIMER_LOAD	0x00			/* ACVR rw */
+#define TIMER_VALUE	0x04			/* ACVR ro */
+#define TIMER_CTRL	0x08			/* ACVR rw */
+#define TIMER_CTRL_ONESHOT	(1 << 0)	/*  CVR */
+#define TIMER_CTRL_32BIT	(1 << 1)	/*  CVR */
+#define TIMER_CTRL_DIV1		(0 << 2)	/* ACVR */
+#define TIMER_CTRL_DIV16	(1 << 2)	/* ACVR */
+#define TIMER_CTRL_DIV256	(2 << 2)	/* ACVR */
+#define TIMER_CTRL_IE		(1 << 5)	/*   VR */
+#define TIMER_CTRL_PERIODIC	(1 << 6)	/* ACVR */
+#define TIMER_CTRL_ENABLE	(1 << 7)	/* ACVR */
+
+#define TIMER_INTCLR	0x0c			/* ACVR wo */
+#define TIMER_RIS	0x10			/*  CVR ro */
+#define TIMER_MIS	0x14			/*  CVR ro */
+#define TIMER_BGLOAD	0x18			/*  CVR rw */
+
+#endif
include/clocksource/timer-sp.h new file +23 -0
new file mode 100644
index 0000000..bb28af7
@@ -0,0 +1,23 @@
+struct clk;
+
+void __sp804_clocksource_and_sched_clock_init(void __iomem *,
+					      const char *, struct clk *, int);
+void __sp804_clockevents_init(void __iomem *, unsigned int,
+			      struct clk *, const char *);
+
+static inline void sp804_clocksource_init(void __iomem *base, const char *name)
+{
+	__sp804_clocksource_and_sched_clock_init(base, name, NULL, 0);
+}
+
+static inline void sp804_clocksource_and_sched_clock_init(void __iomem *base,
+							  const char *name)
+{
+	__sp804_clocksource_and_sched_clock_init(base, name, NULL, 1);
+}
+
+static inline void sp804_clockevents_init(void __iomem *base, unsigned int irq, const char *name)
+{
+	__sp804_clockevents_init(base, irq, NULL, name);
+
+}
Signature · 1 line
1.7.12.4
#3 lore raw

PATCH 3/3 clocksouce: sp804: use pr_fmt for logging

In reply to Kefeng Wang
---
 drivers/clocksource/timer-sp.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/clocksource/timer-sp.c +9 -6
index 82b27c0..4a9bfe3 100644
@@ -18,6 +18,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
+#define pr_fmt(fmt) "sp804: " fmt
+
 #include <linux/clk.h>
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
@@ -40,14 +43,14 @@ static long __init sp804_get_clock_rate(struct clk *clk)
 
 	err = clk_prepare(clk);
 	if (err) {
-		pr_err("sp804: clock failed to prepare: %d\n", err);
+		pr_err("clock failed to prepare: %d\n", err);
 		clk_put(clk);
 		return err;
 	}
 
 	err = clk_enable(clk);
 	if (err) {
-		pr_err("sp804: clock failed to enable: %d\n", err);
+		pr_err("clock failed to enable: %d\n", err);
 		clk_unprepare(clk);
 		clk_put(clk);
 		return err;
@@ -55,7 +58,7 @@ static long __init sp804_get_clock_rate(struct clk *clk)
 
 	rate = clk_get_rate(clk);
 	if (rate < 0) {
-		pr_err("sp804: clock failed to get rate: %ld\n", rate);
+		pr_err("clock failed to get rate: %ld\n", rate);
 		clk_disable(clk);
 		clk_unprepare(clk);
 		clk_put(clk);
@@ -81,7 +84,7 @@ void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base,
 	if (!clk) {
 		clk = clk_get_sys("sp804", name);
 		if (IS_ERR(clk)) {
-			pr_err("sp804: clock not found: %d\n",
+			pr_err("clock not found: %d\n",
 			       (int)PTR_ERR(clk));
 			return;
 		}
@@ -188,7 +191,7 @@ void __init __sp804_clockevents_init(void __iomem *base, unsigned int irq, struc
 	if (!clk)
 		clk = clk_get_sys("sp804", name);
 	if (IS_ERR(clk)) {
-		pr_err("sp804: %s clock not found: %d\n", name,
+		pr_err("%s clock not found: %d\n", name,
 			(int)PTR_ERR(clk));
 		return;
 	}
@@ -237,7 +240,7 @@ static void __init sp804_of_init(struct device_node *np)
 	if (of_count_phandle_with_args(np, "clocks", "#clock-cells") == 3) {
 		clk2 = of_clk_get(np, 1);
 		if (IS_ERR(clk2)) {
-			pr_err("sp804: %s clock not found: %d\n", np->name,
+			pr_err("%s clock not found: %d\n", np->name,
 				(int)PTR_ERR(clk2));
 			goto err;
 		}
Signature · 1 line
1.7.12.4
#4 lore raw

cover move arm dual timer into drivers/clocksource

In reply to Kefeng Wang

Hi Kefeng,

Superficially this series looks as if it could be useful (enabling sp804 support for arm64), but there are several problems:

* The commit messages are terse at best.
* The cover letter provides no rationale.
* Patch 2 doesn't appear to apply to current mainline (v3.17-rc4)

I was unable to find a later posting. Do you intend to continue with this series?

Mark.

Quoted 39 lines · Kefeng Wang

Kefeng Wang (3):
ARM: remove unnecessary include arm_timer.h and timer-sp.h
clocksource: move arm dual timer into drivers/clocksource
clocksouce: sp804: use pr_fmt for logging

 arch/arm/Kconfig                          |   5 -
 arch/arm/common/Makefile                  |   1 -
 arch/arm/common/timer-sp.c                | 304 -----------------------------
 arch/arm/include/asm/hardware/arm_timer.h |  35 ----
 arch/arm/include/asm/hardware/timer-sp.h  |  23 ---
 arch/arm/mach-integrator/integrator_ap.c  |   2 +-
 arch/arm/mach-nspire/nspire.c             |   2 -
 arch/arm/mach-realview/core.c             |   5 +-
 arch/arm/mach-versatile/core.c            |   5 +-
 arch/arm/mach-vexpress/ct-ca9x4.c         |   3 -
 arch/arm/mach-vexpress/v2m.c              |   5 +-
 drivers/clocksource/Kconfig               |   7 +
 drivers/clocksource/Makefile              |   1 +
 drivers/clocksource/timer-sp.c            | 307 ++++++++++++++++++++++++++++++
 include/clocksource/arm_timer.h           |  35 ++++
 include/clocksource/timer-sp.h            |  23 +++
 16 files changed, 383 insertions(+), 380 deletions(-)
 delete mode 100644 arch/arm/common/timer-sp.c
 delete mode 100644 arch/arm/include/asm/hardware/arm_timer.h
 delete mode 100644 arch/arm/include/asm/hardware/timer-sp.h
 create mode 100644 drivers/clocksource/timer-sp.c
 create mode 100644 include/clocksource/arm_timer.h
 create mode 100644 include/clocksource/timer-sp.h
Signature · 8 lines
1.7.12.4



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel