From patchwork Wed Feb 21 19:27:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 204372 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1252401dyc; Wed, 21 Feb 2024 11:32:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWWhrsuIpZFIBdFZ9LGhZ7dZAPriZoXOcS3f+b9qwHLzYfkdqJXqXSxjQJ6wzbPYfgx5N1jLEmLZtM8DD1drIoAoUCDxA== X-Google-Smtp-Source: AGHT+IFt0/U2mWw8U6VDBwL3n3vuQJqym/R0itquddoew2VXz/U78BP1yoXp2IA1KoNb8CUM2TAi X-Received: by 2002:a17:902:b407:b0:1d9:9c96:673c with SMTP id x7-20020a170902b40700b001d99c96673cmr17858668plr.46.1708543926820; Wed, 21 Feb 2024 11:32:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708543926; cv=pass; d=google.com; s=arc-20160816; b=gcD4yHZ6bgMLsQNxyW1y5oKm13HGcezodUorEoYHH+VU8FTnAG3DECKc/SADQt7vo2 2w9RytQ9FMUy4GqqGPFI+fkasJqUHRkdyTVhiO0Dl5kIa3wuKZSNijNVXQIOTLHfzLGc 0sGmfyRLyI1DeYRsCxdaVJ2Izax9Wl6MKpvdQxe1kbOnJsCzK7I0sskm3BWlBKe6wab9 n9ArQVJv8/uAJyLUUrZQPDc8qETxUtoReLJiq6wHm+X/Ij5J7FfwKpy1mXMDcq+hfinr 4ryliIdZDAextqYsSfkVMOUSEMODehQtF+Wue9vrb0Pl49W9LxrYVqvMbqVnbCPurIG5 lyhA== 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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75367-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c9-20020a170902d48900b001dc1df6489dsi3135479plg.26.2024.02.21.11.32.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 11:32:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75367-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75367-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2DB662868E1 for ; Wed, 21 Feb 2024 19:30:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 648AB86628; Wed, 21 Feb 2024 19:30:36 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791538156667850776 X-GMAIL-MSGID: 1791538156667850776 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; }