| // SPDX-License-Identifier: GPL-2.0-only |
| * Copyright (C) 2011 Richard Weinberger <richrd@nod.at> |
| * Mostly copied from arch/x86/lib/delay.c |
| #include <linux/export.h> |
| #include <linux/kernel.h> |
| void __delay(unsigned long loops) |
| : /* we don't need output */ |
| inline void __const_udelay(unsigned long xloops) |
| : "=d" (xloops), "=&a" (d0) |
| (loops_per_jiffy * (HZ/4))); |
| EXPORT_SYMBOL(__const_udelay); |
| void __udelay(unsigned long usecs) |
| __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */ |
| void __ndelay(unsigned long nsecs) |
| __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */ |