diff mbox

sh: boot word / mode pin support

Message ID 20090521071620.12842.12995.sendpatchset@rx1.opensource.se (mailing list archive)
State Changes Requested
Delegated to: Paul Mundt
Headers show

Commit Message

Magnus Damm May 21, 2009, 7:16 a.m. UTC
From: Magnus Damm <damm@igel.co.jp>

Add mode pin support for the SuperH architecture.

Processor and board specific code can with this patch
use set_mode_pin() to set mode pin configuration. Use
test_mode_pin() to test already set mode pin values.

The code warns if a pin is tested but not configured.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 arch/sh/include/asm/processor.h |    4 ++++
 arch/sh/kernel/setup.c          |   28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- 0001/arch/sh/include/asm/processor.h
+++ work/arch/sh/include/asm/processor.h	2009-05-21 15:57:36.000000000 +0900
@@ -94,6 +94,10 @@  extern struct pt_regs fake_swapper_regs;
 const char *get_cpu_subtype(struct sh_cpuinfo *c);
 extern const struct seq_operations cpuinfo_op;
 
+#define SH_MODE_PINS_NR 16
+void set_mode_pin(int pin, int on);
+int test_mode_pin(int pin);
+
 #ifdef CONFIG_VSYSCALL
 int vsyscall_init(void);
 #else
--- 0001/arch/sh/kernel/setup.c
+++ work/arch/sh/kernel/setup.c	2009-05-21 16:08:18.000000000 +0900
@@ -420,6 +420,34 @@  void __init setup_arch(char **cmdline_p)
 #endif
 }
 
+/* processor boot mode configuration */
+static DECLARE_BITMAP(mode_pins, SH_MODE_PINS_NR * 2);
+
+void set_mode_pin(int pin, int on)
+{
+	BUG_ON(pin >= SH_MODE_PINS_NR);
+
+	/* mark pin as configured */
+	set_bit(pin + SH_MODE_PINS_NR, mode_pins);
+
+	/* remember pin value */
+	if (on)
+		set_bit(pin, mode_pins);
+	else
+		clear_bit(pin, mode_pins);
+}
+
+int test_mode_pin(int pin)
+{
+	BUG_ON(pin >= SH_MODE_PINS_NR);
+
+	/* warn if not configured */
+	if (!test_bit(pin + SH_MODE_PINS_NR, mode_pins))
+		pr_warning("test_mode_pin(): pin %d not configured\n", pin);
+
+	return test_bit(pin, mode_pins);
+}
+
 static const char *cpu_name[] = {
 	[CPU_SH7201]	= "SH7201",
 	[CPU_SH7203]	= "SH7203",	[CPU_SH7263]	= "SH7263",