Linux I2C development
 help / color / mirror / Atom feed
* Re: linux-next: manual merge of the i2c-rust tree with the origin tree
       [not found] <aqK86A1SuLKQP5Gi@sirena.org.uk>
@ 2026-10-19 11:48 ` Sasha Levin
  0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2026-10-19 11:48 UTC (permalink / raw)
  To: Mark Brown
  Cc: Igor Korotin, Andi Shyti, Carlos Song, Frank Li, Pei Xiao,
	linux-i2c, linux-kernel, linux-next

On Thu, Sep 10, 2026 at 03:21:28PM +0100, Mark Brown wrote:
> Today's linux-next merge of the i2c-rust tree got a conflict in:
>
>   drivers/i2c/busses/i2c-imx-lpi2c.c

Hi Mark,

The probe hunk of this resolution takes the i2c-rust side, which
reverts

27c9445be86b ("i2c: imx-lpi2c: avoid accessing target registers on master-only controllers")

SCR is written unconditionally again, so master-only controllers such
as i.MX8QM are back to the asynchronous SError at probe. target_supported
is also never set, so lpi2c_imx_register_target() always returns
-EOPNOTSUPP. It builds without warnings, and next-20261016 still has it.

That block should match mainline. The delta against next-20261016 is
below.

The conflict comes back on every merge because rust-i2c-next carries
older copies of mainline's lpi2c commits, for example

90311787f483 ("i2c: imx-lpi2c: reset controller in probe stage")

This is what llminus generated:

diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index dd5b8bcd05d04..7302464c371ae 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -1553,13 +1553,23 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 
 	/*
-	 * Reset all internal controller registers of both Master and Target
-	 * to avoid effects of previous status.
+	 * Reset all internal controller registers to avoid effects of any
+	 * state left over from a previous stage (e.g. the bootloader).
+	 *
+	 * The Master block (MCR) is present on every controller, so reset it
+	 * unconditionally. VERID shows whether the target feature is supported.
+	 * Do not touch the Target block (SCR) on a master-only controller to
+	 * avoid an asynchronous SError.
 	 */
 	writel(MCR_RST, lpi2c_imx->base + LPI2C_MCR);
-	writel(SCR_RST, lpi2c_imx->base + LPI2C_SCR);
 	writel(0, lpi2c_imx->base + LPI2C_MCR);
-	writel(0, lpi2c_imx->base + LPI2C_SCR);
+
+	lpi2c_imx->target_supported = !!(readl(lpi2c_imx->base + LPI2C_VERID) &
+					 VERID_FEATURE_TARGET_PRESENT);
+	if (lpi2c_imx->target_supported) {
+		writel(SCR_RST, lpi2c_imx->base + LPI2C_SCR);
+		writel(0, lpi2c_imx->base + LPI2C_SCR);
+	}
 
 	ret = devm_request_irq(&pdev->dev, lpi2c_imx->irq, lpi2c_imx_isr, IRQF_NO_SUSPEND,
 			       pdev->name, lpi2c_imx);
-- 
Thanks,
Sasha

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-19 11:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <aqK86A1SuLKQP5Gi@sirena.org.uk>
2026-10-19 11:48 ` linux-next: manual merge of the i2c-rust tree with the origin tree Sasha Levin

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