// SPDX-License-Identifier: GPL-2.0 /* * Precise Delay Loops for Meta * * Copyright (C) 1993 Linus Torvalds * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz> * Copyright (C) 2007,2009 Imagination Technologies Ltd. * */ #include <linux/export.h> #include <linux/sched.h> #include <linux/delay.h> #include <asm/core_reg.h> #include <asm/processor.h> /* * TXTACTCYC is only 24 bits, so on chips with fast clocks it will wrap * many times per-second. If it does wrap __delay will return prematurely, * but this is only likely with large delay values. * * We also can't implement read_current_timer() with TXTACTCYC due to * this wrapping behaviour. */ #define rdtimer(t) t = __core_reg_get(TXTACTCYC)
void __delay(unsigned long loops) { unsigned long bclock, now; rdtimer(bclock); do { asm("NOP"); rdtimer(now); } while ((now-bclock) < loops); }Contributors
Person | Tokens | Prop | Commits | CommitProp |
James Hogan | 40 | 100.00% | 1 | 100.00% |
Total | 40 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
James Hogan | 32 | 100.00% | 1 | 100.00% |
Total | 32 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
James Hogan | 17 | 100.00% | 1 | 100.00% |
Total | 17 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
James Hogan | 17 | 100.00% | 1 | 100.00% |
Total | 17 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
James Hogan | 150 | 99.34% | 1 | 50.00% |
Greg Kroah-Hartman | 1 | 0.66% | 1 | 50.00% |
Total | 151 | 100.00% | 2 | 100.00% |