mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
To: Michael Riesch <michael.riesch@collabora.com>,
	 Bryan O'Donoghue <bod@kernel.org>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Hans Verkuil <hverkuil+cisco@kernel.org>,
	Frank Li <Frank.Li@nxp.com>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	 imx@lists.linux.dev, Guoniu Zhou <guoniu.zhou@oss.nxp.com>
Subject: [PATCH] media: synopsys: dw-mipi-csi2rx: Fix DPHY testclr reset sequence
Date: Tue, 20 Oct 2026 11:04:57 +0800	[thread overview]
Message-ID: <20261020-dw-csi2rx-v1-1-c58a2e5cd43d@oss.nxp.com> (raw)

The Synopsys DPHY datasheet recommends applying a testclr pulse at
first power-up to reset the PHY configuration to its default values
before any test control register is programmed.

The existing code deasserts testclr first and then asserts it, which
is the reverse of the sequence recommended by the DPHY documentation.

Generate the required TESTCLR pulse by asserting TESTCLR, waiting
for the required pulse width, and then deasserting it.

Fixes: ec40b431f0ab ("media: synopsys: csi2rx: add i.MX93 support")
Signed-off-by: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
---
 drivers/media/platform/synopsys/dw-mipi-csi2rx.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
index b7247d597c9c..b9f7ba25bd3b 100644
--- a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
+++ b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
@@ -830,18 +830,23 @@ static void imx93_csi2rx_dphy_assert_reset(struct dw_mipi_csi2rx_device *csi2)
 {
 	u32 val;
 
-	/* Release Synopsys DPHY test codes from reset */
+	/* Put PHY in shutdown mode for configuration */
 	dw_mipi_csi2rx_write(csi2, DW_MIPI_CSI2RX_DPHY_RSTZ, 0);
 	dw_mipi_csi2rx_write(csi2, DW_MIPI_CSI2RX_PHY_SHUTDOWNZ, 0);
 
+	/*
+	 * Apply testclr pulse to load analog programmability defaults
+	 * and release the test interface for configuration.
+	 */
 	val = dw_mipi_csi2rx_read(csi2, DW_MIPI_CSI2RX_PHY_TST_CTRL0);
-	val &= ~DPHY_TEST_CTRL0_TEST_CLR;
+	val |= DPHY_TEST_CTRL0_TEST_CLR;
 	dw_mipi_csi2rx_write(csi2, DW_MIPI_CSI2RX_PHY_TST_CTRL0, val);
 
-	val = dw_mipi_csi2rx_read(csi2, DW_MIPI_CSI2RX_PHY_TST_CTRL0);
 	/* Wait for at least 15ns */
 	ndelay(15);
-	val |= DPHY_TEST_CTRL0_TEST_CLR;
+
+	val = dw_mipi_csi2rx_read(csi2, DW_MIPI_CSI2RX_PHY_TST_CTRL0);
+	val &= ~DPHY_TEST_CTRL0_TEST_CLR;
 	dw_mipi_csi2rx_write(csi2, DW_MIPI_CSI2RX_PHY_TST_CTRL0, val);
 }
 

---
base-commit: d7e7bca7169873b46e857c025c10f3336c1258d8
change-id: 20261020-dw-csi2rx-6225697f45bb

Best regards,
-- 
Guoniu Zhou <guoniu.zhou@oss.nxp.com>


             reply	other threads:[~2026-10-20  3:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  3:04 Guoniu Zhou [this message]
2026-10-20 11:56 ` Michael Riesch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261020-dw-csi2rx-v1-1-c58a2e5cd43d@oss.nxp.com \
    --to=guoniu.zhou@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=bod@kernel.org \
    --cc=hverkuil+cisco@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=michael.riesch@collabora.com \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®