linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: GIC: Select R4K counter as fallback.

To: "Steven J. Hill" <Steven.Hill@imgtec.com>, ralf@linux-mips.org
Subject: Re: [PATCH] MIPS: GIC: Select R4K counter as fallback.
From: David Daney <ddaney.cavm@gmail.com>
Date: Wed, 11 Sep 2013 12:11:47 -0700
Cc: linux-mips@linux-mips.org, Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=U8YOjYUfA5aQCvo1LRASpEAx9wgvaJ+IVp9jmDAD1Tc=; b=QPmvz0bqufJo3KW4eKjFf3GCyV0QTknaTMMkwhemjZAyFHcOm7Afb+mUqyPjEYEHpz Aj+usLzRsMj/ToAe55rAo5uh8uzdU6B4X+mU4fz9ySOuMlPyH3v1yj5InFKmbigkI0D+ GUL1QbyJw9t0PhDwhDe51c9lOs9SKACvRrO6ziFCSwCp0Bzp1TP6I5dTFjVXEyj9GYb0 BLSwk5OdDQ9y8YOxqC3b23HftrA3PJt+ij26K9E8MgOL6kmIED/MeQciM+J40QWPCFUn xbTIKzoJzIljya8h1drp4ZsyuQ2Eci39ktjIC6Kl2YJpMcsfm8FTG1sVAToHPC9x4UwH tmvw==
In-reply-to: <1378925634-5830-1-git-send-email-Steven.Hill@imgtec.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1378925634-5830-1-git-send-email-Steven.Hill@imgtec.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7
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,



<Prev in Thread] Current Thread [Next in Thread>