Received: by 10.192.165.148 with SMTP id m20csp735618imm; Fri, 20 Apr 2018 14:51:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/zdAW4Tbm62R6U4UEKfp3/Cnq/8YwZ+arqGq/NPPN9f2NPoodGg98uTDoUOksfBQQDSuw/ X-Received: by 10.98.242.67 with SMTP id y3mr8008151pfl.159.1524261064154; Fri, 20 Apr 2018 14:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524261064; cv=none; d=google.com; s=arc-20160816; b=sPdiucjx6HBGnq2rPiKjoFlGQHR/3VzpRurhGdx0gQPtWIXn6m8UhgFqoLErsoiTE/ RNfxfeMAvdfnICdWLVpfJB1Gpq2T+Gbcm3sAfX5iVUCGh788Pm8MnQzTYBSR8UEr6SZg RMRX3Eno9Lwoxsqb+Us3f6eyEPuQTJ0azB9Lf+ejwnFHPmAKb5DgbvSQh4KVGPgtzYRW sIZx4mffRFF7RnUjfyQKG00YPCd4HSZRg9nmXoDn50xb1xCtMBqhoyNrD9eQeV/uGB7m nsQaYDglbc9GiXWZR1910cPeImpjTzQUYQZeu+N3uZOTHeZ2aBg5GijDrBoOMFMphJ12 Pm1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=0b1oqUH99rXUPGat+1VF/p1pMSBjV/cSg6pJpCfRg98=; b=FunLJC5moPzwcdvELyMgLsJJFc+lSpQYgBZcbKn+r7Ur0B7VrMsc28Gaeq4lK1OOb1 /UhnA5TEb0KzxNn5bY5uX4UwMgnVkm5d1cI+pClD1Ka4iAo939teQ3S4+Wk3RSUMUUyg OKgOrWdrMG7VC+fdVWn+rNasOiAZCiN51jSBdZ8DzpOiOWknWFRUgP1MJmbASyPAmm/S POZkJOWBMHQhTgGv465Giq0Bye+Tu0ACGbHAwvBGABn+RtPhCuJJno2iHdRVN1eZWXf+ KppCoJhbKZB94PfnI6MUvhmv4/36c0IiP/JDrXSEHtc7UBuBlympNNcOOGgQC4eQhLH+ 7ZIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VCWjVRgZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h32-v6si6045404pld.170.2018.04.20.14.50.26; Fri, 20 Apr 2018 14:51:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VCWjVRgZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752325AbeDTVr2 (ORCPT + 99 others); Fri, 20 Apr 2018 17:47:28 -0400 Received: from mail-oi0-f46.google.com ([209.85.218.46]:41031 "EHLO mail-oi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192AbeDTVr0 (ORCPT ); Fri, 20 Apr 2018 17:47:26 -0400 Received: by mail-oi0-f46.google.com with SMTP id 188-v6so9311487oih.8 for ; Fri, 20 Apr 2018 14:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0b1oqUH99rXUPGat+1VF/p1pMSBjV/cSg6pJpCfRg98=; b=VCWjVRgZi5Iss2nE2UjKgWTE9lH2Capi8Nwf0Sb8W/zSPjN2O4B+V2j0wk0ucoqSn5 rfLHpNsJ0Y3rtr9xi4B1t8kooM7afE6IqbrgHst5XMsSWJgSWguCzuR5BHCs5SPlF6p2 2WcsVUALKv1g0SzEnhl9CD5yRgB0YXLxAedq8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0b1oqUH99rXUPGat+1VF/p1pMSBjV/cSg6pJpCfRg98=; b=Zy3q7dwn46wOUWYkasCYWWJ+J+mqbZfmvsSi9ZN9wzyHDEWeBCN7hWJSm/QGxqbYVy iHOIJKG1X3ORn4eiEgj5wooac+JKynr6cqVGXYBNPwmRzAgJanZozPTH84Cqp2R1ZXc+ H+wjhjvUaqPutx/2hhrXTq3anQIbqWgghHn6cx+KnSKfdvIPWA1kxx/8jxhTXLyULoP7 sYOuJLVEL+7P/6jl2OaqKGk7SssmKCYLwjaSs0x0Q8cOVxMQgswSIXR9rAUVMBd2uI+u EvMxxf0KRdqcvkM+S4T7tOVNwCqe6zIPTL7fCk4YgPoBE0UmI4o1ojT1CxXcLy/0iHHQ y6kg== X-Gm-Message-State: ALQs6tAkO47Zmp01n8wk9F9VOfQas3EkK5S7N8HVgOs3UMDz6Nsu6lcJ MG9CSieXb2oBKqi5VTZb9d/GWg== X-Received: by 2002:aca:4b88:: with SMTP id y130-v6mr7624682oia.55.1524260846102; Fri, 20 Apr 2018 14:47:26 -0700 (PDT) Received: from minitux (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id l51-v6sm3710510otb.13.2018.04.20.14.47.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Apr 2018 14:47:25 -0700 (PDT) Date: Fri, 20 Apr 2018 14:47:22 -0700 From: Bjorn Andersson To: Rob Herring Cc: devicetree@vger.kernel.org, devicetree-spec@vger.kernel.org, linux-kernel@vger.kernel.org, grant.likely@arm.com, frowand.list@gmail.com, mark.rutland@arm.com, Geert Uytterhoeven , Linus Walleij , Thierry Reding , Mark Brown , shawnguo@kernel.org, Arnd Bergmann , Stephen Boyd , Jonathan Cameron Subject: Re: [RFC PATCH] dt-bindings: add a jsonschema binding example Message-ID: <20180420214722.GA18510@minitux> References: <20180418222905.10414-1-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180418222905.10414-1-robh@kernel.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 18 Apr 15:29 PDT 2018, Rob Herring wrote: > The current DT binding documentation format of freeform text is painful > to write, review, validate and maintain. > > This is just an example of what a binding in the schema format looks > like. It's using jsonschema vocabulary in a YAML encoded document. Using > jsonschema gives us access to existing tooling. A YAML encoding gives us > something easy to edit. > > This example is just the tip of the iceberg, but it the part most > developers writing bindings will interact with. Backing all this up > are meta-schema (to validate the binding schemas), some DT core schema, > YAML encoded DT output with dtc, and a small number of python scripts to > run validation. The gory details including how to run end-to-end > validation can be found here: > > https://www.spinics.net/lists/devicetree-spec/msg00649.html > > Signed-off-by: Rob Herring > --- > Cc list, > You all review and/or write lots of binding documents. I'd like some feedback > on the format. > I really like the idea of formalizing the binding document format and the ability of validating a dtb is really nice. > Thanks, > Rob > > .../devicetree/bindings/example-schema.yaml | 149 +++++++++++++++++++++ > 1 file changed, 149 insertions(+) > create mode 100644 Documentation/devicetree/bindings/example-schema.yaml > > diff --git a/Documentation/devicetree/bindings/example-schema.yaml b/Documentation/devicetree/bindings/example-schema.yaml [..] > + reg: > + # The description of each element defines the order and implicitly defines > + # the number of reg entries > + items: > + - description: core registers > + - description: aux registers > + # minItems/maxItems equal to 2 is implied I assume that a reg with variable number of entries would have "description" for all of them and then a minItems that matches the required ones and maxItems matching all of them? > + > + reg-names: > + # The core schema enforces this is a string array > + items: > + - const: core > + - const: aux I presume validation based on this should check that there's equal number of entries in reg-names as there where in reg. Should this relationship be described in the schema? [..] > + interrupts: > + # Either 1 or 2 interrupts can be present > + minItems: 1 > + maxItems: 2 > + items: > + - description: tx or combined interrupt > + - description: rx interrupt > + > + description: | > + A variable number of interrupts warrants a description of what conditions > + affect the number of interrupts. Otherwise, descriptions on standard > + properties are not necessary. For validation purposes this could be interrupts with interrupt-parents or a interrupts-extend, a fact that we probably don't want to duplicate in every definition? Perhaps we should just do like you did here and define the "interrupts" and then in the validation tool - where we need to encode the logic behind this anyways - we support the different variants. > + > + interrupt-names: > + # minItems must be specified here because the default would be 2 > + minItems: 1 As with reg-names, it would be good to have the validator warn if this is not the same number of items as entries in "interrupts". > + items: > + - const: "tx irq" > + - const: "rx irq" > + > + # Property names starting with '#' must be quoted > + '#interrupt-cells': > + # A simple case where the value must always be '2'. > + # The core schema handles that this must be a single integer. > + const: 2 If this is specified then interrupt-controller should also be given, or vise versa. How would we describe that? > + > + interrupt-controller: {} > + # The core checks this is a boolean, so just have to list it here to be > + # valid for this binding. > + Regards, Bjorn