Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp374393rdg; Thu, 12 Oct 2023 08:06:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElaOZmHA4z3lOXZUKle54wmc15+AW6VMdSBC2hVOC56+9w2smk87D5gJOOcLkusnJfamfV X-Received: by 2002:a05:6a21:a585:b0:148:f952:552b with SMTP id gd5-20020a056a21a58500b00148f952552bmr33451135pzc.51.1697123200310; Thu, 12 Oct 2023 08:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697123200; cv=none; d=google.com; s=arc-20160816; b=de7RT8KEjoWeOcsLVNNvn2xmSx5xLyXp+HY16vMG1eT3G2gpTACNTXLHRiSk/X3h5j LMiiC+293skDtiBjuYiqDITehuAMZGNlQY3nhDNll2xge0zhavbtwASbhjWsUcvSKONa +wCjE0S1ZRbyfrNZ4LIPejAbkj2fH9W+kStYC63l9HXZnX/XPwOg70lQL5oEd3Si/1kU ehGZAQfx4K2SgKh8Jm0lj6OyfFA1Z+swj8HPrM0oicxRI0QOspSJfPkVJRUu5i8GiQkR h5fmxySwNqdT/R8V9ce3q+c/qN5VSz0I6kJCITbTT8/He6UZbSGTyYi5KeLYxJ2BIH7V cXSg== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=pYGrZGD7TpBpDeJ3uxIQzllaOb+HOsst5dM+V1mauas=; fh=ip6/fbjS8owq/enK4TOF030tPywcAL0epffh7VuG6Uo=; b=XkltJgE+1mpk+UdVd5ysrCtyboscHoDOfdfhF5EnNJdflnIklsqLdBQZ0EcglpVedS ESxKv0p9rkDfH8P0M8+UhdAwna46y3iTgYRFlUPuxFF9Yr8UtBxnPnTv4C3eAwb4Wlye RYm6oy8Erw4mRiq86jICmWcQFTW4xcrj+1eNozuHUzOb5UFcqKU3j0taSdaY5XlCIgzv H25ZKrG8tgAAvcVs5XTUYugvWu1p9k8gX9mKSXOYLJXxUO/6pw8twY3pe5+J9CgmCT4n LHo3+3ngYs+ClvEC0Iq6b47lxlmt/SLltMq16HuOVEv/1WkzOx62jYbJEtvrIIPehNd/ Mj+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tcWh7mvV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id q15-20020a63504f000000b00578666614f1si2356850pgl.63.2023.10.12.08.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 08:06:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tcWh7mvV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id C6EE48212C7D; Thu, 12 Oct 2023 08:06:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379183AbjJLPGX (ORCPT + 99 others); Thu, 12 Oct 2023 11:06:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346441AbjJLPGV (ORCPT ); Thu, 12 Oct 2023 11:06:21 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A63F90; Thu, 12 Oct 2023 08:06:20 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB4A4C433C7; Thu, 12 Oct 2023 15:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697123180; bh=wY9MRkbEMq3vjjbxC2RGfewmVTqD295er3X/G+uewSw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tcWh7mvVxsBYPlGQ76SDWlwQMMhmJvDdc2TceFhV4Lf34p9bJTEseEpPmyCTLUNyA F/+dX6WV6q0G/Yj6yh0cRbRVMtQxPhN2EopKYJ6ybEJaI3hHQTk3BXRdX1kwznT45v Bb8D/MCgslpVXvZHM0g0Fzjee9LcX1cXDLznCPHB6SUkCb5VKgkBvRHAAvfrSiBXy1 HK6ef4eb0e7vVfWSANSNLmXVmSiRxyS3lmSzjSa1fQcihUX4KFb3R1WC8thXWuqZQB Ib7pHN69jP8BdVpa2AzuOPxqSXUjIv/Rx49iKq9UfO64XgPt5QHgq5Vzil8vzWlXJ0 HtPgLQ6z9J0zQ== Date: Thu, 12 Oct 2023 17:06:16 +0200 From: Andi Shyti To: Alain Volmat Cc: Pierre-Yves MORDRET , Maxime Coquelin , Alexandre Torgue , M'boumba Cedric Madianga , Wolfram Sang , stable@vger.kernel.org, Pierre-Yves MORDRET , linux-i2c@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] i2c: stm32f7: Fix PEC handling in case of SMBUS transfers Message-ID: <20231012150616.n6gpovgb6qsg5d7e@zenone.zhora.eu> References: <20231010084455.1718830-1-alain.volmat@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231010084455.1718830-1-alain.volmat@foss.st.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Thu, 12 Oct 2023 08:06:37 -0700 (PDT) Hi Alain, On Tue, Oct 10, 2023 at 10:44:54AM +0200, Alain Volmat wrote: > In case of SMBUS byte read with PEC enabled, the whole transfer > is split into two commands. A first write command, followed by > a read command. The write command does not have any PEC byte > and a PEC byte is appended at the end of the read command. > (cf Read byte protocol with PEC in SMBUS specification) > > Within the STM32 I2C controller, handling (either sending > or receiving) of the PEC byte is done via the PECBYTE bit in > register CR2. > > Currently, the PECBYTE is set at the beginning of a transfer, > which lead to sending a PEC byte at the end of the write command > (hence losing the real last byte), and also does not check the > PEC byte received during the read command. > > This patch corrects the function stm32f7_i2c_smbus_xfer_msg > in order to only set the PECBYTE during the read command. Thanks for improving the log. > Fixes: 9e48155f6bfe ("i2c: i2c-stm32f7: Add initial SMBus protocols support") > Signed-off-by: Alain Volmat > Reviewed-by: Pierre-Yves MORDRET As this is a fix you should have also included and Cc'ed: Cc: # v4.18+ No need to resend. Acked-by: Andi Shyti Thanks, Andi