Re: [PATCH 3/5] media: synopsys: Add PHY stopstate wait for i.MX93

Frank Li
2026-04-17T08:51:16Z

On Wed, Apr 15, 2026 at 11:46:54AM +0800, Guoniu Zhou wrote:
> Implement waiting for D-PHY lanes to enter stop state on i.MX93. This
> ensures proper PHY initialization by verifying that the clock lane and
> all active data lanes have entered the stop state before proceeding with
> further operations.
>
> Signed-off-by: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
> ---
...
>
> +static int imx93_csi2rx_wait_for_phy_stopstate(struct dw_mipi_csi2rx_device *csi2)
> +{
> + struct device *dev = csi2->dev;
> + void __iomem *addr;
> + u32 stopstate_mask;
> + u32 val;
> + int ret;
> +
> + if (!dw_mipi_csi2rx_has_reg(csi2, DW_MIPI_CSI2RX_PHY_STOPSTATE)) {
> + dev_err(dev, "phy_stopstate register not available\n");
> + return -ENXIO;
> + }

Needn't this check, you just implment this specfic callback for imx93, so
DW_MIPI_CSI2RX_PHY_STOPSTATE must be there.

> +
> + stopstate_mask = DPHY_STOPSTATE_CLK_LANE | GENMASK(csi2->lanes_num - 1, 0);
> + addr = dw_mipi_csi2rx_get_regaddr(csi2, DW_MIPI_CSI2RX_PHY_STOPSTATE);
> +
> + ret = readl_poll_timeout(addr, val, (val & stopstate_mask) != stopstate_mask,
> + 1000, 2000000);

There are dw_mipi_csi2rx_read() helper function. So you already use

read_poll_timeout(dw_mipi_csi2rx_read, ...)

Frank