diff options
-rw-r--r-- | arch/blackfin/mach-common/pm.c | 6 | ||||
-rw-r--r-- | include/asm-blackfin/mach-bf561/cdefBF561.h | 4 | ||||
-rw-r--r-- | include/asm-blackfin/string.h | 129 |
3 files changed, 88 insertions, 51 deletions
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c index 1772d8d2c1a7..b10302722202 100644 --- a/arch/blackfin/mach-common/pm.c +++ b/arch/blackfin/mach-common/pm.c | |||
@@ -158,10 +158,16 @@ static int bfin_pm_finish(suspend_state_t state) | |||
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
160 | 160 | ||
161 | static int bfin_pm_valid(suspend_state_t state) | ||
162 | { | ||
163 | return (state == PM_SUSPEND_STANDBY); | ||
164 | } | ||
165 | |||
161 | struct pm_ops bfin_pm_ops = { | 166 | struct pm_ops bfin_pm_ops = { |
162 | .prepare = bfin_pm_prepare, | 167 | .prepare = bfin_pm_prepare, |
163 | .enter = bfin_pm_enter, | 168 | .enter = bfin_pm_enter, |
164 | .finish = bfin_pm_finish, | 169 | .finish = bfin_pm_finish, |
170 | .valid = bfin_pm_valid, | ||
165 | }; | 171 | }; |
166 | 172 | ||
167 | static int __init bfin_pm_init(void) | 173 | static int __init bfin_pm_init(void) |
diff --git a/include/asm-blackfin/mach-bf561/cdefBF561.h b/include/asm-blackfin/mach-bf561/cdefBF561.h index 6e87ab269ffe..73d4d65249cd 100644 --- a/include/asm-blackfin/mach-bf561/cdefBF561.h +++ b/include/asm-blackfin/mach-bf561/cdefBF561.h | |||
@@ -83,9 +83,9 @@ static __inline__ void bfin_write_VR_CTL(unsigned int val) | |||
83 | 83 | ||
84 | /* For MMR's that are reserved on Core B, set up defines to better integrate with other ports */ | 84 | /* For MMR's that are reserved on Core B, set up defines to better integrate with other ports */ |
85 | #define bfin_read_SWRST() bfin_read_SICA_SWRST() | 85 | #define bfin_read_SWRST() bfin_read_SICA_SWRST() |
86 | #define bfin_write_SWRST() bfin_write_SICA_SWRST() | 86 | #define bfin_write_SWRST(val) bfin_write_SICA_SWRST(val) |
87 | #define bfin_read_SYSCR() bfin_read_SICA_SYSCR() | 87 | #define bfin_read_SYSCR() bfin_read_SICA_SYSCR() |
88 | #define bfin_write_SYSCR() bfin_write_SICA_SYSCR() | 88 | #define bfin_write_SYSCR(val) bfin_write_SICA_SYSCR(val) |
89 | 89 | ||
90 | /* System Reset and Interrupt Controller registers for core A (0xFFC0 0100-0xFFC0 01FF) */ | 90 | /* System Reset and Interrupt Controller registers for core A (0xFFC0 0100-0xFFC0 01FF) */ |
91 | #define bfin_read_SICA_SWRST() bfin_read16(SICA_SWRST) | 91 | #define bfin_read_SICA_SWRST() bfin_read16(SICA_SWRST) |
diff --git a/include/asm-blackfin/string.h b/include/asm-blackfin/string.h index 6f1eb7d6d3cb..e8ada91ab002 100644 --- a/include/asm-blackfin/string.h +++ b/include/asm-blackfin/string.h | |||
@@ -9,13 +9,16 @@ extern inline char *strcpy(char *dest, const char *src) | |||
9 | char *xdest = dest; | 9 | char *xdest = dest; |
10 | char temp = 0; | 10 | char temp = 0; |
11 | 11 | ||
12 | __asm__ __volatile__ | 12 | __asm__ __volatile__ ( |
13 | ("1:\t%2 = B [%1++] (Z);\n\t" | 13 | "1:" |
14 | "B [%0++] = %2;\n\t" | 14 | "%2 = B [%1++] (Z);" |
15 | "CC = %2;\n\t" | 15 | "B [%0++] = %2;" |
16 | "if cc jump 1b (bp);\n" | 16 | "CC = %2;" |
17 | : "+&a" (dest), "+&a" (src), "=&d" (temp) | 17 | "if cc jump 1b (bp);" |
18 | ::"memory", "CC"); | 18 | : "+&a" (dest), "+&a" (src), "=&d" (temp) |
19 | : | ||
20 | : "memory", "CC"); | ||
21 | |||
19 | return xdest; | 22 | return xdest; |
20 | } | 23 | } |
21 | 24 | ||
@@ -28,37 +31,56 @@ extern inline char *strncpy(char *dest, const char *src, size_t n) | |||
28 | if (n == 0) | 31 | if (n == 0) |
29 | return xdest; | 32 | return xdest; |
30 | 33 | ||
31 | __asm__ __volatile__ | 34 | __asm__ __volatile__ ( |
32 | ("1:\t%3 = B [%1++] (Z);\n\t" | 35 | "1:" |
33 | "B [%0++] = %3;\n\t" | 36 | "%3 = B [%1++] (Z);" |
34 | "CC = %3;\n\t" | 37 | "B [%0++] = %3;" |
35 | "if ! cc jump 2f;\n\t" | 38 | "CC = %3;" |
36 | "%2 += -1;\n\t" | 39 | "if ! cc jump 2f;" |
37 | "CC = %2 == 0;\n\t" | 40 | "%2 += -1;" |
38 | "if ! cc jump 1b (bp);\n" | 41 | "CC = %2 == 0;" |
39 | "2:\n" | 42 | "if ! cc jump 1b (bp);" |
40 | : "+&a" (dest), "+&a" (src), "+&da" (n), "=&d" (temp) | 43 | "jump 4f;" |
41 | ::"memory", "CC"); | 44 | "2:" |
45 | /* if src is shorter than n, we need to null pad bytes now */ | ||
46 | "%3 = 0;" | ||
47 | "3:" | ||
48 | "%2 += -1;" | ||
49 | "CC = %2 == 0;" | ||
50 | "if cc jump 4f;" | ||
51 | "B [%0++] = %3;" | ||
52 | "jump 3b;" | ||
53 | "4:" | ||
54 | : "+&a" (dest), "+&a" (src), "+&da" (n), "=&d" (temp) | ||
55 | : | ||
56 | : "memory", "CC"); | ||
57 | |||
42 | return xdest; | 58 | return xdest; |
43 | } | 59 | } |
44 | 60 | ||
45 | #define __HAVE_ARCH_STRCMP | 61 | #define __HAVE_ARCH_STRCMP |
46 | extern inline int strcmp(const char *cs, const char *ct) | 62 | extern inline int strcmp(const char *cs, const char *ct) |
47 | { | 63 | { |
48 | char __res1, __res2; | 64 | /* need to use int's here so the char's in the assembly don't get |
49 | 65 | * sign extended incorrectly when we don't want them to be | |
50 | __asm__ | 66 | */ |
51 | ("1:\t%2 = B[%0++] (Z);\n\t" /* get *cs */ | 67 | int __res1, __res2; |
52 | "%3 = B[%1++] (Z);\n\t" /* get *ct */ | 68 | |
53 | "CC = %2 == %3;\n\t" /* compare a byte */ | 69 | __asm__ __volatile__ ( |
54 | "if ! cc jump 2f;\n\t" /* not equal, break out */ | 70 | "1:" |
55 | "CC = %2;\n\t" /* at end of cs? */ | 71 | "%2 = B[%0++] (Z);" /* get *cs */ |
56 | "if cc jump 1b (bp);\n\t" /* no, keep going */ | 72 | "%3 = B[%1++] (Z);" /* get *ct */ |
57 | "jump.s 3f;\n" /* strings are equal */ | 73 | "CC = %2 == %3;" /* compare a byte */ |
58 | "2:\t%2 = %2 - %3;\n" /* *cs - *ct */ | 74 | "if ! cc jump 2f;" /* not equal, break out */ |
59 | "3:\n" | 75 | "CC = %2;" /* at end of cs? */ |
60 | : "+&a" (cs), "+&a" (ct), "=&d" (__res1), "=&d" (__res2) | 76 | "if cc jump 1b (bp);" /* no, keep going */ |
61 | : : "CC"); | 77 | "jump.s 3f;" /* strings are equal */ |
78 | "2:" | ||
79 | "%2 = %2 - %3;" /* *cs - *ct */ | ||
80 | "3:" | ||
81 | : "+&a" (cs), "+&a" (ct), "=&d" (__res1), "=&d" (__res2) | ||
82 | : | ||
83 | : "memory", "CC"); | ||
62 | 84 | ||
63 | return __res1; | 85 | return __res1; |
64 | } | 86 | } |
@@ -66,26 +88,35 @@ extern inline int strcmp(const char *cs, const char *ct) | |||
66 | #define __HAVE_ARCH_STRNCMP | 88 | #define __HAVE_ARCH_STRNCMP |
67 | extern inline int strncmp(const char *cs, const char *ct, size_t count) | 89 | extern inline int strncmp(const char *cs, const char *ct, size_t count) |
68 | { | 90 | { |
69 | char __res1, __res2; | 91 | /* need to use int's here so the char's in the assembly don't get |
92 | * sign extended incorrectly when we don't want them to be | ||
93 | */ | ||
94 | int __res1, __res2; | ||
70 | 95 | ||
71 | if (!count) | 96 | if (!count) |
72 | return 0; | 97 | return 0; |
73 | __asm__ | 98 | |
74 | ("1:\t%3 = B[%0++] (Z);\n\t" /* get *cs */ | 99 | __asm__ __volatile__ ( |
75 | "%4 = B[%1++] (Z);\n\t" /* get *ct */ | 100 | "1:" |
76 | "CC = %3 == %4;\n\t" /* compare a byte */ | 101 | "%3 = B[%0++] (Z);" /* get *cs */ |
77 | "if ! cc jump 3f;\n\t" /* not equal, break out */ | 102 | "%4 = B[%1++] (Z);" /* get *ct */ |
78 | "CC = %3;\n\t" /* at end of cs? */ | 103 | "CC = %3 == %4;" /* compare a byte */ |
79 | "if ! cc jump 4f;\n\t" /* yes, all done */ | 104 | "if ! cc jump 3f;" /* not equal, break out */ |
80 | "%2 += -1;\n\t" /* no, adjust count */ | 105 | "CC = %3;" /* at end of cs? */ |
81 | "CC = %2 == 0;\n\t" | 106 | "if ! cc jump 4f;" /* yes, all done */ |
82 | "if ! cc jump 1b;\n" /* more to do, keep going */ | 107 | "%2 += -1;" /* no, adjust count */ |
83 | "2:\t%3 = 0;\n\t" /* strings are equal */ | 108 | "CC = %2 == 0;" |
84 | "jump.s 4f;\n" | 109 | "if ! cc jump 1b;" /* more to do, keep going */ |
85 | "3:\t%3 = %3 - %4;\n" /* *cs - *ct */ | 110 | "2:" |
86 | "4:" | 111 | "%3 = 0;" /* strings are equal */ |
87 | : "+&a" (cs), "+&a" (ct), "+&da" (count), "=&d" (__res1), "=&d" (__res2) | 112 | "jump.s 4f;" |
88 | : : "CC"); | 113 | "3:" |
114 | "%3 = %3 - %4;" /* *cs - *ct */ | ||
115 | "4:" | ||
116 | : "+&a" (cs), "+&a" (ct), "+&da" (count), "=&d" (__res1), "=&d" (__res2) | ||
117 | : | ||
118 | : "memory", "CC"); | ||
119 | |||
89 | return __res1; | 120 | return __res1; |
90 | } | 121 | } |
91 | 122 | ||