summaryrefslogtreecommitdiffstats
path: root/common/clock.c
Commit message (Collapse)AuthorAgeFilesLines
* clock: initialize dummy clocksource staticallySascha Hauer2017-05-051-6/+1
| | | | | | | | | | | | | | | | | | | | Assigning the dummy clocksource in a initcall has the problem that get_time_ns() crashes before that initcall is executed. This happens when dmesg support is enabled in conjunction with CONFIG_DEBUG_INITCALLS. In this case the dmesg code wants to have the timestamp of a log message. Solve this by setting the current clocksource to the dummy clock statically and not at runtime. This way we always have a dummy clock available. Fixes: commit 8972eb7ff17ad058a6c6018305bb912138ab0ca2 Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Date: Fri Mar 3 13:34:02 2017 +0100 clocksource: move dummy clock source to init_clock Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: move dummy clock source to init_clockJean-Christophe PLAGNIOL-VILLARD2017-03-091-9/+24
| | | | | | | | | And registered it as soon as possible (at pure initcall). So we not need to check the cs all the time. As get_time_ns() is one of the most called function of barebox at runtime. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocksource: allow to have multiple device from clock sourceJean-Christophe PLAGNIOL-VILLARD2017-03-091-0/+11
| | | | | | | | | use the one with the most priority. We can not select the clocksource at user level. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: clock: introduce mdelay_non_interruptible()Peter Mamonov2015-10-021-0/+9
| | | | | Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clock: incorporate dummy clocksource into core clock codeAntony Pavlov2014-12-171-2/+18
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clock.c: fix whitespacesAntony Pavlov2014-10-081-47/+47
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clock: make get_time_ns() safe to be called without clocksourceSascha Hauer2014-09-301-0/+3
| | | | | | | | make it possible to call get_time_ns() before the clocksource has been registered. Just return 0 in this case which is still better than crashing the system. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clock: Add a variable with the first timestamp after startupSascha Hauer2014-09-301-0/+8
| | | | | | | For measuring the startup time it's useful to save the first timestamp after the clocksource has been registered. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clock: introduce non interruptible timeoutJean-Christophe PLAGNIOL-VILLARD2012-10-291-5/+11
| | | | | | | | | | | | | | is_timeout call poller_call if the timeout is >= 100us but on 1-wire bus we need to wait 500us and not more than 930us for the bus reset. So if the poller_call is caller we can not guarantee it. So for this introduce is_non_interruptible_timeout than we only wait. Use it for ndelay too. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-3/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* poller_call: move from getc to is_timeoutJean-Christophe PLAGNIOL-VILLARD2012-01-041-0/+4
| | | | | | | | this will allow to always call poller_call even durring timeout and still the case in getc Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* shift and clocksourceCarlo Caione2011-06-221-0/+55
| | | | | | | Added clocks_calc_mult_shift() Signed-off-by: Carlo Caione <carlo.caione@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clock: fix possible error on overflow in is_timeoutUwe Kleine-König2010-04-221-2/+1
| | | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clock.c: use USECOND and MSECONDMarc Kleine-Budde2009-12-031-2/+2
| | | | | Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clocK: Add ndelay functionSascha Hauer2008-08-131-0/+8
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* 002-clock-overflowNishanth Menon2008-06-051-1/+1
| | | | | | | | | | | | | | [Patch 02/17] U-Boot-V2: Handle case of clock rollover for get_time_ns get_time_ns does a simplistic delta = cycle_now - cycle_last. It is possible that the h/w counter reached max and reset back to 0. This patch addresses this issue by checking for rollover condition. NOTE 1: This does not guarentee that you cannot confuse get_time_ns. You could possibly wait for two reset cycles and then get a messed up value. To fix that we may need interrupt mode timer tick - something on the lines of jiffies on linux. NOTE 2: the question of cs->mask is not clear. if the mask is for the tick, then it is better done with (cycle_now & cs->mask) - (cs->cycle_last & cs->mask). Signed-off-by: Nishanth Menon<x0nishan@ti.com>
* export symbolsSascha Hauer2007-10-071-0/+4
|
* svn_rev_706Sascha Hauer2007-07-051-0/+26
| | | | add file headers
* svn_rev_683Sascha Hauer2007-07-051-6/+1
| | | | more cleanups, fix compiler warnings
* svn_rev_083Sascha Hauer2007-07-051-5/+5
| | | | mx31/move_include_asm-arm_arch-arm1136_to_arch-omap24xx.diff
* svn_rev_033Sascha Hauer2007-07-051-2/+8
| | | | change to clocksource api
* svn_rev_031Sascha Hauer2007-07-051-0/+84
add clocksource stuff from kernel and first implementation (imx) (WIP)