sh: mach-x3proto: Improve ILSEL debugging.
authorPaul Mundt <lethal@linux-sh.org>
Sun, 3 Oct 2010 18:07:49 +0000 (03:07 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Sun, 3 Oct 2010 18:07:49 +0000 (03:07 +0900)
At the moment ILSEL blows up with a BUG when aliased sets are handed in,
but as the enable call is able to hand back errors we opt for that path
instead. None of the ILSEL peripherals are vital to the board's
operation, so trapping a BUG is a bit excessive.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/boards/mach-x3proto/ilsel.c

index aa8eb7e..95e3461 100644 (file)
@@ -1,14 +1,16 @@
 /*
- * arch/sh/boards/renesas/x3proto/ilsel.c
+ * arch/sh/boards/mach-x3proto/ilsel.c
  *
  * Helper routines for SH-X3 proto board ILSEL.
  *
- * Copyright (C) 2007 Paul Mundt
+ * Copyright (C) 2007 - 2010  Paul Mundt
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -64,6 +66,8 @@ static void __ilsel_enable(ilsel_source_t set, unsigned int bit)
        unsigned int tmp, shift;
        unsigned long addr;
 
+       pr_notice("enabling ILSEL set %d\n", set);
+
        addr = mk_ilsel_addr(bit);
        shift = mk_ilsel_shift(bit);
 
@@ -92,8 +96,10 @@ int ilsel_enable(ilsel_source_t set)
 {
        unsigned int bit;
 
-       /* Aliased sources must use ilsel_enable_fixed() */
-       BUG_ON(set > ILSEL_KEY);
+       if (unlikely(set > ILSEL_KEY)) {
+               pr_err("Aliased sources must use ilsel_enable_fixed()\n");
+               return -EINVAL;
+       }
 
        do {
                bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS);
@@ -140,6 +146,8 @@ void ilsel_disable(unsigned int irq)
        unsigned long addr;
        unsigned int tmp;
 
+       pr_notice("disabling ILSEL set %d\n", irq);
+
        addr = mk_ilsel_addr(irq);
 
        tmp = __raw_readw(addr);