diff options
author | Steven J. Hill <sjhill@mips.com> | 2012-12-06 22:53:29 -0500 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2013-02-16 18:15:24 -0500 |
commit | d0c1b478e0b2f0bcbb2a58db6bc5e13354068064 (patch) | |
tree | 05150998c909ec659d01d6cada899f82c6e359b1 /arch/mips/include | |
parent | 32a7ede673cd0be580f24d855099a8a5f195e80c (diff) |
MIPS: dsp: Support toolchains without DSP ASE and microMIPS.
Add macros to support the DSP ASE with microMIPS kernels when the
toolchain does not have support.
Signed-off-by: Steven J. Hill <sjhill@mips.com>
Patchwork: http://patchwork.linux-mips.org/patch/4686/
Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'arch/mips/include')
-rw-r--r-- | arch/mips/include/asm/mipsregs.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index 578132219ff6..24417de673c5 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -1197,6 +1197,94 @@ do { \ | |||
1197 | 1197 | ||
1198 | #else | 1198 | #else |
1199 | 1199 | ||
1200 | #ifdef CONFIG_CPU_MICROMIPS | ||
1201 | #define rddsp(mask) \ | ||
1202 | ({ \ | ||
1203 | unsigned int __res; \ | ||
1204 | \ | ||
1205 | __asm__ __volatile__( \ | ||
1206 | " .set push \n" \ | ||
1207 | " .set noat \n" \ | ||
1208 | " # rddsp $1, %x1 \n" \ | ||
1209 | " .hword ((0x0020067c | (%x1 << 14)) >> 16) \n" \ | ||
1210 | " .hword ((0x0020067c | (%x1 << 14)) & 0xffff) \n" \ | ||
1211 | " move %0, $1 \n" \ | ||
1212 | " .set pop \n" \ | ||
1213 | : "=r" (__res) \ | ||
1214 | : "i" (mask)); \ | ||
1215 | __res; \ | ||
1216 | }) | ||
1217 | |||
1218 | #define wrdsp(val, mask) \ | ||
1219 | do { \ | ||
1220 | __asm__ __volatile__( \ | ||
1221 | " .set push \n" \ | ||
1222 | " .set noat \n" \ | ||
1223 | " move $1, %0 \n" \ | ||
1224 | " # wrdsp $1, %x1 \n" \ | ||
1225 | " .hword ((0x0020167c | (%x1 << 14)) >> 16) \n" \ | ||
1226 | " .hword ((0x0020167c | (%x1 << 14)) & 0xffff) \n" \ | ||
1227 | " .set pop \n" \ | ||
1228 | : \ | ||
1229 | : "r" (val), "i" (mask)); \ | ||
1230 | } while (0) | ||
1231 | |||
1232 | #define _umips_dsp_mfxxx(ins) \ | ||
1233 | ({ \ | ||
1234 | unsigned long __treg; \ | ||
1235 | \ | ||
1236 | __asm__ __volatile__( \ | ||
1237 | " .set push \n" \ | ||
1238 | " .set noat \n" \ | ||
1239 | " .hword 0x0001 \n" \ | ||
1240 | " .hword %x1 \n" \ | ||
1241 | " move %0, $1 \n" \ | ||
1242 | " .set pop \n" \ | ||
1243 | : "=r" (__treg) \ | ||
1244 | : "i" (ins)); \ | ||
1245 | __treg; \ | ||
1246 | }) | ||
1247 | |||
1248 | #define _umips_dsp_mtxxx(val, ins) \ | ||
1249 | do { \ | ||
1250 | __asm__ __volatile__( \ | ||
1251 | " .set push \n" \ | ||
1252 | " .set noat \n" \ | ||
1253 | " move $1, %0 \n" \ | ||
1254 | " .hword 0x0001 \n" \ | ||
1255 | " .hword %x1 \n" \ | ||
1256 | " .set pop \n" \ | ||
1257 | : \ | ||
1258 | : "r" (val), "i" (ins)); \ | ||
1259 | } while (0) | ||
1260 | |||
1261 | #define _umips_dsp_mflo(reg) _umips_dsp_mfxxx((reg << 14) | 0x107c) | ||
1262 | #define _umips_dsp_mfhi(reg) _umips_dsp_mfxxx((reg << 14) | 0x007c) | ||
1263 | |||
1264 | #define _umips_dsp_mtlo(val, reg) _umips_dsp_mtxxx(val, ((reg << 14) | 0x307c)) | ||
1265 | #define _umips_dsp_mthi(val, reg) _umips_dsp_mtxxx(val, ((reg << 14) | 0x207c)) | ||
1266 | |||
1267 | #define mflo0() _umips_dsp_mflo(0) | ||
1268 | #define mflo1() _umips_dsp_mflo(1) | ||
1269 | #define mflo2() _umips_dsp_mflo(2) | ||
1270 | #define mflo3() _umips_dsp_mflo(3) | ||
1271 | |||
1272 | #define mfhi0() _umips_dsp_mfhi(0) | ||
1273 | #define mfhi1() _umips_dsp_mfhi(1) | ||
1274 | #define mfhi2() _umips_dsp_mfhi(2) | ||
1275 | #define mfhi3() _umips_dsp_mfhi(3) | ||
1276 | |||
1277 | #define mtlo0(x) _umips_dsp_mtlo(x, 0) | ||
1278 | #define mtlo1(x) _umips_dsp_mtlo(x, 1) | ||
1279 | #define mtlo2(x) _umips_dsp_mtlo(x, 2) | ||
1280 | #define mtlo3(x) _umips_dsp_mtlo(x, 3) | ||
1281 | |||
1282 | #define mthi0(x) _umips_dsp_mthi(x, 0) | ||
1283 | #define mthi1(x) _umips_dsp_mthi(x, 1) | ||
1284 | #define mthi2(x) _umips_dsp_mthi(x, 2) | ||
1285 | #define mthi3(x) _umips_dsp_mthi(x, 3) | ||
1286 | |||
1287 | #else /* !CONFIG_CPU_MICROMIPS */ | ||
1200 | #define rddsp(mask) \ | 1288 | #define rddsp(mask) \ |
1201 | ({ \ | 1289 | ({ \ |
1202 | unsigned int __res; \ | 1290 | unsigned int __res; \ |
@@ -1450,6 +1538,7 @@ do { \ | |||
1450 | : "r" (x)); \ | 1538 | : "r" (x)); \ |
1451 | } while (0) | 1539 | } while (0) |
1452 | 1540 | ||
1541 | #endif /* CONFIG_CPU_MICROMIPS */ | ||
1453 | #endif | 1542 | #endif |
1454 | 1543 | ||
1455 | /* | 1544 | /* |