From patchwork Thu Jun 9 08:31:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 9166461 X-Patchwork-Delegate: sboyd@codeaurora.org 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 4401A6048F for ; Thu, 9 Jun 2016 08:31:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34F1527248 for ; Thu, 9 Jun 2016 08:31:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29EC528326; Thu, 9 Jun 2016 08:31:48 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 700FA27248 for ; Thu, 9 Jun 2016 08:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754190AbcFIIbj (ORCPT ); Thu, 9 Jun 2016 04:31:39 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:49982 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932332AbcFIIbc (ORCPT ); Thu, 9 Jun 2016 04:31:32 -0400 Received: from vsmta14.fe.internet.bosch.com (unknown [10.4.98.54]) by imta24.fe.bosch.de (Postfix) with ESMTP id 848DDD80222; Thu, 9 Jun 2016 10:31:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=de.bosch.com; s=2015-01-21; t=1465461090; bh=xSzlTI5ByBzxomol2l57PFqBuDQF9cj7yVZ+PcN0FhE=; l=10; h=From:From:Reply-To:Sender; b=ZDy4OZXDJptEH+hJ/89B3YAktXmDcbVELOqzo469oaQhh/QrMmTRuMhz/d1PYWgaw tk21xjOOZ1aMuO9EFGrefBKw/VVZ7giAAAZCzjxCw8fDJDiCC9czPlHCWZgpg+1F6T l53/qYJQxjlM2PVvLzr31y0UsnXT9Uu32s2gqkg0= Received: from FE-HUB1000.de.bosch.com (vsgw23.fe.internet.bosch.com [10.4.98.23]) by vsmta14.fe.internet.bosch.com (Postfix) with ESMTP id 35A9FA40871; Thu, 9 Jun 2016 10:31:30 +0200 (CEST) Received: from [10.34.217.168] (10.34.217.168) by FE-HUB1000.de.bosch.com (10.4.103.107) with Microsoft SMTP Server id 14.3.195.1; Thu, 9 Jun 2016 10:31:29 +0200 Subject: Re: [PATCH v2 2/4] clk: renesas: Add r8a7796 CPG Core Clock Definitions To: Geert Uytterhoeven References: <1464625737-6646-1-git-send-email-geert+renesas@glider.be> <1464625737-6646-3-git-send-email-geert+renesas@glider.be> <574C6C16.3020703@gmail.com> <6b57d59f-d17b-a6c3-41d5-e975db544adc@de.bosch.com> <77a45dc7-59f0-23fc-f30d-b3daab34d689@de.bosch.com> CC: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Simon Horman , Magnus Damm , Laurent Pinchart , linux-clk , , "devicetree@vger.kernel.org" From: Dirk Behme Organization: Robert Bosch Car Multimedia GmbH Message-ID: <94042cf8-5364-8426-a5de-b83fe291fee1@de.bosch.com> Date: Thu, 9 Jun 2016 10:31:29 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 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-22378.006 X-TMASE-MatchedRID: vbSD0OnL8/IOwH4pD14DsPHkpkyUphL9ll6sbwG1OHJ+bUTCaUVYBJJg cwWSs+sWbSdlg1xhZQ1rM0UO3SIDz/T3/iYaKvAGEdFsavUQKAfr9M2AR7TFwwLlYq1KzQi/tJ4 /cXzOBJQZwzFpVQCwLdv8xVQI+Ue+seovEZv0o0zAJnGRMfFxySseSAhqf1rRIbxYwbCxGTQ9CU on0NTGeaKmWYvXxgnT2Kdmew9oBPnbjF84eGLr8lT/YzREB9OKCwUzSHafu24cVJCT3tVgamLkc k5kgaEiDoqCl/x+niteHw0Rrqsj5tq72IXmYAV74nbwqqmOd2m2+OflY2YjKbC5w3HgF8UiUKk3 7LYaElw+XhSpe50+RmDQBwDYf7Hg8FFFRqZ+F4zKGw01e0pbwf70sxpkgFo2KQh26S7BLNyjxYy RBa/qJQPTK4qtAgwIAYt5KiTiutkLbigRnpKlKSPzRlrdFGDwVSbSVeFPrXd9vGM7agRz6lPe7r Xrkh6UFjCKAN+9U5PSoHhU1yXuGg== Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Geert, On 07.06.2016 10:17, Geert Uytterhoeven wrote: > Hi Dirk, > > On Tue, Jun 7, 2016 at 9:53 AM, Dirk Behme wrote: >> I think I just want to discuss if we have a clever idea to further improve >> one detail. That is, if we have a clever idea to avoid the copy & paste >> between the family members using anything like a hierarchical way of >> defining the clocks in r8a779x-cpg-mssr.h. >> >>> Given the small amount of work needed to bootstrap r8a7796, I >>> think they still hold on their promises. >> >> Well, regarding the r8a779x-cpg-mssr.h the small amount of work needed isn't >> a really good argument if you are good with cp & sed for the copy & paste >> done ;) > > They're not really created by cp & sed, as they must match the table in the > datasheet (the latter may have been created by copy & paste though :-) > >> What I fear we end up the way we are doing the copy & paste >> r8a779x-cpg-mssr.h is having 5 or 6 or even more of these files, all > 90% >> identical. And once you have to change anything, you either have to change >> all these files. Or you miss anything, ending up with subtle bugs when one >> SoC does behave differently than an other one. > > The point is these files are stable ABI: no single value can be changed. > No value can be reused. Only new values can be appended at the bottom > (if a newer revision of the datasheet documents more clocks than the old > version, which happens from time to time). > > IMHO a hierarchical way of defining the clocks has more opportunity of > accidentally referring to a clock that doesn't exist on a particular SoC. > > Furthermore, r8a779x-cpg-mssr.h is not a good name to be part of a DT binding, > due to the wildcard. > A future SoC may will match r8a779x and even be called (R-Car 3?), > while using a completely different CPG block. Just to give an example about what we are talking, I've done [1] below. This should just be an *example*, though. I'm sure that we might need a more clever way. I'm interested in your opinion why it doesn't work this way ;) Best regards Dirk [1] include/dt-bindings/clock/r8a7795-cpg-mssr.h | 51 --------------------- include/dt-bindings/clock/r8a7796-cpg-mssr.h | 61 +++----------------------- include/dt-bindings/clock/rcar3-cpg-mssr.h | 63 +++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 104 deletions(-) --- To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: b/include/dt-bindings/clock/r8a7795-cpg-mssr.h =================================================================== --- a/include/dt-bindings/clock/r8a7795-cpg-mssr.h +++ b/include/dt-bindings/clock/r8a7795-cpg-mssr.h @@ -9,55 +9,6 @@ #ifndef __DT_BINDINGS_CLOCK_R8A7795_CPG_MSSR_H__ #define __DT_BINDINGS_CLOCK_R8A7795_CPG_MSSR_H__ -#include - -/* r8a7795 CPG Core Clocks */ -#define R8A7795_CLK_Z 0 -#define R8A7795_CLK_Z2 1 -#define R8A7795_CLK_ZR 2 -#define R8A7795_CLK_ZG 3 -#define R8A7795_CLK_ZTR 4 -#define R8A7795_CLK_ZTRD2 5 -#define R8A7795_CLK_ZT 6 -#define R8A7795_CLK_ZX 7 -#define R8A7795_CLK_S0D1 8 -#define R8A7795_CLK_S0D4 9 -#define R8A7795_CLK_S1D1 10 -#define R8A7795_CLK_S1D2 11 -#define R8A7795_CLK_S1D4 12 -#define R8A7795_CLK_S2D1 13 -#define R8A7795_CLK_S2D2 14 -#define R8A7795_CLK_S2D4 15 -#define R8A7795_CLK_S3D1 16 -#define R8A7795_CLK_S3D2 17 -#define R8A7795_CLK_S3D4 18 -#define R8A7795_CLK_LB 19 -#define R8A7795_CLK_CL 20 -#define R8A7795_CLK_ZB3 21 -#define R8A7795_CLK_ZB3D2 22 -#define R8A7795_CLK_CR 23 -#define R8A7795_CLK_CRD2 24 -#define R8A7795_CLK_SD0H 25 -#define R8A7795_CLK_SD0 26 -#define R8A7795_CLK_SD1H 27 -#define R8A7795_CLK_SD1 28 -#define R8A7795_CLK_SD2H 29 -#define R8A7795_CLK_SD2 30 -#define R8A7795_CLK_SD3H 31 -#define R8A7795_CLK_SD3 32 -#define R8A7795_CLK_SSP2 33 -#define R8A7795_CLK_SSP1 34 -#define R8A7795_CLK_SSPRS 35 -#define R8A7795_CLK_RPC 36 -#define R8A7795_CLK_RPCD2 37 -#define R8A7795_CLK_MSO 38 -#define R8A7795_CLK_CANFD 39 -#define R8A7795_CLK_HDMI 40 -#define R8A7795_CLK_CSI0 41 -#define R8A7795_CLK_CSIREF 42 -#define R8A7795_CLK_CP 43 -#define R8A7795_CLK_CPEX 44 -#define R8A7795_CLK_R 45 -#define R8A7795_CLK_OSC 46 +#include #endif /* __DT_BINDINGS_CLOCK_R8A7795_CPG_MSSR_H__ */ Index: b/include/dt-bindings/clock/r8a7796-cpg-mssr.h =================================================================== --- a/include/dt-bindings/clock/r8a7796-cpg-mssr.h +++ b/include/dt-bindings/clock/r8a7796-cpg-mssr.h @@ -9,61 +9,14 @@ #ifndef __DT_BINDINGS_CLOCK_R8A7796_CPG_MSSR_H__ #define __DT_BINDINGS_CLOCK_R8A7796_CPG_MSSR_H__ -#include +#include /* r8a7796 CPG Core Clocks */ -#define R8A7796_CLK_Z 0 -#define R8A7796_CLK_Z2 1 -#define R8A7796_CLK_ZR 2 -#define R8A7796_CLK_ZG 3 -#define R8A7796_CLK_ZTR 4 -#define R8A7796_CLK_ZTRD2 5 -#define R8A7796_CLK_ZT 6 -#define R8A7796_CLK_ZX 7 -#define R8A7796_CLK_S0D1 8 -#define R8A7796_CLK_S0D2 9 -#define R8A7796_CLK_S0D3 10 -#define R8A7796_CLK_S0D4 11 -#define R8A7796_CLK_S0D6 12 -#define R8A7796_CLK_S0D8 13 -#define R8A7796_CLK_S0D12 14 -#define R8A7796_CLK_S1D1 15 -#define R8A7796_CLK_S1D2 16 -#define R8A7796_CLK_S1D4 17 -#define R8A7796_CLK_S2D1 18 -#define R8A7796_CLK_S2D2 19 -#define R8A7796_CLK_S2D4 20 -#define R8A7796_CLK_S3D1 21 -#define R8A7796_CLK_S3D2 22 -#define R8A7796_CLK_S3D4 23 -#define R8A7796_CLK_LB 24 -#define R8A7796_CLK_CL 25 -#define R8A7796_CLK_ZB3 26 -#define R8A7796_CLK_ZB3D2 27 -#define R8A7796_CLK_ZB3D4 28 -#define R8A7796_CLK_CR 29 -#define R8A7796_CLK_CRD2 30 -#define R8A7796_CLK_SD0H 31 -#define R8A7796_CLK_SD0 32 -#define R8A7796_CLK_SD1H 33 -#define R8A7796_CLK_SD1 34 -#define R8A7796_CLK_SD2H 35 -#define R8A7796_CLK_SD2 36 -#define R8A7796_CLK_SD3H 37 -#define R8A7796_CLK_SD3 38 -#define R8A7796_CLK_SSP2 39 -#define R8A7796_CLK_SSP1 40 -#define R8A7796_CLK_SSPRS 41 -#define R8A7796_CLK_RPC 42 -#define R8A7796_CLK_RPCD2 43 -#define R8A7796_CLK_MSO 44 -#define R8A7796_CLK_CANFD 45 -#define R8A7796_CLK_HDMI 46 -#define R8A7796_CLK_CSI0 47 -#define R8A7796_CLK_CSIREF 48 -#define R8A7796_CLK_CP 49 -#define R8A7796_CLK_CPEX 50 -#define R8A7796_CLK_R 51 -#define R8A7796_CLK_OSC 52 +#define R8A7796_CLK_ZB3D4 47 +#define R8A7796_CLK_S0D2 48 +#define R8A7796_CLK_S0D3 49 +#define R8A7796_CLK_S0D6 50 +#define R8A7796_CLK_S0D8 51 +#define R8A7796_CLK_S0D12 53 #endif /* __DT_BINDINGS_CLOCK_R8A7796_CPG_MSSR_H__ */ Index: b/include/dt-bindings/clock/rcar3-cpg-mssr.h =================================================================== --- /dev/null +++ b/include/dt-bindings/clock/rcar3-cpg-mssr.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2015 Renesas Electronics Corp. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#ifndef __DT_BINDINGS_CLOCK_RCAR3_CPG_MSSR_H__ +#define __DT_BINDINGS_CLOCK_RCAR3_CPG_MSSR_H__ + +#include + +/* RCar3 CPG Core Clocks */ +#define RCAR3_CLK_Z 0 +#define RCAR3_CLK_Z2 1 +#define RCAR3_CLK_ZR 2 +#define RCAR3_CLK_ZG 3 +#define RCAR3_CLK_ZTR 4 +#define RCAR3_CLK_ZTRD2 5 +#define RCAR3_CLK_ZT 6 +#define RCAR3_CLK_ZX 7 +#define RCAR3_CLK_S0D1 8 +#define RCAR3_CLK_S0D4 9 +#define RCAR3_CLK_S1D1 10 +#define RCAR3_CLK_S1D2 11 +#define RCAR3_CLK_S1D4 12 +#define RCAR3_CLK_S2D1 13 +#define RCAR3_CLK_S2D2 14 +#define RCAR3_CLK_S2D4 15 +#define RCAR3_CLK_S3D1 16 +#define RCAR3_CLK_S3D2 17 +#define RCAR3_CLK_S3D4 18 +#define RCAR3_CLK_LB 19 +#define RCAR3_CLK_CL 20 +#define RCAR3_CLK_ZB3 21 +#define RCAR3_CLK_ZB3D2 22 +#define RCAR3_CLK_CR 23 +#define RCAR3_CLK_CRD2 24 +#define RCAR3_CLK_SD0H 25 +#define RCAR3_CLK_SD0 26 +#define RCAR3_CLK_SD1H 27 +#define RCAR3_CLK_SD1 28 +#define RCAR3_CLK_SD2H 29 +#define RCAR3_CLK_SD2 30 +#define RCAR3_CLK_SD3H 31 +#define RCAR3_CLK_SD3 32 +#define RCAR3_CLK_SSP2 33 +#define RCAR3_CLK_SSP1 34 +#define RCAR3_CLK_SSPRS 35 +#define RCAR3_CLK_RPC 36 +#define RCAR3_CLK_RPCD2 37 +#define RCAR3_CLK_MSO 38 +#define RCAR3_CLK_CANFD 39 +#define RCAR3_CLK_HDMI 40 +#define RCAR3_CLK_CSI0 41 +#define RCAR3_CLK_CSIREF 42 +#define RCAR3_CLK_CP 43 +#define RCAR3_CLK_CPEX 44 +#define RCAR3_CLK_R 45 +#define RCAR3_CLK_OSC 46 + +#endif /* __DT_BINDINGS_CLOCK_RCAR3_CPG_MSSR_H__ */