diff mbox series

[v2] media: renesas: fdp1: Identify R-Car Gen2 versions

Message ID 2cd104d61289cafcf17d8f1b0dbf5de5778a0a0c.1682504219.git.geert+renesas@glider.be
State Accepted
Commit 59a95979638664a905cd46845e7cac1b3ff942f7
Headers show
Series [v2] media: renesas: fdp1: Identify R-Car Gen2 versions | expand

Commit Message

Geert Uytterhoeven April 26, 2023, 10:18 a.m. UTC
On R-Car M2-W:

    rcar_fdp1 fe940000.fdp1: FDP1 Unidentifiable (0x02010101)
    rcar_fdp1 fe944000.fdp1: FDP1 Unidentifiable (0x02010101)

Although the IP Internal Data Register on R-Car Gen2 is documented to
contain all zeros, the actual register contents seem to match the FDP1
version ID of R-Car H3 ES1.*, which has just been removed.
Fortunately this version is not used for any other purposes yet.

Fix this by re-adding the ID, now using an R-Car Gen2-specific name.

Fixes: af4273b43f2bd9ee ("media: renesas: fdp1: remove R-Car H3 ES1.* handling")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
Version register contents verified on R-Car H2 ES1.0, R-Car M2-W ES1.0 &
ES3.0, and R-Car E2 ES1.0.  I couldn't get hold of an R-Car M2-N.

v2:
  - Add Reviewed-by,
  - Add comment.
---
 drivers/media/platform/renesas/rcar_fdp1.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Kieran Bingham April 29, 2023, 9:34 p.m. UTC | #1
Hi Geert,

Quoting Geert Uytterhoeven (2023-04-26 11:18:24)
> On R-Car M2-W:
> 
>     rcar_fdp1 fe940000.fdp1: FDP1 Unidentifiable (0x02010101)
>     rcar_fdp1 fe944000.fdp1: FDP1 Unidentifiable (0x02010101)
> 
> Although the IP Internal Data Register on R-Car Gen2 is documented to
> contain all zeros, the actual register contents seem to match the FDP1
> version ID of R-Car H3 ES1.*, which has just been removed.
> Fortunately this version is not used for any other purposes yet.
> 
> Fix this by re-adding the ID, now using an R-Car Gen2-specific name.
> 
> Fixes: af4273b43f2bd9ee ("media: renesas: fdp1: remove R-Car H3 ES1.* handling")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> Version register contents verified on R-Car H2 ES1.0, R-Car M2-W ES1.0 &
> ES3.0, and R-Car E2 ES1.0.  I couldn't get hold of an R-Car M2-N.
> 
> v2:
>   - Add Reviewed-by,
>   - Add comment.

Looks good!. A pain that the hardware doesn't match the documentation
but ... ho hum!


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


> ---
>  drivers/media/platform/renesas/rcar_fdp1.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/platform/renesas/rcar_fdp1.c b/drivers/media/platform/renesas/rcar_fdp1.c
> index 99af68fddc9249f5..d3bb3e71d61fd9dc 100644
> --- a/drivers/media/platform/renesas/rcar_fdp1.c
> +++ b/drivers/media/platform/renesas/rcar_fdp1.c
> @@ -254,6 +254,8 @@ MODULE_PARM_DESC(debug, "activate debug info");
>  
>  /* Internal Data (HW Version) */
>  #define FD1_IP_INTDATA                 0x0800
> +/* R-Car Gen2 HW manual says zero, but actual value matches R-Car H3 ES1.x */
> +#define FD1_IP_GEN2                    0x02010101
>  #define FD1_IP_M3W                     0x02010202
>  #define FD1_IP_H3                      0x02010203
>  #define FD1_IP_M3N                     0x02010204
> @@ -2360,6 +2362,9 @@ static int fdp1_probe(struct platform_device *pdev)
>  
>         hw_version = fdp1_read(fdp1, FD1_IP_INTDATA);
>         switch (hw_version) {
> +       case FD1_IP_GEN2:
> +               dprintk(fdp1, "FDP1 Version R-Car Gen2\n");
> +               break;
>         case FD1_IP_M3W:
>                 dprintk(fdp1, "FDP1 Version R-Car M3-W\n");
>                 break;
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/media/platform/renesas/rcar_fdp1.c b/drivers/media/platform/renesas/rcar_fdp1.c
index 99af68fddc9249f5..d3bb3e71d61fd9dc 100644
--- a/drivers/media/platform/renesas/rcar_fdp1.c
+++ b/drivers/media/platform/renesas/rcar_fdp1.c
@@ -254,6 +254,8 @@  MODULE_PARM_DESC(debug, "activate debug info");
 
 /* Internal Data (HW Version) */
 #define FD1_IP_INTDATA			0x0800
+/* R-Car Gen2 HW manual says zero, but actual value matches R-Car H3 ES1.x */
+#define FD1_IP_GEN2			0x02010101
 #define FD1_IP_M3W			0x02010202
 #define FD1_IP_H3			0x02010203
 #define FD1_IP_M3N			0x02010204
@@ -2360,6 +2362,9 @@  static int fdp1_probe(struct platform_device *pdev)
 
 	hw_version = fdp1_read(fdp1, FD1_IP_INTDATA);
 	switch (hw_version) {
+	case FD1_IP_GEN2:
+		dprintk(fdp1, "FDP1 Version R-Car Gen2\n");
+		break;
 	case FD1_IP_M3W:
 		dprintk(fdp1, "FDP1 Version R-Car M3-W\n");
 		break;