From patchwork Tue Mar 3 09:45:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11417515 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB49417E0 for ; Tue, 3 Mar 2020 09:45:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B53BC208C3 for ; Tue, 3 Mar 2020 09:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727837AbgCCJpa (ORCPT ); Tue, 3 Mar 2020 04:45:30 -0500 Received: from xavier.telenet-ops.be ([195.130.132.52]:52824 "EHLO xavier.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727830AbgCCJpa (ORCPT ); Tue, 3 Mar 2020 04:45:30 -0500 Received: from ramsan ([84.195.182.253]) by xavier.telenet-ops.be with bizsmtp id 9llT2200a5USYZQ01llTh5; Tue, 03 Mar 2020 10:45:28 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1j947D-0006hy-RK; Tue, 03 Mar 2020 10:45:27 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1j947D-00062h-P6; Tue, 03 Mar 2020 10:45:27 +0100 From: Geert Uytterhoeven To: Mark Brown , Rob Herring , Maxime Ripard Cc: Yoshihiro Shimoda , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 1/2] spi: dt-bindings: spi-controller: Fix #address-cells for slave mode Date: Tue, 3 Mar 2020 10:45:21 +0100 Message-Id: <20200303094522.23180-2-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200303094522.23180-1-geert+renesas@glider.be> References: <20200303094522.23180-1-geert+renesas@glider.be> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Currently, the DT bindings for an SPI controller specify that "#address-cells" must be fixed to one. However, that applies to an SPI controller in master mode only. When running in SPI slave mode, "#address-cells" should be zero. Fix this making the value of "#address-cells" dependent on the presence of "spi-slave". Fixes: 0a1b929356830257 ("spi: Add YAML schemas for the generic SPI options") Reported-by: Yoshihiro Shimoda Signed-off-by: Geert Uytterhoeven --- v2: - Use "enum: [0, 1]" instead of min/max limit, - use "- spi-slave" instead of "[ spi-slave ]". As of dtc commit 403cc79f06a135ae ("checks: Update SPI bus check for 'spi-slave'") and Linux commit c2e7075ca8303631 ("scripts/dtc: Update to upstream version v1.4.7-57-gf267e674d145"), dtc knows about SPI slave. However, when using "#address-cells = <0>" with W=1: Warning (avoid_unnecessary_addr_size): /soc/spi@e6e10000: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property Just removing #address-cells (using /delete-property/ in the board DTS) to fix this warning causes: Warning (spi_bus_bridge): /soc/spi@e6e10000: incorrect #address-cells for SPI bus as spi_bus_bridge() uses node_addr_cells(), which defaults to 2 (due to dtc's ppc64 heritage? But node_size_cells() defaults to 1, not 2?). How should this be fixed? Should "#address-cells = <0>" be left out or not? Should node_{addr,size}_cells() in dtc default to zero? Thanks! --- .../devicetree/bindings/spi/spi-controller.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/spi-controller.yaml b/Documentation/devicetree/bindings/spi/spi-controller.yaml index 1e0ca6ccf64bbd0a..401d41a97562dc8d 100644 --- a/Documentation/devicetree/bindings/spi/spi-controller.yaml +++ b/Documentation/devicetree/bindings/spi/spi-controller.yaml @@ -20,7 +20,7 @@ properties: pattern: "^spi(@.*|-[0-9a-f])*$" "#address-cells": - const: 1 + enum: [0, 1] "#size-cells": const: 0 @@ -52,6 +52,18 @@ properties: description: The SPI controller acts as a slave, instead of a master. +if: + required: + - spi-slave +then: + properties: + "#address-cells": + const: 0 +else: + properties: + "#address-cells": + const: 1 + patternProperties: "^slave$": type: object From patchwork Tue Mar 3 09:45:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11417517 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 006631820 for ; Tue, 3 Mar 2020 09:45:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D501B21775 for ; Tue, 3 Mar 2020 09:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727846AbgCCJpa (ORCPT ); Tue, 3 Mar 2020 04:45:30 -0500 Received: from xavier.telenet-ops.be ([195.130.132.52]:52710 "EHLO xavier.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727824AbgCCJp3 (ORCPT ); Tue, 3 Mar 2020 04:45:29 -0500 Received: from ramsan ([84.195.182.253]) by xavier.telenet-ops.be with bizsmtp id 9llT2200b5USYZQ01llTh7; Tue, 03 Mar 2020 10:45:28 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1j947D-0006hz-Ro; Tue, 03 Mar 2020 10:45:27 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1j947D-00062j-QM; Tue, 03 Mar 2020 10:45:27 +0100 From: Geert Uytterhoeven To: Mark Brown , Rob Herring , Maxime Ripard Cc: Yoshihiro Shimoda , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 2/2] spi: dt-bindings: spi-controller: Fix spi-[rt]x-bus-width for slave mode Date: Tue, 3 Mar 2020 10:45:22 +0100 Message-Id: <20200303094522.23180-3-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200303094522.23180-1-geert+renesas@glider.be> References: <20200303094522.23180-1-geert+renesas@glider.be> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The descriptions for the spi-rx-bus-width and spi-tx-bus-width properties refer to "MISO" and "MOSI", which are not explained in the document. While these abbreviations are fairly common when talking about SPI, and thus may not need an explanation, they are not entirely correct in this context, as the SPI controller may be used in slave mode instead of master mode. Fix this by replacing them by "read transfers" resp. "write transfers", like is done for the spi-rx-delay-us and spi-tx-delay-us properties. Signed-off-by: Geert Uytterhoeven --- v2: - New. This issue was present in the .txt version of the bindings, too, so technically it needs Fixes: a8830cb19cfea04e ("spi: Document DT bindings for SPI controllers in slave mode") but of course it won't apply to that version. --- Documentation/devicetree/bindings/spi/spi-controller.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/spi-controller.yaml b/Documentation/devicetree/bindings/spi/spi-controller.yaml index 401d41a97562dc8d..a07819f4efeb9dfe 100644 --- a/Documentation/devicetree/bindings/spi/spi-controller.yaml +++ b/Documentation/devicetree/bindings/spi/spi-controller.yaml @@ -126,7 +126,7 @@ patternProperties: - enum: [ 1, 2, 4, 8 ] - default: 1 description: - Bus width to the SPI bus used for MISO. + Bus width to the SPI bus used for read transfers. spi-rx-delay-us: description: @@ -138,7 +138,7 @@ patternProperties: - enum: [ 1, 2, 4, 8 ] - default: 1 description: - Bus width to the SPI bus used for MOSI. + Bus width to the SPI bus used for write transfers. spi-tx-delay-us: description: