Re: [PATCH 5/7] media: nxp: add DesignWare MIPI CSI2 controller driver

Frank Li
2025-07-04T02:05:03Z

On Wed, Jul 02, 2025 at 11:55:35AM -0400, Frank Li wrote:
> On Wed, Jul 02, 2025 at 12:38:06PM +0300, Laurent Pinchart wrote:
> > Hi Frank,
> >
> > Thank you for the patch.
> >
> > On Tue, Jul 01, 2025 at 06:06:10PM -0400, Frank Li wrote:
> > > From: "Guoniu.zhou" <guoniu.zhou@nxp.com>
> > >
> > > Add V4L2 subdev driver for DesignWare MIPI CSI2 controller.
> >
> > This seems to be at least the third instance of a driver for the CSI-2
> > receiver, the first two being
>
> when I read spec, I known it should be used at other SoC. But I just jump
> to into this area, not easy to find who use it easily.
>
> > drivers/media/platform/raspberrypi/rp1-cfe/dphy.c and the second one
>
> I think this one is not good abstraction. it should be phy driver, which
> use "test" interface to community MIPI phy. I think it'd better create
> a bus driver, like test_if, DPHY should be child devices of this test_if.
>
> like
> csi2@000 {
> ...
> phys = <&dphy>;
>
> dphy: dphy {
> compatible = "...";
> }
> }
>
> The tough problem is that dwc phy have one kind of combo phy, which
> under both dsi and csi controller's test_if.
>
> CSI need config such combophy by DSI test_if. I still have not idea
> how to descript this type hardware yet.
>
> > drivers/media/platform/renesas/rcar-csi2.c (the latter seems to support
> > multiple CSI-2 receivers).
>

Are you sure it is use dwc IP? I check regiser layout only few is the same

#define V4H_N_LANES_REG 0x0004
#define V4H_CSI2_RESETN_REG 0x0008

#define V4H_PHY_MODE_REG 0x001c
#define V4H_PHY_MODE_DPHY 0
#define V4H_PHY_MODE_CPHY 1

#define V4H_PHY_SHUTDOWNZ_REG 0x0040
#define V4H_DPHY_RSTZ_REG 0x0044

Anything I missed?

Frank

> This is one mixed PHY and controller to one drivers, which is not problem
> when use one big MMIO space.
>
> We can create dwc mipi csi common library, let each vendor driver to link
> it (dwc pci/usb did this). The issue is that I have not their hardware to
> test it.
>
> > drivers/staging/media/imx/imx6-mipi-csi2.c
> > seem related too, likely for an old version of the IP.
>
> After we create common dw mipi csi library, we can move this to there.
>
> Frank
>
> >
> > Could we please try to avoid code duplication ?
> >
> > > Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
> > > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > > ---
> > > MAINTAINERS | 1 +
> > > drivers/media/platform/nxp/Kconfig | 11 +
> > > drivers/media/platform/nxp/Makefile | 1 +
> > > drivers/media/platform/nxp/dwc-mipi-csi2.c | 1675 ++++++++++++++++++++++++++++
> >
> > This should go to drivers/media/platform/synopsys/
> >
> > > 4 files changed, 1688 insertions(+)
> >
> > [snip]
> >
> > --
> > Regards,
> >
> > Laurent Pinchart