From patchwork Thu Oct 5 11:03:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 114917 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp456187qgn; Thu, 5 Oct 2017 04:03:46 -0700 (PDT) X-Received: by 10.98.190.16 with SMTP id l16mr7823121pff.124.1507201426130; Thu, 05 Oct 2017 04:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507201426; cv=none; d=google.com; s=arc-20160816; b=hnOFunqSDBxWSPOwsjjgIPGb36Q1X16xGjaDlvKLWX7ps5yXZflWG3uRD85PzPx9Br 1CewU4ztElrIUSoyLDZYUC4VwoEh/HyhJ1t9YnraU68kd57Ii5CMUEsIuS728jrZZn+U jncwgx0wRygWq4A1IbKWB8zhzVU/Rh1jXbdSgxUgsXk9WkMmg5+EN1zRtikLniRYWLc2 gkqUPgjXWF8rR+XaXGYdNv6um+k0e743Bgg+k6d4bKxPhnX5Gg1uOBxowKoyzO7bU81Q ylkeGyU9I4Y84nuPDLPdpm2EpFOsBq+tRyxxzHywrjEhDnGMvYSG4KojX/X+o1Wp8/m5 fUtQ== 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=pbg0k0B/jC+rcD97eGnTP9F27HsFO5mXPA6XYXAvpZI=; b=tQQvVVXA+mm+q2He7n9TyBv0HUSKYcDHv4dlWDXUT4ITNbIbqZ05KJLSGUaXym8UJA B9xPLtffyrnU/5ua2wKsgjRdRQ9ckc/cf/VDEmy04D7uEPUq4qpeAHckW1zDMJ/q0YKh GuzpgvMdRVtxU62PAz7BYGz2X+Nf/Q8MAeDNJfTNZLzSjwg+ZEscMNnqWH2kmybFdFkv Nz6FRwD3ccocWhpKWbFe6TeSqd3BlPNKmZ9rJWa42IAgG6qGbTY68T28K8sLRaH7SGcO C6N+XkCnB247LEMKNB+kxd8KRaDYMaLwtlDidYCw36LV7mKF2I46p5lqrQwm0PagAWY2 R64w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=InTZsU9n; 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 y10si1686719plk.155.2017.10.05.04.03.45; Thu, 05 Oct 2017 04:03:46 -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=InTZsU9n; 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 S1751916AbdJELDp (ORCPT + 6 others); Thu, 5 Oct 2017 07:03:45 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:48515 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751908AbdJELDo (ORCPT ); Thu, 5 Oct 2017 07:03:44 -0400 Received: by mail-wm0-f49.google.com with SMTP id i124so1360167wmf.3 for ; Thu, 05 Oct 2017 04:03:43 -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=TUusIrkqhskclkqhhrkA+8LFd4jSyhgwBXoWkzCx28Q=; b=InTZsU9nspn1JUymWh7WHFCuKGcHCR5Uk2inPE5k8nRnVWblAs4Yy0/f1LieavH/jk L5ZGqyuwPT1RBhFhA8IQCh3BOb+5EXSJ4i6ufneogZX/vGQFi7c9VveEoaQsloFXxhY1 YU+T3Pr/X5i3d/VYYr2UIjz+lSIgCzvq23vmE= 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=TUusIrkqhskclkqhhrkA+8LFd4jSyhgwBXoWkzCx28Q=; b=M2WSsigAgXax4q7PDD3MdgNEKRP0mDlpsDsmRWqubLaSn286i9UiPJNiAS0bX5UHc1 n75W5HMPZo9nZkFHZbMREHrdXOluS+phacOXq+C+kFuVLHal5u/cBvtV9YOhV3A99776 Eerulms66PhjBCI3FYrGcA95IHBjP3/1Wwpk+pEj3jMvMKQeAk5HOk6vviWEwSYEV+2v vhnHU2p21nO+g578/GDSuVIWXngwfgge225Lsx8CT1b/iHmWgx+XhPIX4TjpqPGvPonI oiKz8IX6cawvnrPzyT0EHkLfIa469a6s+3dr6QM1J3Z2dGyGS+83bcqdzfwUtK9AzRwA 93iw== X-Gm-Message-State: AHPjjUiDNNBZRhWuAoj64+6SC6pwWAAXMcp0Qvh9F+/7vL+UrIMXUPwB j2yGBGWzYUUUIeEvbVErFbAWVA== X-Google-Smtp-Source: AOwi7QDwuNeEmpslyBhXVTKTXsn6o6JmbNlTmhw2x+PKikWP4hgp4liJ6XxsGKoP55+YnnorqmVUCg== X-Received: by 10.28.36.212 with SMTP id k203mr16457467wmk.127.1507201422891; Thu, 05 Oct 2017 04:03:42 -0700 (PDT) Received: from genomnajs.local (catv-80-98-18-187.catv.broadband.hu. [80.98.18.187]) by smtp.gmail.com with ESMTPSA id e134sm17336478wma.31.2017.10.05.04.03.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Oct 2017 04:03:42 -0700 (PDT) From: Linus Walleij To: Wolfram Sang , linux-i2c@vger.kernel.org Cc: Geert Uytterhoeven , devicetree@vger.kernel.org, Linus Walleij Subject: [PATCH 6/7 v3] dt-bindings: i2c: i2c-gpio: Add support for named gpios Date: Thu, 5 Oct 2017 13:03:09 +0200 Message-Id: <20171005110310.5900-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20171005110310.5900-1-linus.walleij@linaro.org> References: <20171005110310.5900-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] Tested-by: Geert Uytterhoeven Acked-by: Rob Herring Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Collect Rob's ACK. 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>;