[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [Qemu devel v5 PATCH 0/5] Add support for Smartfusion2 So
From: |
Peter Maydell |
Subject: |
Re: [Qemu-arm] [Qemu devel v5 PATCH 0/5] Add support for Smartfusion2 SoC |
Date: |
Sun, 2 Jul 2017 22:00:40 +0100 |
On 2 July 2017 at 18:39, sundeep subbaraya <address@hidden> wrote:
> I figured out that systick uses cpu clock as clock source and
> system_clock_scale
> need to be set in msf2-soc.c. There is a bug in u-boot where it uses cpu
> clock as
> systick input but configures systick in external clock mode. I have tested
> the modified
> u-boot on real hardware too and it works fine. I am calculating
> system_clock_scale
> as below:
> If CPU clock is X MHz then system_clock_scale = (1 / X) * 1000
>
> Tested with different frequencies and they are yielding same results.
If you calculate it like that you'll probably get rounding
errors. Better is
system_clock_scale = NANOSECONDS_PER_SECOND / freq_in_hz;
(Our systick implementation hardwires the external clock
frequency at 1MHz, but this is not really correct, it
depends on the SoC.)
thanks
-- PMM