From patchwork Mon May 9 07:13:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 9041671 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 17FE4BF29F for ; Mon, 9 May 2016 07:15:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F9E82011B for ; Mon, 9 May 2016 07:15:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B15CB2012B for ; Mon, 9 May 2016 07:15:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751393AbcEIHPr (ORCPT ); Mon, 9 May 2016 03:15:47 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:57393 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751400AbcEIHPo (ORCPT ); Mon, 9 May 2016 03:15:44 -0400 Received: from vsmta12.fe.internet.bosch.com (unknown [10.4.98.52]) by imta24.fe.bosch.de (Postfix) with ESMTP id 5442ED80231 for ; Mon, 9 May 2016 09:15:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=de.bosch.com; s=2015-01-21; t=1462778142; bh=2w9EbYfLCZvPRRVt4bNYm0yWWjP24TdBGiPC7asR1v0=; l=10; h=From:From:Reply-To:Sender; b=O/t2HHVFuEAwvlPYwtEVULmmb7+VuMoZXvnkOIr1XYndWk0jQwGvH/BZM9XKrSvBm oTiHddV9b6xCC2zSL3ew9uqXwQlo4ic9d/yzmGKPChRI7fY19x/SEqbpp1hSs5Lx8u 6rb9BpTKH6YLAwvdopxST2ji6cu+Yy8S3HFp5kRs= Received: from SI-HUB1000.de.bosch.com (vsgw24.fe.internet.bosch.com [10.4.98.24]) by vsmta12.fe.internet.bosch.com (Postfix) with ESMTP id 153B21B80440 for ; Mon, 9 May 2016 09:15:42 +0200 (CEST) Received: from hi-z08if.hi.de.bosch.com (10.34.209.31) by SI-HUB1000.de.bosch.com (10.4.103.106) with Microsoft SMTP Server id 14.3.195.1; Mon, 9 May 2016 09:15:40 +0200 Received: from hi-z08if.hi.de.bosch.com (localhost [127.0.0.1]) by hi-z08if.hi.de.bosch.com (Postfix) with ESMTP id 50A25625E95; Mon, 9 May 2016 09:14:03 +0200 (CEST) From: Dirk Behme To: Geert Uytterhoeven , Simon Horman , Subject: [PATCH 03/10] arm: renesas: rcar-gen2: Obtain MD pin value using boot-mode-reg Date: Mon, 9 May 2016 09:13:54 +0200 Message-ID: <1462778041-19595-4-git-send-email-dirk.behme@de.bosch.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1462778041-19595-1-git-send-email-dirk.behme@de.bosch.com> References: <1462778041-19595-1-git-send-email-dirk.behme@de.bosch.com> MIME-Version: 1.0 X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-8.0.0.1202-22308.006 X-TMASE-MatchedRID: LuXndhVtitkyNFM0Xa1tqLMjW/sniEQKwx0jRRxcQfMypRY3gsuRLZGV Q/ySfpwPEgofxQXb9+B+ZLbS08T2SzJGiGi2yernydRP56yRRA+4vBuE2X0HlU1bmeo40HjQ3/0 3qUr0ofpOJB5wP1oqhNCPpguQSWAlXhUGb1WyHBmIED/RsFAua30tCKdnhB589yM15V5aWpj6C0 ePs7A07blX3Pe+qTcq/xT2aCewJv6oI2eKnPG9QcNiYka2HrltXWyz5bR4xbLCMqRTXDtypvTxT ikZgraP6C1oAH6EVabBRDue1hY4rDP8jKC2q3EXf0kvZkk9Qv/n82Twn05IofXRKCLmZs69UNza MJZ0KX4= Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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: Simon Horman 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_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 fe4ccb5..314dcaa 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig @@ -23,6 +23,7 @@ config ARCH_RCAR_GEN2 select RENESAS_IRQC select SYS_SUPPORTS_SH_CMT select PCI_DOMAINS if PCI + select BOOT_MODE_REG_RCAR 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 1c6fd11..a45b05b 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_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_probe(); }