Skip to content

Commit

Permalink
Blackfin arch: revise anomaly handling by basing things on the compil…
Browse files Browse the repository at this point in the history
…er 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>
  • Loading branch information
Mike Frysinger authored and Bryan Wu committed Jul 25, 2007
1 parent 287050f commit 1aafd90
Show file tree
Hide file tree
Showing 25 changed files with 875 additions and 706 deletions.
10 changes: 5 additions & 5 deletions arch/blackfin/kernel/bfin_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ EXPORT_SYMBOL(set_gpio_ ## name);
SET_GPIO_SC(maska)
SET_GPIO_SC(maskb)

#if defined(ANOMALY_05000311)
#if ANOMALY_05000311
void set_gpio_data(unsigned short gpio, unsigned short arg)
{
unsigned long flags;
Expand All @@ -349,7 +349,7 @@ SET_GPIO_SC(data)
#endif


#if defined(ANOMALY_05000311)
#if ANOMALY_05000311
void set_gpio_toggle(unsigned short gpio)
{
unsigned long flags;
Expand Down Expand Up @@ -387,7 +387,7 @@ SET_GPIO_P(maska)
SET_GPIO_P(maskb)


#if defined(ANOMALY_05000311)
#if ANOMALY_05000311
void set_gpiop_data(unsigned short gpio, unsigned short arg)
{
unsigned long flags;
Expand Down Expand Up @@ -421,7 +421,7 @@ GET_GPIO(maska)
GET_GPIO(maskb)


#if defined(ANOMALY_05000311)
#if ANOMALY_05000311
unsigned short get_gpio_data(unsigned short gpio)
{
unsigned long flags;
Expand Down Expand Up @@ -455,7 +455,7 @@ GET_GPIO_P(both)
GET_GPIO_P(maska)
GET_GPIO_P(maskb)

#if defined(ANOMALY_05000311)
#if ANOMALY_05000311
unsigned short get_gpiop_data(unsigned short gpio)
{
unsigned long flags;
Expand Down
4 changes: 2 additions & 2 deletions arch/blackfin/kernel/cplbinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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].i_conf);
} else {
#if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263))
if (i == SDRAM_KERN) {
#if defined(CONFIG_BLKFIN_CACHE)
if (ANOMALY_05000263 && i == SDRAM_KERN) {
fill_cplbtab(t,
cplb_data[i].start,
cplb_data[i].end,
Expand Down
20 changes: 10 additions & 10 deletions arch/blackfin/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,16 @@ void __init setup_arch(char **cmdline_p)
cclk = get_cclk();
sclk = get_sclk();

#if !defined(CONFIG_BFIN_KERNEL_CLOCK) && defined(ANOMALY_05000273)
if (cclk == sclk)
#if !defined(CONFIG_BFIN_KERNEL_CLOCK)
if (ANOMALY_05000273 && cclk == sclk)
panic("ANOMALY 05000273, SCLK can not be same as CCLK");
#endif

#if defined(ANOMALY_05000266)
bfin_read_IMDMA_D0_IRQ_STATUS();
bfin_read_IMDMA_D1_IRQ_STATUS();
#ifdef BF561_FAMILY
if (ANOMALY_05000266) {
bfin_read_IMDMA_D0_IRQ_STATUS();
bfin_read_IMDMA_D1_IRQ_STATUS();
}
#endif

#ifdef DEBUG_SERIAL_EARLY_INIT
Expand Down Expand Up @@ -260,7 +262,7 @@ void __init setup_arch(char **cmdline_p)
&& ((unsigned long *)mtd_phys)[1] == ROMSB_WORD1)
mtd_size =
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
* instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
* 05000263 - Hardware loop corrupted when taking an ICPLB exception
Expand Down Expand Up @@ -289,7 +291,7 @@ void __init setup_arch(char **cmdline_p)
_ebss = memory_mtd_start; /* define _ebss for compatible */
#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
* instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
* 05000263 - Hardware loop corrupted when taking an ICPLB exception
Expand Down Expand Up @@ -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",
cclk / 1000000, sclk / 1000000);

#if defined(ANOMALY_05000273)
if ((cclk >> 1) <= sclk)
if (ANOMALY_05000273 && (cclk >> 1) <= sclk)
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 "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/lib/memcmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ENTRY(_memcmp)

LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1;
.Lquad_loop_s:
#ifdef ANOMALY_05000202
#if ANOMALY_05000202
R0 = [P0++];
R1 = [I0++];
#else
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/lib/memcpy.S
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ ENTRY(_memcpy)
R0 = R1;
I1 = P1;
R3 = [I1++];
#ifdef ANOMALY_05000202
#if ANOMALY_05000202
.Lword_loops:
[P0++] = R3;
.Lword_loope:
Expand Down
4 changes: 2 additions & 2 deletions arch/blackfin/lib/memmove.S
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ENTRY(_memmove)
R1 = [I0++];

LSETUP (.Lquad_loops, .Lquad_loope) LC0=P1;
#ifdef ANOMALY_05000202
#if ANOMALY_05000202
.Lquad_loops:
[P0++] = R1;
.Lquad_loope:
Expand Down Expand Up @@ -102,7 +102,7 @@ ENTRY(_memmove)
R1 = B[P3--] (Z);
CC = P2 == 0;
IF CC JUMP .Lno_loop;
#ifdef ANOMALY_05000245
#if ANOMALY_05000245
NOP;
NOP;
#endif
Expand Down
10 changes: 5 additions & 5 deletions arch/blackfin/mach-bf533/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ ENTRY(__start)
R0 = R0 & R1;

/* Anomaly 05000125 */
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
CLI R2;
SSYNC;
#endif
[p0] = R0;
SSYNC;
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
STI R2;
#endif

Expand All @@ -169,13 +169,13 @@ ENTRY(__start)
R0 = R0 & R1;

/* Anomaly 05000125 */
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
CLI R2;
SSYNC;
#endif
[p0] = R0;
SSYNC;
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
STI R2;
#endif

Expand Down Expand Up @@ -264,7 +264,7 @@ ENTRY(__start)
p0.l = .LWAIT_HERE;
p0.h = .LWAIT_HERE;
reti = p0;
#if defined(ANOMALY_05000281)
#if ANOMALY_05000281
nop; nop; nop;
#endif
rti;
Expand Down
18 changes: 9 additions & 9 deletions arch/blackfin/mach-bf537/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ ENTRY(__start)
R0 = R0 & R1;

/* Anomaly 05000125 */
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
CLI R2;
SSYNC;
#endif
[p0] = R0;
SSYNC;
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
STI R2;
#endif

Expand All @@ -125,13 +125,13 @@ ENTRY(__start)
R0 = R0 & R1;

/* Anomaly 05000125 */
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
CLI R2;
SSYNC;
#endif
[p0] = R0;
SSYNC;
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
STI R2;
#endif

Expand All @@ -141,12 +141,12 @@ ENTRY(__start)
*/
p0.h = hi(BFIN_PORT_MUX);
p0.l = lo(BFIN_PORT_MUX);
#ifdef ANOMALY_05000212
#if ANOMALY_05000212
R0.L = W[P0]; /* Read */
SSYNC;
#endif
R0 = (PGDE_UART | PFTE_UART)(Z);
#ifdef ANOMALY_05000212
#if ANOMALY_05000212
W[P0] = R0.L; /* Write */
SSYNC;
#endif
Expand All @@ -155,12 +155,12 @@ ENTRY(__start)

p0.h = hi(PORTF_FER);
p0.l = lo(PORTF_FER);
#ifdef ANOMALY_05000212
#if ANOMALY_05000212
R0.L = W[P0]; /* Read */
SSYNC;
#endif
R0 = 0x000F(Z);
#ifdef ANOMALY_05000212
#if ANOMALY_05000212
W[P0] = R0.L; /* Write */
SSYNC;
#endif
Expand Down Expand Up @@ -274,7 +274,7 @@ ENTRY(__start)
p0.l = .LWAIT_HERE;
p0.h = .LWAIT_HERE;
reti = p0;
#if defined(ANOMALY_05000281)
#if ANOMALY_05000281
nop; nop; nop;
#endif
rti;
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/mach-bf548/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ ENTRY(__stext)
p0.l = .LWAIT_HERE;
p0.h = .LWAIT_HERE;
reti = p0;
#if defined (ANOMALY_05000281)
#if ANOMALY_05000281
nop;
nop;
nop;
Expand Down
11 changes: 5 additions & 6 deletions arch/blackfin/mach-bf561/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,13 @@ ENTRY(__start)
R0 = ~ENICPLB;
R0 = R0 & R1;

/* Anomaly 05000125 */
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
CLI R2;
SSYNC;
#endif
[p0] = R0;
SSYNC;
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
STI R2;
#endif

Expand All @@ -125,13 +124,13 @@ ENTRY(__start)
R0 = R0 & R1;

/* Anomaly 05000125 */
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
CLI R2;
SSYNC;
#endif
[p0] = R0;
SSYNC;
#ifdef ANOMALY_05000125
#if ANOMALY_05000125
STI R2;
#endif

Expand Down Expand Up @@ -220,7 +219,7 @@ ENTRY(__start)
p0.l = .LWAIT_HERE;
p0.h = .LWAIT_HERE;
reti = p0;
#if defined(ANOMALY_05000281)
#if ANOMALY_05000281
nop; nop; nop;
#endif
rti;
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/mach-common/cacheinit.S
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

.text

#ifdef ANOMALY_05000125
#if ANOMALY_05000125
#if defined(CONFIG_BLKFIN_CACHE)
ENTRY(_bfin_write_IMEM_CONTROL)

Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/mach-common/cplbmgr.S
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ ENTRY(_cplb_mgr)
P3.L = _page_size_table; /* retrieve end address */
P3.H = _page_size_table; /* retrieve end address */
R3 = 0x1002; /* 16th - position, 2 bits -length */
#ifdef ANOMALY_05000209
#if ANOMALY_05000209
nop; /* Anomaly 05000209 */
#endif
R7 = EXTRACT(R1,R3.l);
Expand Down
10 changes: 5 additions & 5 deletions arch/blackfin/mach-common/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
* patch up CPLB misses on the kernel stack.
*/
ENTRY(_ex_dcplb)
#if defined(ANOMALY_05000261)
#if ANOMALY_05000261
/*
* Work around an anomaly: if we see a new DCPLB fault, return
* without doing anything. Then, if we get the same fault again,
Expand Down Expand Up @@ -137,7 +137,7 @@ ENTRY(_ex_single_step)

_return_from_exception:
DEBUG_START_HWTRACE(p5, r7)
#ifdef ANOMALY_05000257
#if ANOMALY_05000257
R7=LC0;
LC0=R7;
R7=LC1;
Expand Down Expand Up @@ -634,7 +634,7 @@ ENTRY(_return_from_int)
p1.h = _schedule_and_signal_from_int;
[p0] = p1;
csync;
#if defined(ANOMALY_05000281)
#if ANOMALY_05000281
r0.l = lo(CONFIG_BOOT_LOAD);
r0.h = hi(CONFIG_BOOT_LOAD);
reti = r0;
Expand All @@ -648,7 +648,7 @@ ENTRY(_return_from_int)
ENDPROC(_return_from_int)

ENTRY(_lower_to_irq14)
#if defined(ANOMALY_05000281)
#if ANOMALY_05000281
r0.l = lo(CONFIG_BOOT_LOAD);
r0.h = hi(CONFIG_BOOT_LOAD);
reti = r0;
Expand Down Expand Up @@ -1184,7 +1184,7 @@ _exception_stack:
.endr
_exception_stack_top:

#if defined(ANOMALY_05000261)
#if ANOMALY_05000261
/* Used by the assembly entry point to work around an anomaly. */
_last_cplb_fault_retx:
.long 0;
Expand Down
6 changes: 3 additions & 3 deletions arch/blackfin/mach-common/interrupt.S
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ __common_int_entry:
fp = 0;
#endif

#if defined (ANOMALY_05000283) || defined (ANOMALY_05000315)
#if ANOMALY_05000283 || ANOMALY_05000315
cc = r7 == r7;
p5.h = 0xffc0;
p5.l = 0x0014;
Expand All @@ -163,7 +163,7 @@ ENTRY(_evt_ivhw)
#ifdef CONFIG_FRAME_POINTER
fp = 0;
#endif
#ifdef ANOMALY_05000283
#if ANOMALY_05000283
cc = r7 == r7;
p5.h = 0xffc0;
p5.l = 0x0014;
Expand Down Expand Up @@ -207,7 +207,7 @@ ENTRY(_evt_evt2)
#ifdef CONFIG_FRAME_POINTER
fp = 0;
#endif
#ifdef ANOMALY_05000283
#if ANOMALY_05000283
cc = r7 == r7;
p5.h = 0xffc0;
p5.l = 0x0014;
Expand Down
Loading

0 comments on commit 1aafd90

Please sign in to comment.