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=-6.8 required=3.0 tests=BAYES_00,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 491BFC433DF for ; Tue, 4 Aug 2020 09:59:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C57422B40 for ; Tue, 4 Aug 2020 09:59:56 +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="IDpiCvxP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728332AbgHDJ7w (ORCPT ); Tue, 4 Aug 2020 05:59:52 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:63530 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726844AbgHDJ7v (ORCPT ); Tue, 4 Aug 2020 05:59:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1596535191; x=1628071191; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GTtso34T+c/2IIFCa0TTcMqhENR3/ROdcVBd3KrCKhw=; b=IDpiCvxPD4GxdecstZD6Vq6K58oker1H/e8iWZ+MXrv/XuUCKaIMvdcW sClaW2DNF09VRCdNh3be1lxlnEiVeMtX9gAGI7l3g621uRWQVnuNnSyZc fOlBY1AU82Go86tF9k6AASSaZwP8WbcyBWgeqN0GO3dMeKK8Gb6x69aGw yNiBPxxhtrMd+eylhaPrnIT7LqqrXZkBPDt1nNiFBykrqe1IiQsu0Wo/4 yeyIdDoXSFd05jfSeKkhZsu0HmLroRk0Lmxjncs7JUr8gMLp10c941hSQ CuT0Td03XIxlo5RUfJPW0VrRGT5g+nPlbg0bHbUfC3z0fn7O5mWGzwVc6 w==; IronPort-SDR: u84SfLNWqiorX/pxS0wI7QF1VuB+j1TEr37drBBn1mKkKB1G4JeaEW4wdni1nT1WWUZ5EcQ85j 86tA8LXavAVAq58faDRYEEXGFLjaYT7Gjnlx5FsDmPJY1yoL9DtDEKjHYfrUjt17C4rNIpjA9C WaAcu167kSNUj7OVz7SOMrjm0gy1fXBviNHQUUVN/b9DN2veFI2jl8nLW5KB6lrORup7e/1IYW 7ji/li+qKJ7MsRRf35zKals6FAfY3EaimyT6VKsi42QtIMv6aDNiq4rNwLSggb2n7Dz9banJW9 fPc= X-IronPort-AV: E=Sophos;i="5.75,433,1589266800"; d="scan'208";a="85757564" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Aug 2020 02:59:48 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 4 Aug 2020 02:59:45 -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; Tue, 4 Aug 2020 02:59:35 -0700 From: Codrin Ciubotariu To: , , , CC: , , , , , , , Codrin Ciubotariu Subject: [PATCH 0/4] i2c: core: add generic GPIO bus recovery Date: Tue, 4 Aug 2020 12:59:22 +0300 Message-ID: <20200804095926.205643-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-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@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. This patch series was previously sent as a RFC. Significant changes since RFC: - "recovery" pinctrl state marked as deprecared in bindings; - move to "gpio" pinctrl state done after the call to prepare_recovery() callback; - glitch protection when SDA gpio is taken at initialization; 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/busses/i2c-at91.h | 3 - drivers/i2c/i2c-core-base.c | 150 ++++++++++++++++-- include/linux/i2c.h | 11 ++ 5 files changed, 163 insertions(+), 80 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=-7.0 required=3.0 tests=BAYES_00,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 024ECC433E0 for ; Tue, 4 Aug 2020 10:01:18 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 E81C92070A for ; Tue, 4 Aug 2020 10:01:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ncVsONqu"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="GiwMud1U" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E81C92070A 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+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=merlin.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=QaAEJhyKymbSYPiajJaLJMmYCkwVCKbFV/dYZ8tiluU=; b=ncVsONqu0oU/EE+SDUWCKXkiI5 kMa10xew4+rEjB/WoMY83TcCePz5PG1b2FtSFCuJO8m5I4GOI7UqONDwsI9vEC3i6gYIkdrAx+JSJ NqToAbAC6pEnwyguvaNzte1ExZG60bprMyON1IcqHId6nEKT3QEGrBMGRUHfAidjza0cqPtK2krY8 Vi6nIUVvWCVIrSlFk5hHttZ+IIaxEX857IuTUnZrNLYgO6OHunTgzhC/s84IVjGKJ6NPp2lBRAMD/ M+/FBuWEPzkHlupcgpykUoh50mrz5efMgU6g5uAcWb3qOXhLcPkY2FUsNlmKJOV6sarLPOiY/IkPG 3s+7Yuqg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2tjh-00043d-Ds; Tue, 04 Aug 2020 09:59:57 +0000 Received: from esa5.microchip.iphmx.com ([216.71.150.166]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2tjf-00042X-3r for linux-arm-kernel@lists.infradead.org; Tue, 04 Aug 2020 09:59:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1596535195; x=1628071195; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GTtso34T+c/2IIFCa0TTcMqhENR3/ROdcVBd3KrCKhw=; b=GiwMud1U2tPSt/2hEzSNQ3Ruz4NdFhYCG+/Y+jFh26dwWrziyuVHbRa6 nhNxTrpiQK8h90hVWKhypY/+CqSySEXm3g91fTMiSV22GOvAmunUu8Dlz 1cmP9uhYfzJ6HzZE0vOijCW6mt0SNtlLCoOiaDAyZrHPabS99Apouw6zR rCxHkzYS/HGjaw0/lOG/9bWsC5bU6F5Lu+HC0p8WNBOQnw807/HYvs2UT L7Gg7k9nm3moaqvVzaHgK1kgk48nQCrzPZLGLASPKkHL2HfYNKtaee/TD vpR4dLr+1ejlyfd84VJoM7PamrpQT6jzwz0ft5Lp9/GDO3AQ3ocpZJyww Q==; IronPort-SDR: u84SfLNWqiorX/pxS0wI7QF1VuB+j1TEr37drBBn1mKkKB1G4JeaEW4wdni1nT1WWUZ5EcQ85j 86tA8LXavAVAq58faDRYEEXGFLjaYT7Gjnlx5FsDmPJY1yoL9DtDEKjHYfrUjt17C4rNIpjA9C WaAcu167kSNUj7OVz7SOMrjm0gy1fXBviNHQUUVN/b9DN2veFI2jl8nLW5KB6lrORup7e/1IYW 7ji/li+qKJ7MsRRf35zKals6FAfY3EaimyT6VKsi42QtIMv6aDNiq4rNwLSggb2n7Dz9banJW9 fPc= X-IronPort-AV: E=Sophos;i="5.75,433,1589266800"; d="scan'208";a="85757564" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Aug 2020 02:59:48 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 4 Aug 2020 02:59:45 -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; Tue, 4 Aug 2020 02:59:35 -0700 From: Codrin Ciubotariu To: , , , Subject: [PATCH 0/4] i2c: core: add generic GPIO bus recovery Date: Tue, 4 Aug 2020 12:59:22 +0300 Message-ID: <20200804095926.205643-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-20200804_055955_296211_24C81BE7 X-CRM114-Status: GOOD ( 12.42 ) 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+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. This patch series was previously sent as a RFC. Significant changes since RFC: - "recovery" pinctrl state marked as deprecared in bindings; - move to "gpio" pinctrl state done after the call to prepare_recovery() callback; - glitch protection when SDA gpio is taken at initialization; 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/busses/i2c-at91.h | 3 - drivers/i2c/i2c-core-base.c | 150 ++++++++++++++++-- include/linux/i2c.h | 11 ++ 5 files changed, 163 insertions(+), 80 deletions(-) -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel