Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4765873ybc; Fri, 15 Nov 2019 09:43:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzPCVHcZ7gxpMdEMF1hA2TWGzyamxoqw5fe7FWZwAfAjPscNnfjsm1UGQ0d+seKsg+bUD1m X-Received: by 2002:a17:906:32d0:: with SMTP id k16mr2382428ejk.155.1573839786386; Fri, 15 Nov 2019 09:43:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573839786; cv=none; d=google.com; s=arc-20160816; b=TSbDX2a+FfGoL/KjaYO6wV16cTgnak2eKrfG4xihyD72YzJNPEwcXO6lhgXHLxrd2I vQCySN5iVQbo0feW9I+EOXY59/j9oqXgIzd388fiDzLRVwyUSDsC2JDScM43ZTKjdWpk bR/tiqOTdgGEdNk9j92iSxFgFKXH+uuuWlyrF9AVaDJy9WIkUjDGTjB1XwDo39BzC0wR sY1yY5fkD6BfuIHqHQLQD/jFQPwhav80ClYjL3EHc5gfdVg9zKc3elihlZEhXb3K6LrZ LDYXqAF9Ba88nl8Tmop+Sutg47xi0vArHUwHYnCFwkQG9neJiBS0xFYCuI20gqLamyXZ N7PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZhmHcJW3L/R0IVCIwVxbYjNpSzZSwJ4JCEEUdiudkek=; b=H9tqEJXOeobLPPfPjoaJ3sMRzHNI9oXAs4kHmfztLmfCkHt3C0yOJn7QOC188reL91 uaGuWih2X0DkU7SUIhbVCA+rXRFy+Hiyb4SJGhx4l902ABSSg2EmiCqd4xh/4b9wuYwQ SMzRA50bjWSOnRqzHnKKRUF+vb6q92Dgj8C/nFi8El88AWi1aoqthRYKZPofkaDoGCrQ 51RjTK0nnIoxZrbawJqmbs/Lw9t2te957DuzkjY+2JReuD2ZUBWlTaEGe6OrkPy4EmWY cutwGdFzHRwsUlXySqIH6Lhb7VFZ54PCN1kbA2+jE/nbhr7y49J6x4OwpCjLLW+UkfGQ nf6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UcKu93Oa; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a25si6087541ejb.285.2019.11.15.09.42.41; Fri, 15 Nov 2019 09:43:06 -0800 (PST) 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=@kernel.org header.s=default header.b=UcKu93Oa; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727031AbfKORlT (ORCPT + 99 others); Fri, 15 Nov 2019 12:41:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:47628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbfKORlT (ORCPT ); Fri, 15 Nov 2019 12:41:19 -0500 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8BD8120733; Fri, 15 Nov 2019 17:41:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573839677; bh=Ah9mSdZJn6L9OIVN76ESOloTb5qPCovaFeYqf7nVJhU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=UcKu93OaflKRQhXGUB2GfOrdH4JFoylzqiwTyOnSUF/gMOgTQFSNXAtZU0oReGX+r q0WKbb82DPWD7+bYz5IsQif7lcD1++Xhx3eVBSGcyEy7ROBtX/oeUxwksPD9UtB1hB QltqE3KZTXokHbeQ6gwvn7zpWJoqvW+IMDHSZKFM= Received: by mail-qt1-f175.google.com with SMTP id o11so11602469qtr.11; Fri, 15 Nov 2019 09:41:17 -0800 (PST) X-Gm-Message-State: APjAAAUeqCeMaGH/qZdltdK/DnRHy26c2NNRCAQwc3PeC4gj1+z8QLJg u8ApV/YfMlVKvcQ23FrxS6UcYly/drD+MwhrJw== X-Received: by 2002:ac8:73ce:: with SMTP id v14mr15034569qtp.136.1573839676618; Fri, 15 Nov 2019 09:41:16 -0800 (PST) MIME-Version: 1.0 References: <20191114164104.22782-1-alexandre.torgue@st.com> <7415fff5-030c-a65b-a405-a1197e166432@st.com> In-Reply-To: <7415fff5-030c-a65b-a405-a1197e166432@st.com> From: Rob Herring Date: Fri, 15 Nov 2019 11:41:04 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] dt-bindings: interrupt-controller: Convert stm32-exti to json-schema To: Alexandre Torgue Cc: Mark Rutland , Thomas Gleixner , Jason Cooper , Marc Zyngier , devicetree@vger.kernel.org, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , "linux-kernel@vger.kernel.org" , linux-stm32@st-md-mailman.stormreply.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 15, 2019 at 11:28 AM Alexandre Torgue wrote: > > > > On 11/14/19 6:18 PM, Rob Herring wrote: > > On Thu, Nov 14, 2019 at 10:41 AM Alexandre Torgue > > wrote: > >> > >> Convert the STM32 external interrupt controller (EXTI) binding to DT > >> schema format using json-schema. > >> > >> Signed-off-by: Alexandre Torgue > >> --- > >> > >> Hi Rob, > >> > >> I planned to use "additionalProperties: false" for this schema but as I add a > >> property under condition, I got an error (property added under contion seems > >> to be detected as an "additional" property and then error is raised). > >> > >> Is there a way to fix that ? > > > > See below. > > > >> > >> regards > >> Alex > >> > >> diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt > >> deleted file mode 100644 > >> index cd01b2292ec6..000000000000 > >> --- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt > >> +++ /dev/null > >> @@ -1,29 +0,0 @@ > >> -STM32 External Interrupt Controller > >> - > >> -Required properties: > >> - > >> -- compatible: Should be: > >> - "st,stm32-exti" > >> - "st,stm32h7-exti" > >> - "st,stm32mp1-exti" > >> -- reg: Specifies base physical address and size of the registers > >> -- interrupt-controller: Indentifies the node as an interrupt controller > >> -- #interrupt-cells: Specifies the number of cells to encode an interrupt > >> - specifier, shall be 2 > >> -- interrupts: interrupts references to primary interrupt controller > >> - (only needed for exti controller with multiple exti under > >> - same parent interrupt: st,stm32-exti and st,stm32h7-exti) > >> - > >> -Optional properties: > >> - > >> -- hwlocks: reference to a phandle of a hardware spinlock provider node. > >> - > >> -Example: > >> - > >> -exti: interrupt-controller@40013c00 { > >> - compatible = "st,stm32-exti"; > >> - interrupt-controller; > >> - #interrupt-cells = <2>; > >> - reg = <0x40013C00 0x400>; > >> - interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>; > >> -}; > >> diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml > >> new file mode 100644 > >> index 000000000000..39be37e1e532 > >> --- /dev/null > >> +++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml > >> @@ -0,0 +1,82 @@ > >> +# SPDX-License-Identifier: GPL-2.0 > > > > If ST has copyright on the old binding, can you add BSD here. > > > > I will. > > >> +%YAML 1.2 > >> +--- > >> +$id: http://devicetree.org/schemas/interrupt-controller/st,stm32-exti.yaml# > >> +$schema: http://devicetree.org/meta-schemas/core.yaml# > >> + > >> +title: STM32 External Interrupt Controller Device Tree Bindings > >> + > >> +maintainers: > >> + - Alexandre Torgue > >> + - Ludovic Barre > >> + > >> +properties: > >> + compatible: > >> + oneOf: > >> + - items: > >> + - enum: > >> + - st,stm32-exti > >> + - st,stm32h7-exti > >> + - items: > >> + - enum: > >> + - st,stm32mp1-exti > >> + - const: syscon > >> + > >> + "#interrupt-cells": > >> + const: 2 > >> + > >> + reg: > >> + maxItems: 1 > >> + > >> + interrupt-controller: true > >> + > >> + hwlocks: > >> + maxItems: 1 > >> + description: > >> + Reference to a phandle of a hardware spinlock provider node. > >> + > >> +required: > >> + - "#interrupt-cells" > >> + - compatible > >> + - reg > >> + - interrupt-controller > >> + > >> +allOf: > >> + - $ref: /schemas/interrupt-controller.yaml# > >> + - if: > >> + properties: > >> + compatible: > >> + contains: > >> + enum: > >> + - st,stm32-exti > >> + - st,stm32h7-exti > >> + then: > >> + properties: > >> + interrupts: > >> + allOf: > >> + - $ref: /schemas/types.yaml#/definitions/uint32-array > > > > Standard property, doesn't need a type. You just need 'maxItems' or an > > 'items' list if the index is not meaningful. This appears to be the > > former case. > > ok > > > > >> + description: > >> + Interrupts references to primary interrupt controller > >> + required: > >> + - interrupts > > > > You can move the definition to the main section as you only need > > 'required' here. That should fix your additionalProperties issue. > > > Doing that it fails as I don't have interrupts define for mp1 > compatible. Maybe I missed something ? Like this: properties: ... interrupts: maxItems: ?? minItems: ?? allOf: - $ref: /schemas/interrupt-controller.yaml# - if: properties: compatible: contains: enum: - st,stm32-exti - st,stm32h7-exti then: required: - interrupts