|
@@ -323,3 +323,65 @@ gpio_irq_setup(struct pio_device *pio, int irq, int gpio_irq)
|
|
|
irq_set_chained_handler(irq, gpio_irq_handler);
|
|
|
}
|
|
|
|
|
|
+/*--------------------------------------------------------------------------*/
|
|
|
+
|
|
|
+#ifdef CONFIG_DEBUG_FS
|
|
|
+
|
|
|
+#include <linux/seq_file.h>
|
|
|
+
|
|
|
+/*
|
|
|
+ * This shows more info than the generic gpio dump code:
|
|
|
+ * pullups, deglitching, open drain drive.
|
|
|
+ */
|
|
|
+static void pio_bank_show(struct seq_file *s, struct gpio_chip *chip)
|
|
|
+{
|
|
|
+ struct pio_device *pio = container_of(chip, struct pio_device, chip);
|
|
|
+ u32 psr, osr, imr, pdsr, pusr, ifsr, mdsr;
|
|
|
+ unsigned i;
|
|
|
+ u32 mask;
|
|
|
+ char bank;
|
|
|
+
|
|
|
+ psr = pio_readl(pio, PSR);
|
|
|
+ osr = pio_readl(pio, OSR);
|
|
|
+ imr = pio_readl(pio, IMR);
|
|
|
+ pdsr = pio_readl(pio, PDSR);
|
|
|
+ pusr = pio_readl(pio, PUSR);
|
|
|
+ ifsr = pio_readl(pio, IFSR);
|
|
|
+ mdsr = pio_readl(pio, MDSR);
|
|
|
+
|
|
|
+ bank = 'A' + pio->pdev->id;
|
|
|
+
|
|
|
+ for (i = 0, mask = 1; i < 32; i++, mask <<= 1) {
|
|
|
+ const char *label;
|
|
|
+
|
|
|
+ label = gpiochip_is_requested(chip, i);
|
|
|
+ if (!label && (imr & mask))
|
|
|
+ label = "[irq]";
|
|
|
+ if (!label)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ seq_printf(s, " gpio-%-3d P%c%-2d (%-12s) %s %s %s",
|
|
|
+ chip->base + i, bank, i,
|
|
|
+ label,
|
|
|
+ (osr & mask) ? "out" : "in ",
|
|
|
+ (mask & pdsr) ? "hi" : "lo",
|
|
|
+ (mask & pusr) ? " " : "up");
|
|
|
+ if (ifsr & mask)
|
|
|
+ seq_printf(s, " deglitch");
|
|
|
+ if ((osr & mdsr) & mask)
|
|
|
+ seq_printf(s, " open-drain");
|
|
|
+ if (imr & mask)
|
|
|
+ seq_printf(s, " irq-%d edge-both",
|
|
|
+ gpio_to_irq(chip->base + i));
|
|
|
+ seq_printf(s, "\n");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#else
|
|
|
+#define pio_bank_show NULL
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+/*--------------------------------------------------------------------------*/
|
|
|
+
|
|
|
+static int __init pio_probe(struct platform_device *pdev)
|