http://downloads.netgear.com/files/GPL/GPL_Source_V361j_DM111PSP_series_consumer_rele...
[bcm963xx.git] / kernel / linux / arch / arm / lib / io-writesw-armv4.S
1 /*
2  *  linux/arch/arm/lib/io-writesw-armv4.S
3  *
4  *  Copyright (C) 1995-2000 Russell King
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 #include <linux/linkage.h>
11 #include <asm/assembler.h>
12
13                 .macro  outword, rd
14 #ifndef __ARMEB__
15                 strh    \rd, [r0]
16                 mov     \rd, \rd, lsr #16
17                 strh    \rd, [r0]
18 #else
19                 mov     lr, \rd, lsr #16
20                 strh    lr, [r0]
21                 strh    \rd, [r0]
22 #endif
23                 .endm
24
25 .outsw_bad_alignment:
26                 adr     r0, .outsw_bad_align_msg
27                 mov     r2, lr
28                 b       panic
29 .outsw_bad_align_msg:
30                 .asciz  "outsw: bad buffer alignment (0x%p, lr=0x%08lX)\n"
31                 .align
32
33 .outsw_align:   tst     r1, #1
34                 bne     .outsw_bad_alignment
35
36                 ldrh    r3, [r1], #2
37                 strh    r3, [r0]
38
39                 subs    r2, r2, #1
40                 RETINSTR(moveq, pc, lr)
41
42 ENTRY(__raw_writesw)
43                 teq     r2, #0          @ do we have to check for the zero len?
44                 moveq   pc, lr
45                 tst     r1, #3
46                 bne     .outsw_align
47
48                 stmfd   sp!, {r4, r5, lr}
49
50                 subs    r2, r2, #8
51                 bmi     .no_outsw_8
52
53 .outsw_8_lp:    ldmia   r1!, {r3, r4, r5, ip}
54                 outword r3
55                 outword r4
56                 outword r5
57                 outword ip
58                 subs    r2, r2, #8
59                 bpl     .outsw_8_lp
60
61                 tst     r2, #7
62                 LOADREGS(eqfd, sp!, {r4, r5, pc})
63
64 .no_outsw_8:    tst     r2, #4
65                 beq     .no_outsw_4
66
67                 ldmia   r1!, {r3, ip}
68                 outword r3
69                 outword ip
70
71 .no_outsw_4:    tst     r2, #2
72                 beq     .no_outsw_2
73
74                 ldr     r3, [r1], #4
75                 outword r3
76
77 .no_outsw_2:    tst     r2, #1
78                 ldrneh  r3, [r1]
79                 strneh  r3, [r0]
80
81                 LOADREGS(fd, sp!, {r4, r5, pc})