Merge tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux/fpc-iii.git] / arch / arm / lib / io-readsw-armv3.S
blob266043610c0c19bbafb931292714fbf13f9f709b
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  linux/arch/arm/lib/io-readsw-armv3.S
4  *
5  *  Copyright (C) 1995-2000 Russell King
6  */
7 #include <linux/linkage.h>
8 #include <asm/assembler.h>
10 .Linsw_bad_alignment:
11                 adr     r0, .Linsw_bad_align_msg
12                 mov     r2, lr
13                 b       panic
14 .Linsw_bad_align_msg:
15                 .asciz  "insw: bad buffer alignment (0x%p, lr=0x%08lX)\n"
16                 .align
18 .Linsw_align:   tst     r1, #1
19                 bne     .Linsw_bad_alignment
21                 ldr     r3, [r0]
22                 strb    r3, [r1], #1
23                 mov     r3, r3, lsr #8
24                 strb    r3, [r1], #1
26                 subs    r2, r2, #1
27                 reteq   lr
29 ENTRY(__raw_readsw)
30                 teq     r2, #0          @ do we have to check for the zero len?
31                 reteq   lr
32                 tst     r1, #3
33                 bne     .Linsw_align
35 .Linsw_aligned: mov     ip, #0xff
36                 orr     ip, ip, ip, lsl #8
37                 stmfd   sp!, {r4, r5, r6, lr}
39                 subs    r2, r2, #8
40                 bmi     .Lno_insw_8
42 .Linsw_8_lp:    ldr     r3, [r0]
43                 and     r3, r3, ip
44                 ldr     r4, [r0]
45                 orr     r3, r3, r4, lsl #16
47                 ldr     r4, [r0]
48                 and     r4, r4, ip
49                 ldr     r5, [r0]
50                 orr     r4, r4, r5, lsl #16
52                 ldr     r5, [r0]
53                 and     r5, r5, ip
54                 ldr     r6, [r0]
55                 orr     r5, r5, r6, lsl #16
57                 ldr     r6, [r0]
58                 and     r6, r6, ip
59                 ldr     lr, [r0]
60                 orr     r6, r6, lr, lsl #16
62                 stmia   r1!, {r3 - r6}
64                 subs    r2, r2, #8
65                 bpl     .Linsw_8_lp
67                 tst     r2, #7
68                 ldmfdeq sp!, {r4, r5, r6, pc}
70 .Lno_insw_8:    tst     r2, #4
71                 beq     .Lno_insw_4
73                 ldr     r3, [r0]
74                 and     r3, r3, ip
75                 ldr     r4, [r0]
76                 orr     r3, r3, r4, lsl #16
78                 ldr     r4, [r0]
79                 and     r4, r4, ip
80                 ldr     r5, [r0]
81                 orr     r4, r4, r5, lsl #16
83                 stmia   r1!, {r3, r4}
85 .Lno_insw_4:    tst     r2, #2
86                 beq     .Lno_insw_2
88                 ldr     r3, [r0]
89                 and     r3, r3, ip
90                 ldr     r4, [r0]
91                 orr     r3, r3, r4, lsl #16
93                 str     r3, [r1], #4
95 .Lno_insw_2:    tst     r2, #1
96                 ldrne   r3, [r0]
97                 strbne  r3, [r1], #1
98                 movne   r3, r3, lsr #8
99                 strbne  r3, [r1]
101                 ldmfd   sp!, {r4, r5, r6, pc}