From patchwork Thu Oct 15 06:59:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 7402941 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A05239F1B9 for ; Thu, 15 Oct 2015 06:59:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD44920851 for ; Thu, 15 Oct 2015 06:59:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EDEA1208B4 for ; Thu, 15 Oct 2015 06:59:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753983AbbJOG7q (ORCPT ); Thu, 15 Oct 2015 02:59:46 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:36826 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753794AbbJOG7q (ORCPT ); Thu, 15 Oct 2015 02:59:46 -0400 Received: from reginn.isobedori.kobe.vergenet.net (p2250-ipbfp1101kobeminato.hyogo.ocn.ne.jp [122.22.210.250]) by kirsty.vergenet.net (Postfix) with ESMTPA id DF1E525B7A1; Thu, 15 Oct 2015 17:59:39 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=verge.net.au; s=mail; t=1444892380; bh=LzLk2V5dF92GUr3jtnHbS6nmLQhWwwgP1AZD7m6cr+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EFuotfg+d7Gzh3m57uNrzjX2lG37AXngFwbEksUeib3WJ7PjkUUz95GAyLSAp2Kch 2UwYE/C//0Bp6t1nLqjvMxKxuUuDs5JY4fxIS1VzOqLkN2y3wkDQLYiNFnsdRjDijy sUsrA0iT0/8h97Bq+IohD5VKFq0IRZl+zZ0MDIoA= Received: by reginn.isobedori.kobe.vergenet.net (Postfix, from userid 7100) id B4177942D30; Thu, 15 Oct 2015 15:59:38 +0900 (JST) From: Simon Horman To: Laurent Pinchart Cc: linux-sh@vger.kernel.org, Magnus Damm , Simon Horman Subject: [PATCH/RFC 3/6] arm: shmobile: rcar-gen2: Obtain MD pin value using boot-mode-reg Date: Thu, 15 Oct 2015 15:59:34 +0900 Message-Id: <1444892377-10170-4-git-send-email-horms+renesas@verge.net.au> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1444892377-10170-1-git-send-email-horms+renesas@verge.net.au> References: <1444892377-10170-1-git-send-email-horms+renesas@verge.net.au> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,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 Use new boot mode reg infrastructure to obtain the mode pin value for initialising arch timer for R-Car Gen2 SoCs. Subsequent patches will remove other calls to rcar_gen2_read_mode_pins() and in turn that function. rcar_gen2_init_boot_mode() is called to implicitly initialise the R-Car Gen2 boot mod register driver as rcar_gen2_timer_init() is run before initcalls. Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 88734a5e10ca..79b7db5f6417 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig @@ -22,6 +22,7 @@ config ARCH_RCAR_GEN2 select RENESAS_IRQC select SYS_SUPPORTS_SH_CMT select PCI_DOMAINS if PCI + select BOOT_MODE_REG_RCAR_GEN2 config ARCH_RMOBILE bool diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c index aa3339258d9c..3a2bffd4c1cf 100644 --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "common.h" #include "rcar-gen2.h" @@ -49,13 +50,19 @@ u32 rcar_gen2_read_mode_pins(void) #define CNTCR 0 #define CNTFID0 0x20 -void __init rcar_gen2_timer_init(void) +void __init rcar_gen2_timer_init_for_arch_timer(void) { - u32 mode = rcar_gen2_read_mode_pins(); #ifdef CONFIG_ARM_ARCH_TIMER void __iomem *base; int extal_mhz = 0; - u32 freq; + u32 freq, mode; + int err; + + err = boot_mode_reg_get(&mode); + if (err) { + pr_err("%s: failed obtain boot mode\n", __func__); + return; + } if (of_machine_is_compatible("renesas,r8a7794")) { freq = 260000000 / 8; /* ZS / 8 */ @@ -126,7 +133,18 @@ void __init rcar_gen2_timer_init(void) iounmap(base); #endif /* CONFIG_ARM_ARCH_TIMER */ +} + +void __init rcar_gen2_timer_init(void) +{ + int err; + u32 mode = rcar_gen2_read_mode_pins(); + + err = rcar_gen2_init_boot_mode(); + if (err) + pr_err("Could not initialise boot mode register driver\n"); + rcar_gen2_timer_init_for_arch_timer(); rcar_gen2_clocks_init(mode); clocksource_of_init(); }