/*1* Copyright 2010 Tilera Corporation. All Rights Reserved.2*3* This program is free software; you can redistribute it and/or4* modify it under the terms of the GNU General Public License5* as published by the Free Software Foundation, version 2.6*7* This program is distributed in the hope that it will be useful, but8* WITHOUT ANY WARRANTY; without even the implied warranty of9* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or10* NON INFRINGEMENT. See the GNU General Public License for11* more details.12*/1314#include <linux/module.h>15#include <linux/delay.h>16#include <linux/thread_info.h>17#include <asm/timex.h>1819void __udelay(unsigned long usecs)20{21if (usecs > ULONG_MAX / 1000) {22WARN_ON_ONCE(usecs > ULONG_MAX / 1000);23usecs = ULONG_MAX / 1000;24}25__ndelay(usecs * 1000);26}27EXPORT_SYMBOL(__udelay);2829void __ndelay(unsigned long nsecs)30{31cycles_t target = get_cycles();32target += ns2cycles(nsecs);33while (get_cycles() < target)34cpu_relax();35}36EXPORT_SYMBOL(__ndelay);3738void __delay(unsigned long cycles)39{40cycles_t target = get_cycles() + cycles;41while (get_cycles() < target)42cpu_relax();43}44EXPORT_SYMBOL(__delay);454647