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 X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED92AC433E0 for ; Fri, 19 Jun 2020 14:19:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA6D820776 for ; Fri, 19 Jun 2020 14:19:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="yjDXen20" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733038AbgFSOTq (ORCPT ); Fri, 19 Jun 2020 10:19:46 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:61027 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbgFSOTj (ORCPT ); Fri, 19 Jun 2020 10:19:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1592576378; x=1624112378; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ros1udrNYa0R2yOGLKL28tb4ZWwAiFbhELcD5GmGfWE=; b=yjDXen20OXBWKc7tF8sZSdfLIc9BFGGTBlmMG4mNHcb4RZOuQkBXdshy yGBKrUOIX5dVXgzYjIFTchpN54BVUuCaR7q3vxs7oAKpIR1agToWvRR05 B8pQuM24Fa4oQ9QJ49Dg8hOSdg2wYZ1uOObijHesU8GAFO37ik/pQEf70 PGElfowDkt5uXYI+vLb1LhkNosWBVJadcwjMTZPhPI9JsuNZ7wpGKa4Up A+Bg1DFLb456X2+EVO/hXFbkr5DEm2tyFIQE+KWTEg3fdyc0ViZ6zFdQB IW0enrb3uzPejpBH7Oi3G3wReAwP5vyY74G9nS0+pGfK8Xe5ovFYpZDYS Q==; IronPort-SDR: ttCeUGkYrT5A6qXqYkzgvjaXNmyeSXotP+seJRIRHv6vitXQAeCdnf8aed2SxV1GglISnQLQz0 k+Q/g1ImcJ5izfZ7NWlTuZMCWlg33tXhghqh+COpF74n/5IeIIRjq4idz9FEVd0rVLNbvZP0TE eHaIil9LhzxeUNJVkG5bg/JnIvCxa/HY00nY8xdpc/gVd3nvmiLIhfmYvEoNh452lQpEX0nLGO mpKByhimmbiCJxz+K03d4SGiVsTC8JN2p2RCZvNDaKaRUlfcgw/dm+a7k1xMT5F8DVeNZCxZW7 sVs= X-IronPort-AV: E=Sophos;i="5.75,255,1589266800"; d="scan'208";a="79100746" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 19 Jun 2020 07:19:33 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 19 Jun 2020 07:19:32 -0700 Received: from rob-ult-m19940.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Fri, 19 Jun 2020 07:19:05 -0700 From: Codrin Ciubotariu To: , , , CC: , , , , , , , Codrin Ciubotariu Subject: [RFC PATCH 0/4] i2c: core: add generic GPIO bus recovery Date: Fri, 19 Jun 2020 17:19:00 +0300 Message-ID: <20200619141904.910889-1-codrin.ciubotariu@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org GPIO recovery has been added already for some I2C bus drivers, such as imx, pxa and at91. These drivers use similar bindings and have more or less the same code for recovery. For this reason, we aim to move the GPIO bus recovery implementation to the I2C core so that other drivers can benefit from it, with small modifications. This implementation initializes the pinctrl states and the SDA/SCL GPIOs based on common bindings. The I2C bus drivers can still use different bindings or other particular recovery steps if needed. The ugly part with this patch series is the handle of PROBE_DEFER which could be returned by devm_gpiod_get(). This changes things a little for i2c_register_adapter() and for this reason this step is implemented in a sperate patch. The at91 Microchip driver is the first to use this implementation, with an AI to move the rest of the drivers in the following steps. Codrin Ciubotariu (4): dt-binding: i2c: add generic properties for GPIO bus recovery i2c: core: add generic I2C GPIO recovery i2c: core: treat EPROBE_DEFER when acquiring SCL/SDA GPIOs i2c: at91: Move to generic GPIO bus recovery Documentation/devicetree/bindings/i2c/i2c.txt | 10 ++ drivers/i2c/busses/i2c-at91-master.c | 69 +-------- drivers/i2c/i2c-core-base.c | 139 +++++++++++++++++- include/linux/i2c.h | 11 ++ 4 files changed, 158 insertions(+), 71 deletions(-) -- 2.25.1 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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA9C4C433E1 for ; Fri, 19 Jun 2020 14:19:45 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 84C5820776 for ; Fri, 19 Jun 2020 14:19:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DHTMEUwi"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="fwd+SZP/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84C5820776 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9sl9dRxV67r8Snzcgn0begG87RGxlmo3gUEYs/XbkSU=; b=DHTMEUwiiP3TjA KXmdUL5tDRn3qr2adz2JhBqL6PegvYAHed6xgRWB45ThHUjLvibBguvaid+5j13aD5H1K8kj5pJ+A H33tMHJaT7hSiLUca2e4Z3u6PKjcTmfINRXRSS7Ces0OfeLNANETSSQrbjzLyVUXTYQMBDGbuJKxu F76fKBbMrLNagPfOpq5lG/YoW5J1rr+WZIpjoEfIrTD4kiwLYYCtuAIv3qXi7Jo4XCFpYj2HpO/mb Jx45tXGs1n/geSWpm8ql+xzTuak8uDNhTxTe5RJdkuMiu57x4JtZZWkIp56AU3NwLhd45SKH/n5qq 7VpJ3lKMfdKeTzYWieHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jmHrs-0005vN-Lv; Fri, 19 Jun 2020 14:19:44 +0000 Received: from esa2.microchip.iphmx.com ([68.232.149.84]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jmHro-0005uj-R4 for linux-arm-kernel@lists.infradead.org; Fri, 19 Jun 2020 14:19:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1592576380; x=1624112380; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ros1udrNYa0R2yOGLKL28tb4ZWwAiFbhELcD5GmGfWE=; b=fwd+SZP/dzxwhkP4UxUqHFt05ri86H0zHxuqDtGlTLNzPFAe/3YgBgWj nbjUS+ClozeXsH2gaWU3pOn6PRTMT9mPpNHBdIwpFCooYcWmRMinZdxt+ mm2ugzxESp8yUHKeSgSuWcjqe4kn2Sfd4r4jg5CW5pXxzUAMiVTzMk8Jr zilwTjf67qJ/4XosTUA385u6JlvULex0QBsI05KopHj4UH2YMDlVDvd9Q mNp74FgZsZyEIopQEeErXw2YnWt6JJdT3iEN4d0I4vkZcKHXS+jaFcuiO bGtO6LHBA97sBbhN3QD/j01b5fhz34jUndnnlYMVnmEwzmPOppdKC6SuQ Q==; IronPort-SDR: ttCeUGkYrT5A6qXqYkzgvjaXNmyeSXotP+seJRIRHv6vitXQAeCdnf8aed2SxV1GglISnQLQz0 k+Q/g1ImcJ5izfZ7NWlTuZMCWlg33tXhghqh+COpF74n/5IeIIRjq4idz9FEVd0rVLNbvZP0TE eHaIil9LhzxeUNJVkG5bg/JnIvCxa/HY00nY8xdpc/gVd3nvmiLIhfmYvEoNh452lQpEX0nLGO mpKByhimmbiCJxz+K03d4SGiVsTC8JN2p2RCZvNDaKaRUlfcgw/dm+a7k1xMT5F8DVeNZCxZW7 sVs= X-IronPort-AV: E=Sophos;i="5.75,255,1589266800"; d="scan'208";a="79100746" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 19 Jun 2020 07:19:33 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 19 Jun 2020 07:19:32 -0700 Received: from rob-ult-m19940.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Fri, 19 Jun 2020 07:19:05 -0700 From: Codrin Ciubotariu To: , , , Subject: [RFC PATCH 0/4] i2c: core: add generic GPIO bus recovery Date: Fri, 19 Jun 2020 17:19:00 +0300 Message-ID: <20200619141904.910889-1-codrin.ciubotariu@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200619_071940_965595_10240107 X-CRM114-Status: UNSURE ( 7.36 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kamel.bouhara@bootlin.com, alexandre.belloni@bootlin.com, linux@armlinux.org.uk, wsa@kernel.org, ludovic.desroches@microchip.com, robh+dt@kernel.org, Codrin Ciubotariu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org GPIO recovery has been added already for some I2C bus drivers, such as imx, pxa and at91. These drivers use similar bindings and have more or less the same code for recovery. For this reason, we aim to move the GPIO bus recovery implementation to the I2C core so that other drivers can benefit from it, with small modifications. This implementation initializes the pinctrl states and the SDA/SCL GPIOs based on common bindings. The I2C bus drivers can still use different bindings or other particular recovery steps if needed. The ugly part with this patch series is the handle of PROBE_DEFER which could be returned by devm_gpiod_get(). This changes things a little for i2c_register_adapter() and for this reason this step is implemented in a sperate patch. The at91 Microchip driver is the first to use this implementation, with an AI to move the rest of the drivers in the following steps. Codrin Ciubotariu (4): dt-binding: i2c: add generic properties for GPIO bus recovery i2c: core: add generic I2C GPIO recovery i2c: core: treat EPROBE_DEFER when acquiring SCL/SDA GPIOs i2c: at91: Move to generic GPIO bus recovery Documentation/devicetree/bindings/i2c/i2c.txt | 10 ++ drivers/i2c/busses/i2c-at91-master.c | 69 +-------- drivers/i2c/i2c-core-base.c | 139 +++++++++++++++++- include/linux/i2c.h | 11 ++ 4 files changed, 158 insertions(+), 71 deletions(-) -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel