Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2564184rdb; Wed, 21 Feb 2024 11:31:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUdNbf5qsrcbpyAIweCQ4socUd2EzUT/3GAV3LCIAe5eSitCtgq7b+xbQhTLLC3bp4TXfhzWzDeE3MB1HDcZkuKyaBQPeOQyxHCYCNlQQ== X-Google-Smtp-Source: AGHT+IGFM9OVD7cFw+wt1FQt9+IYPT7nUAzMP5pEWfQ2HMVzyGiD6pNByzPyDVQ6f3mPvKcHVaNH X-Received: by 2002:a05:6830:22f5:b0:6e2:decb:2462 with SMTP id t21-20020a05683022f500b006e2decb2462mr19850490otc.0.1708543881326; Wed, 21 Feb 2024 11:31:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708543881; cv=pass; d=google.com; s=arc-20160816; b=W3VAdmycbaPvZ/lVhE+1jl9kvvtKgYZpahJfAGbITFrYE8BMrO1Y2ob0e+2A7C22FH jEbjh2v2LsZMoBZHvSmFC7F/Otcfrnm4obEwzY4FEDQ5QMf1KTmMWTFMvpt6NEkpzdmn ahzyxLZB7HLBZqdZf3krrb1sy5E8TnoZ3K1mHjBrFNzNZyyelypBgFX44xT6jnMvfcJ8 EspEaa0RKGHwTM0bmChtyWzfSIjLQLsNyNbG1Ziua/Ldbuy6gzXpWPedgjq11K+hPKdF x5EK38pqiCh9HdeURup+TNir1ktUwrTNxsiEl2Z/wGP0j1xtZ9556B7pC9mhsDgSlJGG a2Qw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=KYNKdWlES08xC8IxQFhBeyr/WjAKjrL7fnuvAKo0ujM=; fh=BCex3fG5TUIdNYYJBeGNYK0fbxFHC91d3iyR/tAO5zA=; b=tlOKJbU0x3jViJuO53JImgO1d5PyJZVLhXffv2t3XwnBIM2m5OdIbgfloo0SdsoPJU gka7qKJQ300RjtJeRTJ65WWKMTk56xotTNZUTmfGbn+V9BQoghawoqvWl8y2Bqv2id6Y /BWIg38vtyVmR13/QGDB++4Cs/0aYfbII3jlH5+rUo3kn4FvTPJ+PnN8uHjCdJo5256h sWDG7DAQI8lvfFpF8ThO1w+/bJYtI1o8S90jqYQQQcIB+4psJ4ZKZfimQUUuUiC9+SDG /2r48FPBhks6Ap2H33j8eJPeRMz5lDqLKO795tyJe9+U26fUhtGFTkUn6pPfElfcIk67 P5Gw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=BvYDj5kG; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-75367-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75367-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e6-20020ac84e46000000b0042dee8b1173si11786330qtw.13.2024.02.21.11.31.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 11:31:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75367-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=BvYDj5kG; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-75367-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75367-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 80D251C24E13 for ; Wed, 21 Feb 2024 19:30:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A596586134; Wed, 21 Feb 2024 19:30:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="BvYDj5kG" Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BCA983A06 for ; Wed, 21 Feb 2024 19:30:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708543833; cv=none; b=g2qTAfcQDViYO2EOFo3ronzw4oIa7jSzywbsv3TXEMPMgGlOok+p6vzkEtqyZwWXMpbFw/kr7QcOQGeLrBxFVpO4jjlmUVdh1iOYxLz4t7g6Yd76WtObUwi+oAM2N9lFg0H6KCu7JdJgy4Yuxg/6K9Y1CbMfNeyYrYFzrDN7C24= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708543833; c=relaxed/simple; bh=eI73Aixk2ZKHUCC+WBNzciPi+YGny+3Nqau0gA+LQpY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=RPDcJpZAWP2PtHbuRjcs8JYckclEzSPyOr1DVzfa+c4xnMbuz1p4Bkb5T7W2+yJ9/f21QTAUhl8uyG8vBXqybPFLRij6dMEUIcmAHGH1QKzaXu5NYNZYZyNr3DF8hIds2K9RSVEJ/FIycQHCLb1o7dWnGtCFJOgtekNmjeRJbOM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=BvYDj5kG; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=k1; bh=KYNKdWlES08xC8 IxQFhBeyr/WjAKjrL7fnuvAKo0ujM=; b=BvYDj5kG40dEMpit8vA9MSanfwXVLL zGh9UGUyFGrSltMzj9QJdbQjLztaE0KpG6N0wN5mGg1BGH5dGVLfdPQHZ1ornxrV 1diT9JHYxlBVgdeLEqPgeNMytpXIAREJ2Z8QM7W/CTw6ko6NYX1R1Z/SSpb025Du hjuRxw1hRIGtAIVgk+LadiWFZDfKep0fb87jwzovL61CRKSDfrXStiTGU4NAmKTe 9Z5ZQdrc+obfCZtQpCnY0KaQm4SHInVoaSW1WX+QsS8vYpXmmrtYP+KRc0wOTB2N dVeNwASObWBRct3ixqLoS3/bUvuf0eF3zV15WdypKeguHcwBsCuWmmRA== Received: (qmail 3720737 invoked from network); 21 Feb 2024 20:30:20 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 21 Feb 2024 20:30:20 +0100 X-UD-Smtp-Session: l3s3148p1@WCl5W+kRkr8ujnsZ From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Corey Minyard , Andrew Manley , Oleksij Rempel , Wolfram Sang , Pengutronix Kernel Team , Andi Shyti , Shawn Guo , Sascha Hauer , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] i2c: imx: when being a target, mark the last read as processed Date: Wed, 21 Feb 2024 20:27:13 +0100 Message-ID: <20240221193013.14233-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Corey Minyard When being a target, NAK from the controller means that all bytes have been transferred. So, the last byte needs also to be marked as 'processed'. Otherwise index registers of backends may not increase. Signed-off-by: Corey Minyard Tested-by: Andrew Manley Reviewed-by: Andrew Manley Reviewed-by: Oleksij Rempel [wsa: fixed comment and commit message to properly describe the case] Signed-off-by: Wolfram Sang --- Changes since v2: * updated commit message and comment In the stalled discussion[1], it seems I couldn't make my suggestions clear. So, here are the changes how I meant them. I hope this can be agreed on. [1] http://patchwork.ozlabs.org/project/linux-i2c/patch/20211112133956.655179-3-minyard@acm.org/ drivers/i2c/busses/i2c-imx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 88a053987403..60e813137f84 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -803,6 +803,11 @@ static irqreturn_t i2c_imx_slave_handle(struct imx_i2c_struct *i2c_imx, ctl &= ~I2CR_MTX; imx_i2c_write_reg(ctl, i2c_imx, IMX_I2C_I2CR); imx_i2c_read_reg(i2c_imx, IMX_I2C_I2DR); + + /* flag the last byte as processed */ + i2c_imx_slave_event(i2c_imx, + I2C_SLAVE_READ_PROCESSED, &value); + i2c_imx_slave_finish_op(i2c_imx); return IRQ_HANDLED; } -- 2.43.0