]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sh: boot word / mode pin support V2
authorMagnus Damm <damm@igel.co.jp>
Thu, 28 May 2009 11:51:51 +0000 (11:51 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 1 Jun 2009 06:44:49 +0000 (15:44 +0900)
Add mode pin support for the SuperH architecture V2.

With this patch applied the board code can add their
own function to export the cpu mode pin configuration.
In most cases this will be a constant bitmap, but
boards that allow reading this from a register can
instead read out the pin state from hardware.

The code warns if a pin is tested but no board specific
mode pin function has been provided.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/include/asm/machvec.h
arch/sh/include/asm/processor.h
arch/sh/kernel/machvec.c
arch/sh/kernel/setup.c

index 73d6d16fa06b34ec61fc16215adf5c4fa9d81d34..84dd37761f563ee56aef820e97d6d1cc844f0936 100644 (file)
@@ -48,6 +48,7 @@ struct sh_machine_vector {
        void (*mv_ioport_unmap)(void __iomem *);
 
        int (*mv_clk_init)(void);
+       int (*mv_mode_pins)(void);
 };
 
 extern struct sh_machine_vector sh_mv;
index 005c962c8b1c549516db99bcdd36c376bd5b40e0..fb67482e47eb453f18e45213df86af0a5ba99a13 100644 (file)
@@ -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;
 
+/* processor boot mode configuration */
+int generic_mode_pins(void);
+int test_mode_pin(int pin);
+
 #ifdef CONFIG_VSYSCALL
 int vsyscall_init(void);
 #else
index c1ea41e5812a5897a5abfc8e8bb94fba925e414d..548f6607fd0fbd074c8ee23759cc6710015618a8 100644 (file)
@@ -129,6 +129,7 @@ void __init sh_mv_setup(void)
        mv_set(ioport_map);
        mv_set(ioport_unmap);
        mv_set(irq_demux);
+       mv_set(mode_pins);
 
        if (!sh_mv.mv_nr_irqs)
                sh_mv.mv_nr_irqs = NR_IRQS;
index 00086b234278c980fff6260341b75db8c36c2307..050131eec7738070be9b5603e9d1c96967fb2d8c 100644 (file)
@@ -420,6 +420,18 @@ void __init setup_arch(char **cmdline_p)
 #endif
 }
 
+/* processor boot mode configuration */
+int generic_mode_pins(void)
+{
+       pr_warning("generic_mode_pins(): missing mode pin configuration\n");
+       return 0;
+}
+
+int test_mode_pin(int pin)
+{
+       return sh_mv.mv_mode_pins() & (1 << pin);
+}
+
 static const char *cpu_name[] = {
        [CPU_SH7201]    = "SH7201",
        [CPU_SH7203]    = "SH7203",     [CPU_SH7263]    = "SH7263",