Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
KED U-Boot Fork
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KED Software Projects
Miscellaneous
KED U-Boot Fork
Commits
7ed998f6
Commit
7ed998f6
authored
13 years ago
by
Mike Frysinger
Browse files
Options
Downloads
Patches
Plain Diff
Blackfin: sync MMR read/write helpers with Linux
Signed-off-by:
Mike Frysinger
<
vapier@gentoo.org
>
parent
95b4b9d9
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arch/blackfin/include/asm/blackfin_local.h
+42
-46
42 additions, 46 deletions
arch/blackfin/include/asm/blackfin_local.h
with
42 additions
and
46 deletions
arch/blackfin/include/asm/blackfin_local.h
+
42
−
46
View file @
7ed998f6
...
@@ -93,65 +93,61 @@ extern void blackfin_dcache_flush_invalidate_range(const void *, const void *);
...
@@ -93,65 +93,61 @@ extern void blackfin_dcache_flush_invalidate_range(const void *, const void *);
# define NOP_PAD_ANOMALY_05000198
# define NOP_PAD_ANOMALY_05000198
#endif
#endif
#define bfin_read
8
(addr) ({ \
#define
_
bfin_read
X
(addr
, size, asm_size, asm_ext
) ({ \
u
int8_t
__v; \
u
32
__v; \
__asm__ __volatile__( \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
NOP_PAD_ANOMALY_05000198 \
"%0 =
b[%1] (z)
;" \
"%0 =
" #asm_size "[%1]" #asm_ext "
;" \
: "=d" (__v) \
: "=d" (__v) \
: "a" (addr) \
: "a" (addr) \
); \
); \
__v; })
__v; })
#define _bfin_writeX(addr, val, size, asm_size) \
#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__( \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
NOP_PAD_ANOMALY_05000198 \
"%0 = [%1];" \
#asm_size "[%0] = %1;" \
: "=d" (__v) \
: "a" (addr) \
); \
__v; })
#define bfin_readPTR(addr) bfin_read32(addr)
#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) \
: "a" (addr), "d"
((u##size)
(val)
)
\
: "memory" \
: "memory" \
)
)
#define bfin_write32(addr, val) \
#define bfin_read8(addr) _bfin_readX(addr, 8, b, (z))
__asm__ __volatile__( \
#define bfin_read16(addr) _bfin_readX(addr, 16, w, (z))
NOP_PAD_ANOMALY_05000198 \
#define bfin_read32(addr) _bfin_readX(addr, 32, , )
"[%0] = %1;" \
#define bfin_write8(addr, val) _bfin_writeX(addr, val, 8, b)
: \
#define bfin_write16(addr, val) _bfin_writeX(addr, val, 16, w)
: "a" (addr), "d" (val) \
#define bfin_write32(addr, val) _bfin_writeX(addr, val, 32, )
: "memory" \
)
#define bfin_read(addr) \
({ \
sizeof(*(addr)) == 1 ? bfin_read8(addr) : \
sizeof(*(addr)) == 2 ? bfin_read16(addr) : \
sizeof(*(addr)) == 4 ? bfin_read32(addr) : \
({ BUG(); 0; }); \
})
#define bfin_write(addr, val) \
do { \
switch (sizeof(*(addr))) { \
case 1: bfin_write8(addr, val); break; \
case 2: bfin_write16(addr, val); break; \
case 4: bfin_write32(addr, val); break; \
default: BUG(); \
} \
} while (0)
#define bfin_write_or(addr, bits) \
do { \
typeof(addr) __addr = (addr); \
bfin_write(__addr, bfin_read(__addr) | (bits)); \
} while (0)
#define bfin_write_and(addr, bits) \
do { \
typeof(addr) __addr = (addr); \
bfin_write(__addr, bfin_read(__addr) & (bits)); \
} while (0)
#define bfin_readPTR(addr) bfin_read32(addr)
#define bfin_writePTR(addr, val) bfin_write32(addr, val)
#define bfin_writePTR(addr, val) bfin_write32(addr, val)
/* SSYNC implementation for C file */
/* SSYNC implementation for C file */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment