summaryrefslogtreecommitdiff
path: root/drivers/staging/fsl-mc/bus
diff options
context:
space:
mode:
authorItai Katz <itai.katz@nxp.com>2016-04-11 11:56:05 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-04-29 18:00:45 -0700
commit1716cb4c65d2ca4e18110b345b11b285d89d346f (patch)
tree400f25293b79b1f0bf5a0d3e131c418d92cdd8fc /drivers/staging/fsl-mc/bus
parent9529d166f32a2364fa644f8431ba508443953d64 (diff)
staging: fsl-mc: add dprc version check
The dprc driver supports dprc version 5.0 and above. This patch adds the code to check the version. Signed-off-by: Itai Katz <itai.katz@nxp.com> (Stuart: resolved merge conflicts, split dpseci quirk into separate patch) Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com> Acked-by: German Rivera <german.rivera@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fsl-mc/bus')
-rw-r--r--drivers/staging/fsl-mc/bus/dprc-cmd.h6
-rw-r--r--drivers/staging/fsl-mc/bus/dprc-driver.c19
-rw-r--r--drivers/staging/fsl-mc/bus/mc-bus.c1
3 files changed, 23 insertions, 3 deletions
diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h b/drivers/staging/fsl-mc/bus/dprc-cmd.h
index d0198f5d2c1f..9b854fa8e84d 100644
--- a/drivers/staging/fsl-mc/bus/dprc-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h
@@ -40,9 +40,9 @@
#ifndef _FSL_DPRC_CMD_H
#define _FSL_DPRC_CMD_H
-/* DPRC Version */
-#define DPRC_VER_MAJOR 5
-#define DPRC_VER_MINOR 1
+/* Minimal supported DPRC Version */
+#define DPRC_MIN_VER_MAJOR 5
+#define DPRC_MIN_VER_MINOR 0
/* Command IDs */
#define DPRC_CMDID_CLOSE 0x800
diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c
index 2d88c106b974..53c6e98b65e8 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -693,6 +693,25 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
goto error_cleanup_msi_domain;
}
+ error = dprc_get_attributes(mc_dev->mc_io, 0, mc_dev->mc_handle,
+ &mc_bus->dprc_attr);
+ if (error < 0) {
+ dev_err(&mc_dev->dev, "dprc_get_attributes() failed: %d\n",
+ error);
+ goto error_cleanup_open;
+ }
+
+ if (mc_bus->dprc_attr.version.major < DPRC_MIN_VER_MAJOR ||
+ (mc_bus->dprc_attr.version.major == DPRC_MIN_VER_MAJOR &&
+ mc_bus->dprc_attr.version.minor < DPRC_MIN_VER_MINOR)) {
+ dev_err(&mc_dev->dev,
+ "ERROR: DPRC version %d.%d not supported\n",
+ mc_bus->dprc_attr.version.major,
+ mc_bus->dprc_attr.version.minor);
+ error = -ENOTSUPP;
+ goto error_cleanup_open;
+ }
+
mutex_init(&mc_bus->scan_mutex);
/*
diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c
index b4c3c5e27e00..405364307561 100644
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
@@ -745,6 +745,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
goto error_cleanup_mc_io;
}
+ memset(&obj_desc, 0, sizeof(struct dprc_obj_desc));
error = get_dprc_version(mc_io, container_id,
&obj_desc.ver_major, &obj_desc.ver_minor);
if (error < 0)