From patchwork Thu May 21 07:16:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 25189 X-Patchwork-Delegate: lethal@linux-sh.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4L7JLR4014192 for ; Thu, 21 May 2009 07:19:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751307AbZEUHTS (ORCPT ); Thu, 21 May 2009 03:19:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751446AbZEUHTS (ORCPT ); Thu, 21 May 2009 03:19:18 -0400 Received: from mail-pz0-f177.google.com ([209.85.222.177]:58995 "EHLO mail-pz0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751307AbZEUHTR (ORCPT ); Thu, 21 May 2009 03:19:17 -0400 Received: by pzk7 with SMTP id 7so517358pzk.33 for ; Thu, 21 May 2009 00:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=m3S+jQ6yv+X3ODaGtnBGPehSf3VcBkeJk1FapeJYIgk=; b=n0Hz4xLHbnCRbxkUfv8hkzHM9PP1fw9D3jGLq3VHIfn5abKaj3o+iGvq1ySXwMhdR5 bm3UNjj4qUFn8SN6I15yx6qG9w+Epku0WN2mV+OXsYpPgSI71Fi3gUdGNUHQBQFH61QC U1bmmCDSVug90BrdLq9fyBCv8kvTLKk86ymZY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=gku71z7MKP86REbg8pNVn09ZfqpGMl5hppEKCX/5Y2idaIThReis+Hb9zzPu5nYglR +NUWBn/gbw/LkA6SOjmxHenq8OQLivmU31Y+QJ5Kj/6YrFmwZhZptyOKf4Uak0Bp9GrC 066vRoanCuO+HQZIPXUuMOYIKVsa3KvbBFKao= Received: by 10.142.254.8 with SMTP id b8mr759256wfi.197.1242890358754; Thu, 21 May 2009 00:19:18 -0700 (PDT) Received: from rx1.opensource.se (210.5.32.202.bf.2iij.net [202.32.5.210]) by mx.google.com with ESMTPS id 30sm335203wfa.35.2009.05.21.00.19.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 21 May 2009 00:19:17 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Thu, 21 May 2009 16:16:20 +0900 Message-Id: <20090521071620.12842.12995.sendpatchset@rx1.opensource.se> Subject: [PATCH] sh: boot word / mode pin support Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm 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 --- 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 --- 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",