Commit 1aafd909 authored by Mike Frysinger's avatar Mike Frysinger Committed by Bryan Wu

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: default avatarMike Frysinger <michael.frysinger@analog.com>
Signed-off-by: default avatarBryan Wu <bryan.wu@analog.com>
parent 287050fe
...@@ -330,7 +330,7 @@ EXPORT_SYMBOL(set_gpio_ ## name); ...@@ -330,7 +330,7 @@ EXPORT_SYMBOL(set_gpio_ ## name);
SET_GPIO_SC(maska) SET_GPIO_SC(maska)
SET_GPIO_SC(maskb) SET_GPIO_SC(maskb)
#if defined(ANOMALY_05000311) #if ANOMALY_05000311
void set_gpio_data(unsigned short gpio, unsigned short arg) void set_gpio_data(unsigned short gpio, unsigned short arg)
{ {
unsigned long flags; unsigned long flags;
...@@ -349,7 +349,7 @@ SET_GPIO_SC(data) ...@@ -349,7 +349,7 @@ SET_GPIO_SC(data)
#endif #endif
#if defined(ANOMALY_05000311) #if ANOMALY_05000311
void set_gpio_toggle(unsigned short gpio) void set_gpio_toggle(unsigned short gpio)
{ {
unsigned long flags; unsigned long flags;
...@@ -387,7 +387,7 @@ SET_GPIO_P(maska) ...@@ -387,7 +387,7 @@ SET_GPIO_P(maska)
SET_GPIO_P(maskb) SET_GPIO_P(maskb)
#if defined(ANOMALY_05000311) #if ANOMALY_05000311
void set_gpiop_data(unsigned short gpio, unsigned short arg) void set_gpiop_data(unsigned short gpio, unsigned short arg)
{ {
unsigned long flags; unsigned long flags;
...@@ -421,7 +421,7 @@ GET_GPIO(maska) ...@@ -421,7 +421,7 @@ GET_GPIO(maska)
GET_GPIO(maskb) GET_GPIO(maskb)
#if defined(ANOMALY_05000311) #if ANOMALY_05000311
unsigned short get_gpio_data(unsigned short gpio) unsigned short get_gpio_data(unsigned short gpio)
{ {
unsigned long flags; unsigned long flags;
...@@ -455,7 +455,7 @@ GET_GPIO_P(both) ...@@ -455,7 +455,7 @@ GET_GPIO_P(both)
GET_GPIO_P(maska) GET_GPIO_P(maska)
GET_GPIO_P(maskb) GET_GPIO_P(maskb)
#if defined(ANOMALY_05000311) #if ANOMALY_05000311
unsigned short get_gpiop_data(unsigned short gpio) unsigned short get_gpiop_data(unsigned short gpio)
{ {
unsigned long flags; unsigned long flags;
......
...@@ -230,8 +230,8 @@ static void __fill_code_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_en ...@@ -230,8 +230,8 @@ static void __fill_code_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_en
cplb_data[i].psize, cplb_data[i].psize,
cplb_data[i].i_conf); cplb_data[i].i_conf);
} else { } else {
#if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263)) #if defined(CONFIG_BLKFIN_CACHE)
if (i == SDRAM_KERN) { if (ANOMALY_05000263 && i == SDRAM_KERN) {
fill_cplbtab(t, fill_cplbtab(t,
cplb_data[i].start, cplb_data[i].start,
cplb_data[i].end, cplb_data[i].end,
......
...@@ -179,14 +179,16 @@ void __init setup_arch(char **cmdline_p) ...@@ -179,14 +179,16 @@ void __init setup_arch(char **cmdline_p)
cclk = get_cclk(); cclk = get_cclk();
sclk = get_sclk(); sclk = get_sclk();
#if !defined(CONFIG_BFIN_KERNEL_CLOCK) && defined(ANOMALY_05000273) #if !defined(CONFIG_BFIN_KERNEL_CLOCK)
if (cclk == sclk) if (ANOMALY_05000273 && cclk == sclk)
panic("ANOMALY 05000273, SCLK can not be same as CCLK"); panic("ANOMALY 05000273, SCLK can not be same as CCLK");
#endif #endif
#if defined(ANOMALY_05000266) #ifdef BF561_FAMILY
bfin_read_IMDMA_D0_IRQ_STATUS(); if (ANOMALY_05000266) {
bfin_read_IMDMA_D1_IRQ_STATUS(); bfin_read_IMDMA_D0_IRQ_STATUS();
bfin_read_IMDMA_D1_IRQ_STATUS();
}
#endif #endif
#ifdef DEBUG_SERIAL_EARLY_INIT #ifdef DEBUG_SERIAL_EARLY_INIT
...@@ -260,7 +262,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -260,7 +262,7 @@ void __init setup_arch(char **cmdline_p)
&& ((unsigned long *)mtd_phys)[1] == ROMSB_WORD1) && ((unsigned long *)mtd_phys)[1] == ROMSB_WORD1)
mtd_size = mtd_size =
PAGE_ALIGN(be32_to_cpu(((unsigned long *)mtd_phys)[2])); PAGE_ALIGN(be32_to_cpu(((unsigned long *)mtd_phys)[2]));
# if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263)) # if (defined(CONFIG_BLKFIN_CACHE) && ANOMALY_05000263)
/* Due to a Hardware Anomaly we need to limit the size of usable /* Due to a Hardware Anomaly we need to limit the size of usable
* instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
* 05000263 - Hardware loop corrupted when taking an ICPLB exception * 05000263 - Hardware loop corrupted when taking an ICPLB exception
...@@ -289,7 +291,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -289,7 +291,7 @@ void __init setup_arch(char **cmdline_p)
_ebss = memory_mtd_start; /* define _ebss for compatible */ _ebss = memory_mtd_start; /* define _ebss for compatible */
#endif /* CONFIG_MTD_UCLINUX */ #endif /* CONFIG_MTD_UCLINUX */
#if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263)) #if (defined(CONFIG_BLKFIN_CACHE) && ANOMALY_05000263)
/* Due to a Hardware Anomaly we need to limit the size of usable /* Due to a Hardware Anomaly we need to limit the size of usable
* instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
* 05000263 - Hardware loop corrupted when taking an ICPLB exception * 05000263 - Hardware loop corrupted when taking an ICPLB exception
...@@ -337,10 +339,8 @@ void __init setup_arch(char **cmdline_p) ...@@ -337,10 +339,8 @@ void __init setup_arch(char **cmdline_p)
printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu Mhz System Clock\n", printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu Mhz System Clock\n",
cclk / 1000000, sclk / 1000000); cclk / 1000000, sclk / 1000000);
#if defined(ANOMALY_05000273) if (ANOMALY_05000273 && (cclk >> 1) <= sclk)
if ((cclk >> 1) <= sclk)
printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n"); printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n");
#endif
printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20); printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20);
printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20); printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
......
...@@ -61,7 +61,7 @@ ENTRY(_memcmp) ...@@ -61,7 +61,7 @@ ENTRY(_memcmp)
LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1; LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1;
.Lquad_loop_s: .Lquad_loop_s:
#ifdef ANOMALY_05000202 #if ANOMALY_05000202
R0 = [P0++]; R0 = [P0++];
R1 = [I0++]; R1 = [I0++];
#else #else
......
...@@ -98,7 +98,7 @@ ENTRY(_memcpy) ...@@ -98,7 +98,7 @@ ENTRY(_memcpy)
R0 = R1; R0 = R1;
I1 = P1; I1 = P1;
R3 = [I1++]; R3 = [I1++];
#ifdef ANOMALY_05000202 #if ANOMALY_05000202
.Lword_loops: .Lword_loops:
[P0++] = R3; [P0++] = R3;
.Lword_loope: .Lword_loope:
......
...@@ -70,7 +70,7 @@ ENTRY(_memmove) ...@@ -70,7 +70,7 @@ ENTRY(_memmove)
R1 = [I0++]; R1 = [I0++];
LSETUP (.Lquad_loops, .Lquad_loope) LC0=P1; LSETUP (.Lquad_loops, .Lquad_loope) LC0=P1;
#ifdef ANOMALY_05000202 #if ANOMALY_05000202
.Lquad_loops: .Lquad_loops:
[P0++] = R1; [P0++] = R1;
.Lquad_loope: .Lquad_loope:
...@@ -102,7 +102,7 @@ ENTRY(_memmove) ...@@ -102,7 +102,7 @@ ENTRY(_memmove)
R1 = B[P3--] (Z); R1 = B[P3--] (Z);
CC = P2 == 0; CC = P2 == 0;
IF CC JUMP .Lno_loop; IF CC JUMP .Lno_loop;
#ifdef ANOMALY_05000245 #if ANOMALY_05000245
NOP; NOP;
NOP; NOP;
#endif #endif
......
...@@ -151,13 +151,13 @@ ENTRY(__start) ...@@ -151,13 +151,13 @@ ENTRY(__start)
R0 = R0 & R1; R0 = R0 & R1;
/* Anomaly 05000125 */ /* Anomaly 05000125 */
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
CLI R2; CLI R2;
SSYNC; SSYNC;
#endif #endif
[p0] = R0; [p0] = R0;
SSYNC; SSYNC;
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
STI R2; STI R2;
#endif #endif
...@@ -169,13 +169,13 @@ ENTRY(__start) ...@@ -169,13 +169,13 @@ ENTRY(__start)
R0 = R0 & R1; R0 = R0 & R1;
/* Anomaly 05000125 */ /* Anomaly 05000125 */
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
CLI R2; CLI R2;
SSYNC; SSYNC;
#endif #endif
[p0] = R0; [p0] = R0;
SSYNC; SSYNC;
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
STI R2; STI R2;
#endif #endif
...@@ -264,7 +264,7 @@ ENTRY(__start) ...@@ -264,7 +264,7 @@ ENTRY(__start)
p0.l = .LWAIT_HERE; p0.l = .LWAIT_HERE;
p0.h = .LWAIT_HERE; p0.h = .LWAIT_HERE;
reti = p0; reti = p0;
#if defined(ANOMALY_05000281) #if ANOMALY_05000281
nop; nop; nop; nop; nop; nop;
#endif #endif
rti; rti;
......
...@@ -107,13 +107,13 @@ ENTRY(__start) ...@@ -107,13 +107,13 @@ ENTRY(__start)
R0 = R0 & R1; R0 = R0 & R1;
/* Anomaly 05000125 */ /* Anomaly 05000125 */
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
CLI R2; CLI R2;
SSYNC; SSYNC;
#endif #endif
[p0] = R0; [p0] = R0;
SSYNC; SSYNC;
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
STI R2; STI R2;
#endif #endif
...@@ -125,13 +125,13 @@ ENTRY(__start) ...@@ -125,13 +125,13 @@ ENTRY(__start)
R0 = R0 & R1; R0 = R0 & R1;
/* Anomaly 05000125 */ /* Anomaly 05000125 */
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
CLI R2; CLI R2;
SSYNC; SSYNC;
#endif #endif
[p0] = R0; [p0] = R0;
SSYNC; SSYNC;
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
STI R2; STI R2;
#endif #endif
...@@ -141,12 +141,12 @@ ENTRY(__start) ...@@ -141,12 +141,12 @@ ENTRY(__start)
*/ */
p0.h = hi(BFIN_PORT_MUX); p0.h = hi(BFIN_PORT_MUX);
p0.l = lo(BFIN_PORT_MUX); p0.l = lo(BFIN_PORT_MUX);
#ifdef ANOMALY_05000212 #if ANOMALY_05000212
R0.L = W[P0]; /* Read */ R0.L = W[P0]; /* Read */
SSYNC; SSYNC;
#endif #endif
R0 = (PGDE_UART | PFTE_UART)(Z); R0 = (PGDE_UART | PFTE_UART)(Z);
#ifdef ANOMALY_05000212 #if ANOMALY_05000212
W[P0] = R0.L; /* Write */ W[P0] = R0.L; /* Write */
SSYNC; SSYNC;
#endif #endif
...@@ -155,12 +155,12 @@ ENTRY(__start) ...@@ -155,12 +155,12 @@ ENTRY(__start)
p0.h = hi(PORTF_FER); p0.h = hi(PORTF_FER);
p0.l = lo(PORTF_FER); p0.l = lo(PORTF_FER);
#ifdef ANOMALY_05000212 #if ANOMALY_05000212
R0.L = W[P0]; /* Read */ R0.L = W[P0]; /* Read */
SSYNC; SSYNC;
#endif #endif
R0 = 0x000F(Z); R0 = 0x000F(Z);
#ifdef ANOMALY_05000212 #if ANOMALY_05000212
W[P0] = R0.L; /* Write */ W[P0] = R0.L; /* Write */
SSYNC; SSYNC;
#endif #endif
...@@ -274,7 +274,7 @@ ENTRY(__start) ...@@ -274,7 +274,7 @@ ENTRY(__start)
p0.l = .LWAIT_HERE; p0.l = .LWAIT_HERE;
p0.h = .LWAIT_HERE; p0.h = .LWAIT_HERE;
reti = p0; reti = p0;
#if defined(ANOMALY_05000281) #if ANOMALY_05000281
nop; nop; nop; nop; nop; nop;
#endif #endif
rti; rti;
......
...@@ -172,7 +172,7 @@ ENTRY(__stext) ...@@ -172,7 +172,7 @@ ENTRY(__stext)
p0.l = .LWAIT_HERE; p0.l = .LWAIT_HERE;
p0.h = .LWAIT_HERE; p0.h = .LWAIT_HERE;
reti = p0; reti = p0;
#if defined (ANOMALY_05000281) #if ANOMALY_05000281
nop; nop;
nop; nop;
nop; nop;
......
...@@ -106,14 +106,13 @@ ENTRY(__start) ...@@ -106,14 +106,13 @@ ENTRY(__start)
R0 = ~ENICPLB; R0 = ~ENICPLB;
R0 = R0 & R1; R0 = R0 & R1;
/* Anomaly 05000125 */ #if ANOMALY_05000125
#ifdef ANOMALY_05000125
CLI R2; CLI R2;
SSYNC; SSYNC;
#endif #endif
[p0] = R0; [p0] = R0;
SSYNC; SSYNC;
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
STI R2; STI R2;
#endif #endif
...@@ -125,13 +124,13 @@ ENTRY(__start) ...@@ -125,13 +124,13 @@ ENTRY(__start)
R0 = R0 & R1; R0 = R0 & R1;
/* Anomaly 05000125 */ /* Anomaly 05000125 */
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
CLI R2; CLI R2;
SSYNC; SSYNC;
#endif #endif
[p0] = R0; [p0] = R0;
SSYNC; SSYNC;
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
STI R2; STI R2;
#endif #endif
...@@ -220,7 +219,7 @@ ENTRY(__start) ...@@ -220,7 +219,7 @@ ENTRY(__start)
p0.l = .LWAIT_HERE; p0.l = .LWAIT_HERE;
p0.h = .LWAIT_HERE; p0.h = .LWAIT_HERE;
reti = p0; reti = p0;
#if defined(ANOMALY_05000281) #if ANOMALY_05000281
nop; nop; nop; nop; nop; nop;
#endif #endif
rti; rti;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
.text .text
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
#if defined(CONFIG_BLKFIN_CACHE) #if defined(CONFIG_BLKFIN_CACHE)
ENTRY(_bfin_write_IMEM_CONTROL) ENTRY(_bfin_write_IMEM_CONTROL)
......
...@@ -405,7 +405,7 @@ ENTRY(_cplb_mgr) ...@@ -405,7 +405,7 @@ ENTRY(_cplb_mgr)
P3.L = _page_size_table; /* retrieve end address */ P3.L = _page_size_table; /* retrieve end address */
P3.H = _page_size_table; /* retrieve end address */ P3.H = _page_size_table; /* retrieve end address */
R3 = 0x1002; /* 16th - position, 2 bits -length */ R3 = 0x1002; /* 16th - position, 2 bits -length */
#ifdef ANOMALY_05000209 #if ANOMALY_05000209
nop; /* Anomaly 05000209 */ nop; /* Anomaly 05000209 */
#endif #endif
R7 = EXTRACT(R1,R3.l); R7 = EXTRACT(R1,R3.l);
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
* patch up CPLB misses on the kernel stack. * patch up CPLB misses on the kernel stack.
*/ */
ENTRY(_ex_dcplb) ENTRY(_ex_dcplb)
#if defined(ANOMALY_05000261) #if ANOMALY_05000261
/* /*
* Work around an anomaly: if we see a new DCPLB fault, return * Work around an anomaly: if we see a new DCPLB fault, return
* without doing anything. Then, if we get the same fault again, * without doing anything. Then, if we get the same fault again,
...@@ -137,7 +137,7 @@ ENTRY(_ex_single_step) ...@@ -137,7 +137,7 @@ ENTRY(_ex_single_step)
_return_from_exception: _return_from_exception:
DEBUG_START_HWTRACE(p5, r7) DEBUG_START_HWTRACE(p5, r7)
#ifdef ANOMALY_05000257 #if ANOMALY_05000257
R7=LC0; R7=LC0;
LC0=R7; LC0=R7;
R7=LC1; R7=LC1;
...@@ -634,7 +634,7 @@ ENTRY(_return_from_int) ...@@ -634,7 +634,7 @@ ENTRY(_return_from_int)
p1.h = _schedule_and_signal_from_int; p1.h = _schedule_and_signal_from_int;
[p0] = p1; [p0] = p1;
csync; csync;
#if defined(ANOMALY_05000281) #if ANOMALY_05000281
r0.l = lo(CONFIG_BOOT_LOAD); r0.l = lo(CONFIG_BOOT_LOAD);
r0.h = hi(CONFIG_BOOT_LOAD); r0.h = hi(CONFIG_BOOT_LOAD);
reti = r0; reti = r0;
...@@ -648,7 +648,7 @@ ENTRY(_return_from_int) ...@@ -648,7 +648,7 @@ ENTRY(_return_from_int)
ENDPROC(_return_from_int) ENDPROC(_return_from_int)
ENTRY(_lower_to_irq14) ENTRY(_lower_to_irq14)
#if defined(ANOMALY_05000281) #if ANOMALY_05000281
r0.l = lo(CONFIG_BOOT_LOAD); r0.l = lo(CONFIG_BOOT_LOAD);
r0.h = hi(CONFIG_BOOT_LOAD); r0.h = hi(CONFIG_BOOT_LOAD);
reti = r0; reti = r0;
...@@ -1184,7 +1184,7 @@ _exception_stack: ...@@ -1184,7 +1184,7 @@ _exception_stack:
.endr .endr
_exception_stack_top: _exception_stack_top:
#if defined(ANOMALY_05000261) #if ANOMALY_05000261
/* Used by the assembly entry point to work around an anomaly. */ /* Used by the assembly entry point to work around an anomaly. */
_last_cplb_fault_retx: _last_cplb_fault_retx:
.long 0; .long 0;
......
...@@ -140,7 +140,7 @@ __common_int_entry: ...@@ -140,7 +140,7 @@ __common_int_entry:
fp = 0; fp = 0;
#endif #endif
#if defined (ANOMALY_05000283) || defined (ANOMALY_05000315) #if ANOMALY_05000283 || ANOMALY_05000315
cc = r7 == r7; cc = r7 == r7;
p5.h = 0xffc0; p5.h = 0xffc0;
p5.l = 0x0014; p5.l = 0x0014;
...@@ -163,7 +163,7 @@ ENTRY(_evt_ivhw) ...@@ -163,7 +163,7 @@ ENTRY(_evt_ivhw)
#ifdef CONFIG_FRAME_POINTER #ifdef CONFIG_FRAME_POINTER
fp = 0; fp = 0;
#endif #endif
#ifdef ANOMALY_05000283 #if ANOMALY_05000283
cc = r7 == r7; cc = r7 == r7;
p5.h = 0xffc0; p5.h = 0xffc0;
p5.l = 0x0014; p5.l = 0x0014;
...@@ -207,7 +207,7 @@ ENTRY(_evt_evt2) ...@@ -207,7 +207,7 @@ ENTRY(_evt_evt2)
#ifdef CONFIG_FRAME_POINTER #ifdef CONFIG_FRAME_POINTER
fp = 0; fp = 0;
#endif #endif
#ifdef ANOMALY_05000283 #if ANOMALY_05000283
cc = r7 == r7; cc = r7 == r7;
p5.h = 0xffc0; p5.h = 0xffc0;
p5.l = 0x0014; p5.l = 0x0014;
......
...@@ -17,72 +17,66 @@ ...@@ -17,72 +17,66 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
/* SSYNC implementation for C file */ /* SSYNC implementation for C file */
#if defined(ANOMALY_05000312) && defined(ANOMALY_05000244) static inline void SSYNC(void)
static inline void SSYNC (void)
{ {
int _tmp; int _tmp;
__asm__ __volatile__ ("cli %0;\n\t" if (ANOMALY_05000312 && ANOMALY_05000244)
"nop;nop;\n\t" __asm__ __volatile__(
"ssync;\n\t" "cli %0;"
"sti %0;\n\t" "nop;"
:"=d"(_tmp):); "nop;"
"ssync;"
"sti %0;"
: "=d" (_tmp)
);
else if (ANOMALY_05000312 && !ANOMALY_05000244)
__asm__ __volatile__(
"cli %0;"
"ssync;"
"sti %0;"
: "=d" (_tmp)
);
else if (!ANOMALY_05000312 && ANOMALY_05000244)
__asm__ __volatile__(
"nop;"
"nop;"
"nop;"
"ssync;"
);
else
__asm__ __volatile__("ssync;");
} }
#elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
static inline void SSYNC (void)
{
int _tmp;
__asm__ __volatile__ ("cli %0;\n\t"
"ssync;\n\t"
"sti %0;\n\t"
:"=d"(_tmp):);
}
#elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
static inline void SSYNC (void)
{
__asm__ __volatile__ ("nop; nop; nop;\n\t"
"ssync;\n\t"
::);
}
#elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
static inline void SSYNC (void)
{
__asm__ __volatile__ ("ssync;\n\t");
}
#endif
/* CSYNC implementation for C file */ /* CSYNC implementation for C file */
#if defined(ANOMALY_05000312) && defined(ANOMALY_05000244) static inline void CSYNC(void)
static inline void CSYNC (void)
{ {
int _tmp; int _tmp;
__asm__ __volatile__ ("cli %0;\n\t" if (ANOMALY_05000312 && ANOMALY_05000244)
"nop;nop;\n\t" __asm__ __volatile__(
"csync;\n\t" "cli %0;"
"sti %0;\n\t" "nop;"
:"=d"(_tmp):); "nop;"
} "csync;"
#elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244) "sti %0;"
static inline void CSYNC (void) : "=d" (_tmp)
{ );
int _tmp; else if (ANOMALY_05000312 && !ANOMALY_05000244)
__asm__ __volatile__ ("cli %0;\n\t" __asm__ __volatile__(
"csync;\n\t" "cli %0;"
"sti %0;\n\t" "csync;"
:"=d"(_tmp):); "sti %0;"
} : "=d" (_tmp)
#elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244) );
static inline void CSYNC (void) else if (!ANOMALY_05000312 && ANOMALY_05000244)
{ __asm__ __volatile__(
__asm__ __volatile__ ("nop; nop; nop;\n\t" "nop;"
"ssync;\n\t" "nop;"
::); "nop;"
} "ssync;"
#elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244) );
static inline void CSYNC (void) else
{ __asm__ __volatile__("csync;");
__asm__ __volatile__ ("csync;\n\t");
} }
#endif
#else /* __ASSEMBLY__ */ #else /* __ASSEMBLY__ */
...@@ -91,19 +85,19 @@ static inline void CSYNC (void) ...@@ -91,19 +85,19 @@ static inline void CSYNC (void)
#define ssync(x) SSYNC(x) #define ssync(x) SSYNC(x)
#define csync(x) CSYNC(x) #define csync(x) CSYNC(x)
#if defined(ANOMALY_05000312) && defined(ANOMALY_05000244) #if ANOMALY_05000312 && ANOMALY_05000244
#define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch; #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
#define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch; #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
#elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244) #elif ANOMALY_05000312 && !ANOMALY_05000244
#define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch; #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
#define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch; #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
#elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244) #elif !ANOMALY_05000312 && ANOMALY_05000244
#define SSYNC(scratch) nop; nop; nop; SSYNC; #define SSYNC(scratch) nop; nop; nop; SSYNC;
#define CSYNC(scratch) nop; nop; nop; CSYNC; #define CSYNC(scratch) nop; nop; nop; CSYNC;
#elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244) #elif !ANOMALY_05000312 && !ANOMALY_05000244
#define SSYNC(scratch) SSYNC; #define SSYNC(scratch) SSYNC;
#define CSYNC(scratch) CSYNC; #define CSYNC(scratch) CSYNC;
......
This diff is collapsed.
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
#define CONFIG_CCLK_ACT_DIV CONFIG_CCLK_DIV_not_defined_properly #define CONFIG_CCLK_ACT_DIV CONFIG_CCLK_DIV_not_defined_properly
#endif #endif
#if defined(ANOMALY_05000273) && (CONFIG_CCLK_DIV == 1) #if ANOMALY_05000273 && (CONFIG_CCLK_DIV == 1)
#error ANOMALY 05000273, please make sure CCLK is at least 2x SCLK #error ANOMALY 05000273, please make sure CCLK is at least 2x SCLK
#endif #endif
......
This diff is collapsed.
...@@ -206,7 +206,7 @@ ...@@ -206,7 +206,7 @@
#define CONFIG_CCLK_ACT_DIV CONFIG_CCLK_DIV_not_defined_properly #define CONFIG_CCLK_ACT_DIV CONFIG_CCLK_DIV_not_defined_properly
#endif #endif
#if defined(ANOMALY_05000273) && (CONFIG_CCLK_DIV == 1) #if ANOMALY_05000273 && (CONFIG_CCLK_DIV == 1)
#error ANOMALY 05000273, please make sure CCLK is at least 2x SCLK #error ANOMALY 05000273, please make sure CCLK is at least 2x SCLK
#endif #endif
......
...@@ -6,46 +6,62 @@ ...@@ -6,46 +6,62 @@
* Licensed under the GPL-2 or later. * Licensed under the GPL-2 or later.
*/ */
/* This file shoule be up to date with:
* - Revision B, April 6, 2007; ADSP-BF549 Silicon Anomaly List
*/
#ifndef _MACH_ANOMALY_H_ #ifndef _MACH_ANOMALY_H_
#define _MACH_ANOMALY_H_ #define _MACH_ANOMALY_H_
#define ANOMALY_05000074 /* A multi issue instruction with dsp32shiftimm in /* Multi-Issue Instruction with dsp32shiftimm in slot1 and P-reg Store in slot 2 Not Supported */
* slot1 and store of a P register in slot 2 is not #define ANOMALY_05000074 (1)
* supported */ /* DMA_RUN Bit Is Not Valid after a Peripheral Receive Channel DMA Stops */
#define ANOMALY_05000119 /* DMA_RUN bit is not valid after a Peripheral Receive #define ANOMALY_05000119 (1)
* Channel DMA stops */ /* Rx.H Cannot Be Used to Access 16-bit System MMR Registers */
#define ANOMALY_05000122 /* Rx.H can not be used to access 16-bit System MMR #define ANOMALY_05000122 (1)
* registers. */ /* Spurious Hardware Error from an Access in the Shadow of a Conditional Branch */
#define ANOMALY_05000245 /* Spurious Hardware Error from an Access in the #define ANOMALY_05000245 (1)
* Shadow of a Conditional Branch */ /* Entering Hibernate State with RTC Seconds Interrupt Not Functional */
#define ANOMALY_05000255 /* Entering Hibernate Mode with RTC Seconds event #define ANOMALY_05000255 (1)
* interrupt not functional */ /* Sensitivity To Noise with Slow Input Edge Rates on External SPORT TX and RX Clocks */
#define ANOMALY_05000265 /* Sensitivity to noise with slow input edge rates on #define ANOMALY_05000265 (1)
* SPORT external receive and transmit clocks. */ /* Certain Data Cache Writethrough Modes Fail for Vddint <= 0.9V */
#define ANOMALY_05000272 /* Certain data cache write through modes fail for #define ANOMALY_05000272 (1)
* VDDint <=0.9V */ /* False Hardware Errors Caused by Fetches at the Boundary of Reserved Memory */
#define ANOMALY_05000281 /* False Hardware Error Exception when ISR context is #define ANOMALY_05000310 (1)
* not restored */ /* Errors When SSYNC, CSYNC, or Loads to LT, LB and LC Registers Are Interrupted */
#define ANOMALY_05000310 /* False Hardware Errors Caused by Fetches at the #define ANOMALY_05000312 (1)
* Boundary of Reserved Memory */ /* TWI Slave Boot Mode Is Not Functional */
#define ANOMALY_05000312 /* Errors When SSYNC, CSYNC, or Loads to LT, LB and #define ANOMALY_05000324 (1)
* LC Registers Are Interrupted */ /* External FIFO Boot Mode Is Not Functional */
#define ANOMALY_05000324 /* TWI Slave Boot Mode Is Not Functional */ #define ANOMALY_05000325 (1)
#define ANOMALY_05000325 /* External FIFO Boot Mode Is Not Functional */ /* Data Lost When Core and DMA Accesses Are Made to the USB FIFO Simultaneously */
#define ANOMALY_05000327 /* Data Lost When Core and DMA Accesses Are Made to #define ANOMALY_05000327 (1)
* the USB FIFO Simultaneously */ /* Incorrect Access of OTP_STATUS During otp_write() Function */
#define ANOMALY_05000328 /* Incorrect Access of OTP_STATUS During otp_write() #define ANOMALY_05000328 (1)
* function */ /* Synchronous Burst Flash Boot Mode Is Not Functional */
#define ANOMALY_05000329 /* Synchronous Burst Flash Boot Mode Is Not Functional #define ANOMALY_05000329 (1)
* */ /* Host DMA Boot Mode Is Not Functional */
#define ANOMALY_05000330 /* Host DMA Boot Mode Is Not Functional */ #define ANOMALY_05000330 (1)
#define ANOMALY_05000334 /* Inadequate Timing Margins on DDR DQS to DQ and DQM /* Inadequate Timing Margins on DDR DQS to DQ and DQM Skew */
* Skew */ #define ANOMALY_05000334 (1)
#define ANOMALY_05000335 /* Inadequate Rotary Debounce Logic Duration */ /* Inadequate Rotary Debounce Logic Duration */
#define ANOMALY_05000336 /* Phantom Interrupt Occurs After First Configuration #define ANOMALY_05000335 (1)
* of Host DMA Port */ /* Phantom Interrupt Occurs After First Configuration of Host DMA Port */
#define ANOMALY_05000337 /* Disallowed Configuration Prevents Subsequent #define ANOMALY_05000336 (1)
* Allowed Configuration on Host DMA Port */ /* Disallowed Configuration Prevents Subsequent Allowed Configuration on Host DMA Port */
#define ANOMALY_05000338 /* Slave-Mode SPI0 MISO Failure With CPHA = 0 */ #define ANOMALY_05000337 (1)
/* Slave-Mode SPI0 MISO Failure With CPHA = 0 */
#define ANOMALY_05000338 (1)
/* Anomalies that don't exist on this proc */
#define ANOMALY_05000125 (0)
#define ANOMALY_05000183 (0)
#define ANOMALY_05000198 (0)
#define ANOMALY_05000244 (0)
#define ANOMALY_05000263 (0)
#define ANOMALY_05000266 (0)
#define ANOMALY_05000273 (0)
#define ANOMALY_05000311 (0)
#endif /* _MACH_ANOMALY_H_ */ #endif
This diff is collapsed.
...@@ -311,7 +311,7 @@ ...@@ -311,7 +311,7 @@
#define CONFIG_CCLK_ACT_DIV CONFIG_CCLK_DIV_not_defined_properly #define CONFIG_CCLK_ACT_DIV CONFIG_CCLK_DIV_not_defined_properly
#endif #endif
#if defined(ANOMALY_05000273) && (CONFIG_CCLK_DIV == 1) #if ANOMALY_05000273 && (CONFIG_CCLK_DIV == 1)
#error ANOMALY 05000273, please make sure CCLK is at least 2x SCLK #error ANOMALY 05000273, please make sure CCLK is at least 2x SCLK
#endif #endif
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define bfin_read_SRAM_BASE_ADDRESS() bfin_read32(SRAM_BASE_ADDRESS) #define bfin_read_SRAM_BASE_ADDRESS() bfin_read32(SRAM_BASE_ADDRESS)
#define bfin_write_SRAM_BASE_ADDRESS(val) bfin_write32(SRAM_BASE_ADDRESS,val) #define bfin_write_SRAM_BASE_ADDRESS(val) bfin_write32(SRAM_BASE_ADDRESS,val)
#define bfin_read_DMEM_CONTROL() bfin_read32(DMEM_CONTROL) #define bfin_read_DMEM_CONTROL() bfin_read32(DMEM_CONTROL)
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
extern void bfin_write_DMEM_CONTROL(unsigned int val); extern void bfin_write_DMEM_CONTROL(unsigned int val);
#else #else
#define bfin_write_DMEM_CONTROL(val) bfin_write32(DMEM_CONTROL,val) #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,7 +129,7 @@ extern void bfin_write_DMEM_CONTROL(unsigned int val);
#define DTEST_DATA3 0xFFE0040C #define DTEST_DATA3 0xFFE0040C
*/ */
#define bfin_read_IMEM_CONTROL() bfin_read32(IMEM_CONTROL) #define bfin_read_IMEM_CONTROL() bfin_read32(IMEM_CONTROL)
#ifdef ANOMALY_05000125 #if ANOMALY_05000125
extern void bfin_write_IMEM_CONTROL(unsigned int val); extern void bfin_write_IMEM_CONTROL(unsigned int val);
#else #else
#define bfin_write_IMEM_CONTROL(val) bfin_write32(IMEM_CONTROL,val) #define bfin_write_IMEM_CONTROL(val) bfin_write32(IMEM_CONTROL,val)
......
...@@ -33,81 +33,77 @@ ...@@ -33,81 +33,77 @@
#include <asm/mach/anomaly.h> #include <asm/mach/anomaly.h>
/*#if !defined(__ADSPLPBLACKFIN__)
#warning def_LPBlackfin.h should only be included for 532 compatible chips.
#endif
*/
#define MK_BMSK_(x) (1<<x) #define MK_BMSK_(x) (1<<x)
#if defined(ANOMALY_05000198) #ifndef __ASSEMBLY__
#define bfin_read8(addr) ({ unsigned char __v; \
__asm__ __volatile__ ("NOP;\n\t" \
"%0 = b[%1] (z);\n\t" \
: "=d"(__v) : "a"(addr)); \
__v; })
#define bfin_read16(addr) ({ unsigned __v; \
__asm__ __volatile__ ("NOP;\n\t"\
"%0 = w[%1] (z);\n\t"\
: "=d"(__v) : "a"(addr)); (unsigned short)__v; })
#define bfin_read32(addr) ({ unsigned __v; \
__asm__ __volatile__ ("NOP;\n\t"\
"%0 = [%1];\n\t"\
: "=d"(__v) : "a"(addr)); __v; })
#define bfin_write8(addr, val) ({ \ #include <linux/types.h>
__asm__ __volatile__ ("NOP;\n\t" \
"b[%0] = %1;\n\t" \
: : "a"(addr), "d"(val) : "memory");})
#define bfin_write16(addr,val) ({\
__asm__ __volatile__ ("NOP;\n\t"\
"w[%0] = %1;\n\t"\
: : "a"(addr) , "d"(val) : "memory");})
#define bfin_write32(addr,val) ({\
__asm__ __volatile__ ("NOP;\n\t"\
"[%0] = %1;\n\t"\
: : "a"(addr) , "d"(val) : "memory");})
#if ANOMALY_05000198
# define NOP_PAD_ANOMALY_05000198 "nop;"
#else #else
# define NOP_PAD_ANOMALY_05000198
#define bfin_read8(addr) ({ unsigned char __v; \
__asm__ __volatile__ ( \
"%0 = b[%1] (z);\n\t" \
:"=d"(__v) : "a"(addr)); \
__v; })
#define bfin_read16(addr) ({ unsigned __v; \
__asm__ __volatile__ (\
"%0 = w[%1] (z);\n\t"\
: "=d"(__v) : "a"(addr)); (unsigned short)__v; })
#define bfin_read32(addr) ({ unsigned __v; \
__asm__ __volatile__ (\
"%0 = [%1];\n\t"\
: "=d"(__v) : "a"(addr)); __v; })
#define bfin_write8(addr, val) ({ \
__asm__ __volatile__ ( \
"b[%0] = %1; \n\t" \
::"a"(addr), "d"(val) : "memory");})
#define bfin_write16(addr,val) ({\
__asm__ __volatile__ (\
"w[%0] = %1;\n\t"\
: : "a"(addr) , "d"(val) : "memory");})
#define bfin_write32(addr,val) ({\
__asm__ __volatile__ (\
"[%0] = %1;\n\t"\
: : "a"(addr) , "d"(val) : "memory");})
#endif #endif
#define bfin_read8(addr) ({ \
uint8_t __v; \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"%0 = b[%1] (z);" \
: "=d" (__v) \
: "a" (addr) \
); \
__v; })
#define bfin_read16(addr) ({ \
uint16_t __v; \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"%0 = w[%1] (z);" \
: "=d" (__v) \
: "a" (addr) \
); \
__v; })
#define bfin_read32(addr) ({ \
uint32_t __v; \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"%0 = [%1];" \
: "=d" (__v) \
: "a" (addr) \
); \
__v; })
#define bfin_write8(addr, val) \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"b[%0] = %1;" \
: \
: "a" (addr), "d" (val) \
: "memory" \
)
#define bfin_write16(addr, val) \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"w[%0] = %1;" \
: \
: "a" (addr), "d" (val) \
: "memory" \
)
#define bfin_write32(addr, val) \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"[%0] = %1;" \
: \
: "a" (addr), "d" (val) \
: "memory" \
)
#endif /* __ASSEMBLY__ */
/************************************************** /**************************************************
* System Register Bits * System Register Bits
**************************************************/ **************************************************/
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <asm/mach/anomaly.h>
/* /*
* Interrupt configuring macros. * Interrupt configuring macros.
...@@ -43,53 +44,60 @@ ...@@ -43,53 +44,60 @@
extern unsigned long irq_flags; extern unsigned long irq_flags;
#define local_irq_enable() do { \ #define local_irq_enable() \
__asm__ __volatile__ ( \ __asm__ __volatile__( \
"sti %0;" \ "sti %0;" \
::"d"(irq_flags)); \ : \
} while (0) : "d" (irq_flags) \
)
#define local_irq_disable() do { \ #define local_irq_disable() \
int _tmp_dummy; \ do { \
__asm__ __volatile__ ( \ int __tmp_dummy; \
"cli %0;" \ __asm__ __volatile__( \
:"=d" (_tmp_dummy):); \ "cli %0;" \
} while (0) : "=d" (__tmp_dummy) \
); \
} while (0)
#if defined(ANOMALY_05000244) && defined (CONFIG_BLKFIN_CACHE) #if ANOMALY_05000244 && defined(CONFIG_BLKFIN_CACHE)
#define idle_with_irq_disabled() do { \ # define NOP_PAD_ANOMALY_05000244 "nop; nop;"
__asm__ __volatile__ ( \
"nop; nop;\n" \
".align 8;\n" \
"sti %0; idle;\n" \
::"d" (irq_flags)); \
} while (0)
#else #else
#define idle_with_irq_disabled() do { \ # define NOP_PAD_ANOMALY_05000244
__asm__ __volatile__ ( \
".align 8;\n" \
"sti %0; idle;\n" \
::"d" (irq_flags)); \
} while (0)
#endif #endif
#define idle_with_irq_disabled() \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000244 \
".align 8;" \
"sti %0;" \
"idle;" \
: \
: "d" (irq_flags) \
)
#ifdef CONFIG_DEBUG_HWERR #ifdef CONFIG_DEBUG_HWERR
#define __save_and_cli(x) do { \ # define __save_and_cli(x) \
__asm__ __volatile__ ( \ __asm__ __volatile__( \
"cli %0;\n\tsti %1;" \ "cli %0;" \
:"=&d"(x): "d" (0x3F)); \ "sti %1;" \
} while (0) : "=&d" (x) \
: "d" (0x3F) \
)
#else #else
#define __save_and_cli(x) do { \ # define __save_and_cli(x) \
__asm__ __volatile__ ( \ __asm__ __volatile__( \
"cli %0;" \ "cli %0;" \
:"=&d"(x):); \ : "=&d" (x) \
} while (0) )
#endif #endif
#define local_save_flags(x) asm volatile ("cli %0;" \ #define local_save_flags(x) \
"sti %0;" \ __asm__ __volatile__( \
:"=d"(x):); "cli %0;" \
"sti %0;" \
: "=d" (x) \
)
#ifdef CONFIG_DEBUG_HWERR #ifdef CONFIG_DEBUG_HWERR
#define irqs_enabled_from_flags(x) (((x) & ~0x3f) != 0) #define irqs_enabled_from_flags(x) (((x) & ~0x3f) != 0)
...@@ -97,10 +105,11 @@ extern unsigned long irq_flags; ...@@ -97,10 +105,11 @@ extern unsigned long irq_flags;
#define irqs_enabled_from_flags(x) ((x) != 0x1f) #define irqs_enabled_from_flags(x) ((x) != 0x1f)
#endif #endif
#define local_irq_restore(x) do { \ #define local_irq_restore(x) \
if (irqs_enabled_from_flags(x)) \ do { \
local_irq_enable (); \ if (irqs_enabled_from_flags(x)) \
} while (0) local_irq_enable(); \
} while (0)
/* For spinlocks etc */ /* For spinlocks etc */
#define local_irq_save(x) __save_and_cli(x) #define local_irq_save(x) __save_and_cli(x)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment