diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-06-15 16:53:12 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-07-23 01:18:20 -0400 |
commit | af459864b363ff1b1567741d52f5334ceb10d829 (patch) | |
tree | 4068599d4a8d6d38dab562949e45da04c989ae92 /arch/blackfin/kernel | |
parent | 94674b15df4fdb111aeb2b07e67a818db5faa3c3 (diff) |
Blackfin: debug-mmrs: use new gptimer_group layout to simplify code
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/kernel')
-rw-r--r-- | arch/blackfin/kernel/debug-mmrs.c | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/arch/blackfin/kernel/debug-mmrs.c b/arch/blackfin/kernel/debug-mmrs.c index bafae8717903..c40dd6bbeac2 100644 --- a/arch/blackfin/kernel/debug-mmrs.c +++ b/arch/blackfin/kernel/debug-mmrs.c | |||
@@ -278,6 +278,32 @@ bfin_debug_mmrs_gptimer(struct dentry *parent, unsigned long base, int num) | |||
278 | } | 278 | } |
279 | #define GPTIMER(num) bfin_debug_mmrs_gptimer(parent, TIMER##num##_CONFIG, num) | 279 | #define GPTIMER(num) bfin_debug_mmrs_gptimer(parent, TIMER##num##_CONFIG, num) |
280 | 280 | ||
281 | #define GPTIMER_GROUP_OFF(mmr) REGS_OFF(gptimer_group, mmr) | ||
282 | #define __GPTIMER_GROUP(uname, lname) __REGS(gptimer_group, #uname, lname) | ||
283 | static void __init __maybe_unused | ||
284 | bfin_debug_mmrs_gptimer_group(struct dentry *parent, unsigned long base, int num) | ||
285 | { | ||
286 | char buf[32], *_buf; | ||
287 | |||
288 | if (num == -1) { | ||
289 | _buf = buf + sprintf(buf, "TIMER_"); | ||
290 | __GPTIMER_GROUP(ENABLE, enable); | ||
291 | __GPTIMER_GROUP(DISABLE, disable); | ||
292 | __GPTIMER_GROUP(STATUS, status); | ||
293 | } else { | ||
294 | /* These MMRs are a bit odd as the group # is a suffix */ | ||
295 | _buf = buf + sprintf(buf, "TIMER_ENABLE%i", num); | ||
296 | d(buf, 16, base + GPTIMER_GROUP_OFF(enable)); | ||
297 | |||
298 | _buf = buf + sprintf(buf, "TIMER_DISABLE%i", num); | ||
299 | d(buf, 16, base + GPTIMER_GROUP_OFF(disable)); | ||
300 | |||
301 | _buf = buf + sprintf(buf, "TIMER_STATUS%i", num); | ||
302 | d(buf, 32, base + GPTIMER_GROUP_OFF(status)); | ||
303 | } | ||
304 | } | ||
305 | #define GPTIMER_GROUP(mmr, num) bfin_debug_mmrs_gptimer_group(parent, mmr, num) | ||
306 | |||
281 | /* | 307 | /* |
282 | * Handshake MDMA | 308 | * Handshake MDMA |
283 | */ | 309 | */ |
@@ -1006,29 +1032,19 @@ static int __init bfin_debug_mmrs_init(void) | |||
1006 | #endif | 1032 | #endif |
1007 | 1033 | ||
1008 | parent = debugfs_create_dir("gptimer", top); | 1034 | parent = debugfs_create_dir("gptimer", top); |
1009 | #ifdef TIMER_DISABLE | 1035 | #ifdef TIMER_ENABLE |
1010 | D16(TIMER_DISABLE); | 1036 | GPTIMER_GROUP(TIMER_ENABLE, -1); |
1011 | D16(TIMER_ENABLE); | ||
1012 | D32(TIMER_STATUS); | ||
1013 | #endif | 1037 | #endif |
1014 | #ifdef TIMER_DISABLE0 | 1038 | #ifdef TIMER_ENABLE0 |
1015 | D16(TIMER_DISABLE0); | 1039 | GPTIMER_GROUP(TIMER_ENABLE0, 0); |
1016 | D16(TIMER_ENABLE0); | ||
1017 | D32(TIMER_STATUS0); | ||
1018 | #endif | 1040 | #endif |
1019 | #ifdef TIMER_DISABLE1 | 1041 | #ifdef TIMER_ENABLE1 |
1020 | D16(TIMER_DISABLE1); | 1042 | GPTIMER_GROUP(TIMER_ENABLE1, 1); |
1021 | D16(TIMER_ENABLE1); | ||
1022 | D32(TIMER_STATUS1); | ||
1023 | #endif | 1043 | #endif |
1024 | /* XXX: Should convert BF561 MMR names */ | 1044 | /* XXX: Should convert BF561 MMR names */ |
1025 | #ifdef TMRS4_DISABLE | 1045 | #ifdef TMRS4_DISABLE |
1026 | D16(TMRS4_DISABLE); | 1046 | GPTIMER_GROUP(TMRS4_ENABLE, 0); |
1027 | D16(TMRS4_ENABLE); | 1047 | GPTIMER_GROUP(TMRS8_ENABLE, 1); |
1028 | D32(TMRS4_STATUS); | ||
1029 | D16(TMRS8_DISABLE); | ||
1030 | D16(TMRS8_ENABLE); | ||
1031 | D32(TMRS8_STATUS); | ||
1032 | #endif | 1048 | #endif |
1033 | GPTIMER(0); | 1049 | GPTIMER(0); |
1034 | GPTIMER(1); | 1050 | GPTIMER(1); |