All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 2/8] hw/mips_gictimer: provide API for retrieving frequency
@ 2017-02-08 16:32 Yongbok Kim
  2017-02-08 21:31 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 2+ messages in thread
From: Yongbok Kim @ 2017-02-08 16:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: paul.burton, aurelien

From: Paul Burton <paul.burton@imgtec.com>

Provide a new function mips_gictimer_get_freq() which returns the
frequency at which a GIC timer will count. This will be useful for
boards which perform setup based upon this frequency.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
---
 hw/timer/mips_gictimer.c         | 5 +++++
 include/hw/timer/mips_gictimer.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/hw/timer/mips_gictimer.c b/hw/timer/mips_gictimer.c
index 3698889..f5c5806 100644
--- a/hw/timer/mips_gictimer.c
+++ b/hw/timer/mips_gictimer.c
@@ -14,6 +14,11 @@
 
 #define TIMER_PERIOD 10 /* 10 ns period for 100 Mhz frequency */
 
+uint32_t mips_gictimer_get_freq(MIPSGICTimerState *gic)
+{
+    return NANOSECONDS_PER_SECOND / TIMER_PERIOD;
+}
+
 static void gic_vptimer_update(MIPSGICTimerState *gictimer,
                                    uint32_t vp_index, uint64_t now)
 {
diff --git a/include/hw/timer/mips_gictimer.h b/include/hw/timer/mips_gictimer.h
index c8bc5d2..c7ca6c8 100644
--- a/include/hw/timer/mips_gictimer.h
+++ b/include/hw/timer/mips_gictimer.h
@@ -31,6 +31,7 @@ struct MIPSGICTimerState {
     MIPSGICTimerCB *cb;
 };
 
+uint32_t mips_gictimer_get_freq(MIPSGICTimerState *gic);
 uint32_t mips_gictimer_get_sh_count(MIPSGICTimerState *gic);
 void mips_gictimer_store_sh_count(MIPSGICTimerState *gic, uint64_t count);
 uint32_t mips_gictimer_get_vp_compare(MIPSGICTimerState *gictimer,
-- 
2.7.4

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

* Re: [Qemu-devel] [PATCH v3 2/8] hw/mips_gictimer: provide API for retrieving frequency
  2017-02-08 16:32 [Qemu-devel] [PATCH v3 2/8] hw/mips_gictimer: provide API for retrieving frequency Yongbok Kim
@ 2017-02-08 21:31 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-02-08 21:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yongbok Kim, aurelien, Paul Burton

On 02/08/2017 01:32 PM, Yongbok Kim wrote:
> From: Paul Burton <paul.burton@imgtec.com>
>
> Provide a new function mips_gictimer_get_freq() which returns the
> frequency at which a GIC timer will count. This will be useful for
> boards which perform setup based upon this frequency.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
> Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
> ---
>  hw/timer/mips_gictimer.c         | 5 +++++
>  include/hw/timer/mips_gictimer.h | 1 +
>  2 files changed, 6 insertions(+)
>
> diff --git a/hw/timer/mips_gictimer.c b/hw/timer/mips_gictimer.c
> index 3698889..f5c5806 100644
> --- a/hw/timer/mips_gictimer.c
> +++ b/hw/timer/mips_gictimer.c
> @@ -14,6 +14,11 @@
>
>  #define TIMER_PERIOD 10 /* 10 ns period for 100 Mhz frequency */
>
> +uint32_t mips_gictimer_get_freq(MIPSGICTimerState *gic)
> +{
> +    return NANOSECONDS_PER_SECOND / TIMER_PERIOD;
> +}
> +
>  static void gic_vptimer_update(MIPSGICTimerState *gictimer,
>                                     uint32_t vp_index, uint64_t now)
>  {
> diff --git a/include/hw/timer/mips_gictimer.h b/include/hw/timer/mips_gictimer.h
> index c8bc5d2..c7ca6c8 100644
> --- a/include/hw/timer/mips_gictimer.h
> +++ b/include/hw/timer/mips_gictimer.h
> @@ -31,6 +31,7 @@ struct MIPSGICTimerState {
>      MIPSGICTimerCB *cb;
>  };
>
> +uint32_t mips_gictimer_get_freq(MIPSGICTimerState *gic);
>  uint32_t mips_gictimer_get_sh_count(MIPSGICTimerState *gic);
>  void mips_gictimer_store_sh_count(MIPSGICTimerState *gic, uint64_t count);
>  uint32_t mips_gictimer_get_vp_compare(MIPSGICTimerState *gictimer,
>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

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

end of thread, other threads:[~2017-02-08 21:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08 16:32 [Qemu-devel] [PATCH v3 2/8] hw/mips_gictimer: provide API for retrieving frequency Yongbok Kim
2017-02-08 21:31 ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.