Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1407960ybn; Wed, 25 Sep 2019 17:57:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiODoLmTi62nU9+RTJ/h11C4XreeQ92qlRbHV9WJYrAOhcc8sxLAevnE5IJSDXC1DOcMIj X-Received: by 2002:a50:a557:: with SMTP id z23mr850483edb.99.1569459429317; Wed, 25 Sep 2019 17:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569459429; cv=none; d=google.com; s=arc-20160816; b=fvmTmmqpGZndWfTxs2/yVWz8CdVJaF6+pCtXNfu26MaGJaD57j9qBJwhx42X2eiYIy SfSSODFPvBgc4TCFcsQ8w+hoQdK9tGU1SmDRv3mtPD0CDRzbna7gttW8XChpXu4tQcF8 s1i+PUyhcqXOk5Bm0rUggxQQ54p8IU6HPCt44v5oGv9/7xCPK1ZT/bpLlTSZeBttHUjh p/+QcqaUvr1ziIYaZRyfb/h5xo9BOpctvsVMSbV/SajUMdoc5wvGddDrTsOE8XcViBW+ SUpk5dUao8/5tiTjqtZXnWRD0671KlCdE3Yr9J6ooOWiFjQkehb/43IFvdxTpbZFG+Oo WrfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=t63WI6jnEVUeiSnM61KUP9eWloPNpDRUCDwDuMDDoVg=; b=Rv1zfIX98w0o/uTUhLLK7ROsTyBqpXOhiRs2XCQ89UNR/TDOhRlLlkt85UbkS1YHg0 mvIfwebnh4masIz913woOYF9tCOZJS72uvNMtxeko6lAhTRkIeAZ3W9A262XDFaY6QAG KA9SiYymDSJQ4YYHJ1FBUI7UwMH3jArc8UlFLiQeQfqGiZv4nGfrrlde8IlPXpI6E3yC xehEmBNE7ht9K8mMx7BJMmX7wcgNH2dlqhIf3tWtW5ttwKba6Yd8HHf8Z5h9fDoxar7O KjucnKJ7b1ANhny3atI9cKlIE/iJTFKCJ40AMfhDRRMarlVQZ04tuhIEBKprQhXWeOmI FdGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=098imhfX; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gh2si242413ejb.330.2019.09.25.17.56.46; Wed, 25 Sep 2019 17:57:09 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=098imhfX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504131AbfIXJUx (ORCPT + 99 others); Tue, 24 Sep 2019 05:20:53 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:36497 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405138AbfIXJUw (ORCPT ); Tue, 24 Sep 2019 05:20:52 -0400 Received: by mail-oi1-f195.google.com with SMTP id k20so1011331oih.3 for ; Tue, 24 Sep 2019 02:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=t63WI6jnEVUeiSnM61KUP9eWloPNpDRUCDwDuMDDoVg=; b=098imhfXUnWyUFSKUmzK25160O/img3eT5gYzMnSulDsq5DpyYfnq0WE8Mzkwnk/SB b6UE1jvvMPLEeShXakMQBKcKxtkD4r+cdYynG1yrLvpikA9s/3EZqeMYL4nmVn1xoCDK 1KX3ZlcR6pFUIAfqJ8cS8yftBxxG4vuxF3jFfG8pQX89VdmfTaAtGnnVhvmSD8uAUcJC dHSzZtbuoNY4r/a41bQXNNhs8gPGBj4XdZObMZvN8C0iVHBWuQm+DpBdGWuyq+QyPi1Z gAdt92wruxr4QXqO0gkH/gT5lOJqjsHqQ3EFkFtvAky7b/8zK0q8awCRfq54nOefPTdm AXWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=t63WI6jnEVUeiSnM61KUP9eWloPNpDRUCDwDuMDDoVg=; b=EclBwcKn5ryPGeLd8oA7QQxeM8qTyJQTNuMto7chz1Ud27qcTSmS0QG153MrvPUDze RpAtQdAyCrmyS1swj9adfk7wOhwuaGvEUugdva/qE4ncZe23770hwvQIFUGueobnARo0 YI0h8xjXxgPWInE8FF4Uux862uhnzIS9N0qQqwv4nVMP0e4Cvyd4aA4+TGgjKPPDha0A jsWX2ghTa8l7BuGq6kdylRK0V901dudfIwKTotqlbwhPpSq2/xJom8SAXKeS2uwZOlTF UbC8f8XjkFHe70d9Iv49KsyGQfqY+KnujEpb0SjmH+uMMVwlpniqAiMe9VxJolcHU3k8 wDhA== X-Gm-Message-State: APjAAAXFWiscrrLOmAwcun/l1ju283y3HbxMAXhkMvTwsbtqMXOtnF/v PadpuYnbUWI2HTL+lK4PhiKHcMVNAFCrxXXytqc+tuq0 X-Received: by 2002:aca:4406:: with SMTP id r6mr1269018oia.175.1569316849530; Tue, 24 Sep 2019 02:20:49 -0700 (PDT) MIME-Version: 1.0 References: <20190923175211.2060-1-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Tue, 24 Sep 2019 11:20:38 +0200 Message-ID: Subject: Re: [PATCH] dt-bindings: at24: convert the binding document to yaml To: Rob Herring Cc: Bartosz Golaszewski , Mark Rutland , linux-devicetree , "linux-kernel@vger.kernel.org" , Linux I2C Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pon., 23 wrz 2019 o 22:38 Rob Herring napisa=C5=82(a): > > On Mon, Sep 23, 2019 at 12:52 PM Bartosz Golaszewski wrot= e: > > > > 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/Docum= entation/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. > I couldn't get the dt_binding_check target to work, but I ran it through dt-doc-validate directly until it didn't complain. > > + 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 t= his: > > 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),24c= 00$" > - const: atmel,24c00 > > Or just add this to the above with an 'allOf': > > items: > pattern: "(c00|c01|mac402|...)$" > I'm lost here - what do you mean add this to the above with an 'allOf'? I can't really imagine an example for that. > Note the lack of '-' under items. That means the schema applies to all en= tries. > > > + 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: > I'm not sure I follow the entire thing. I'll try to prepare a v2 but I don't really expect it to be right already. > > + - 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? > Nobody is using anything other than 1, 8, 16, 32 and 64, so I guess we can limit ourselves to those for now. > > + > > + 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... Right. > > > + type: integer > > + > > + num-addresses: > > + description: > > + Total number of i2c slave addresses this device takes. > > 2^32 addresses okay? > Nope, I'll fix it. Thanks for the review! Bart > > + type: integer > > + > > +required: > > + - compatible > > + - reg > > + > > +examples: > > + - | > > + eeprom@52 { > > + compatible =3D "microchip,24c32", "atmel,24c32"; > > + reg =3D <0x52>; > > + pagesize =3D <32>; > > + wp-gpios =3D <&gpio1 3 0>; > > + num-addresses =3D <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.gi= t > > 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 > >