staging: fsl-mc: add dpmcp version check

The dpmcp driver supports dpmcp version 3.0 and above.
This patch adds the code to check the version.

Signed-off-by: Itai Katz <itai.katz@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Acked-by: German Rivera <german.rivera@nxp.com>

 drivers/staging/fsl-mc/bus/dpmcp-cmd.h    |    6 +++---
 drivers/staging/fsl-mc/bus/mc-allocator.c |   11 +++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Itai Katz 2016-04-11 11:56:11 -05:00 committed by Greg Kroah-Hartman
parent ae014c23d5
commit 01f9330846
2 changed files with 14 additions and 3 deletions

View File

@ -32,9 +32,9 @@
#ifndef _FSL_DPMCP_CMD_H
#define _FSL_DPMCP_CMD_H
/* DPMCP Version */
#define DPMCP_VER_MAJOR 3
#define DPMCP_VER_MINOR 0
/* Minimal supported DPMCP Version */
#define DPMCP_MIN_VER_MAJOR 3
#define DPMCP_MIN_VER_MINOR 0
/* Command IDs */
#define DPMCP_CMDID_CLOSE 0x800

View File

@ -297,6 +297,17 @@ int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
if (WARN_ON(!dpmcp_dev))
goto error_cleanup_resource;
if (dpmcp_dev->obj_desc.ver_major < DPMCP_MIN_VER_MAJOR ||
(dpmcp_dev->obj_desc.ver_major == DPMCP_MIN_VER_MAJOR &&
dpmcp_dev->obj_desc.ver_minor < DPMCP_MIN_VER_MINOR)) {
dev_err(&dpmcp_dev->dev,
"ERROR: Version %d.%d of DPMCP not supported.\n",
dpmcp_dev->obj_desc.ver_major,
dpmcp_dev->obj_desc.ver_minor);
error = -ENOTSUPP;
goto error_cleanup_resource;
}
if (WARN_ON(dpmcp_dev->obj_desc.region_count == 0))
goto error_cleanup_resource;