From patchwork Wed Nov 13 21:49:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hogan X-Patchwork-Id: 3179771 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A4A289F3A0 for ; Wed, 13 Nov 2013 21:53:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9186208EC for ; Wed, 13 Nov 2013 21:53:54 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A7E8D208E8 for ; Wed, 13 Nov 2013 21:53:53 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VgiN0-0005Hd-4Y; Wed, 13 Nov 2013 21:53:06 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VgiMm-0006RF-02; Wed, 13 Nov 2013 21:52:52 +0000 Received: from multi.imgtec.com ([194.200.65.239]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VgiMS-0006Nw-1a for linux-arm-kernel@lists.infradead.org; Wed, 13 Nov 2013 21:52:33 +0000 From: James Hogan To: Mike Turquette , Subject: [PATCH v2 1/2] dt: binding: add specified-clock for discoverable rate clocks Date: Wed, 13 Nov 2013 21:49:59 +0000 Message-ID: <1384379400-24776-2-git-send-email-james.hogan@imgtec.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1384379400-24776-1-git-send-email-james.hogan@imgtec.com> References: <1384379400-24776-1-git-send-email-james.hogan@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.154.65] X-SEF-Processed: 7_3_0_01192__2013_11_13_21_52_05 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131113_165232_182693_4598AEC8 X-CRM114-Status: GOOD ( 11.45 ) X-Spam-Score: -1.9 (-) Cc: Mark Rutland , devicetree@vger.kernel.org, James Hogan , Pawel Moll , Stephen Warren , Ian Campbell , linux-doc@vger.kernel.org, Tomasz Figa , Rob Herring , linux-kernel@vger.kernel.org, Rob Landley , linux-metag@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 The frequency of some fixed rate external oscillators on some SoCs (for example TZ1090's XTAL1) are specified by the board using pull-ups and pull-downs of configuration pins which are automatically latched on reset and available in an SoC register, so that the boot ROM and OS can automatically discover it. These clocks are very similar to fixed-clocks since the rate never changes, but we still want to be able to automatically discover the frequency, so add a new binding to describe such clocks. Instead of using a "clock-frequency" property, use "reg", "bit-mask", "bit-shift" properties to describe the register field. The mapping from register values to clock frequencies is specified in a "table" property which contains pairs of register values and frequencies. There is scope to extend the binding further in future to handle other mapping types, by using different properties instead of "table". Signed-off-by: James Hogan Cc: Mike Turquette Cc: linux-arm-kernel@lists.infradead.org Cc: Ian Campbell Cc: Mark Rutland Cc: Pawel Moll Cc: Rob Herring Cc: Stephen Warren Cc: devicetree@vger.kernel.org Cc: Rob Landley Cc: linux-doc@vger.kernel.org --- I could easily have extended the fixed-rate binding instead, but there'd be no properties in common except the standard common clock properties so it seemed like it deserved a separate binding. I'm open to arguments to the contrary or better compatible string names though. Changes in v2: * Borrow bit-mask and bit-shift bindings from Mike's mux clock binding proposals. --- .../devicetree/bindings/clock/specified-clock.txt | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/specified-clock.txt diff --git a/Documentation/devicetree/bindings/clock/specified-clock.txt b/Documentation/devicetree/bindings/clock/specified-clock.txt new file mode 100644 index 000000000000..fa5010ffd903 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/specified-clock.txt @@ -0,0 +1,38 @@ +Binding for discoverable-fixed-rate clock sources. + +This binding uses the common clock binding[1]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt + +Required properties: +- compatible : shall be "specified-clock". +- #clock-cells : from common clock binding; shall be set to 0. +- reg : Base address of configuration register specifying the frequency. +- bit-mask : Mask of bits in the field specifying the frequency. +- table : array of integer pairs defining register field values and + corresponding clock frequencies in Hz. + +Optional properties: +- bit-shift : Number of bits to shift the masked register value, + defaults to (ffs(bit-mask) - 1) if absent. +- gpios : From common gpio binding; gpio connection to clock enable pin. +- clock-output-names : From common clock binding. + +Example: + clock { + compatible = "specified-clock"; + #clock-cells = <0>; + reg = <0x02004004 0x4>; /* CR_PERIP_RESET_CFG */ + bit-mask = <0x00000f00>; /* FXTAL */ + table = /* FXTAL Frequency */ + <0 16384000>, + <1 19200000>, + <2 24000000>, + <3 24576000>, + <4 26000000>, + <5 36000000>, + <6 36864000>, + <7 38400000>, + <8 40000000>; + clock-output-names = "xtal1"; + };