Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1862117ybe; Tue, 3 Sep 2019 04:45:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJu87OvbDT26Tim0ZPmoG/sRyBh2amesaiV7OwoGFhAkpaNfj84VC8x8SG1RE9swzmZcGt X-Received: by 2002:a62:65c7:: with SMTP id z190mr41056955pfb.9.1567511144098; Tue, 03 Sep 2019 04:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567511144; cv=none; d=google.com; s=arc-20160816; b=xpXA7RMLyyEvFilEZqCdHjY2sKzyrmz9lAxpgC1oMk1HOCt+iawbh2K3eNy2vvQuw7 WUPzL9GctfQpuBl057uoC7XHldHKdNfv6RxsLr3WXCCLMW83wM+fG2OTDw1XYHz9OKPe hEirOdsODg7Z1Lf5jL+6x4Znlr8b6AYbLgI1UYJxmUtrTRDKsXBtPYq+k424USeSxsAc eoEg6w2orB8mGe2ov5778qHRZnVffTkFUYY+WPliZf4u+U30OdgJBU4MPlGvJCuuburD MC7+0J9+wA/jDwpCIUQQn24/xddf1V1WxHNUJJXGtp2dbF21uhqGtmfbfAPAdRifinNk Ua/A== 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=46fy6fHlztiwO3P0eWHv7L5a+hSPz8kKTZWoBb5Qxdw=; b=vW554ROrVR1wGT2JGYdt7I91PRuFPiVO6RCKdBWbW0IEcfWT6H+cTDhoS7TMnXj2L0 +dgDMp7kSbfpfbA1317K/NWT2IktDsVvjUxvHxFgMXV/+0e9K52zmGiWQvDSQvmHUs/d wA9FfRUYnglsIN+VbR92nRvjO4QnT7SGyqQXQzZwHsSuBNWNz6GArRJ3awxhOPhuNcEx gHTfN+pCKXcRwDUnDDPMhy5G2qDeT48vkODFjec6y9NlulckuwGYFKORFHNa+K23Q1eD zJcIMwm4ttyCY1GXBj2WojjXSSxYVSlePyyeEhRIi9nSXcwpkK4riEHOHoVv1AC3z93A uaIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EnqJXBD8; 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 f5si14623245pgv.70.2019.09.03.04.45.27; Tue, 03 Sep 2019 04:45:44 -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=@kernel.org header.s=default header.b=EnqJXBD8; 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 S1728869AbfICLof (ORCPT + 99 others); Tue, 3 Sep 2019 07:44:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:45898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726936AbfICLoe (ORCPT ); Tue, 3 Sep 2019 07:44:34 -0400 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 B59E22087E; Tue, 3 Sep 2019 11:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567511074; bh=GLV2PrI/w8WKtzeB6Jimizt3wNVcE7gXazlgmzVZ2VA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=EnqJXBD8dkyrwGsBAUhGPddErCfaZwlTLTUa5f+8glfQltP2ohwel9bhSzZha9Sqz UgceN2Su+cXuY4948X2puyubqSotGIyYVxXsOb3AETqjK/xEyB0/ki14jvvmgJIeEu WasyBWRwQcna6q44TUF//BKBUv32kZLtmNiLNK9I= Received: by mail-lj1-f179.google.com with SMTP id l20so1224256ljj.3; Tue, 03 Sep 2019 04:44:33 -0700 (PDT) X-Gm-Message-State: APjAAAUM8oSm9kQ99K2JLg0Cj1YCfl8fVd46N3YXPChGhrjaYogPMByH 9mii0dw+rtbsjsvoXfZhtblcKSi3L7l1/CGs+wA= X-Received: by 2002:a2e:99cc:: with SMTP id l12mr7148200ljj.5.1567511071966; Tue, 03 Sep 2019 04:44:31 -0700 (PDT) MIME-Version: 1.0 References: <20190902150336.3600-1-krzk@kernel.org> In-Reply-To: From: Krzysztof Kozlowski Date: Tue, 3 Sep 2019 13:44:20 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] dt-bindings: power: syscon-reboot: Convert bindings to json-schema To: Rob Herring Cc: Sebastian Reichel , Mark Rutland , "open list:THERMAL" , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" 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 Tue, 3 Sep 2019 at 11:00, Rob Herring wrote: > > On Tue, Sep 3, 2019 at 8:47 AM Krzysztof Kozlowski wrote: > > > > On Tue, 3 Sep 2019 at 09:14, Rob Herring wrote: > > > > > > On Mon, Sep 2, 2019 at 4:03 PM Krzysztof Kozlowski wrote: > > > > > > > > Convert the Syscon reboot bindings to DT schema format using > > > > json-schema. > > > > > > > > Signed-off-by: Krzysztof Kozlowski > > > > --- > > > > .../bindings/power/reset/syscon-reboot.txt | 30 -------- > > > > .../bindings/power/reset/syscon-reboot.yaml | 68 +++++++++++++++++++ > > > > 2 files changed, 68 insertions(+), 30 deletions(-) > > > > delete mode 100644 Documentation/devicetree/bindings/power/reset/syscon-reboot.txt > > > > create mode 100644 Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml > > > > > > > diff --git a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml > > > > new file mode 100644 > > > > index 000000000000..a583f3dc8ef4 > > > > --- /dev/null > > > > +++ b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml > > > > @@ -0,0 +1,68 @@ > > > > +# SPDX-License-Identifier: GPL-2.0 > > > > +%YAML 1.2 > > > > +--- > > > > +$id: http://devicetree.org/schemas/power/reset/syscon-reboot.yaml# > > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > > + > > > > +title: Generic SYSCON mapped register reset driver > > > > + > > > > +maintainers: > > > > + - Sebastian Reichel > > > > + > > > > +description: |+ > > > > + This is a generic reset driver using syscon to map the reset register. > > > > + The reset is generally performed with a write to the reset register > > > > + defined by the register map pointed by syscon reference plus the offset > > > > + with the value and mask defined in the reboot node. > > > > + Default will be little endian mode, 32 bit access only. > > > > + > > > > +properties: > > > > + compatible: > > > > + const: syscon-reboot > > > > + > > > > + mask: > > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > > > + description: Update only the register bits defined by the mask (32 bit). > > > > + maxItems: 1 > > > > > > Drop this as that is already defined for uint32. > > > > > > It also doesn't actually work. The $ref has to be under an 'allOf' if > > > you have additional schemas. A quirk of json-schema... > > > > > > > + > > > > + offset: > > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > > > + description: Offset in the register map for the reboot register (in bytes). > > > > + maxItems: 1 > > > > + > > > > + regmap: > > > > + $ref: /schemas/types.yaml#/definitions/phandle > > > > + description: Phandle to the register map node. > > > > + maxItems: 1 > > > > + > > > > + value: > > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > > > + description: The reset value written to the reboot register (32 bit access). > > > > + maxItems: 1 > > > > + > > > > +required: > > > > + - compatible > > > > + - regmap > > > > + - offset > > > > + > > > > +allOf: > > > > + - if: > > > > + properties: > > > > + value: > > > > + not: > > > > + type: array > > > > > > I think you could make this a bit more readable with: > > > > > > if: > > > not: > > > required: > > > - value > > > > I do not understand how does it work (value is not mentioned in the > > required fields so why checking of it?)... but it works fine. > > What's under required doesn't have to be listed as a property. > > > > However, if the tree is free of legacy usage, then you could just drop all this. > > > > One of them - mask or value - has to be provided. > > Or both, right? > > Actually, a better way to express it is probably this: > > oneOf: > - required: [ value ] > - required: [ mask ] > - required: [ value, mask ] This does not work mask+value would be valid everywhere: arch/arm/boot/dts/exynos3250-artik5-eval.dt.yaml: syscon-reboot: {'regmap': [[9]], 'mask': [[1]], '$nodename': ['syscon-reboot'], 'value': [[1]], 'offset': [[1024]], 'compatible': ['syscon-reboot']} is valid under each of {'required': ['mask']}, {'required': ['value', 'mask']}, {'required': ['value']}