License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[sfrench/cifs-2.6.git] / arch / cris / arch-v32 / lib / delay.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Precise Delay Loops for ETRAX FS
4  *
5  * Copyright (C) 2006 Axis Communications AB.
6  *
7  */
8
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>
15
16 /*
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.
21  */
22
23 void cris_delay10ns(u32 n10ns)
24 {
25         u32 t0 = REG_RD(timer, regi_timer0, r_time);
26         while (REG_RD(timer, regi_timer0, r_time) - t0 < n10ns)
27                 ;
28 }
29 EXPORT_SYMBOL(cris_delay10ns);