~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/m68k/include/asm/delay.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/m68k/include/asm/delay.h (Architecture mips) and /arch/sparc/include/asm-sparc/delay.h (Architecture sparc)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 #ifndef _M68K_DELAY_H                             
  3 #define _M68K_DELAY_H                             
  4                                                   
  5 #include <asm/param.h>                            
  6                                                   
  7 /*                                                
  8  * Copyright (C) 1994 Hamish Macdonald            
  9  * Copyright (C) 2004 Greg Ungerer <gerg@uclin    
 10  *                                                
 11  * Delay routines, using a pre-computed "loops    
 12  */                                               
 13                                                   
 14 #if defined(CONFIG_COLDFIRE)                      
 15 /*                                                
 16  * The ColdFire runs the delay loop at signifi    
 17  * depending upon long word alignment or not.     
 18  * long word alignment which is the faster ver    
 19  * The 0x4a8e is of course a 'tstl %fp' instru    
 20  * than using a NOP (0x4e71) instruction becau    
 21  * cycle not three and doesn't allow for an ar    
 22  * for bus cycles to finish.  Also fp/a6 isn't    
 23  * stall waiting for the register to become va    
 24  * to the coldfire at some stage.                 
 25  */                                               
 26 #define DELAY_ALIGN     ".balignw 4, 0x4a8e\n\    
 27 #else                                             
 28 /*                                                
 29  * No instruction alignment required for other    
 30  */                                               
 31 #define DELAY_ALIGN                               
 32 #endif                                            
 33                                                   
 34 static inline void __delay(unsigned long loops    
 35 {                                                 
 36         __asm__ __volatile__ (                    
 37                 DELAY_ALIGN                       
 38                 "1: subql #1,%0\n\t"              
 39                 "jcc 1b"                          
 40                 : "=d" (loops)                    
 41                 : "" (loops));                    
 42 }                                                 
 43                                                   
 44 extern void __bad_udelay(void);                   
 45                                                   
 46                                                   
 47 #ifdef CONFIG_CPU_HAS_NO_MULDIV64                 
 48 /*                                                
 49  * The simpler m68k and ColdFire processors do    
 50  * multiply instruction. So we need to handle     
 51  * We use a bit of shifting and a single 32*32    
 52  */                                               
 53 #define HZSCALE         (268435456 / (1000000     
 54                                                   
 55 #define __const_udelay(u) \                       
 56         __delay(((((u) * HZSCALE) >> 11) * (lo    
 57                                                   
 58 #else                                             
 59                                                   
 60 static inline void __xdelay(unsigned long xloo    
 61 {                                                 
 62         unsigned long tmp;                        
 63                                                   
 64         __asm__ ("mulul %2,%0:%1"                 
 65                 : "=d" (xloops), "=d" (tmp)       
 66                 : "d" (xloops), "1" (loops_per    
 67         __delay(xloops * HZ);                     
 68 }                                                 
 69                                                   
 70 /*                                                
 71  * The definition of __const_udelay is specifi    
 72  * the const factor (4295 = 2**32 / 1000000) c    
 73  * the delay is a const.                          
 74  */                                               
 75 #define __const_udelay(n)       (__xdelay((n)     
 76                                                   
 77 #endif                                            
 78                                                   
 79 static inline void __udelay(unsigned long usec    
 80 {                                                 
 81         __const_udelay(usecs);                    
 82 }                                                 
 83                                                   
 84 /*                                                
 85  * Use only for very small delays ( < 1 msec).    
 86  * lookup table, really, as the multiplication    
 87  * short delays.  This is a "reasonable" imple    
 88  * first constant multiplications gets optimiz    
 89  * a constant)                                    
 90  */                                               
 91 #define udelay(n) (__builtin_constant_p(n) ? \    
 92         ((n) > 20000 ? __bad_udelay() : __cons    
 93                                                   
 94 /*                                                
 95  * nanosecond delay:                              
 96  *                                                
 97  * ((((HZSCALE) >> 11) * (loops_per_jiffy >> 1    
 98  * per microsecond                                
 99  *                                                
100  * 1000 / ((((HZSCALE) >> 11) * (loops_per_jif    
101  * nanoseconds per loop                           
102  *                                                
103  * So n / ( 1000 / ((((HZSCALE) >> 11) * (loop    
104  * be the number of loops for n nanoseconds       
105  */                                               
106                                                   
107 /*                                                
108  * The simpler m68k and ColdFire processors do    
109  * multiply instruction. So we need to handle     
110  * We use a bit of shifting and a single 32*32    
111  * This is a macro so that the const version c    
112  * multiply and shift.                            
113  */                                               
114 #define HZSCALE         (268435456 / (1000000     
115                                                   
116 static inline void ndelay(unsigned long nsec)     
117 {                                                 
118         __delay(DIV_ROUND_UP(nsec *               
119                              ((((HZSCALE) >> 1    
120                                (loops_per_jiff    
121                              1000));              
122 }                                                 
123 #define ndelay(n) ndelay(n)                       
124                                                   
125 #endif /* defined(_M68K_DELAY_H) */               
126                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php