Skip to content

Commit f344194

Browse files
committed
Blackfin: Split the BF532 BFIN_*_FIO_FLAG() functions to their own header
Split the BF532 machine type BFIN_*_FIO_FLAG() functions to their own header file to avoid circular #include problems as these functions require IRQ flag handling, which requires asm/blackfin.h, which otherwise requires the header file that defines these functions. For good measure, also get rid of the inclusion of asm/blackfin.h from mach/cdefBF532.h (which is circular) and defBF532.h (which is included by asm/blackfin.h before including this header). Signed-off-by: David Howells <dhowells@redhat.com>
1 parent 3dcc1e7 commit f344194

5 files changed

Lines changed: 58 additions & 47 deletions

File tree

‎arch/blackfin/mach-bf533/boards/blackstamp.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <asm/bfin5xx_spi.h>
2626
#include <asm/portmux.h>
2727
#include <asm/dpmc.h>
28+
#include <mach/fio_flag.h>
2829

2930
/*
3031
* Name the Board for the /proc/cpuinfo

‎arch/blackfin/mach-bf533/boards/ip0x.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <asm/dma.h>
2323
#include <asm/bfin5xx_spi.h>
2424
#include <asm/portmux.h>
25+
#include <mach/fio_flag.h>
2526

2627
/*
2728
* Name the Board for the /proc/cpuinfo

‎arch/blackfin/mach-bf533/boards/stamp.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <asm/reboot.h>
2525
#include <asm/portmux.h>
2626
#include <asm/dpmc.h>
27+
#include <mach/fio_flag.h>
2728

2829
/*
2930
* Name the Board for the /proc/cpuinfo

‎arch/blackfin/mach-bf533/include/mach/cdefBF532.h‎

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
#ifndef _CDEF_BF532_H
88
#define _CDEF_BF532_H
99

10-
#include <asm/blackfin.h>
11-
12-
/*include all Core registers and bit definitions*/
13-
#include "defBF532.h"
14-
1510
/*include core specific register pointer definitions*/
1611
#include <asm/cdef_LPBlackfin.h>
1712

@@ -655,46 +650,4 @@
655650
/* These need to be last due to the cdef/linux inter-dependencies */
656651
#include <asm/irq.h>
657652

658-
#if ANOMALY_05000311
659-
#define BFIN_WRITE_FIO_FLAG(name) \
660-
static inline void bfin_write_FIO_FLAG_##name(unsigned short val) \
661-
{ \
662-
unsigned long flags; \
663-
local_irq_save_hw(flags); \
664-
bfin_write16(FIO_FLAG_##name, val); \
665-
bfin_read_CHIPID(); \
666-
local_irq_restore_hw(flags); \
667-
}
668-
BFIN_WRITE_FIO_FLAG(D)
669-
BFIN_WRITE_FIO_FLAG(C)
670-
BFIN_WRITE_FIO_FLAG(S)
671-
BFIN_WRITE_FIO_FLAG(T)
672-
673-
#define BFIN_READ_FIO_FLAG(name) \
674-
static inline u16 bfin_read_FIO_FLAG_##name(void) \
675-
{ \
676-
unsigned long flags; \
677-
u16 ret; \
678-
local_irq_save_hw(flags); \
679-
ret = bfin_read16(FIO_FLAG_##name); \
680-
bfin_read_CHIPID(); \
681-
local_irq_restore_hw(flags); \
682-
return ret; \
683-
}
684-
BFIN_READ_FIO_FLAG(D)
685-
BFIN_READ_FIO_FLAG(C)
686-
BFIN_READ_FIO_FLAG(S)
687-
BFIN_READ_FIO_FLAG(T)
688-
689-
#else
690-
#define bfin_write_FIO_FLAG_D(val) bfin_write16(FIO_FLAG_D, val)
691-
#define bfin_write_FIO_FLAG_C(val) bfin_write16(FIO_FLAG_C, val)
692-
#define bfin_write_FIO_FLAG_S(val) bfin_write16(FIO_FLAG_S, val)
693-
#define bfin_write_FIO_FLAG_T(val) bfin_write16(FIO_FLAG_T, val)
694-
#define bfin_read_FIO_FLAG_T() bfin_read16(FIO_FLAG_T)
695-
#define bfin_read_FIO_FLAG_C() bfin_read16(FIO_FLAG_C)
696-
#define bfin_read_FIO_FLAG_S() bfin_read16(FIO_FLAG_S)
697-
#define bfin_read_FIO_FLAG_D() bfin_read16(FIO_FLAG_D)
698-
#endif
699-
700653
#endif /* _CDEF_BF532_H */
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2005-2008 Analog Devices Inc.
3+
*
4+
* Licensed under the GPL-2 or later
5+
*/
6+
7+
#ifndef _MACH_FIO_FLAG_H
8+
#define _MACH_FIO_FLAG_H
9+
10+
#include <asm/blackfin.h>
11+
#include <asm/irqflags.h>
12+
13+
#if ANOMALY_05000311
14+
#define BFIN_WRITE_FIO_FLAG(name) \
15+
static inline void bfin_write_FIO_FLAG_##name(unsigned short val) \
16+
{ \
17+
unsigned long flags; \
18+
local_irq_save_hw(flags); \
19+
bfin_write16(FIO_FLAG_##name, val); \
20+
bfin_read_CHIPID(); \
21+
local_irq_restore_hw(flags); \
22+
}
23+
BFIN_WRITE_FIO_FLAG(D)
24+
BFIN_WRITE_FIO_FLAG(C)
25+
BFIN_WRITE_FIO_FLAG(S)
26+
BFIN_WRITE_FIO_FLAG(T)
27+
28+
#define BFIN_READ_FIO_FLAG(name) \
29+
static inline u16 bfin_read_FIO_FLAG_##name(void) \
30+
{ \
31+
unsigned long flags; \
32+
u16 ret; \
33+
local_irq_save_hw(flags); \
34+
ret = bfin_read16(FIO_FLAG_##name); \
35+
bfin_read_CHIPID(); \
36+
local_irq_restore_hw(flags); \
37+
return ret; \
38+
}
39+
BFIN_READ_FIO_FLAG(D)
40+
BFIN_READ_FIO_FLAG(C)
41+
BFIN_READ_FIO_FLAG(S)
42+
BFIN_READ_FIO_FLAG(T)
43+
44+
#else
45+
#define bfin_write_FIO_FLAG_D(val) bfin_write16(FIO_FLAG_D, val)
46+
#define bfin_write_FIO_FLAG_C(val) bfin_write16(FIO_FLAG_C, val)
47+
#define bfin_write_FIO_FLAG_S(val) bfin_write16(FIO_FLAG_S, val)
48+
#define bfin_write_FIO_FLAG_T(val) bfin_write16(FIO_FLAG_T, val)
49+
#define bfin_read_FIO_FLAG_T() bfin_read16(FIO_FLAG_T)
50+
#define bfin_read_FIO_FLAG_C() bfin_read16(FIO_FLAG_C)
51+
#define bfin_read_FIO_FLAG_S() bfin_read16(FIO_FLAG_S)
52+
#define bfin_read_FIO_FLAG_D() bfin_read16(FIO_FLAG_D)
53+
#endif
54+
55+
#endif /* _MACH_FIO_FLAG_H */

0 commit comments

Comments
 (0)