Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / cris / arch-v32 / lib / delay.c
blobdb06a94ef646246a7cf52446181a3e0095391fbd
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Precise Delay Loops for ETRAX FS
5 * Copyright (C) 2006 Axis Communications AB.
7 */
9 #include <hwregs/reg_map.h>
10 #include <hwregs/reg_rdwr.h>
11 #include <hwregs/timer_defs.h>
12 #include <linux/types.h>
13 #include <linux/delay.h>
14 #include <linux/module.h>
17 * On ETRAX FS, we can check the free-running read-only 100MHz timer
18 * getting 32-bit 10ns precision, theoretically good for 42.94967295
19 * seconds. Unsigned arithmetic and careful expression handles
20 * wrapping.
23 void cris_delay10ns(u32 n10ns)
25 u32 t0 = REG_RD(timer, regi_timer0, r_time);
26 while (REG_RD(timer, regi_timer0, r_time) - t0 < n10ns)
29 EXPORT_SYMBOL(cris_delay10ns);