From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 99E69C38145 for ; Thu, 8 Sep 2022 15:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NVSL5n2vT+VsfHF/JfaMx+pcAaa9W7YwAG76EoSkI7o=; b=FWVKrdHcZWgmlx yyiWh28ghegPPlNaXIK6sf1DzyDkGIcwxUSrbE0Nz3OK9IeeydwMTfUv4wHlKdongWecRAhwPNldW h9cujJ3lgvfAFT5oezlaQ8tE8Wa8gjQUegcc3zx964bDUExc0rmiyp9ew5u4PXktkQV8GL4Twgry+ sSxDK0qE3u7fKjCIz2Z3NUqVnbWozc6e+4nRuCWFbtXLReuegfq1rgfj6CQUNjEEO9ueunKYkDOe0 wPZo+2Q/DVPAXOm9Ph+n618iVlzF73e1/ClW8ErSSeWAD6oLTH9GJOL4MTotS8TuOeKHIk6y9Bk+w h5wdSKiNRlORczMjBb5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oWJMY-0059fg-VW; Thu, 08 Sep 2022 15:22:44 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oWJAd-0054bX-NO for linux-arm-kernel@lists.infradead.org; Thu, 08 Sep 2022 15:10:25 +0000 Received: by mail-lf1-x129.google.com with SMTP id k10so13629570lfm.4 for ; Thu, 08 Sep 2022 08:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=5nfFIngu44pae0WCPcM9HQdcNod8T/OMsQbWWVXDqBo=; b=LpM3YfC1fmIAQHVaXCX9t/gf9W/yDctvTi9sGXLM0KZtsTeRFtfSYa0I+lVOn77RZG gfzpsFmshBRPGemal9JP8/hOz9uhDZK7PZbPVmfkyMH6ujA4/HPnp4dyVPodGiK17X7n /OgBw/FsLG5qhSW7iffykKunHEEWz+owJsX6aT7Bu7a+g7DFx1K3mRGRJfSV+l8Vs4A3 MmWXafVDRzF/+E0ntAcuuaRVZ0BF4OPx032SZfLnno9qPKtWXjRHdda2FlHPyCRVqjxb f/m+QK5eXftPOazJbg8mmMjnxKysa5jz7BNvgAjm/tkGj8LtMDWqOxZwUPUGMLMWQUa2 wpyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=5nfFIngu44pae0WCPcM9HQdcNod8T/OMsQbWWVXDqBo=; b=7tyYAuc60p0SlFhWu4jR446DLBPhHayEH8FhRBJvJUZq8WyerJTDkkKfd76mAYSkcZ LiiQQzXDidYQrw5131iMvYjHK3zsHYXdgoEaRRVy405kunx+TCLefTYOZcdJtWW4wCRD Uv6BAkpGcR3EabfJC/V7eKYDUVBwzFIB13HNlWt2+kwGOzC8nxg/EDCLN5yne1mrRlo2 d9FmvkD7kyRHvyKbInzHyZyKce/KUHJnS2x/oNFHZkBhI4DQSQU00pCIE3e0U2VZIe1a ikG4yL95AUmcjNF/N92R8oAu+BGrNlcqbsUGgVPjNpoImy/zcxTkS5V0NIYVhN/X2MDK atiw== X-Gm-Message-State: ACgBeo2LBQmNz+Xub78DuJLrpKYX8/fq7XIuSxsxMbFxwLtVnScymdQh cpKYgSxM1HH4rL5fLq3od0Aorw== X-Google-Smtp-Source: AA6agR7mH7tBvCONHwd5zeSS7p8UBOMCrjw3/bIV+uQT7ic1vLgbCVloBrxwXFxi0Pxd+glXTXPrRg== X-Received: by 2002:a19:2d5c:0:b0:498:3e16:b3fc with SMTP id t28-20020a192d5c000000b004983e16b3fcmr1346131lft.498.1662649819860; Thu, 08 Sep 2022 08:10:19 -0700 (PDT) Received: from [192.168.0.21] (78-11-189-27.static.ip.netia.com.pl. [78.11.189.27]) by smtp.gmail.com with ESMTPSA id f11-20020a056512092b00b00497b198987bsm546555lft.26.2022.09.08.08.10.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Sep 2022 08:10:19 -0700 (PDT) Message-ID: <1d3904d9-7fec-2e61-f999-61b89c4becb6@linaro.org> Date: Thu, 8 Sep 2022 17:10:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH v2 05/13] dt-bindings: serial: atmel,at91-usart: convert to json-schema Content-Language: en-US To: Sergiu.Moga@microchip.com, lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, Nicolas.Ferre@microchip.com, alexandre.belloni@bootlin.com, Claudiu.Beznea@microchip.com, richard.genoud@gmail.com, radu_nicolae.pirea@upb.ro, gregkh@linuxfoundation.org, broonie@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, jirislaby@kernel.org, admin@hifiphile.com, Kavyasree.Kotagiri@microchip.com, Tudor.Ambarus@microchip.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org, linux-clk@vger.kernel.org References: <20220906135511.144725-1-sergiu.moga@microchip.com> <20220906135511.144725-6-sergiu.moga@microchip.com> From: Krzysztof Kozlowski In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220908_081023_882328_271400F9 X-CRM114-Status: GOOD ( 20.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 08/09/2022 17:06, Sergiu.Moga@microchip.com wrote: > On 08.09.2022 15:29, Krzysztof Kozlowski wrote: >>> +required: >>> + - compatible >>> + - reg >>> + - interrupts >>> + - clock-names >>> + - clocks >>> + >>> +allOf: >>> + - if: >>> + properties: >>> + $nodename: >>> + pattern: "^serial@[0-9a-f]+$" >> >> You should rather check value of atmel,usart-mode, because now you won't >> properly match device nodes called "foobar". Since usart-mode has only >> two possible values, this will nicely simplify you if-else. >> >> > > > I did think of that but the previous binding specifies that > atmel,usart-mode is required only for the SPI mode and it is optional > for the USART mode. That is why I went for the node's regex since I > thought it is something that both nodes would have. I think it should be explicit - you configure node either to this or that, so the property should be always present. The node name should not be responsible for it, even though we want node names to match certain patterns. > > >>> + then: >>> + allOf: >>> + - $ref: /schemas/serial/serial.yaml# >>> + - $ref: /schemas/serial/rs485.yaml# >>> + >>> + properties: >>> + atmel,use-dma-rx: >>> + type: boolean >>> + description: use of PDC or DMA for receiving data >>> + >>> + atmel,use-dma-tx: >>> + type: boolean >>> + description: use of PDC or DMA for transmitting data >>> + >>> + atmel,fifo-size: >>> + $ref: /schemas/types.yaml#/definitions/uint32 >>> + description: >>> + Maximum number of data the RX and TX FIFOs can store for FIFO >>> + capable USARTS. >>> + enum: [ 16, 32 ] >> >> I did not mention it last time, but I think it should follow generic >> practice, so define all properties top-level and disallow them for other >> type. This allows you to simply use additionalProperties:false at the end. >> > > > What would be a good example binding in this case? The example binding. https://elixir.bootlin.com/linux/v5.19/source/Documentation/devicetree/bindings/example-schema.yaml#L212 > > >>> + >>> + else: >>> + if: >>> + properties: >>> + $nodename: >>> + pattern: "^spi@[0-9a-f]+$" >>> + then: >>> + allOf: >>> + - $ref: /schemas/spi/spi-controller.yaml# >>> + >>> + properties: >>> + atmel,usart-mode: >>> + const: 1 >>> + >>> + "#size-cells": >>> + const: 0 >>> + >>> + "#address-cells": >>> + const: 1 >> >> The same - top level and disallow them for uart. >> > > > These values of #size-cells and #address-cells are only meant for the > SPI so I guess I would still have to specify their mandatory const > values here. Sure, ok. > > >>> + >>> + required: >>> + - atmel,usart-mode >>> + - "#size-cells" >>> + - "#address-cells" >> >> End else in this branch is what? >> > > > You are right, I will remove the useless if: after else: Best regards, Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel