From patchwork Wed May 11 05:29:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 9065051 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 4929CBF29F for ; Wed, 11 May 2016 05:31:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF4F720155 for ; Wed, 11 May 2016 05:31:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0C2E02017D for ; Wed, 11 May 2016 05:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751404AbcEKFb3 (ORCPT ); Wed, 11 May 2016 01:31:29 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:12992 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751315AbcEKFb1 (ORCPT ); Wed, 11 May 2016 01:31:27 -0400 Received: from vsmta12.fe.internet.bosch.com (unknown [10.4.98.52]) by imta23.fe.bosch.de (Postfix) with ESMTP id 4837D15801D4 for ; Wed, 11 May 2016 07:31:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=de.bosch.com; s=2015-01-21; t=1462944686; bh=icFWhIfoJDNnmwaL+dfFAXk///0PFS4A/c4xu/CT9nk=; l=10; h=From:From:Reply-To:Sender; b=TZynUBYd66e+RxXC6hDglrIhogDsTY5VG+KRvya/WcSFmmuGWqYPL1ozmer9qxgK6 zFqzdOzFVpkaLc/4C/wAk3TOg1hvLp6+qv6qN7dEUbFKu4Wq2DTM5KyE7scvWoznWy yJsE1GnPhTJXsjjhaRtNw+adzixdYgKI8w4YDQgE= Received: from SI-HUB1000.de.bosch.com (vsgw23.fe.internet.bosch.com [10.4.98.23]) by vsmta12.fe.internet.bosch.com (Postfix) with ESMTP id D687B1B80420 for ; Wed, 11 May 2016 07:31:25 +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; 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 79FF8625E9F; Wed, 11 May 2016 07:29:41 +0200 (CEST) From: Dirk Behme To: Geert Uytterhoeven , Simon Horman , CC: Dirk Behme Subject: [PATCH v2 10/10] boot-mode-reg: Convert to device tree Date: Wed, 11 May 2016 07:29:38 +0200 Message-ID: <1462944578-1220-11-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: PQIaRDv4+w6eHTkwQi/s18nUT+eskUQPuP9+fQUL2ahAOR/x5IFWlWb6 PphVtfZggq4Vy91HEnbu5ezEA2FHU6K176S49UNHutvHF25zoU9o3Yq5PCwLAoeUNQK7Qj5cKLW rCrDVHUni8zVgXoAltsIJ+4gwXrEtec3QM3secWY9bpdtS2My20yIEfux1x39OOfdyrSIOFXFQI Imbuf4Q0salEo7nZhblExlQIQeRG0= 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 Instead of using a hard coded address in the driver for the boot mode register, optain it from the device tree. Signed-off-by: Dirk Behme --- drivers/misc/boot-mode-reg/rcar.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/misc/boot-mode-reg/rcar.c b/drivers/misc/boot-mode-reg/rcar.c index e994980..0b23352 100644 --- a/drivers/misc/boot-mode-reg/rcar.c +++ b/drivers/misc/boot-mode-reg/rcar.c @@ -16,24 +16,37 @@ #include #include #include +#include #include -#define MODEMR 0xe6160060 +#define RCAR_RST_BASE 0xe6160000 +#define RCAR_RST_SIZE 0x200 +#define MODEMR 0x60 static int __init rcar_read_mode_pins(void) { - void __iomem *modemr; + void __iomem *reset; + struct device_node *np; int err = -ENOMEM; static u32 mode; - modemr = ioremap_nocache(MODEMR, 4); - if (!modemr) { - pr_err("failed to map boot mode register"); + np = of_find_compatible_node(NULL, NULL, "renesas,rcar-rst"); + if (np) + reset = of_iomap(np, 0); + else { + pr_warn("can't find renesas rcar-rst device node"); + reset = ioremap_nocache(RCAR_RST_BASE, RCAR_RST_SIZE); + } + + if (!reset) { + pr_err("failed to map reset registers"); + of_node_put(np); goto err; } - mode = ioread32(modemr); - iounmap(modemr); + mode = ioread32(reset + MODEMR); + iounmap(reset); + of_node_put(np); err = boot_mode_reg_set(mode); err: