Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1344710ybn; Wed, 25 Sep 2019 16:47:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0rzDAp12zFMrlFoHnj0KIsJVPgtJvVSW1frzcGg4QoBkYZ7udhEb8MszApd8u/JutZmmo X-Received: by 2002:a17:906:57c3:: with SMTP id u3mr623416ejr.303.1569455221815; Wed, 25 Sep 2019 16:47:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569455221; cv=none; d=google.com; s=arc-20160816; b=quS+AhxTLLzlcK7NHkXt+vqp3+J01+NCUgi5+xs0kOunLdnVzK1VZC/F1b45M15nLI 0QgSZ1LuQYCjX3VSB5cnww//3TUlFmeEWMsCwnoARN/U2zrbjb/FqhjNxY6xxDrgerkP zFKHQJFU0LSc95CtkDVdPAT225TfFWJmj1GoIcKJQztmcGOvJAU6kM7H0FZ39BE2rlt9 7lo1IN4vbfTL2hSZ5GbbfI4TGf3GKRlIolnN/fZJbltfLZjzjhQr2ojOzZA6Nh1Q4+DX SFTb4U6musiy+Qj6mx6VIIrLifp8eo6Hn6BD/KszAEPTQTCgKXWHY3LRT8Kl53X0j/7b OsnA== 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=zBhT1AMuVdxpcFlrLSnPl00OMYTP9BHSLJPsSPS7r4A=; b=FzXYfyExofI24okWfPWSNpnrN5JjRmgVaIa4U8oYKUfeCn9eVzTNg4NNZ5KUWCuLM6 br8ny9hOdElpNfOPZDZ9LFUGMYa9GdpUkScT/7GVxD0ZGJ7T4JAfR/4dGQ5fmkSkF430 ydty3z4dICIHIrNkczx4g2yqHugPRN2mJ2+Tf+N1npENu2p/gh6ugs5ckbBEiCPUuC5j i1dThIqrx8QROBL7lxMUNJX0+v7DDgCz3S3lJANzKxVyDJatRFQZBFzST/E8zVFpG8RV Jn9Rlt6Kj6j8Aw3e59JyjiUKrv+OAAk2+qOdWXFBP+YSV8+KUSQayhf2dqtY0d96e1nV qkqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Zhmep+7Y; 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 ot41si191150ejb.215.2019.09.25.16.46.38; Wed, 25 Sep 2019 16:47:01 -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=Zhmep+7Y; 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 S2388467AbfIWUis (ORCPT + 99 others); Mon, 23 Sep 2019 16:38:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:33822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387586AbfIWUis (ORCPT ); Mon, 23 Sep 2019 16:38:48 -0400 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (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 3500020B7C; Mon, 23 Sep 2019 20:38:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569271127; bh=gNrXvUAU8wOQh+iz7AfVncMXjSwAzg06fGaV6JWq7VM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Zhmep+7Yb+218KwH3rXqqFXlWqTUT+B+anFjP7DzudTHptIUjrsAhFxa2zsVTSJ1p 7FSXtVzzeonhZORvXyVB/BQzuNpVpvxJpvRb40C4i3gDsU5sg8IMC6ELwXmaUIXQ/T A6DX/9i1XQuCcydOn+6Ax6wgn94ATIiAwIPhT3Ic= Received: by mail-qk1-f169.google.com with SMTP id y189so16935585qkc.3; Mon, 23 Sep 2019 13:38:47 -0700 (PDT) X-Gm-Message-State: APjAAAXmTOnrvgXG3anSag8jToy+W93QqGMEDDzZ2FzR03yt9Z7gB8VD whbrHBqogkKd4e1qGm4F9GU6m0C6+XFtPjSdQw== X-Received: by 2002:a37:682:: with SMTP id 124mr1915258qkg.393.1569271126374; Mon, 23 Sep 2019 13:38:46 -0700 (PDT) MIME-Version: 1.0 References: <20190923175211.2060-1-brgl@bgdev.pl> In-Reply-To: <20190923175211.2060-1-brgl@bgdev.pl> From: Rob Herring Date: Mon, 23 Sep 2019 15:38:35 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] dt-bindings: at24: convert the binding document to yaml To: Bartosz Golaszewski Cc: Mark Rutland , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Linux I2C , Bartosz Golaszewski 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 Mon, Sep 23, 2019 at 12:52 PM Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > Convert the binding document for at24 EEPROMs from txt to yaml. The > compatible property uses a regex pattern to address all the possible > combinations of "vendor,model" strings. > > Signed-off-by: Bartosz Golaszewski > --- > .../devicetree/bindings/eeprom/at24.txt | 90 +-------------- > .../devicetree/bindings/eeprom/at24.yaml | 107 ++++++++++++++++++ > MAINTAINERS | 2 +- > 3 files changed, 109 insertions(+), 90 deletions(-) > create mode 100644 Documentation/devicetree/bindings/eeprom/at24.yaml [...] > diff --git a/Documentation/devicetree/bindings/eeprom/at24.yaml b/Documentation/devicetree/bindings/eeprom/at24.yaml > new file mode 100644 > index 000000000000..28c8b068c8a1 > --- /dev/null > +++ b/Documentation/devicetree/bindings/eeprom/at24.yaml > @@ -0,0 +1,107 @@ > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright 2019 BayLibre SAS > +%YAML 1.2 > +--- > +$id: "http://devicetree.org/schemas/eeprom/at24.yaml#" > +$schema: "http://devicetree.org/meta-schemas/core.yaml#" > + > +title: I2C EEPROMs compatible with Atmel's AT24 > + > +maintainers: > + - Bartosz Golaszewski > + > +properties: > + compatible: Did you run this thru 'make dt_bindings_check' and is dt-schema up to date? I don't think it will pass and if it does I want to fix that. > + additionalItems: true We pretty much never allow this. > + maxItems: 2 This applies to arrays... > + pattern: "^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),24(c|cs|mac)[0-9]+$" And this to strings which is non-sense. What you want is something like this: minItems: 1 maxItems: 2 items: - pattern: "^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),24(c|cs|mac)[0-9]+$" - pattern: "^atmel,24(c|cs|mac)[0-9]+$" This would allow 'atmel' twice, but entries have to be unique already. It doesn't enforce the part numbers matching though. For that, you'd need either a bunch of these under a oneOf instead: items: - pattern: "^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),24c00$" - const: atmel,24c00 Or just add this to the above with an 'allOf': items: pattern: "(c00|c01|mac402|...)$" Note the lack of '-' under items. That means the schema applies to all entries. > + oneOf: > + - const: nxp,se97b > + - const: renesas,r1ex24002 > + - const: renesas,r1ex24016 > + - const: renesas,r1ex24128 > + - const: rohm,br24t01 For this part, you probably want: oneOf: - items: - const: nxp,se97b - const: atmel,24c02 - items: ... And for the spd cases... > + contains: > + enum: allOf: - oneOf: # all the above stuff - contains: enum: > + - atmel,24c00 > + - atmel,24c01 > + - atmel,24cs01 > + - atmel,24c02 > + - atmel,24cs02 > + - atmel,24mac402 > + - atmel,24mac602 > + - atmel,spd > + - atmel,24c04 > + - atmel,24cs04 > + - atmel,24c08 > + - atmel,24cs08 > + - atmel,24c16 > + - atmel,24cs16 > + - atmel,24c32 > + - atmel,24cs32 > + - atmel,24c64 > + - atmel,24cs64 > + - atmel,24c128 > + - atmel,24c256 > + - atmel,24c512 > + - atmel,24c1024 > + - atmel,24c2048 > + > + reg: > + description: > + The I2C slave address of the EEPROM. > + maxItems: 1 > + > + pagesize: > + description: > + The length of the pagesize for writing. Please consult the > + manual of your device, that value varies a lot. A wrong value > + may result in data loss! If not specified, a safety value of > + '1' is used which will be very slow. > + type: integer Other than boolean, you need to reference a type in types.yaml. Does it really vary too much to list out possible values? > + > + read-only: > + description: > + This parameterless property disables writes to the eeprom. > + type: boolean > + > + size: > + description: > + Total eeprom size in bytes. > + type: integer > + > + no-read-rollover: > + description: > + This parameterless property indicates that the multi-address > + eeprom does not automatically roll over reads to the next slave > + address. Please consult the manual of your device. > + type: boolean > + > + wp-gpios: > + description: > + GPIO to which the write-protect pin of the chip is connected. > + maxItems: 1 > + > + address-width: > + description: > + Number of address bits (one of 8, 16). Sounds like a constraint... > + type: integer > + > + num-addresses: > + description: > + Total number of i2c slave addresses this device takes. 2^32 addresses okay? > + type: integer > + > +required: > + - compatible > + - reg > + > +examples: > + - | > + eeprom@52 { > + compatible = "microchip,24c32", "atmel,24c32"; > + reg = <0x52>; > + pagesize = <32>; > + wp-gpios = <&gpio1 3 0>; > + num-addresses = <8>; > + }; > diff --git a/MAINTAINERS b/MAINTAINERS > index a400af0501c9..3c7ced686966 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -2698,7 +2698,7 @@ M: Bartosz Golaszewski > L: linux-i2c@vger.kernel.org > T: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git > S: Maintained > -F: Documentation/devicetree/bindings/eeprom/at24.txt > +F: Documentation/devicetree/bindings/eeprom/at24.yaml > F: drivers/misc/eeprom/at24.c > > ATA OVER ETHERNET (AOE) DRIVER > -- > 2.23.0 >