2 * arch/sh/lib/io.c - SH32 optimized I/O routines
4 * Copyright (C) 2000 Stuart Menefy
5 * Copyright (C) 2005 Paul Mundt
7 * Provide real functions which expand to whatever the header file defined.
8 * Also definitions of machine independent IO functions.
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
14 #include <linux/module.h>
17 void __raw_readsl(const void __iomem
*addr
, void *datap
, int len
)
21 for (data
= datap
; (len
!= 0) && (((u32
)data
& 0x1f) != 0); len
--)
22 *data
++ = __raw_readl(addr
);
24 if (likely(len
>= (0x20 >> 2))) {
25 int tmp2
, tmp3
, tmp4
, tmp5
, tmp6
;
32 "movca.l r0, @%0 \n\t"
42 "mov.l %2, @(0x04,%0) \n\t"
43 "mov #0x20>>2, %2 \n\t"
44 "mov.l %3, @(0x08,%0) \n\t"
46 "mov.l %4, @(0x0c,%0) \n\t"
47 "cmp/hi %1, %2 ! T if 32 > len \n\t"
48 "mov.l %5, @(0x10,%0) \n\t"
49 "mov.l %6, @(0x14,%0) \n\t"
50 "mov.l r7, @(0x18,%0) \n\t"
51 "mov.l r0, @(0x1c,%0) \n\t"
54 : "=&r" (data
), "=&r" (len
),
55 "=&r" (tmp2
), "=&r" (tmp3
), "=&r" (tmp4
),
56 "=&r" (tmp5
), "=&r" (tmp6
)
57 : "r"(addr
), "0" (data
), "1" (len
)
58 : "r0", "r7", "t", "memory");
61 for (; len
!= 0; len
--)
62 *data
++ = __raw_readl(addr
);
64 EXPORT_SYMBOL(__raw_readsl
);
66 void __raw_writesl(void __iomem
*addr
, const void *data
, int len
)
68 if (likely(len
!= 0)) {
71 __asm__
__volatile__ (
77 : "=&r" (data
), "=&r" (tmp1
)
78 : "0" (data
), "r" (len
), "r"(addr
)
82 EXPORT_SYMBOL(__raw_writesl
);