From patchwork Thu Oct 12 03:58:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 151734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp968214vqb; Wed, 11 Oct 2023 21:03:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEJgleKSgEXnr8IMkSkNr3Btg4GPoewaZzLVvYUDaLpAzVMBwCq81O45Tq7k5h6AAh71dQ X-Received: by 2002:a05:6a00:1d94:b0:690:d314:38d with SMTP id z20-20020a056a001d9400b00690d314038dmr25969018pfw.1.1697083388238; Wed, 11 Oct 2023 21:03:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697083388; cv=none; d=google.com; s=arc-20160816; b=RZsBkwvCF8stoRZMhkveWipVCrisHUxT5iZY2h7eWLSA4SDIZhxGB/8oR0pvTlL50n H4Aaa1u1A3EbuB09tbI3X1GX1oR+JcC0nUomSeLgXo4ngBs1XmBmev16WrrQLU1r+jhB avygHTv7oHSH7A8LNJaQ5uvdvuaOHIB5FCOw39beU6aSbEHv97Ik9eQUrTxVcysO6Nbb Vfo8PFsOYW2uW7vPcA5FFNS4QWq3z1qlrDObJER7OkTJvrcXin9mzhLEU9vJ5GWu9LAl w6HhWAv2wqbB6GS7zaxlwAEKzqu9W5W/5B0LC6buVWw9t2MOj1+kfK3T9St0+RQulj3N BFkQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8ldxjY2XTVgukHtY2rU8b3TaXM/2baQ3LVMTeqZSFyE=; fh=3tQj0XukzIaVVOd6lLPEALhtzKzMAG+0/N98Vq3ytYw=; b=x/izqyqC6FV/jVAEvLVZy2izvrzDELvURap4KpcRC6/zrzTbegA0rzqAgtUZLel9n5 fi7R+AwKqygkmW9AEiuXDJpvXpowR4GnpnMf/cywxUz53CZNs7rXPlsR53tgO8qmxK83 KZMcG0jxeKeGP7RvCUS0206wiiqZMqtv8VJ4SNLl7oppi4TGykSlmUx237Q6u7JXl1YG rTejokD8PgDxt2bWyYdigls2FFHBf5uXWns/p3Gkhz1AK9kNLnrINxKHnBwikVAjzUhP rTyeiEZVU9OD8ZxU2r0Wp9DPeA5FK6skoiRVF+ZqFRtw4U086W6EE1souM6FxrxH3GYx LNbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=motWq61l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id o20-20020a056a0015d400b0069eacad28acsi1039298pfu.178.2023.10.11.21.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 21:03:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=motWq61l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6DA998061B6D; Wed, 11 Oct 2023 21:01:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235359AbjJLEBc (ORCPT + 18 others); Thu, 12 Oct 2023 00:01:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235350AbjJLEBS (ORCPT ); Thu, 12 Oct 2023 00:01:18 -0400 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [202.36.163.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8255F2137 for ; Wed, 11 Oct 2023 20:58:42 -0700 (PDT) Received: from svr-chch-seg1.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 8F9B22C0288; Thu, 12 Oct 2023 16:58:39 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1697083119; bh=8ldxjY2XTVgukHtY2rU8b3TaXM/2baQ3LVMTeqZSFyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=motWq61lWkOuOaMRfUANhoQoIHNDoWkqsnEE//eCsasehWoGqql0M8KAfYGo2gJz2 EmPekgCqNYWsysDWE5txCPKdvmknFSEg9wi3enVQvoZ0T0tgg7Hp5OIEkcxz4b7f/o ESAJ6rZixG/ZqoWsPwj0b9N89O/Eu5l/8lrrmUNLfWDzM82p0RgpS1PMPQLNHmDJXa X4V5+FkmpC1IbaIwFnujL0wj4cGqIrSMsyZgO+pfKorN9yp3VqIjB6RBWAxvmHpg/p 0hdTAKpEV4EVTdeiydnkscHeYZlMY7K31Krc5Smeqy9AJmsuvw/YBcqNl2aCufebbi rHv9KvZULevvw== Received: from pat.atlnz.lc (Not Verified[10.32.16.33]) by svr-chch-seg1.atlnz.lc with Trustwave SEG (v8,2,6,11305) id ; Thu, 12 Oct 2023 16:58:39 +1300 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by pat.atlnz.lc (Postfix) with ESMTP id 52D8C13EE41; Thu, 12 Oct 2023 16:58:39 +1300 (NZDT) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 4F3A12809D8; Thu, 12 Oct 2023 16:58:39 +1300 (NZDT) From: Chris Packham To: gregory.clement@bootlin.com, andi.shyti@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Packham Subject: [PATCH 1/2] dt-bindings: i2c: mv64xxx: add reset-gpios property Date: Thu, 12 Oct 2023 16:58:37 +1300 Message-ID: <20231012035838.2804064-2-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231012035838.2804064-1-chris.packham@alliedtelesis.co.nz> References: <20231012035838.2804064-1-chris.packham@alliedtelesis.co.nz> MIME-Version: 1.0 X-SEG-SpamProfiler-Analysis: v=2.3 cv=L6ZjvNb8 c=1 sm=1 tr=0 a=KLBiSEs5mFS1a/PbTCJxuA==:117 a=bhdUkHdE2iEA:10 a=9qZDCEfNSpnagL8JuG8A:9 X-SEG-SpamProfiler-Score: 0 x-atlnz-ls: pat X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 21:01:41 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779520910577019237 X-GMAIL-MSGID: 1779520910577019237 Add a reset-gpios property to the marvell,mv64xxx-i2c binding. Signed-off-by: Chris Packham --- Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml b/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml index 461d1c9ee3f7..ac8859aa2545 100644 --- a/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml +++ b/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml @@ -70,6 +70,9 @@ properties: resets: maxItems: 1 + reset-gpios: + maxItems: 1 + dmas: items: - description: RX DMA Channel From patchwork Thu Oct 12 03:58:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 151735 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp968221vqb; Wed, 11 Oct 2023 21:03:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6Tyw6RbnOKYsGDRTz0VF68GhnVRR7gpxtApVqEjG3yGp3NzYRj5c9ScLa/kpYZmL6iV6j X-Received: by 2002:a17:90a:3c8f:b0:269:34a6:d4ca with SMTP id g15-20020a17090a3c8f00b0026934a6d4camr20625550pjc.0.1697083388958; Wed, 11 Oct 2023 21:03:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697083388; cv=none; d=google.com; s=arc-20160816; b=qVWX3vln4GJjm74XvZrxnZ5FwWWbvXorqW+LPpZ9cmwmxd2XMcHu+peb6rKp6LsMXV eJ7fukdxYxUEaq9aIL4DI9/bvZA/Hd+W7z2k1RARfDZH0BC96v/uPViZvWbmVSV6Wvs7 2wm4fa12EHcq8f78kWyP8YOApZ9+1qazMc3b7/hKPYqtwdkXsQhgTGvR/QhMG7eWTFrA J2jhsHgb9HEMsTqBz6pQbmMvCWzyxvXM+YqKFS0c9OttfC3UfdPcZUMq9IeQ/GvzP1b8 8ZqprOS0VujmYVVLHJKdMDm+FG9iCHW9SHwLL3lM5mn7B5Qz9E3poAtH5aDnbY938dkv WAtA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ifZwplH9sagN0NTIjZH8ZM2CYg5lA3N8aVUArps8x2I=; fh=3tQj0XukzIaVVOd6lLPEALhtzKzMAG+0/N98Vq3ytYw=; b=bQ/zZZ+a6vRFuGsxuRju8grDS3IgmBvyl42KaWTTDcXlXwqa6u1x1ZbtuSQlxohj8S DYF/FaMQ13baKSBe1ykJNIfqkhSe8C6bgDGw3mbuSFihc88GRKIOl5nUaX+amEPTwLYd TLE/h5cGYgVJbGcdAp2HpKTwyLK28bPSej7CcPYc84HxhCYEcQSNEpAhckNiHpNp0a7J zcN3dYN1SuWk4oRN197JHgHUv3ki1Is7BqkBlOoeneTQFB4aFyQMEGNAESwmhZQXwWZD Js16PST8Hg06vBGTZJhOSzGq8jpELk7Vnur2KfVB2tz4fEOLz551zNf0RODqLGyy/1bH jfnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=gjt70Jch; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id il16-20020a17090b165000b00274b668b762si1371320pjb.172.2023.10.11.21.03.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 21:03:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=gjt70Jch; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 342068097894; Wed, 11 Oct 2023 21:01:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347080AbjJLEBg (ORCPT + 18 others); Thu, 12 Oct 2023 00:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235351AbjJLEBS (ORCPT ); Thu, 12 Oct 2023 00:01:18 -0400 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [202.36.163.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F2F92130 for ; Wed, 11 Oct 2023 20:58:42 -0700 (PDT) Received: from svr-chch-seg1.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 95A6B2C0806; Thu, 12 Oct 2023 16:58:39 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1697083119; bh=ifZwplH9sagN0NTIjZH8ZM2CYg5lA3N8aVUArps8x2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gjt70JchAEo3lFT+mTcjRQZEHFTWm4kkIMy90yFJcppKwahtB4dfrObAdEi2oHe/n F2HPaIv1UA6Oz+cK4FncrUrq+bvF9CzRo485BdekGScB15haVSH4ZrQYW+ZQ1P7beV EA0ueWg5hb7+qPjl0fb7tHB5qKQxvdSdAUzEWYsOeRNVhA/4WAQ72eV6YbIigELw8o l6roi+xCzPCn3H1NaJgiIaIwwa/Zp7OmJ9MYk+rR3YY9PTc1Ki1cUDdxDGKp7lBvO7 9S1keH95OqPBP9Mu1MK0jUzM5L6oB9G+jaVTQ658ahSTcbc+SvSaKaBlxCYhE3eg/P Ls5CX1b5AnxSg== Received: from pat.atlnz.lc (Not Verified[10.32.16.33]) by svr-chch-seg1.atlnz.lc with Trustwave SEG (v8,2,6,11305) id ; Thu, 12 Oct 2023 16:58:39 +1300 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by pat.atlnz.lc (Postfix) with ESMTP id 5552813EE9B; Thu, 12 Oct 2023 16:58:39 +1300 (NZDT) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 539DF2809D8; Thu, 12 Oct 2023 16:58:39 +1300 (NZDT) From: Chris Packham To: gregory.clement@bootlin.com, andi.shyti@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Packham Subject: [PATCH 2/2] i2c: mv64xxx: add an optional reset-gpios property Date: Thu, 12 Oct 2023 16:58:38 +1300 Message-ID: <20231012035838.2804064-3-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231012035838.2804064-1-chris.packham@alliedtelesis.co.nz> References: <20231012035838.2804064-1-chris.packham@alliedtelesis.co.nz> MIME-Version: 1.0 X-SEG-SpamProfiler-Analysis: v=2.3 cv=L6ZjvNb8 c=1 sm=1 tr=0 a=KLBiSEs5mFS1a/PbTCJxuA==:117 a=bhdUkHdE2iEA:10 a=qKArIWvIHuvpQEZHLy4A:9 X-SEG-SpamProfiler-Score: 0 x-atlnz-ls: pat X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 21:01:51 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779520911663696556 X-GMAIL-MSGID: 1779520911663696556 Some hardware designs have a GPIO used to control the reset of all the devices on and I2C bus. It's not possible for every child node to declare a reset-gpios property as only the first device probed would be able to successfully request it (the others will get -EBUSY). Represent this kind of hardware design by associating the reset-gpios with the parent I2C bus. The reset line will be released prior to the child I2C devices being probed. Signed-off-by: Chris Packham --- drivers/i2c/busses/i2c-mv64xxx.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index efd28bbecf61..b2ca31857cbd 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -160,6 +160,7 @@ struct mv64xxx_i2c_data { bool clk_n_base_0; struct i2c_bus_recovery_info rinfo; bool atomic; + struct gpio_desc *reset_gpio; }; static struct mv64xxx_i2c_regs mv64xxx_i2c_regs_mv64xxx = { @@ -1083,6 +1084,10 @@ mv64xxx_i2c_probe(struct platform_device *pd) if (drv_data->irq < 0) return drv_data->irq; + drv_data->reset_gpio = devm_gpiod_get_optional(&pd->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(drv_data->reset_gpio)) + return PTR_ERR(drv_data->reset_gpio); + if (pdata) { drv_data->freq_m = pdata->freq_m; drv_data->freq_n = pdata->freq_n; @@ -1121,6 +1126,12 @@ mv64xxx_i2c_probe(struct platform_device *pd) goto exit_disable_pm; } + if (drv_data->reset_gpio) { + udelay(1); + gpiod_set_value_cansleep(drv_data->reset_gpio, 0); + udelay(1); + } + rc = request_irq(drv_data->irq, mv64xxx_i2c_intr, 0, MV64XXX_I2C_CTLR_NAME, drv_data); if (rc) {