Re: [PATCH DNI v3 15/15] media: rcar-fcp: Check device revision at probe time
From: Geert Uytterhoeven
Date: Tue Oct 20 2026 - 10:08:35 EST
Hi Paul,
On Thu, 15 Oct 2026 at 09:53, Paul Elder
<paul.elder+renesas@xxxxxxxxxxxxxxxx> wrote:
> From: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx>
>
> Verify that the device revision register reports a valid value,
> otherwise reject the device.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx>
> Signed-off-by: Paul Elder <paul.elder+renesas@xxxxxxxxxxxxxxxx>
> ---
> Changes since v2:
>
> - Add FCP type information
> - Reject devices with an unsupported version
Thanks for the update!
> --- a/drivers/media/platform/renesas/rcar-fcp.c
> +++ b/drivers/media/platform/renesas/rcar-fcp.c
> @@ -154,15 +204,67 @@ EXPORT_SYMBOL_GPL(rcar_fcp_soft_reset);
> * Platform Driver
> */
>
> +static int rcar_fcp_setup(struct rcar_fcp_device *fcp)
> +{
> + static const char * const models[] = {
> + [RCAR_FCPF] = "FCPF",
> + [RCAR_FCPV] = "FCPV",
> + };
> + static struct {
> + u32 version;
> + const char *name;
> + } versions[] = {
> + { RCAR_FCP_REG_VCR_CATEGORY | RCAR_FCP_REG_VCR_REVISION_H3_ES1, "H3 ES1.x" },
> + { RCAR_FCP_REG_VCR_CATEGORY | RCAR_FCP_REG_VCR_REVISION_M3W, "M3W" },
> + { RCAR_FCP_REG_VCR_CATEGORY | RCAR_FCP_REG_VCR_REVISION_V3M, "V3M" },
> + { RCAR_FCP_REG_VCR_CATEGORY | RCAR_FCP_REG_VCR_REVISION_H3, "H3" },
> + { RCAR_FCP_REG_VCR_CATEGORY | RCAR_FCP_REG_VCR_REVISION_D3, "D3" },
> + { RCAR_FCP_REG_VCR_CATEGORY | RCAR_FCP_REG_VCR_REVISION_M3N, "M3N" },
> + { RCAR_FCP_REG_VCR_CATEGORY | RCAR_FCP_REG_VCR_REVISION_V3H, "V3H" },
> + { RCAR_FCP_REG_VCR_CATEGORY | RCAR_FCP_REG_VCR_REVISION_E3, "E3" },
> + { RCAR_FCP_REG_VCR_CATEGORY | RCAR_FCP_REG_VCR_REVISION_X5H_V1, "X5H v1.0" },
> + };
> +
> + unsigned int i;
> + u32 version;
> +
> + /* Check the device version register. */
> + version = rcar_fcp_read(fcp, RCAR_FCP_REG_VCR);
> +
> + for (i = 0; i < ARRAY_SIZE(versions); ++i) {
> + if (versions[i].version == version)
> + break;
> + }
> +
> + if (i >= ARRAY_SIZE(versions)) {
> + dev_err(fcp->dev, "Invalid FCP version 0x%08x\n", version);
You're missing a few variants:
R-Car V4H: rcar-fcp fea10000.fcp: Invalid FCP version 0x0000010a
R-Car V4M: rcar-fcp fea10000.fcp: Invalid FCP version 0x0000010b
> + return -ENODEV;
> + }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds