From patchwork Tue Jul 9 12:50:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 2825271 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 7B9979F968 for ; Tue, 9 Jul 2013 12:52:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 365E8200E1 for ; Tue, 9 Jul 2013 12:52:21 +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 C7902200DE for ; Tue, 9 Jul 2013 12:52:19 +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 1UwXNd-0006Jo-Nt; Tue, 09 Jul 2013 12:50:55 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UwXNK-0007IA-6k; Tue, 09 Jul 2013 12:50:34 +0000 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UwXNH-0007Go-Uj for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2013 12:50:32 +0000 Received: by mail-pd0-f169.google.com with SMTP id y10so5237585pdj.0 for ; Tue, 09 Jul 2013 05:50:10 -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=/QsF9KwTKDOI3lQS9L8IrUwD/m3metetC4qxGnrMv/g=; b=sSjY+vXxN+kab2vK+AkIMCNDL/NsnJ9CkqrOMAqeTT0DVLraQHdWbh0eRgSt+b6n7i nfH/ZjMYki5fjKL1P4Lk3TPskHL4Jlfu9xtbGUA4yhxXyot0U41Yjcln+7ldWZ8QKOki GaqRsPzbVxT4t2b5PdOVXj+sspEnCmc1LU1qc4FOPOqo3aqqgAHQ+/7CjPBcX6xjkPCn dVRKC5RxNfQIWyiQPAXF+USEZfaKcRg7I8HeqnWd0J+yol3s8HU6z8g95KFMD6vuTxi6 1AuKO9N6elKX7bZxE/NI4atQtzd6wXEXjksaXx9+lXpXNysVj8DSsa2dN+2AhXP1fuqR rLIg== X-Received: by 10.66.9.71 with SMTP id x7mr23840298paa.37.1373374210196; Tue, 09 Jul 2013 05:50:10 -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 wi6sm28137628pbc.22.2013.07.09.05.50.08 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Jul 2013 05:50:09 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Date: Tue, 09 Jul 2013 21:50:16 +0900 Message-Id: <20130709125016.4388.47414.sendpatchset@w520> In-Reply-To: <20130709125007.4388.15701.sendpatchset@w520> References: <20130709125007.4388.15701.sendpatchset@w520> Subject: [PATCH 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-20130709_085032_134679_D918E8F2 X-CRM114-Status: GOOD ( 11.48 ) 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 --- 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-09 20:03:09.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-09 20:02:34.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-09 19:59:37.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, PAGE_SIZE); + u32 mode; + + BUG_ON(!modemr); + mode = ioread32(modemr); + iounmap(modemr); + + return mode; +} + void __init r8a7790_timer_init(void) { void __iomem *cntcr;