Skip to contentSkip to conversation

MIPS: GIC: Select R4K counter as fallback.

PATCH Superseded Steven J. Hill 2 participants 2 messages Sep 11, 2013 MIPS

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: GIC: Select R4K counter as fallback.

From: Leonid Yegoshin <[email protected]>

If CONFIG_CSRC_GIC is selected and the GIC is not found during boot, then fallback to the R4K counter gracefully.

---
 arch/mips/include/asm/time.h |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
arch/mips/include/asm/time.h +6 -4
index 2d7b9df..1194c31 100644
@@ -75,11 +75,13 @@ extern int init_r4k_clocksource(void);
 
 static inline int init_mips_clocksource(void)
 {
-#if defined(CONFIG_CSRC_R4K) && !defined(CONFIG_CSRC_GIC)
-	return init_r4k_clocksource();
-#else
-	return 0;
+#ifdef CONFIG_CSRC_R4K
+#ifdef CONFIG_CSRC_GIC
+	if (!gic_present)
 #endif
+		return init_r4k_clocksource();
+#endif
+	return 0;
 }
 
 static inline void clockevent_set_clock(struct clock_event_device *cd,
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 21 lines · Steven J. Hill

From: Leonid Yegoshin <[email protected]>

If CONFIG_CSRC_GIC is selected and the GIC is not found during boot, then fallback to the R4K counter gracefully.

---
  arch/mips/include/asm/time.h |   10 ++++++----
  1 file changed, 6 insertions(+), 4 deletions(-)
arch/mips/include/asm/time.h +0 -2
index 2d7b9df..1194c31 100644
@@ -75,11 +75,13 @@ extern int init_r4k_clocksource(void);
 
  static inline int init_mips_clocksource(void)
  {
-#if defined(CONFIG_CSRC_R4K) && !defined(CONFIG_CSRC_GIC)
-	return init_r4k_clocksource();

arch/mips/include/asm/time.h extern int init_r4k_clocksource(void); · line 85

Quoted 10 lines
arch/mips/include/asm/time.h +6 -2
-#else
-	return 0;
+#ifdef CONFIG_CSRC_R4K
+#ifdef CONFIG_CSRC_GIC
+	if (!gic_present)
  #endif
+		return init_r4k_clocksource();
+#endif
+	return 0;
  }

An alternative would be to place in gic.h something like:

#ifdef CONFIG_CSRC_GIC

# define use_mips_gic_csrc gic_present
#else
# define use_mips_gic_csrc 0
#endif

Then the above code would be

if (!use_mips_gic_csrc)

	return init_r4k_clocksource();

With less #if ugliness

Quoted 3 lines
arch/mips/include/asm/time.h +0 -0
  static inline void clockevent_set_clock(struct clock_event_device *cd,