summaryrefslogtreecommitdiff
path: root/target/linux/layerscape/patches-4.4/7217-dpaa2-evb-Add-object-version-check.patch
blob: 13d61cfb5feed9b05346f348e67f710e111c0dde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 213c59501bbd6da8c56e95f90f8a8c6af2682002 Mon Sep 17 00:00:00 2001
From: Razvan Stefanescu <razvan.stefanescu@freescale.com>
Date: Thu, 18 Feb 2016 10:54:40 +0200
Subject: [PATCH 217/226] dpaa2-evb: Add object version check

Abort probing if DPDMUX object version is smaller than required.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@freescale.com>
---
 drivers/staging/fsl-dpaa2/evb/evb.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

--- a/drivers/staging/fsl-dpaa2/evb/evb.c
+++ b/drivers/staging/fsl-dpaa2/evb/evb.c
@@ -44,6 +44,10 @@
 #include "dpdmux.h"
 #include "dpdmux-cmd.h"
 
+/* Minimal supported DPDMUX version */
+#define DPDMUX_MIN_VER_MAJOR			5
+#define DPDMUX_MIN_VER_MINOR			0
+
 /* IRQ index */
 #define DPDMUX_MAX_IRQ_NUM			2
 
@@ -1004,6 +1008,17 @@ static int evb_init(struct fsl_mc_device
 		goto err_close;
 	}
 
+	/* Minimum supported DPDMUX version check */
+	if (priv->attr.version.major < DPDMUX_MIN_VER_MAJOR ||
+	    (priv->attr.version.major == DPDMUX_MIN_VER_MAJOR &&
+	     priv->attr.version.minor < DPDMUX_MIN_VER_MINOR)) {
+		dev_err(dev, "DPDMUX version %d.%d not supported. Use %d.%d or greater.\n",
+			priv->attr.version.major, priv->attr.version.minor,
+			DPDMUX_MIN_VER_MAJOR, DPDMUX_MIN_VER_MAJOR);
+		err = -ENOTSUPP;
+		goto err_close;
+	}
+
 	err = dpdmux_reset(priv->mc_io, 0, priv->mux_handle);
 	if (unlikely(err)) {
 		dev_err(dev, "dpdmux_reset err %d\n", err);