Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3850452pxu; Wed, 9 Dec 2020 02:06:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBiW5aLpENOXLgdsieWFvzEjaotmO+b9y2TFITc6SBYXNOIfxgscK8/CsJ9FzDnT8Z9+2A X-Received: by 2002:a05:6402:1748:: with SMTP id v8mr1319372edx.136.1607508402801; Wed, 09 Dec 2020 02:06:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607508402; cv=none; d=google.com; s=arc-20160816; b=LBeU5oUCXkKJFWSe6dLcENoe93OInybShJjb3b0KVpSY6aN/g5vjcD+9LIDcuW3G6C Sh7kk5CZDlzi6ChjVeok5oe0xQLr1IL6mGFM73pQm6GMPhcLf7aQ1J0u5CaSesKUS5D9 z1Nlbk2yWUB8AO3BfmGQOeMukqoQuz8Q7EghMP3i4P/93lvVfIoNvX1VkyEuZUWZ1768 9x3tQ0OKjkwc1AzD02Owdhe48UkAtQWBnIXGfxYYePuH72Y1f2uz017X0RX1CUJz4jzq 4CmIaAeR06yXtfJYVsp0XxQyHQZuaV+E9wiac5VADOgeKu0gF6gRz9bjWU11NEl1PHWZ kMVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=8Y1PdLucYIkCKVYFMjCy954XW6R1LXzP14geS5eN+IA=; b=b+eHswXPyg3AQORQBqgVVDWUivPI5no5VdTWgmysuGmPLDTB+wLtcaP9HpXuVS9kB9 Sq5/F9HuS02T4z6mxa2Cd89NmUjzXOldHXCqQfM4lBzuGjUadzDdU7dKMOH9/ZbvUwHc PJ7g+2OuFNS45rMVOYkPuSIfDJX8zhaX/htW763eEQSYUwF8qX+BtJOp/Um+a7WEqVBy KLGkKgYme8LLquo4OSE0yDu1+6eH18d9t5x1F4biZU99VdqNSmIaInjQhTNbX1wLbklA C7mY6fMpw924YGgDKNe2bPR0W6OveqMK1FZGPDHdP5UkZS20IDiIcOUa/z1tMxGuRE5Z +Evw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r2si590851edx.114.2020.12.09.02.06.20; Wed, 09 Dec 2020 02:06:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729628AbgLIKBB (ORCPT + 99 others); Wed, 9 Dec 2020 05:01:01 -0500 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.51]:8314 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729523AbgLIKBB (ORCPT ); Wed, 9 Dec 2020 05:01:01 -0500 X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMhflhwDubTJ9o1mfYzBGHXH6HGqpg2w=" X-RZG-CLASS-ID: mo00 Received: from iMac.fritz.box by smtp.strato.de (RZmta 47.6.2 DYNA|AUTH) with ESMTPSA id 908871wB99vi5Sm (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Wed, 9 Dec 2020 10:57:44 +0100 (CET) From: "H. Nikolaus Schaller" To: Mark Brown , Rob Herring , linus.walleij@linaro.org Cc: linux-spi@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, kernel@pyra-handheld.com, Maxime Ripard , thesven73@gmail.com, lukas@wunner.de, laurent.pinchart@ideasonboard.com, andreas@kemnade.info, "H. Nikolaus Schaller" Subject: [PATCH] spi: dt-bindings: clarify CS behavior for spi-cs-high and gpio descriptors Date: Wed, 9 Dec 2020 10:57:44 +0100 Message-Id: <3bed61807fff6268789e7d411412fbc5cd6ffe2a.1607507863.git.hns@goldelico.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Behavior of CS signal in combination of spi-cs-high and gpio descriptors is not clearly defined and documented. So clarify the documentation Cc: linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org Signed-off-by: H. Nikolaus Schaller --- .../bindings/spi/spi-controller.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/spi-controller.yaml b/Documentation/devicetree/bindings/spi/spi-controller.yaml index 1b56d5e40f1fc..5f505810104dd 100644 --- a/Documentation/devicetree/bindings/spi/spi-controller.yaml +++ b/Documentation/devicetree/bindings/spi/spi-controller.yaml @@ -42,6 +42,33 @@ properties: cs2 : &gpio1 1 0 cs3 : &gpio1 2 0 + The second flag of a gpio descriptor can be GPIO_ACTIVE_HIGH (0) + or GPIO_ACTIVE_LOW(1). Legacy device trees often use 0. + + There is a special rule set for combining the second flag of an + cs-gpio with the optional spi-cs-high flag for SPI slaves. + + Each table entry defines how the CS pin is to be physically + driven (not considering potential gpio inversions by pinmux): + + device node | cs-gpio | CS pin state active | Note + ================+===============+=====================+===== + spi-cs-high | - | H | + - | - | L | + spi-cs-high | ACTIVE_HIGH | H | + - | ACTIVE_HIGH | L | 1 + spi-cs-high | ACTIVE_LOW | H | 2 + - | ACTIVE_LOW | L | + + Notes: + 1) Should print a warning about polarity inversion. + Here it would be wise to avoid and define the gpio as + ACTIVE_LOW. + 2) Should print a warning about polarity inversion + because ACTIVE_LOW is overridden by spi-cs-high. + Should be generally avoided and be replaced by + spi-cs-high + ACTIVE_HIGH. + num-cs: $ref: /schemas/types.yaml#/definitions/uint32 description: -- 2.26.2