1 // SPDX-License-Identifier: GPL-2.0
3 * Precise Delay Loops for ETRAX FS
5 * Copyright (C) 2006 Axis Communications AB.
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
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
);