diff options
author | Mike Frysinger <michael.frysinger@analog.com> | 2007-07-24 23:19:14 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@analog.com> | 2007-07-24 23:19:14 -0400 |
commit | 1aafd9091226a02b481298315f959f777294684e (patch) | |
tree | b09e0aaabb6aacd882499a69b28638cbd669dbba /include/asm-blackfin/mach-common | |
parent | 287050fe13bf34824f03b4351002b0e2db4ee5cb (diff) |
Blackfin arch: revise anomaly handling by basing things on the compiler not the kconfig defines
revise anomaly handling by basing things on the compiler not the kconfig defines,
so the header is stable and usable outside of the kernel. This also allows us to
move some code from preprocessing to compiling (gcc culls dead code)
which should help with code quality (readability, catch minor bugs, etc...).
Signed-off-by: Mike Frysinger <michael.frysinger@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'include/asm-blackfin/mach-common')
-rw-r--r-- | include/asm-blackfin/mach-common/cdef_LPBlackfin.h | 4 | ||||
-rw-r--r-- | include/asm-blackfin/mach-common/def_LPBlackfin.h | 132 |
2 files changed, 66 insertions, 70 deletions
diff --git a/include/asm-blackfin/mach-common/cdef_LPBlackfin.h b/include/asm-blackfin/mach-common/cdef_LPBlackfin.h index 94ed381e5606..ede210eca4ec 100644 --- a/include/asm-blackfin/mach-common/cdef_LPBlackfin.h +++ b/include/asm-blackfin/mach-common/cdef_LPBlackfin.h | |||
@@ -39,7 +39,7 @@ | |||
39 | #define bfin_read_SRAM_BASE_ADDRESS() bfin_read32(SRAM_BASE_ADDRESS) | 39 | #define bfin_read_SRAM_BASE_ADDRESS() bfin_read32(SRAM_BASE_ADDRESS) |
40 | #define bfin_write_SRAM_BASE_ADDRESS(val) bfin_write32(SRAM_BASE_ADDRESS,val) | 40 | #define bfin_write_SRAM_BASE_ADDRESS(val) bfin_write32(SRAM_BASE_ADDRESS,val) |
41 | #define bfin_read_DMEM_CONTROL() bfin_read32(DMEM_CONTROL) | 41 | #define bfin_read_DMEM_CONTROL() bfin_read32(DMEM_CONTROL) |
42 | #ifdef ANOMALY_05000125 | 42 | #if ANOMALY_05000125 |
43 | extern void bfin_write_DMEM_CONTROL(unsigned int val); | 43 | extern void bfin_write_DMEM_CONTROL(unsigned int val); |
44 | #else | 44 | #else |
45 | #define bfin_write_DMEM_CONTROL(val) bfin_write32(DMEM_CONTROL,val) | 45 | #define bfin_write_DMEM_CONTROL(val) bfin_write32(DMEM_CONTROL,val) |
@@ -129,7 +129,7 @@ extern void bfin_write_DMEM_CONTROL(unsigned int val); | |||
129 | #define DTEST_DATA3 0xFFE0040C | 129 | #define DTEST_DATA3 0xFFE0040C |
130 | */ | 130 | */ |
131 | #define bfin_read_IMEM_CONTROL() bfin_read32(IMEM_CONTROL) | 131 | #define bfin_read_IMEM_CONTROL() bfin_read32(IMEM_CONTROL) |
132 | #ifdef ANOMALY_05000125 | 132 | #if ANOMALY_05000125 |
133 | extern void bfin_write_IMEM_CONTROL(unsigned int val); | 133 | extern void bfin_write_IMEM_CONTROL(unsigned int val); |
134 | #else | 134 | #else |
135 | #define bfin_write_IMEM_CONTROL(val) bfin_write32(IMEM_CONTROL,val) | 135 | #define bfin_write_IMEM_CONTROL(val) bfin_write32(IMEM_CONTROL,val) |
diff --git a/include/asm-blackfin/mach-common/def_LPBlackfin.h b/include/asm-blackfin/mach-common/def_LPBlackfin.h index be1ece8c0c27..260515d15280 100644 --- a/include/asm-blackfin/mach-common/def_LPBlackfin.h +++ b/include/asm-blackfin/mach-common/def_LPBlackfin.h | |||
@@ -33,81 +33,77 @@ | |||
33 | 33 | ||
34 | #include <asm/mach/anomaly.h> | 34 | #include <asm/mach/anomaly.h> |
35 | 35 | ||
36 | /*#if !defined(__ADSPLPBLACKFIN__) | ||
37 | #warning def_LPBlackfin.h should only be included for 532 compatible chips. | ||
38 | #endif | ||
39 | */ | ||
40 | |||
41 | #define MK_BMSK_(x) (1<<x) | 36 | #define MK_BMSK_(x) (1<<x) |
42 | 37 | ||
43 | #if defined(ANOMALY_05000198) | 38 | #ifndef __ASSEMBLY__ |
44 | |||
45 | #define bfin_read8(addr) ({ unsigned char __v; \ | ||
46 | __asm__ __volatile__ ("NOP;\n\t" \ | ||
47 | "%0 = b[%1] (z);\n\t" \ | ||
48 | : "=d"(__v) : "a"(addr)); \ | ||
49 | __v; }) | ||
50 | |||
51 | #define bfin_read16(addr) ({ unsigned __v; \ | ||
52 | __asm__ __volatile__ ("NOP;\n\t"\ | ||
53 | "%0 = w[%1] (z);\n\t"\ | ||
54 | : "=d"(__v) : "a"(addr)); (unsigned short)__v; }) | ||
55 | |||
56 | #define bfin_read32(addr) ({ unsigned __v; \ | ||
57 | __asm__ __volatile__ ("NOP;\n\t"\ | ||
58 | "%0 = [%1];\n\t"\ | ||
59 | : "=d"(__v) : "a"(addr)); __v; }) | ||
60 | 39 | ||
61 | #define bfin_write8(addr, val) ({ \ | 40 | #include <linux/types.h> |
62 | __asm__ __volatile__ ("NOP;\n\t" \ | ||
63 | "b[%0] = %1;\n\t" \ | ||
64 | : : "a"(addr), "d"(val) : "memory");}) | ||
65 | |||
66 | #define bfin_write16(addr,val) ({\ | ||
67 | __asm__ __volatile__ ("NOP;\n\t"\ | ||
68 | "w[%0] = %1;\n\t"\ | ||
69 | : : "a"(addr) , "d"(val) : "memory");}) | ||
70 | |||
71 | #define bfin_write32(addr,val) ({\ | ||
72 | __asm__ __volatile__ ("NOP;\n\t"\ | ||
73 | "[%0] = %1;\n\t"\ | ||
74 | : : "a"(addr) , "d"(val) : "memory");}) | ||
75 | 41 | ||
42 | #if ANOMALY_05000198 | ||
43 | # define NOP_PAD_ANOMALY_05000198 "nop;" | ||
76 | #else | 44 | #else |
77 | 45 | # define NOP_PAD_ANOMALY_05000198 | |
78 | #define bfin_read8(addr) ({ unsigned char __v; \ | ||
79 | __asm__ __volatile__ ( \ | ||
80 | "%0 = b[%1] (z);\n\t" \ | ||
81 | :"=d"(__v) : "a"(addr)); \ | ||
82 | __v; }) | ||
83 | |||
84 | #define bfin_read16(addr) ({ unsigned __v; \ | ||
85 | __asm__ __volatile__ (\ | ||
86 | "%0 = w[%1] (z);\n\t"\ | ||
87 | : "=d"(__v) : "a"(addr)); (unsigned short)__v; }) | ||
88 | |||
89 | #define bfin_read32(addr) ({ unsigned __v; \ | ||
90 | __asm__ __volatile__ (\ | ||
91 | "%0 = [%1];\n\t"\ | ||
92 | : "=d"(__v) : "a"(addr)); __v; }) | ||
93 | |||
94 | #define bfin_write8(addr, val) ({ \ | ||
95 | __asm__ __volatile__ ( \ | ||
96 | "b[%0] = %1; \n\t" \ | ||
97 | ::"a"(addr), "d"(val) : "memory");}) | ||
98 | |||
99 | #define bfin_write16(addr,val) ({\ | ||
100 | __asm__ __volatile__ (\ | ||
101 | "w[%0] = %1;\n\t"\ | ||
102 | : : "a"(addr) , "d"(val) : "memory");}) | ||
103 | |||
104 | #define bfin_write32(addr,val) ({\ | ||
105 | __asm__ __volatile__ (\ | ||
106 | "[%0] = %1;\n\t"\ | ||
107 | : : "a"(addr) , "d"(val) : "memory");}) | ||
108 | |||
109 | #endif | 46 | #endif |
110 | 47 | ||
48 | #define bfin_read8(addr) ({ \ | ||
49 | uint8_t __v; \ | ||
50 | __asm__ __volatile__( \ | ||
51 | NOP_PAD_ANOMALY_05000198 \ | ||
52 | "%0 = b[%1] (z);" \ | ||
53 | : "=d" (__v) \ | ||
54 | : "a" (addr) \ | ||
55 | ); \ | ||
56 | __v; }) | ||
57 | |||
58 | #define bfin_read16(addr) ({ \ | ||
59 | uint16_t __v; \ | ||
60 | __asm__ __volatile__( \ | ||
61 | NOP_PAD_ANOMALY_05000198 \ | ||
62 | "%0 = w[%1] (z);" \ | ||
63 | : "=d" (__v) \ | ||
64 | : "a" (addr) \ | ||
65 | ); \ | ||
66 | __v; }) | ||
67 | |||
68 | #define bfin_read32(addr) ({ \ | ||
69 | uint32_t __v; \ | ||
70 | __asm__ __volatile__( \ | ||
71 | NOP_PAD_ANOMALY_05000198 \ | ||
72 | "%0 = [%1];" \ | ||
73 | : "=d" (__v) \ | ||
74 | : "a" (addr) \ | ||
75 | ); \ | ||
76 | __v; }) | ||
77 | |||
78 | #define bfin_write8(addr, val) \ | ||
79 | __asm__ __volatile__( \ | ||
80 | NOP_PAD_ANOMALY_05000198 \ | ||
81 | "b[%0] = %1;" \ | ||
82 | : \ | ||
83 | : "a" (addr), "d" (val) \ | ||
84 | : "memory" \ | ||
85 | ) | ||
86 | |||
87 | #define bfin_write16(addr, val) \ | ||
88 | __asm__ __volatile__( \ | ||
89 | NOP_PAD_ANOMALY_05000198 \ | ||
90 | "w[%0] = %1;" \ | ||
91 | : \ | ||
92 | : "a" (addr), "d" (val) \ | ||
93 | : "memory" \ | ||
94 | ) | ||
95 | |||
96 | #define bfin_write32(addr, val) \ | ||
97 | __asm__ __volatile__( \ | ||
98 | NOP_PAD_ANOMALY_05000198 \ | ||
99 | "[%0] = %1;" \ | ||
100 | : \ | ||
101 | : "a" (addr), "d" (val) \ | ||
102 | : "memory" \ | ||
103 | ) | ||
104 | |||
105 | #endif /* __ASSEMBLY__ */ | ||
106 | |||
111 | /************************************************** | 107 | /************************************************** |
112 | * System Register Bits | 108 | * System Register Bits |
113 | **************************************************/ | 109 | **************************************************/ |