Message ID | 20240221193013.14233-2-wsa+renesas@sang-engineering.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-75367-ouuuleilei=gmail.com@vger.kernel.org> 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 <ouuuleilei@gmail.com> (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 <ouuuleilei@gmail.com>; 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 <linux-kernel@vger.kernel.org>; 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 <wsa+renesas@sang-engineering.com> To: linux-i2c@vger.kernel.org Cc: Corey Minyard <minyard@acm.org>, Andrew Manley <andrew.manley@sealingtech.com>, Oleksij Rempel <o.rempel@pengutronix.de>, Wolfram Sang <wsa+renesas@sang-engineering.com>, Pengutronix Kernel Team <kernel@pengutronix.de>, Andi Shyti <andi.shyti@kernel.org>, Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Fabio Estevam <festevam@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, 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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791538156667850776 X-GMAIL-MSGID: 1791538156667850776 |
Series |
[v3] i2c: imx: when being a target, mark the last read as processed
|
|
Commit Message
Wolfram Sang
Feb. 21, 2024, 7:27 p.m. UTC
From: Corey Minyard <minyard@acm.org> 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 <minyard@acm.org> Tested-by: Andrew Manley <andrew.manley@sealingtech.com> Reviewed-by: Andrew Manley <andrew.manley@sealingtech.com> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> [wsa: fixed comment and commit message to properly describe the case] Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- 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(+)
Comments
Hi Wolfram and Corey, On Wed, Feb 21, 2024 at 08:27:13PM +0100, Wolfram Sang wrote: > From: Corey Minyard <minyard@acm.org> > > 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 <minyard@acm.org> > Tested-by: Andrew Manley <andrew.manley@sealingtech.com> > Reviewed-by: Andrew Manley <andrew.manley@sealingtech.com> > Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> > [wsa: fixed comment and commit message to properly describe the case] > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> is this a fix? Andi > --- > > 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 >
On Wed, Feb 21, 2024 at 09:58:23PM +0100, Andi Shyti wrote: > Hi Wolfram and Corey, > > On Wed, Feb 21, 2024 at 08:27:13PM +0100, Wolfram Sang wrote: > > From: Corey Minyard <minyard@acm.org> > > > > 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 <minyard@acm.org> > > Tested-by: Andrew Manley <andrew.manley@sealingtech.com> > > Reviewed-by: Andrew Manley <andrew.manley@sealingtech.com> > > Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> > > [wsa: fixed comment and commit message to properly describe the case] > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > > is this a fix? In deed, it is: Fixes: f7414cd6923f ("i2c: imx: support slave mode for imx I2C driver")
Hi Wolfram, On Wed, Feb 21, 2024 at 11:54:54PM +0100, Wolfram Sang wrote: > On Wed, Feb 21, 2024 at 09:58:23PM +0100, Andi Shyti wrote: > > Hi Wolfram and Corey, > > > > On Wed, Feb 21, 2024 at 08:27:13PM +0100, Wolfram Sang wrote: > > > From: Corey Minyard <minyard@acm.org> > > > > > > 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 <minyard@acm.org> > > > Tested-by: Andrew Manley <andrew.manley@sealingtech.com> > > > Reviewed-by: Andrew Manley <andrew.manley@sealingtech.com> > > > Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> > > > [wsa: fixed comment and commit message to properly describe the case] > > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > > > > is this a fix? > > In deed, it is: > > Fixes: f7414cd6923f ("i2c: imx: support slave mode for imx I2C driver") Looks good :) Are any action needed on my side? Regards, Oleksij
On Thu, Feb 22, 2024 at 08:56:00AM +0100, Oleksij Rempel wrote: > > > > 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 <minyard@acm.org> > > > > Tested-by: Andrew Manley <andrew.manley@sealingtech.com> > > > > Reviewed-by: Andrew Manley <andrew.manley@sealingtech.com> > > > > Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> > > > > [wsa: fixed comment and commit message to properly describe the case] > > > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > > > > > > is this a fix? > > > > In deed, it is: > > > > Fixes: f7414cd6923f ("i2c: imx: support slave mode for imx I2C driver") > > Looks good :) > Are any action needed on my side? Nope. All tags are still valid, I'd say, because I didn't change any code. Thanks!
Hi On Wed, 21 Feb 2024 20:27:13 +0100, Wolfram Sang wrote: > 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. > > Applied to i2c/i2c-host-fixes on git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git Thank you, Andi Patches applied =============== [1/1] i2c: imx: when being a target, mark the last read as processed commit: cf8281b1aeab93a03c87033a741075c39ace80d4
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; }