Skip to contentSkip to conversation

Add new GIC clocksource.

PATCH New Steven J. Hill 1 participant 1 message Apr 9, 2012 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add new GIC clocksource.

From: "Steven J. Hill" <[email protected]>

Add new clocksource that uses the counter present on the GIC controller.

---
 arch/mips/Kconfig                |   21 ++++++++-
 arch/mips/include/asm/gic.h      |    3 ++
 arch/mips/include/asm/time.h     |    8 ++--
 arch/mips/kernel/Makefile        |    1 +
 arch/mips/kernel/csrc-gic.c      |   49 +++++++++++++++++++++
 arch/mips/kernel/irq-gic.c       |    3 +-
 arch/mips/mti-malta/malta-time.c |   88 +++++++++++++++++++++++++++-----------
 7 files changed, 141 insertions(+), 32 deletions(-)
 create mode 100644 arch/mips/kernel/csrc-gic.c
arch/mips/Kconfig +19 -2
index fae33f3..3a8d277 100644
@@ -264,7 +264,6 @@ config MIPS_MALTA
 	select BOOT_ELF32
 	select BOOT_RAW
 	select CEVT_R4K
-	select CSRC_R4K
 	select DMA_NONCOHERENT
 	select GENERIC_ISA_DMA
 	select HAVE_PCSPKR_PLATFORM
@@ -863,6 +862,24 @@ source "arch/mips/netlogic/Kconfig"
 
 endmenu
 
+menu "Clock source"
+	depends on MIPS_MALTA || MIPS_SEAD3
+
+comment "Select one or more precise CPU clock source kernel modules below:"
+
+config CSRC_R4K
+	bool "R4K count/compare counter"
+	default y if !CSRC_GIC
+	help
+	  Use the R4K count/compare counter for the kernel clock source.
+
+config CSRC_GIC
+	bool "GIC global counter (ROC-it or similar system controller)"
+	help
+	  Use the GIC global counter for the kernel clock source.
+
+endmenu
+
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
@@ -2031,7 +2048,7 @@ config MIPS_APSP_KSPD
 config MIPS_CMP
 	bool "MIPS CMP framework support"
 	depends on SYS_SUPPORTS_MIPS_CMP
-	select SYNC_R4K
+	select SYNC_R4K if CSRC_R4K
 	select SYS_SUPPORTS_SMP
 	select SYS_SUPPORTS_SCHED_SMT if SMP
 	select WEAK_ORDERING
arch/mips/include/asm/gic.h +3 -0
index 991b659..7583417 100644
@@ -13,6 +13,8 @@
 
 #undef	GICISBYTELITTLEENDIAN
 
+extern unsigned long _gic_base;
+
 /* Constants */
 #define GIC_POL_POS			1
 #define GIC_POL_NEG			0
@@ -345,6 +347,7 @@ extern void gic_init(unsigned long gic_base_addr,
 	unsigned long gic_addrspace_size, struct gic_intr_map *intrmap,
 	unsigned int intrmap_size, unsigned int irqbase);
 
+extern void gic_clocksource_init(unsigned int);
 extern unsigned int gic_get_int(void);
 extern void gic_send_ipi(unsigned int intr);
 extern unsigned int plat_ipi_call_int_xlate(unsigned int);
arch/mips/include/asm/time.h +4 -4
index bc14447..96a6c8c 100644
@@ -77,11 +77,11 @@ extern int init_r4k_clocksource(void);
 
 static inline int init_mips_clocksource(void)
 {
-#ifdef CONFIG_CSRC_R4K
-	return init_r4k_clocksource();
-#else
+	extern int gic_present;
+
+	if (!gic_present)
+		return init_r4k_clocksource();
 	return 0;
-#endif
 }
 
 static inline void clockevent_set_clock(struct clock_event_device *cd,
arch/mips/kernel/Makefile +1 -0
index 0c6877e..1b9af57 100644
@@ -27,6 +27,7 @@ obj-$(CONFIG_CSRC_IOASIC)	+= csrc-ioasic.o
 obj-$(CONFIG_CSRC_POWERTV)	+= csrc-powertv.o
 obj-$(CONFIG_CSRC_R4K_LIB)	+= csrc-r4k.o
 obj-$(CONFIG_CSRC_SB1250)	+= csrc-sb1250.o
+obj-$(CONFIG_CSRC_GIC)		+= csrc-gic.o
 obj-$(CONFIG_SYNC_R4K)		+= sync-r4k.o
 
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
arch/mips/kernel/csrc-gic.c new file +49 -0

49 lines not on this page · raw message

arch/mips/kernel/irq-gic.c +2 -1
index 275b163..191a255 100644
@@ -20,7 +20,8 @@
 #include <linux/hardirq.h>
 #include <asm-generic/bitops/find.h>
 
-static unsigned long _gic_base;
+
+unsigned long _gic_base;
 static unsigned int _irqbase;
 static unsigned int gic_irq_flags[GIC_NUM_INTRS];
 #define GIC_IRQ_FLAG_EDGE      0x0001
arch/mips/mti-malta/malta-time.c +63 -25

138 lines not on this page · raw message

Signature · 1 line
1.7.9.6