Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp838857iog; Wed, 15 Jun 2022 13:34:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1shpSbd7ILXIuIQr/CB1hxq77uQ6EAPa60nTgDv9b3r22cyX6MHilZelBXPlzZmZv6gTwu8 X-Received: by 2002:a17:902:d58a:b0:164:f5d1:82e9 with SMTP id k10-20020a170902d58a00b00164f5d182e9mr1297239plh.3.1655325288574; Wed, 15 Jun 2022 13:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655325288; cv=none; d=google.com; s=arc-20160816; b=1Ke2GRsPt9c4MaMtqQcXWZO1FEI4G8YA2aV9b2lRF/Q9tTt1RfSpN6Raw+YNbIEsuJ 8s1b+YxmpGnRhWOvO5Rudcx3tYNbNha0vFgLM7hk5H9D8kGkFt0DiSda3Rg/FEu7Qv8A byke5/G4maPF14tVINMao1QUwA/dJ2o/a6fYNThl58MNac7fxyVWo1rikGjfl6Mj/5OR hXJoyBpKba01Xc+VwVyZVen/NmgWOimCWSHaNiK1EkPmUk4KvPGLgzcLRaQsaL9ulOk0 4aFaKEPKXjdSY3B6bdnhfcGD9/u8tMSdDCwxLTxUJNQWCQb8v6LX89cPMWXtl/rU9lZL ZgNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=lBqHeIh7QN6W7gjFQBn65/oTIFXlRPRhYhbYeNGnRZo=; b=TdDYcq8PU0dE6wkIwKHWMO+PLVz2fZwQDysZPxfiTFdCflHAGJNEeEPV3WqDS4hZ0k 6wDk+viuE7PvNeueOVTD58Ul9xcKeCRsqTapmkYBahs5B0sIcwgvpFiBA9Qk7OfOGaOy Zj9CC+AzJ02ZoOMkgTEJykfMMWCUMf23QTELZsPotiPtgRioMQljcdMbrVUciS5ZKPUA XR9A8j3bCeJCu1bdCR1bvrsaHP1Jlb4CR16Z8xdxE3BNxYkrSiVIkFNFUSrwNjIc6Pnk zH1HTcGZD+NFc+g6+VCoVX1AY9v2ORqWjc3lZWoqUZUGLAru1eoGkkY81zpWgtGse9gK iVIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TaEB3qqt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jj20-20020a170903049400b0016206c77292si136053plb.277.2022.06.15.13.34.35; Wed, 15 Jun 2022 13:34:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TaEB3qqt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345033AbiFOUdA (ORCPT + 99 others); Wed, 15 Jun 2022 16:33:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231149AbiFOUc6 (ORCPT ); Wed, 15 Jun 2022 16:32:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C223DB7EF; Wed, 15 Jun 2022 13:32:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 50A796174B; Wed, 15 Jun 2022 20:32:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8E81C3411A; Wed, 15 Jun 2022 20:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655325175; bh=xweyU4/oqSOwHkI/hoomOugSz3ECvQLAuoo5JQYmEfo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TaEB3qqtKQ7sFL15nSzdXBJU4cC65s35LLseLFBizPWZY6R0fkh1UNU118TVUYK1o +RgR2Kb7+JUTTRc6tXQLDV5Yr04FvNjjexnZN+hnW90VBWcBBSmrbQ/DXQNlArTmrO 88eeDrMzneYDF4mE5yZwMpYmHLHbGZJzvBkYY1WhFONh3L/S7j8pbx+i3oaleJ/16y srDQGXS6Uj5dnKWP+vtWmZ2wEE+3fMfy6S0WYzEs60VGbb09bKpzasdEvB9av9Kcsp 1a9AufleimVC0Yf7ajnDauhN/ir1rOjEJDExZ/LCrCN22uG968pCcUBS8atRmknu0U syD3CL+ZAGM4Q== Date: Wed, 15 Jun 2022 22:32:48 +0200 From: Wolfram Sang To: Quan Nguyen Cc: Corey Minyard , Rob Herring , Krzysztof Kozlowski , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org, Open Source Submission , Phong Vo , "Thang Q . Nguyen" Subject: Re: [PATCH v7 3/3] i2c: aspeed: Assert NAK when slave is busy Message-ID: Mail-Followup-To: Wolfram Sang , Quan Nguyen , Corey Minyard , Rob Herring , Krzysztof Kozlowski , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org, Open Source Submission , Phong Vo , "Thang Q . Nguyen" References: <20220422040803.2524940-1-quan@os.amperecomputing.com> <20220422040803.2524940-4-quan@os.amperecomputing.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ic1hM2GHeE5Hfcvc" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 --ic1hM2GHeE5Hfcvc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Quan, > When tested with ast2500, it is observed that there's always a > I2C_SLAVE_WRITE_REQUESTED comes first then other I2C_SLAVE_WRITE_RECEIVED= 's > follow for all transactions. Yes, that's the design of the interface :) > In case slave is busy, the NAK will be asserted on the first occurrence of > I2C_SLAVE_WRITE_REQUESTED make host to stop the current transaction (host > later will retry with other transaction) until slave ready. >=20 > This behavior is expected as we want host to drop all transactions while > slave is busy on working on the response. That is why we choose to assert > NAK on the first I2C_SLAVE_WRITE_REQUESTED of the transaction instead of > I2C_SLAVE_WRITE_RECEIVED. =46rom Documentation/i2c/slave-interface.rst: =3D=3D=3D About ACK/NACK -------------- It is good behaviour to always ACK the address phase, so the master knows i= f a device is basically present or if it mysteriously disappeared. Using NACK to state being busy is troublesome. SMBus demands to always ACK the address ph= ase, while the I2C specification is more loose on that. Most I2C controllers also automatically ACK when detecting their slave addresses, so there is no opti= on to NACK them. For those reasons, this API does not support NACK in the addr= ess phase. =3D=3D=3D So, the proper design is to NACK on the first received byte. All EEPROMs do it this way when they are busy because of erasing a page. All the best, Wolfram --ic1hM2GHeE5Hfcvc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmKqQewACgkQFA3kzBSg KbaRvBAAhGHBikwxwBVjvxYQ3WkD53anNZCb8H7DLS+EBHUqZUhE3sB1E0xjhLw9 /D56GGMOC0z26eO0epBcCjharkSDE5kolGFghi/5ymiKkHoS/wGCHuTr6nJVt0xO CXf1YVkIb4I3bHHxgiAPrOc+N6jw5e+Ujao7nOXjpaTuJ84RNT4hHPNKUcJIqZNR ciM/xRqC0CslNEW4RH2fapeCw97/HksITYb/1Ix3DabxRnLj6obVmAtuokUr7Tmd Aro8RsCKMzkJmknyhX4A/cbVuRKXGiWLthW3srmUKPCgu9dndoBsIoTty+E3vJXY QZO0uNLBRydxJOBXT/+skne0wB3xo4RNuAzYXov/RMVkTGO2r3n3Q99wjSyHv7Zh BWIy/QnYni2FguU4NtjgBXurWfvqguvLr37+5QMcruMLFsRKkeifb1zfOlVV9RVU whpoeJrrFrxE3wI/L4Ol3eBokDneI4Ldo4dUvFv+CQ2GNQgj1qLfZcUnqE/SKNKj JhcvsMNszDV7QXk8jIbzdkWbL5zxijQ4y+q+vOou/b3BZTVJ+d+wXXH72LeIxxPY JqQD9F2vzrULR55rbXw+ZBU0jESxcBrx3aC54ksz1vIPM7gsuOldNICk00eBI8tD HmatAjq9W/yS0VpX7XlTsBwk8w8MXJc2/VXzlJaO4M8yLddwLW0= =SfIi -----END PGP SIGNATURE----- --ic1hM2GHeE5Hfcvc--