From patchwork Tue Jun 28 14:10:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 9203337 X-Patchwork-Delegate: horms@verge.net.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BF852608A6 for ; Tue, 28 Jun 2016 14:10:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0E68285BD for ; Tue, 28 Jun 2016 14:10:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A580D28603; Tue, 28 Jun 2016 14:10:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B46F285F9 for ; Tue, 28 Jun 2016 14:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752414AbcF1OKz (ORCPT ); Tue, 28 Jun 2016 10:10:55 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:49243 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752421AbcF1OKt (ORCPT ); Tue, 28 Jun 2016 10:10:49 -0400 Received: from ayla.of.borg ([84.193.137.253]) by baptiste.telenet-ops.be with bizsmtp id CEAk1t00E5UCtCs01EAkw5; Tue, 28 Jun 2016 16:10:48 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1bHtiu-0002dE-6v; Tue, 28 Jun 2016 16:10:44 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1bHtiu-0002Dc-6Y; Tue, 28 Jun 2016 16:10:44 +0200 From: Geert Uytterhoeven To: Simon Horman , Magnus Damm Cc: Mark Rutland , Lorenzo Pieralisi , Keita Kobayashi , Laurent Pinchart , Sergei Shtylyov , linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v5 03/13] soc: renesas: rcar-sysc: Make rcar_sysc_init() init the PM domains Date: Tue, 28 Jun 2016 16:10:32 +0200 Message-Id: <1467123042-8468-4-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467123042-8468-1-git-send-email-geert+renesas@glider.be> References: <1467123042-8468-1-git-send-email-geert+renesas@glider.be> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Let rcar_sysc_init() trigger initialization of the SYSC PM domains from DT if called before the early_initcall. On failure, it falls back to mapping the passed register block, as before. Signed-off-by: Geert Uytterhoeven --- v5: - No changes, v4: - New. --- drivers/soc/renesas/rcar-sysc.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c index 59a8152681a59a5c..68d6856c9d3cd192 100644 --- a/drivers/soc/renesas/rcar-sysc.c +++ b/drivers/soc/renesas/rcar-sysc.c @@ -164,15 +164,6 @@ static bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch) return false; } -void __iomem *rcar_sysc_init(phys_addr_t base) -{ - rcar_sysc_base = ioremap_nocache(base, PAGE_SIZE); - if (!rcar_sysc_base) - panic("unable to ioremap R-Car SYSC hardware block\n"); - - return rcar_sysc_base; -} - struct rcar_sysc_pd { struct generic_pm_domain genpd; struct rcar_sysc_ch ch; @@ -328,6 +319,9 @@ static int __init rcar_sysc_pd_init(void) unsigned int i; int error; + if (rcar_sysc_base) + return 0; + np = of_find_matching_node_and_match(NULL, rcar_sysc_matches, &match); if (!np) return -ENODEV; @@ -405,3 +399,11 @@ out_put: return error; } early_initcall(rcar_sysc_pd_init); + +void __iomem * __init rcar_sysc_init(phys_addr_t base) +{ + if (rcar_sysc_pd_init()) + rcar_sysc_base = ioremap_nocache(base, PAGE_SIZE); + + return rcar_sysc_base; +}