From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] sh: boot word / mode pin support
Date: Thu, 21 May 2009 07:16:20 +0000 [thread overview]
Message-ID: <20090521071620.12842.12995.sendpatchset@rx1.opensource.se> (raw)
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(+)
--- 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",
next reply other threads:[~2009-05-21 7:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-21 7:16 Magnus Damm [this message]
2009-05-28 11:51 ` [PATCH] sh: boot word / mode pin support V2 Magnus Damm
2009-06-01 8:39 ` Paul Mundt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090521071620.12842.12995.sendpatchset@rx1.opensource.se \
--to=magnus.damm@gmail.com \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox