Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs-2.6
[pandora-kernel.git] / arch / blackfin / kernel / debug-mmrs.c
index fce4807..92f6648 100644 (file)
@@ -27,7 +27,7 @@
 #define PORT_MUX BFIN_PORT_MUX
 #endif
 
-#define _d(name, bits, addr, perms) debugfs_create_x##bits(name, perms, parent, (u##bits *)addr)
+#define _d(name, bits, addr, perms) debugfs_create_x##bits(name, perms, parent, (u##bits *)(addr))
 #define d(name, bits, addr)         _d(name, bits, addr, S_IRUSR|S_IWUSR)
 #define d_RO(name, bits, addr)      _d(name, bits, addr, S_IRUSR)
 #define d_WO(name, bits, addr)      _d(name, bits, addr, S_IWUSR)
@@ -223,7 +223,8 @@ bfin_debug_mmrs_dma(struct dentry *parent, unsigned long base, int num, char mdm
        __DMA(CURR_DESC_PTR, curr_desc_ptr);
        __DMA(CURR_ADDR, curr_addr);
        __DMA(IRQ_STATUS, irq_status);
-       __DMA(PERIPHERAL_MAP, peripheral_map);
+       if (strcmp(pfx, "IMDMA") != 0)
+               __DMA(PERIPHERAL_MAP, peripheral_map);
        __DMA(CURR_X_COUNT, curr_x_count);
        __DMA(CURR_Y_COUNT, curr_y_count);
 }
@@ -277,6 +278,32 @@ bfin_debug_mmrs_gptimer(struct dentry *parent, unsigned long base, int num)
 }
 #define GPTIMER(num) bfin_debug_mmrs_gptimer(parent, TIMER##num##_CONFIG, num)
 
+#define GPTIMER_GROUP_OFF(mmr) REGS_OFF(gptimer_group, mmr)
+#define __GPTIMER_GROUP(uname, lname) __REGS(gptimer_group, #uname, lname)
+static void __init __maybe_unused
+bfin_debug_mmrs_gptimer_group(struct dentry *parent, unsigned long base, int num)
+{
+       char buf[32], *_buf;
+
+       if (num == -1) {
+               _buf = buf + sprintf(buf, "TIMER_");
+               __GPTIMER_GROUP(ENABLE, enable);
+               __GPTIMER_GROUP(DISABLE, disable);
+               __GPTIMER_GROUP(STATUS, status);
+       } else {
+               /* These MMRs are a bit odd as the group # is a suffix */
+               _buf = buf + sprintf(buf, "TIMER_ENABLE%i", num);
+               d(buf, 16, base + GPTIMER_GROUP_OFF(enable));
+
+               _buf = buf + sprintf(buf, "TIMER_DISABLE%i", num);
+               d(buf, 16, base + GPTIMER_GROUP_OFF(disable));
+
+               _buf = buf + sprintf(buf, "TIMER_STATUS%i", num);
+               d(buf, 32, base + GPTIMER_GROUP_OFF(status));
+       }
+}
+#define GPTIMER_GROUP(mmr, num) bfin_debug_mmrs_gptimer_group(parent, mmr, num)
+
 /*
  * Handshake MDMA
  */
@@ -295,6 +322,29 @@ bfin_debug_mmrs_hmdma(struct dentry *parent, unsigned long base, int num)
 }
 #define HMDMA(num) bfin_debug_mmrs_hmdma(parent, HMDMA##num##_CONTROL, num)
 
+/*
+ * Peripheral Interrupts (PINT/GPIO)
+ */
+#ifdef PINT0_MASK_SET
+#define __PINT(uname, lname) __REGS(pint, #uname, lname)
+static void __init __maybe_unused
+bfin_debug_mmrs_pint(struct dentry *parent, unsigned long base, int num)
+{
+       char buf[32], *_buf = REGS_STR_PFX(buf, PINT, num);
+       __PINT(MASK_SET, mask_set);
+       __PINT(MASK_CLEAR, mask_clear);
+       __PINT(REQUEST, request);
+       __PINT(ASSIGN, assign);
+       __PINT(EDGE_SET, edge_set);
+       __PINT(EDGE_CLEAR, edge_clear);
+       __PINT(INVERT_SET, invert_set);
+       __PINT(INVERT_CLEAR, invert_clear);
+       __PINT(PINSTATE, pinstate);
+       __PINT(LATCH, latch);
+}
+#define PINT(num) bfin_debug_mmrs_pint(parent, PINT##num##_MASK_SET, num)
+#endif
+
 /*
  * Port/GPIO
  */
