public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 6/6] i2c: npcm: Enable slave in eob interrupt
@ 2024-09-13 10:15 Tyrone Ting
  2024-09-13 10:29 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Tyrone Ting @ 2024-09-13 10:15 UTC (permalink / raw)
  To: avifishman70, tmaimon77, tali.perry1, venture, yuenn,
	benjaminfair, andi.shyti, andriy.shevchenko, wsa, rand.sec96,
	wsa+renesas, warp5tw, tali.perry, Avi.Fishman, tomer.maimon,
	KWLIU, JJLIU0, kfting
  Cc: openbmc, linux-i2c, linux-kernel, Charles Boyer,
	Vivekanand Veeracholan

From: Charles Boyer <Charles.Boyer@fii-usa.com>

Nuvoton slave enable was in user space API call master_xfer, so it is
subject to delays from the OS scheduler. If the BMC is not enabled for
slave mode in time for master to send response, then it will NAK the
address match. Then the PLDM request timeout occurs.

If the slave enable is moved to the EOB interrupt service routine, then
the BMC can be ready in slave mode by the time it needs to receive a
response.

Signed-off-by: Charles Boyer <Charles.Boyer@fii-usa.com>
Signed-off-by: Vivekanand Veeracholan <vveerach@google.com>
Signed-off-by: Tyrone Ting <kfting@nuvoton.com>
Reviewed-by: Tali Perry <tali.perry1@gmail.com>
---
 drivers/i2c/busses/i2c-npcm7xx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index 03de1353ad6e..bb4586563c0c 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -1781,6 +1781,12 @@ static int npcm_i2c_int_master_handler(struct npcm_i2c *bus)
 	    (FIELD_GET(NPCM_I2CCST3_EO_BUSY,
 		       ioread8(bus->reg + NPCM_I2CCST3)))) {
 		npcm_i2c_irq_handle_eob(bus);
+#if IS_ENABLED(CONFIG_I2C_SLAVE)
+		/* reenable slave if it was enabled */
+		if (bus->slave)
+			iowrite8((bus->slave->addr & 0x7F) | NPCM_I2CADDR_SAEN,
+				 bus->reg + NPCM_I2CADDR1);
+#endif
 		return 0;
 	}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 6/6] i2c: npcm: Enable slave in eob interrupt
  2024-09-13 10:15 [PATCH v3 6/6] i2c: npcm: Enable slave in eob interrupt Tyrone Ting
@ 2024-09-13 10:29 ` Andy Shevchenko
  2024-09-16  1:44   ` Tyrone Ting
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2024-09-13 10:29 UTC (permalink / raw)
  To: Tyrone Ting
  Cc: avifishman70, tmaimon77, tali.perry1, venture, yuenn,
	benjaminfair, andi.shyti, wsa, rand.sec96, wsa+renesas,
	tali.perry, Avi.Fishman, tomer.maimon, KWLIU, JJLIU0, kfting,
	openbmc, linux-i2c, linux-kernel, Charles Boyer,
	Vivekanand Veeracholan

On Fri, Sep 13, 2024 at 06:15:32PM +0800, Tyrone Ting wrote:
> From: Charles Boyer <Charles.Boyer@fii-usa.com>
> 
> Nuvoton slave enable was in user space API call master_xfer, so it is
> subject to delays from the OS scheduler. If the BMC is not enabled for
> slave mode in time for master to send response, then it will NAK the
> address match. Then the PLDM request timeout occurs.
> 
> If the slave enable is moved to the EOB interrupt service routine, then
> the BMC can be ready in slave mode by the time it needs to receive a
> response.

Fixes tag?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 6/6] i2c: npcm: Enable slave in eob interrupt
  2024-09-13 10:29 ` Andy Shevchenko
@ 2024-09-16  1:44   ` Tyrone Ting
  0 siblings, 0 replies; 3+ messages in thread
From: Tyrone Ting @ 2024-09-16  1:44 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: avifishman70, tmaimon77, tali.perry1, venture, yuenn,
	benjaminfair, andi.shyti, wsa, rand.sec96, wsa+renesas,
	tali.perry, Avi.Fishman, tomer.maimon, KWLIU, JJLIU0, kfting,
	openbmc, linux-i2c, linux-kernel, Charles Boyer,
	Vivekanand Veeracholan

Hi Andy:

Thank you for your feedback.

Andy Shevchenko <andriy.shevchenko@linux.intel.com> 於 2024年9月13日 週五 下午6:29寫道:
>
> On Fri, Sep 13, 2024 at 06:15:32PM +0800, Tyrone Ting wrote:
> > From: Charles Boyer <Charles.Boyer@fii-usa.com>
> >
> > Nuvoton slave enable was in user space API call master_xfer, so it is
> > subject to delays from the OS scheduler. If the BMC is not enabled for
> > slave mode in time for master to send response, then it will NAK the
> > address match. Then the PLDM request timeout occurs.
> >
> > If the slave enable is moved to the EOB interrupt service routine, then
> > the BMC can be ready in slave mode by the time it needs to receive a
> > response.
>
> Fixes tag?
>
The patch is to reduce the time for the i2c module to behave as a target.
IOW, the i2c module target function will be ready earlier than it was.
So I remove the Fixes tag.

> --
> With Best Regards,
> Andy Shevchenko
>
>

Thank you.

Regards,
Tyrone

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-16  1:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-13 10:15 [PATCH v3 6/6] i2c: npcm: Enable slave in eob interrupt Tyrone Ting
2024-09-13 10:29 ` Andy Shevchenko
2024-09-16  1:44   ` Tyrone Ting

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox