From patchwork Sun Sep 17 09:39:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 112828 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2503941qgf; Sun, 17 Sep 2017 02:40:18 -0700 (PDT) X-Received: by 10.99.122.22 with SMTP id v22mr28454198pgc.394.1505641218455; Sun, 17 Sep 2017 02:40:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505641218; cv=none; d=google.com; s=arc-20160816; b=MrOU+EzAWdn/0s4HRrR+MzAiMAU9/hGUSW31EUc6Seb9CbEbvA4zM5j+XgAXSmu8o2 Qhkcecn/0ZywMMUnAW+XuJ1jjG4c9mZGygoYVinbJi2FpiR6+EMhDThMmDN7UegX5Fp8 hO3Cm9c4GQi9Oj8bUCHgtMZQVsLGS9WmP8LO7LWDX2P54c75fNYR+Ym2ayXUAvayMjWA nOQtvykQl2AfpIFgGSrzELAEWmN6U8uxoutiqdZkFH/U9Ea2/Geu0E5uw52JVWBh6bOO iHr67uICYgjr1GFn3QnVNGTqa2MnLMYM7RjU2PgP2Mo+xNKPmms47XOLE2SFq+9sySRW RjKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=0rwmaFWCVjR2ecIms+PhYhI5NIzaRZkw8Y9tWYBWa3k=; b=rNxjuqBQbmEcpDJ2Guc607GRBFARprFBNe9OIiqZ9+6dSt3rCpDELyrltSZkHhbKc4 MQmj5mz0rtEwT/Hj8ZZkAEoz7D/Ph50yJ3s98zft05YNHRcvdWzcF6i5DVqALzCh6II6 lXoUGwKtpyl3nHa4jqqofLnCJfWNkc6L5Lz1xmwYb3v/++YhE+7aax/yf2dHF5OvQzIO sjGgymfl8cIK4FDrquCF4w00d2/b5vaS2Q7BO/OBo6DtuQGX3S/oESwlhwYYnsFLLLM1 VXn6N4xsUtVr5j4gYw1BALGKrUjZZPFWXgEG6ObWuCuAbX7An87VD80ysiXHhzjR2tx8 YMYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EJcODZSd; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8si3374838plz.730.2017.09.17.02.40.18; Sun, 17 Sep 2017 02:40:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EJcODZSd; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751300AbdIQJkR (ORCPT + 6 others); Sun, 17 Sep 2017 05:40:17 -0400 Received: from mail-lf0-f50.google.com ([209.85.215.50]:45745 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750862AbdIQJkQ (ORCPT ); Sun, 17 Sep 2017 05:40:16 -0400 Received: by mail-lf0-f50.google.com with SMTP id d17so5589706lfe.2 for ; Sun, 17 Sep 2017 02:40:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gCUiTTfNN4A0Ks5ICP11L6908VWob6q3aNpZBxzMr2o=; b=EJcODZSdpg3anuolr3cBANwdDM8I3E5iGHNAV6io8KZ76ctPs1N8pDHUd5hSGKBLmS PWtS4Z0u2rQ02mW/KebTOT15ijAUtZAR325dmSS6xwD2tQcKoSAwgvypytV92QiQmxTf dG62zACB18ekGsRb0Lruib8UTN498A80hzV68= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gCUiTTfNN4A0Ks5ICP11L6908VWob6q3aNpZBxzMr2o=; b=MdRb3Z2daIQHd0L0dbOQAtwv6pEwWtDJ6dlj014XysCy/Ddcs1ok2dliF8lJcC24eU uPNYdMZhe/b9iqerxr96nBhZFdF+x5x9y7CYthfH8k6gV4fejoPPqep4zRLeWq54TyvR cGMxHTb5cxrjW0/s2Ht8VjG5UiMb6dszLH3qhS95wyufgMdpXzI74JQY+8sZzPtQZ3YF xD/qvGZhRZ439RJ4U5lhxhJCqGiQBdlMWIji5p0ZJX3Np4UvhkK97rGCklRck1qOFvxR ySRyG2wbhYlam1wihV2e34EEuDuyWhDX7oWm1c0eyyfqia2Fx4oxZVDWSQmvKM6l5aLH BJeA== X-Gm-Message-State: AHPjjUjFXkxRFR3fk0JJmjDB5aLvi4w1p/4mp8gwtS8fvSWpM6XzBUu9 ufRO4ib0OhOWUwod X-Google-Smtp-Source: AOwi7QDWbRvs7Toyp6taphGqkvNt0d7MrNzgbP/livSNkIwozyUchtApTPh4f+O29jWcgjEgCNNigg== X-Received: by 10.25.217.213 with SMTP id s82mr2511208lfi.176.1505641214477; Sun, 17 Sep 2017 02:40:14 -0700 (PDT) Received: from fabina.bredbandsbolaget.se (c-2209e055.014-348-6c756e10.cust.bredbandsbolaget.se. [85.224.9.34]) by smtp.gmail.com with ESMTPSA id t84sm974559lfi.21.2017.09.17.02.40.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Sep 2017 02:40:13 -0700 (PDT) From: Linus Walleij To: Wolfram Sang , linux-i2c@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org, adi-buildroot-devel@lists.sourceforge.net, Geert Uytterhoeven , geert.renesas@glider.be, devicetree@vger.kernel.org, Geert Uytterhoeven , Linus Walleij Subject: [PATCH 6/7] dt-bindings: i2c: i2c-gpio: Add support for named gpios Date: Sun, 17 Sep 2017 11:39:05 +0200 Message-Id: <20170917093906.16325-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170917093906.16325-1-linus.walleij@linaro.org> References: <20170917093906.16325-1-linus.walleij@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Geert Uytterhoeven The current i2c-gpio DT bindings use a single unnamed "gpios" property to refer to the SDA and SCL signal lines by index. This is error-prone for the casual DT writer and reviewer, as one has to look up the order in the DT bindings. Fix this by amending the DT bindings to use two separate named gpios properties, and deprecate the old unnamed variant. Take this opportunity to clearly deprecate the "i2c-gpio,sda-open-drain" and "i2c-gpio,scl-open-drain" flags as well. The commit describes in detail what these flags actually mean, and why they should not be used in new device trees. Cc: devicetree@vger.kernel.org Signed-off-by: Geert Uytterhoeven [Augmented to what I and Rob would like] Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Create a special section for the deprecated bindings - Also deprecate the open drain bool properties - Update the example to use the new style of bindings --- Documentation/devicetree/bindings/i2c/i2c-gpio.txt | 32 ++++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) -- 2.13.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/i2c/i2c-gpio.txt b/Documentation/devicetree/bindings/i2c/i2c-gpio.txt index 4f8ec947c6bd..38a05562d1d2 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-gpio.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-gpio.txt @@ -2,25 +2,39 @@ Device-Tree bindings for i2c gpio driver Required properties: - compatible = "i2c-gpio"; - - gpios: sda and scl gpio - + - sda-gpios: gpio used for the sda signal, this should be flagged as + active high using open drain with (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) + from since the signal is by definition + open drain. + - scl-gpios: gpio used for the scl signal, this should be flagged as + active high using open drain with (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) + from since the signal is by definition + open drain. Optional properties: - - i2c-gpio,sda-open-drain: sda as open drain - - i2c-gpio,scl-open-drain: scl as open drain - i2c-gpio,scl-output-only: scl as output only - i2c-gpio,delay-us: delay between GPIO operations (may depend on each platform) - i2c-gpio,timeout-ms: timeout to get data +Deprecated properties, do not use in new device tree sources: + - gpios: sda and scl gpio, alternative for {sda,scl}-gpios + - i2c-gpio,sda-open-drain: this means that something outside of our + control has put the GPIO line used for SDA into open drain mode, and + that something is not the GPIO chip. It is essentially an + inconsistency flag. + - i2c-gpio,scl-open-drain: this means that something outside of our + control has put the GPIO line used for SCL into open drain mode, and + that something is not the GPIO chip. It is essentially an + inconsistency flag. + Example nodes: +#include + i2c@0 { compatible = "i2c-gpio"; - gpios = <&pioA 23 0 /* sda */ - &pioA 24 0 /* scl */ - >; - i2c-gpio,sda-open-drain; - i2c-gpio,scl-open-drain; + sda-gpios = <&pioA 23 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + scl-gpios = <&pioA 24 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; i2c-gpio,delay-us = <2>; /* ~100 kHz */ #address-cells = <1>; #size-cells = <0>;