@@ -747,7 +797,7 @@ static int __init bfin_debug_mmrs_init(void)
 #endif
 
        parent = debugfs_create_dir("dmac", top);
-#ifdef DMA_TC_CNT
+#ifdef DMAC_TC_CNT
        D16(DMAC_TC_CNT);
        D16(DMAC_TC_PER);
 #endif
@@ -1005,29 +1055,19 @@ static int __init bfin_debug_mmrs_init(void)
 #endif
 
        parent = debugfs_create_dir("gptimer", top);
-#ifdef TIMER_DISABLE
-       D16(TIMER_DISABLE);
-       D16(TIMER_ENABLE);
-       D32(TIMER_STATUS);
+#ifdef TIMER_ENABLE
+       GPTIMER_GROUP(TIMER_ENABLE, -1);
 #endif
-#ifdef TIMER_DISABLE0
-       D16(TIMER_DISABLE0);
-       D16(TIMER_ENABLE0);
-       D32(TIMER_STATUS0);
+#ifdef TIMER_ENABLE0
+       GPTIMER_GROUP(TIMER_ENABLE0, 0);
 #endif
-#ifdef TIMER_DISABLE1
-       D16(TIMER_DISABLE1);
-       D16(TIMER_ENABLE1);
-       D32(TIMER_STATUS1);
+#ifdef TIMER_ENABLE1
+       GPTIMER_GROUP(TIMER_ENABLE1, 1);
 #endif
        /* XXX: Should convert BF561 MMR names */
 #ifdef TMRS4_DISABLE
-       D16(TMRS4_DISABLE);
-       D16(TMRS4_ENABLE);
-       D32(TMRS4_STATUS);
-       D16(TMRS8_DISABLE);
-       D16(TMRS8_ENABLE);
-       D32(TMRS8_STATUS);
+       GPTIMER_GROUP(TMRS4_ENABLE, 0);
+       GPTIMER_GROUP(TMRS8_ENABLE, 1);
 #endif
        GPTIMER(0);
        GPTIMER(1);
@@ -1253,6 +1293,14 @@ static int __init bfin_debug_mmrs_init(void)
        D32(OTP_DATA3);
 #endif
 
+#ifdef PINT0_MASK_SET
+       parent = debugfs_create_dir("pint", top);
+       PINT(0);
+       PINT(1);
+       PINT(2);
+       PINT(3);
+#endif
+
 #ifdef PIXC_CTL
        parent = debugfs_create_dir("pixc", top);
        D16(PIXC_CTL);
@@ -1816,7 +1864,6 @@ static int __init bfin_debug_mmrs_init(void)
        {
                int num;
                unsigned long base;
-               char *_buf, buf[32];
 
                base = PORTA_FER;
                for (num = 0; num < 10; ++num) {
@@ -1824,24 +1871,6 @@ static int __init bfin_debug_mmrs_init(void)
                        base += sizeof(struct bfin_gpio_regs);
                }
 
-#define __PINT(uname, lname) __REGS(pint, #uname, lname)
-               parent = debugfs_create_dir("pint", top);
-               base = PINT0_MASK_SET;
-               for (num = 0; num < 4; ++num) {
-                       _buf = REGS_STR_PFX(buf, PINT, num);
-                       __PINT(MASK_SET, mask_set);
-                       __PINT(MASK_CLEAR, mask_clear);
-                       __PINT(IRQ, irq);
-                       __PINT(ASSIGN, assign);
-                       __PINT(EDGE_SET, edge_set);
-                       __PINT(EDGE_CLEAR, edge_clear);
-                       __PINT(INVERT_SET, invert_set);
-                       __PINT(INVERT_CLEAR, invert_clear);
-                       __PINT(PINSTATE, pinstate);
-                       __PINT(LATCH, latch);
-                       base += sizeof(struct bfin_pint_regs);
-               }
-
        }
 #endif /* BF54x */