[adm5120] update to 2.6.22-rc6
[openwrt/svn-archive/archive.git] / target / linux / adm5120-2.6 / patches / 008-adm5120_hardware_swab.patch
1 Index: linux-2.6.22-rc6/include/asm-mips/byteorder.h
2 ===================================================================
3 --- linux-2.6.22-rc6.orig/include/asm-mips/byteorder.h
4 +++ linux-2.6.22-rc6/include/asm-mips/byteorder.h
5 @@ -58,6 +58,35 @@ static __inline__ __attribute_const__ __
6
7 #endif /* CONFIG_CPU_MIPSR2 */
8
9 +#ifdef CONFIG_ADM5120_HARDWARE_SWAB
10 +
11 +static __inline__ __attribute_const__ __u16 ___adm5120__swab16(__u16 x)
12 +{
13 + __asm__ (
14 + " sh %2, 0xCA(%1) \n"
15 + " lhu %0, 0xCC(%1) \n"
16 + : "=r" (x)
17 + : "r" (0xB2000000), "r" (x));
18 +
19 + return x;
20 +}
21 +
22 +static __inline__ __attribute_const__ __u32 ___adm5120__swab32(__u32 x)
23 +{
24 + __asm__ (
25 + " sw %2, 0xC8(%1) \n"
26 + " lw %0, 0xCC(%1) \n"
27 + : "=r" (x)
28 + : "r" (0xB2000000), "r" (x));
29 +
30 + return x;
31 +}
32 +
33 +#define __arch__swab16(x) ___adm5120__swab16(x)
34 +#define __arch__swab32(x) ___adm5120__swab32(x)
35 +
36 +#endif /* CONFIG_ADM5120_HARDWARE_SWAB */
37 +
38 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
39 # define __BYTEORDER_HAS_U64__
40 # define __SWAB_64_THRU_32__