spi-topcliff-pch: Fix issue for transmitting over 4KByte
[zen-stable.git] / arch / m68k / include / asm / irqflags.h
blob7ef4115b8c4a59f0248df2273184ab5e2ed8f053
1 #ifndef _M68K_IRQFLAGS_H
2 #define _M68K_IRQFLAGS_H
4 #include <linux/types.h>
5 #ifdef CONFIG_MMU
6 #include <linux/hardirq.h>
7 #endif
8 #include <linux/preempt.h>
9 #include <asm/thread_info.h>
10 #include <asm/entry.h>
12 static inline unsigned long arch_local_save_flags(void)
14 unsigned long flags;
15 asm volatile ("movew %%sr,%0" : "=d" (flags) : : "memory");
16 return flags;
19 static inline void arch_local_irq_disable(void)
21 #ifdef CONFIG_COLDFIRE
22 asm volatile (
23 "move %/sr,%%d0 \n\t"
24 "ori.l #0x0700,%%d0 \n\t"
25 "move %%d0,%/sr \n"
26 : /* no outputs */
28 : "cc", "%d0", "memory");
29 #else
30 asm volatile ("oriw #0x0700,%%sr" : : : "memory");
31 #endif
34 static inline void arch_local_irq_enable(void)
36 #if defined(CONFIG_COLDFIRE)
37 asm volatile (
38 "move %/sr,%%d0 \n\t"
39 "andi.l #0xf8ff,%%d0 \n\t"
40 "move %%d0,%/sr \n"
41 : /* no outputs */
43 : "cc", "%d0", "memory");
44 #else
45 # if defined(CONFIG_MMU)
46 if (MACH_IS_Q40 || !hardirq_count())
47 # endif
48 asm volatile (
49 "andiw %0,%%sr"
51 : "i" (ALLOWINT)
52 : "memory");
53 #endif
56 static inline unsigned long arch_local_irq_save(void)
58 unsigned long flags = arch_local_save_flags();
59 arch_local_irq_disable();
60 return flags;
63 static inline void arch_local_irq_restore(unsigned long flags)
65 asm volatile ("movew %0,%%sr" : : "d" (flags) : "memory");
68 static inline bool arch_irqs_disabled_flags(unsigned long flags)
70 return (flags & ~ALLOWINT) != 0;
73 static inline bool arch_irqs_disabled(void)
75 return arch_irqs_disabled_flags(arch_local_save_flags());
78 #endif /* _M68K_IRQFLAGS_H */