On Mon, Oct 5, 2015 at 9:07 AM, Dmitry Osipenko <dig...@gmail.com> wrote: > 03.10.2015 16:11, Dmitry Osipenko пишет: > >> 20.09.2015 20:48, Peter Crosthwaite пишет: >>> >>> On Sun, Jul 5, 2015 at 1:58 PM, Peter Crosthwaite >>> <peter.crosthwa...@xilinx.com> wrote: >>>> >>>> On Sun, Jul 5, 2015 at 1:47 PM, Dmitry Osipenko <dig...@gmail.com> >>>> wrote: >>>>> >>>>> 05.07.2015 23:26, Peter Crosthwaite пишет: >>>>> >>>>>> Hi Dmitry, >>>>>> >>>>>> Based on my comment earlier, this is what I came up with RE >>>>>> consolidation >>>>>> of >>>>>> those arm_mptimer code paths that were giving you problems. I have not >>>>>> done the >>>>>> interrupt mask fix, as that one from your series is reasonably >>>>>> independent. >>>>>> >>>>>> Regards, >>>>>> Peter >>>>>> >>>>>> Peter Crosthwaite (2): >>>>>> timer: arm_mp: Factor out timer value calculation >>>>>> timer: arm_mp: consolidate control and counter write logic >>>>>> >>>>>> hw/timer/arm_mptimer.c | 73 >>>>>> +++++++++++++++++++++++++++++--------------------- >>>>>> 1 file changed, 42 insertions(+), 31 deletions(-) >>>>>> >>>>> >>>>> Hi Peter, thanks a lot! Generally, I don't have any trouble with >>>>> currently >>>>> missed functionality, just noticed it while was hacking my NVIDIA >>>>> Tegra2 >>>>> emulation pet-project and decided to contribute =). >>>>> >>>>> It looks like you are trying to duplicate what generic ptimer is >>>>> already >>>>> doing, isn't it? >>>>> >>>> >>>> Yes, ptimer was probably the correct way to do this in the first >>>> place. Some of the new code structures introduced in this patch series >>>> are directly applicable though for that conversion effort. >>>> >>> >>> I looked into doing this with ptimer, and pitmer doesn't really play >>> nice with periodic down counters. You could do the subtractions >>> against an up counter with the load value but that seems just as >>> complex as the current solution IMO. The hardest part is setting the >>> counter value on an already running timer. >>> >>> The alternative is to patch ptimer to handle down timers. >>> >>> Regards, >>> Peter >>> >> >> Hmm, I think you missed something. Ptimer is doing downcount, not up. >> ptimer_get_count() might be a misnomer, it returns current timer value (it >> goes >> down to 0), not a passed ticks count number. Ptimer also should handle >> reloading >> of a running timer just fine with ptimer_set_count(), don't see any >> trouble >> here. Anyway, I'll try to re-implement MPtimer using ptimer ASAP and see >> how it >> really fits. >> > > Finally, I tried ptimer and everything seem to work perfect. Pausing, > re-loading, etc works as it should. Will send the patch soon. >
Great! Thanks for the efforts. I'll take a CC on the review. Do on the fly prescaler changes work? Regards, Peter > -- > Dmitry