From patchwork Thu Jul 11 16:22:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 2826566 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C88DF9F7D6 for ; Thu, 11 Jul 2013 17:33:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8550420259 for ; Thu, 11 Jul 2013 17:33:05 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27CFE20251 for ; Thu, 11 Jul 2013 17:33:04 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UxJfy-0001ZQ-Sp; Thu, 11 Jul 2013 16:25:12 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UxJdh-0004Q6-Cs; Thu, 11 Jul 2013 16:22:41 +0000 Received: from mail-pd0-x22a.google.com ([2607:f8b0:400e:c02::22a]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UxJdc-0004OK-5O for linux-arm-kernel@lists.infradead.org; Thu, 11 Jul 2013 16:22:37 +0000 Received: by mail-pd0-f170.google.com with SMTP id x11so7692723pdj.15 for ; Thu, 11 Jul 2013 09:22:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=viGpG/e84W0HGiiyILmEx7ksqhw7RWU3BISZgewGLTM=; b=cKHe5l70B7rty63xuxl0Cd51rDRB1SteH7p7B2iKB/BRezz2NWq3c6WbUmGAGl6TNb mjUYL1hJeGlyvLIOn6mU5j3tW0XY0Lf5S+NA+JmtXIsX4+FdoBJwZOErlBQNcPKjJp7W Un0sYeuzo0KZbCUANQlcP/VwEMJMBH64WIOB1PeC8eBlgdOkzuVvS4oYM8/J5PkPAPY5 BGNkmZJnKpIncoE2geVX5LFFJQysPtYaxXYhumNfTfhcywMlDi/bWtLANrGvBkwIv0s8 mK9PLBYV2q2D7tQtssSvQnLC91MoNq2UAGWL4C3brR87arxAHfY43D4KI6tBcx0Zhc0W d+AA== X-Received: by 10.68.160.193 with SMTP id xm1mr22635762pbb.88.1373559734680; Thu, 11 Jul 2013 09:22:14 -0700 (PDT) Received: from [127.0.0.1] (ac230065.ppp.asahi-net.or.jp. [183.77.230.65]) by mx.google.com with ESMTPSA id b4sm40475531pba.45.2013.07.11.09.22.11 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Jul 2013 09:22:13 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Date: Fri, 12 Jul 2013 01:22:19 +0900 Message-Id: <20130711162219.933.96902.sendpatchset@w520> In-Reply-To: <20130711162209.933.47610.sendpatchset@w520> References: <20130711162209.933.47610.sendpatchset@w520> Subject: [PATCH v2 01/02] ARM: shmobile: Introduce r8a7790_read_mode_pins() X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130711_122236_344628_0C938799 X-CRM114-Status: GOOD ( 11.75 ) X-Spam-Score: -2.0 (--) Cc: arnd@arndb.de, Magnus Damm , horms@verge.net.au, ulrich.hecht@gmail.com, olof@lixom.net, shinya.kuribayashi.px@renesas.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm Break out the r8a7790 boot mode code into a separate function so it can be shared by multiple users. Signed-off-by: Magnus Damm --- Changes since v1: - Don't ioremap() two pages, thanks Sergei! arch/arm/mach-shmobile/clock-r8a7790.c | 11 ++--------- arch/arm/mach-shmobile/include/mach/r8a7790.h | 3 +++ arch/arm/mach-shmobile/setup-r8a7790.c | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 9 deletions(-) --- 0001/arch/arm/mach-shmobile/clock-r8a7790.c +++ work/arch/arm/mach-shmobile/clock-r8a7790.c 2013-07-12 01:13:42.000000000 +0900 @@ -24,6 +24,7 @@ #include #include #include +#include /* * MD EXTAL PLL0 PLL1 PLL3 @@ -42,8 +43,6 @@ * see "p1 / 2" on R8A7790_CLOCK_ROOT() below */ -#define MD(nr) (1 << nr) - #define CPG_BASE 0xe6150000 #define CPG_LEN 0x1000 @@ -53,7 +52,6 @@ #define SMSTPCR5 0xe6150144 #define SMSTPCR7 0xe615014c -#define MODEMR 0xE6160060 #define SDCKCR 0xE6150074 #define SD2CKCR 0xE6150078 #define SD3CKCR 0xE615007C @@ -288,14 +286,9 @@ static struct clk_lookup lookups[] = { void __init r8a7790_clock_init(void) { - void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE); - u32 mode; + u32 mode = r8a7790_read_mode_pins(); int k, ret = 0; - BUG_ON(!modemr); - mode = ioread32(modemr); - iounmap(modemr); - switch (mode & (MD(14) | MD(13))) { case 0: R8A7790_CLOCK_ROOT(15, &extal_clk, 172, 208, 106, 88); --- 0001/arch/arm/mach-shmobile/include/mach/r8a7790.h +++ work/arch/arm/mach-shmobile/include/mach/r8a7790.h 2013-07-12 01:13:42.000000000 +0900 @@ -8,4 +8,7 @@ void r8a7790_pinmux_init(void); void r8a7790_init_delay(void); void r8a7790_timer_init(void); +#define MD(nr) BIT(nr) +u32 r8a7790_read_mode_pins(void); + #endif /* __ASM_R8A7790_H__ */ --- 0001/arch/arm/mach-shmobile/setup-r8a7790.c +++ work/arch/arm/mach-shmobile/setup-r8a7790.c 2013-07-12 01:14:03.000000000 +0900 @@ -201,6 +201,20 @@ void __init r8a7790_add_standard_devices r8a7790_register_thermal(); } +#define MODEMR 0xe6160060 + +u32 __init r8a7790_read_mode_pins(void) +{ + void __iomem *modemr = ioremap_nocache(MODEMR, 4); + u32 mode; + + BUG_ON(!modemr); + mode = ioread32(modemr); + iounmap(modemr); + + return mode; +} + void __init r8a7790_timer_init(void) { void __iomem *cntcr;