From patchwork Wed May 11 11:56:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 9068171 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-renesas-soc@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 C34EA9F1C1 for ; Wed, 11 May 2016 11:57:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E4D8320114 for ; Wed, 11 May 2016 11:57:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 460AD200F3 for ; Wed, 11 May 2016 11:57:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752463AbcEKL5C (ORCPT ); Wed, 11 May 2016 07:57:02 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:25980 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752455AbcEKL5B (ORCPT ); Wed, 11 May 2016 07:57:01 -0400 Received: from vsmta13.fe.internet.bosch.com (unknown [10.4.98.53]) by imta23.fe.bosch.de (Postfix) with ESMTP id 2E7B41580015; Wed, 11 May 2016 13:56:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=de.bosch.com; s=2015-01-21; t=1462967819; bh=xSzlTI5ByBzxomol2l57PFqBuDQF9cj7yVZ+PcN0FhE=; l=10; h=From:From:Reply-To:Sender; b=tFNunHta1ew8o2ccwWxd75ARUt+S1PtpBmdKtFRq3JcvtrgEJAS8uHe4CWNGQBU8B fTo094hvfJ0oDWkElp+IYIOqrgs6gEmveo5EGSpQDQFq/psVw2iCX3bGz50VCpSpK0 qqku0jkZJ7ec2a5Cf4TCK99/q/3Iy+HiQOpHNs7I= Received: from SI-HUB1000.de.bosch.com (vsgw24.fe.internet.bosch.com [10.4.98.24]) by vsmta13.fe.internet.bosch.com (Postfix) with ESMTP id E51652E406DE; Wed, 11 May 2016 13:56:58 +0200 (CEST) Received: from [10.34.217.168] (10.34.217.168) by SI-HUB1000.de.bosch.com (10.4.103.106) with Microsoft SMTP Server id 14.3.195.1; Wed, 11 May 2016 13:56:58 +0200 Subject: Re: [PATCH v2 09/10] ARM: dts: r8a779x: Add reset module support To: Geert Uytterhoeven References: <1462944578-1220-1-git-send-email-dirk.behme@de.bosch.com> <1462944578-1220-10-git-send-email-dirk.behme@de.bosch.com> CC: Geert Uytterhoeven , Simon Horman , , Dirk Behme From: Dirk Behme Organization: Robert Bosch Car Multimedia GmbH Message-ID: Date: Wed, 11 May 2016 13:56:57 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.34.217.168] X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-8.0.0.1202-22314.006 X-TMASE-MatchedRID: y/2oPz6gbvgOwH4pD14DsPHkpkyUphL9vgj97y8eilZNShtWKzkFv5dA ax/AUFGFbX5McBQ6vv4EVzfzIiIfQH2DiRBaC3mkDB+ErBr0bAPWme/MypByxpMxNpDOG+h6dg5 Us4K5ZbAxtZLhhft969ZJVvybaLV585v3IoiI3IwTRDzcDa8P6/hs+N+bSEhB2oLGTNKlb9ckOQ aRC4OfAyFy8LxNieu+0E73q8rCjvxUlNXflSeCI+KXavbHY/C1Ct59Uh3p/NWHlDUCu0I+XN96V 2NgrEHi09NQNrxIpFYzIRsMySCVEAzyMxeMEX6wOX/V8P8ail1ZDL1gLmoa/PoA9r2LThYYKrau Xd3MZDWK832yxgRljdq6Nwy5qsGSqJXAsEuW9mlJcu6qd6ED3ZDTQyAKxP6e 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 Hi Geert, On 11.05.2016 10:06, Geert Uytterhoeven wrote: > Hi Dirk, > > On Wed, May 11, 2016 at 7:29 AM, Dirk Behme wrote: >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt >> @@ -0,0 +1,15 @@ >> +Renesas RCar r8a779x reset module >> +----------------------------------------------------- >> +This binding defines the reset module found on Renesas RCar r8a779x >> +SoCs. The reset module contains several reset related registers, >> +the meaning of them is implementation dependent. >> + >> +Required properties: >> +- compatible : "renesas,rcar-rst" >> +- reg : Location and size of the reset module >> + >> +Example: >> + reset-controller@e6160000 { >> + compatible = "renesas,rcar-rst"; >> + reg = <0 0xe6160000 0 0x200>; >> + }; > > While I understand you want to match on a single comptible value, the RST > module itself highly depends on the actual SoC. > Furthermore, R-Car Gen1 doesn't have RST. > > Hence I'd go for requiring 2 compatible values: > - An SoC-specific one, e.g. "renesas,r8a7795-rst", > - A family-specific one, e.g. "renesas,rcar-gen3-rst". > > Your driver code can match against the two family-specific compatible values > using of_find_matching_node(). This way? See below [1]. Best regards Dirk [1] --- a/drivers/misc/boot-mode-reg/rcar.c +++ b/drivers/misc/boot-mode-reg/rcar.c @@ -16,24 +16,43 @@ #include #include #include +#include #include -#define MODEMR 0xe6160060 +#define RCAR_RST_BASE 0xe6160000 +#define RCAR_RST_SIZE 0x200 +#define MODEMR 0x60 + +static struct of_device_id rcar_rst_ids[] __initdata = { + { .compatible = "renesas,rcar-gen2-rst" }, + { .compatible = "renesas,rcar-gen3-rst" }, + {} +}; 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_matching_node(NULL, rcar_rst_ids); + 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: --- /dev/null +++ b/Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt @@ -0,0 +1,24 @@ +Renesas RCar r8a779x reset module +----------------------------------------------------- +This binding defines the reset module found on Renesas RCar r8a779x +SoCs. The reset module contains several reset related registers, +the meaning of them is implementation dependent. + +Required properties: +- compatible : "renesas,rcar-gen2-rst" for RCar Gen2 or + "renesas,rcar-gen3-rst" for RCar Gen3 + and additionally a SoC specific property like + "renesas,r8a7790-rst" or + "renesas,r8a7791-rst" or + "renesas,r8a7792-rst" or + "renesas,r8a7793-rst" or + "renesas,r8a7794-rst" or + "renesas,r8a7795-rst" or + "renesas,r8a7796-rst" +- reg : Location and size of the reset module + +Example: + reset-controller@e6160000 { + compatible = "renesas,rcar-gen3-rst", "renesas,r8a7795-rst"; + reg = <0 0xe6160000 0 0x200>; + }; diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi index 83cf23c..7102002 100644 --- a/arch/arm/boot/dts/r8a7790.dtsi +++ b/arch/arm/boot/dts/r8a7790.dtsi @@ -1102,6 +1102,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-gen2-rst", "renesas,r8a7790-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi index db67e34..d54b58e 100644 --- a/arch/arm/boot/dts/r8a7791.dtsi +++ b/arch/arm/boot/dts/r8a7791.dtsi @@ -1122,6 +1122,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-gen2-rst", "renesas,r8a7791-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock"; diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi index 1dd6d20..9ebe978 100644 --- a/arch/arm/boot/dts/r8a7793.dtsi +++ b/arch/arm/boot/dts/r8a7793.dtsi @@ -933,6 +933,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-gen2-rst", "renesas,r8a7793-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7793-div6-clock", diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi index f334a3a..bd998fd 100644 --- a/arch/arm/boot/dts/r8a7794.dtsi +++ b/arch/arm/boot/dts/r8a7794.dtsi @@ -932,6 +932,12 @@ "rcan"; #power-domain-cells = <0>; }; + + reset-controller@e6160000 { + compatible = "renesas,rcar-gen2-rst", "renesas,r8a7794-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7794-div6-clock", "renesas,cpg-div6-clock"; diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi index 7181db0..b846bca 100644 --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi @@ -309,6 +309,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-gen3-rst", "renesas,r8a7795-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + sysc: system-controller@e6180000 { compatible = "renesas,r8a7795-sysc"; reg = <0 0xe6180000 0 0x0400>; diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi b/arch/arm64/boot/dts/renesas/r8a7796.dtsi index 1389528..7c65f8a 100644 --- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi @@ -109,6 +109,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-gen3-rst", "renesas,r8a7796-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + sysc: system-controller@e6180000 { compatible = "renesas,r8a7796-sysc"; reg = <0 0xe6180000 0 0x0400>;