Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] MIPS: GIC: Select R4K counter as fallback.
@ 2013-09-11 18:53 Steven J. Hill
  2013-09-11 19:11 ` David Daney
  0 siblings, 1 reply; 2+ messages in thread
From: Steven J. Hill @ 2013-09-11 18:53 UTC (permalink / raw)
  To: linux-mips; +Cc: Leonid Yegoshin, ralf, Steven J. Hill

From: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>

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

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
---
 arch/mips/include/asm/time.h |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h
index 2d7b9df..1194c31 100644
--- a/arch/mips/include/asm/time.h
+++ b/arch/mips/include/asm/time.h
@@ -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,
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: GIC: Select R4K counter as fallback.
  2013-09-11 18:53 [PATCH] MIPS: GIC: Select R4K counter as fallback Steven J. Hill
@ 2013-09-11 19:11 ` David Daney
  0 siblings, 0 replies; 2+ messages in thread
From: David Daney @ 2013-09-11 19:11 UTC (permalink / raw)
  To: Steven J. Hill, ralf; +Cc: linux-mips, Leonid Yegoshin

On 09/11/2013 11:53 AM, Steven J. Hill wrote:
> From: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
>
> If CONFIG_CSRC_GIC is selected and the GIC is not found during
> boot, then fallback to the R4K counter gracefully.
>
> Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
> Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
> ---
>   arch/mips/include/asm/time.h |   10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h
> index 2d7b9df..1194c31 100644
> --- a/arch/mips/include/asm/time.h
> +++ b/arch/mips/include/asm/time.h
> @@ -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;
>   }

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


>
>   static inline void clockevent_set_clock(struct clock_event_device *cd,
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-11 19:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-11 18:53 [PATCH] MIPS: GIC: Select R4K counter as fallback Steven J. Hill
2013-09-11 19:11 ` David Daney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox