From patchwork Wed May 11 05:29:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 9065021 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 CAAA4BF29F for ; Wed, 11 May 2016 05:31:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 263FC2015A for ; Wed, 11 May 2016 05:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5D605201B9 for ; Wed, 11 May 2016 05:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751271AbcEKFb2 (ORCPT ); Wed, 11 May 2016 01:31:28 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:12991 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751255AbcEKFb0 (ORCPT ); Wed, 11 May 2016 01:31:26 -0400 Received: from vsmta13.fe.internet.bosch.com (unknown [10.4.98.53]) by imta24.fe.bosch.de (Postfix) with ESMTP id 14FDCD80220 for ; Wed, 11 May 2016 07:31:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=de.bosch.com; s=2015-01-21; t=1462944685; bh=icFWhIfoJDNnmwaL+dfFAXk///0PFS4A/c4xu/CT9nk=; l=10; h=From:From:Reply-To:Sender; b=xYTsCQUN98JUfuuss/o10LYJRM8jMizD+ccTuPvkqv6DnqGyVexxiILFMRAAXoJ/y duZwTI26Jypx4to3s1po/wDEm/eFDc/MyzsvSaXe+j5ixMGIf6Wa1GA0moj8vf+lY9 YZDkfboAn+LK4sGPUvN7uUlGYcORrqAWwcKCTTR4= Received: from SI-HUB1001.de.bosch.com (vsgw22.fe.internet.bosch.com [10.4.98.11]) by vsmta13.fe.internet.bosch.com (Postfix) with ESMTP id B52772E406AB for ; Wed, 11 May 2016 07:31:24 +0200 (CEST) Received: from hi-z08if.hi.de.bosch.com (10.34.209.31) by SI-HUB1001.de.bosch.com (10.4.103.108) with Microsoft SMTP Server id 14.3.195.1; Wed, 11 May 2016 07:31:22 +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 5DA20625E9D; Wed, 11 May 2016 07:29:41 +0200 (CEST) From: Dirk Behme To: Geert Uytterhoeven , Simon Horman , CC: Dirk Behme Subject: [PATCH v2 08/10] clk: renesas: rcar-gen3: Obtain MD pin value using boot-mode-reg Date: Wed, 11 May 2016 07:29:36 +0200 Message-ID: <1462944578-1220-9-git-send-email-dirk.behme@de.bosch.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1462944578-1220-1-git-send-email-dirk.behme@de.bosch.com> References: <1462944578-1220-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-22312.006 X-TMASE-MatchedRID: goA0jlRLL4svRbVu13x7nu7KTDtx8Cgggw/hrtu73Ou6kyzpjaDWSt/9 N6lK9KH6ThbvLLI8RvPxY0WGgfScA/4KcCyKEWS2dOc7KAdVCk74uJ1REX4MHbuwJO8uVRhKo8W MkQWv6iXBcIE78YqRWo6HM5rqDwqtsMsQ5YA2VjI1eJ5+giEgBJOH+/zA0/PKBMfZKWV6J2UC9w IKnC9Oa55zFY77l8PuWDDI98w/Nt18lJPaH+O3n4UPP9XIylzfo/G+4k9fsa9mNZ8xUDzC8x8CM VsKypBZfuHvzFCR4y/lRD1MXQmMzA== 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.2 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: Dirk Behme Use new boot mode reg infrastructure to obtain the mode pin value for initialising clocks for for R-Car Gen3 SoCs. Signed-off-by: Dirk Behme --- drivers/clk/renesas/r8a7795-cpg-mssr.c | 11 ++++++++++- drivers/clk/renesas/r8a7796-cpg-mssr.c | 11 ++++++++++- drivers/clk/renesas/rcar-gen3-cpg.c | 17 ----------------- drivers/clk/renesas/rcar-gen3-cpg.h | 1 - 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c index e53aff5..23bd58f 100644 --- a/drivers/clk/renesas/r8a7795-cpg-mssr.c +++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c @@ -18,6 +18,8 @@ #include +#include + #include "renesas-cpg-mssr.h" #include "rcar-gen3-cpg.h" @@ -294,7 +296,14 @@ static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = { static int __init r8a7795_cpg_mssr_init(struct device *dev) { const struct rcar_gen3_cpg_pll_config *cpg_pll_config; - u32 cpg_mode = rcar_gen3_read_mode_pins(); + u32 cpg_mode; + int err; + + err = boot_mode_reg_get(&cpg_mode); + if (err) { + dev_err(dev, "Failed obtain boot mode: %i\n", err); + return err; + } cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)]; if (!cpg_pll_config->extal_div) { diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c b/drivers/clk/renesas/r8a7796-cpg-mssr.c index c84b549..2ecb135 100644 --- a/drivers/clk/renesas/r8a7796-cpg-mssr.c +++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c @@ -19,6 +19,8 @@ #include +#include + #include "renesas-cpg-mssr.h" #include "rcar-gen3-cpg.h" @@ -159,7 +161,14 @@ static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = { static int __init r8a7796_cpg_mssr_init(struct device *dev) { const struct rcar_gen3_cpg_pll_config *cpg_pll_config; - u32 cpg_mode = rcar_gen3_read_mode_pins(); + u32 cpg_mode; + int err; + + err = boot_mode_reg_get(&cpg_mode); + if (err) { + dev_err(dev, "Failed obtain boot mode: %i\n", err); + return err; + } cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)]; if (!cpg_pll_config->extal_div) { diff --git a/drivers/clk/renesas/rcar-gen3-cpg.c b/drivers/clk/renesas/rcar-gen3-cpg.c index bb4f2f9..9d76076 100644 --- a/drivers/clk/renesas/rcar-gen3-cpg.c +++ b/drivers/clk/renesas/rcar-gen3-cpg.c @@ -333,23 +333,6 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev, __clk_get_name(parent), 0, mult, div); } -/* - * Reset register definitions. - */ -#define MODEMR 0xe6160060 - -u32 __init rcar_gen3_read_mode_pins(void) -{ - void __iomem *modemr = ioremap_nocache(MODEMR, 4); - u32 mode; - - BUG_ON(!modemr); - mode = ioread32(modemr); - iounmap(modemr); - - return mode; -} - int __init rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config, unsigned int clk_extalr) { diff --git a/drivers/clk/renesas/rcar-gen3-cpg.h b/drivers/clk/renesas/rcar-gen3-cpg.h index f699085..f788f48 100644 --- a/drivers/clk/renesas/rcar-gen3-cpg.h +++ b/drivers/clk/renesas/rcar-gen3-cpg.h @@ -33,7 +33,6 @@ struct rcar_gen3_cpg_pll_config { #define CPG_RCKCR 0x240 -u32 rcar_gen3_read_mode_pins(void); struct clk *rcar_gen3_cpg_clk_register(struct device *dev, const struct cpg_core_clk *core, const struct cpg_mssr_info *info, struct clk **clks, void __iomem *base);