Commit 1716cb4c authored by Itai Katz's avatar Itai Katz Committed by Greg Kroah-Hartman

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: default avatarItai Katz <itai.katz@nxp.com>
(Stuart: resolved merge conflicts, split dpseci quirk into separate patch)
Signed-off-by: default avatarStuart Yoder <stuart.yoder@nxp.com>
Acked-by: default avatarGerman Rivera <german.rivera@nxp.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9529d166
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
#ifndef _FSL_DPRC_CMD_H #ifndef _FSL_DPRC_CMD_H
#define _FSL_DPRC_CMD_H #define _FSL_DPRC_CMD_H
/* DPRC Version */ /* Minimal supported DPRC Version */
#define DPRC_VER_MAJOR 5 #define DPRC_MIN_VER_MAJOR 5
#define DPRC_VER_MINOR 1 #define DPRC_MIN_VER_MINOR 0
/* Command IDs */ /* Command IDs */
#define DPRC_CMDID_CLOSE 0x800 #define DPRC_CMDID_CLOSE 0x800
......
...@@ -693,6 +693,25 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) ...@@ -693,6 +693,25 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
goto error_cleanup_msi_domain; 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); mutex_init(&mc_bus->scan_mutex);
/* /*
......
...@@ -745,6 +745,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) ...@@ -745,6 +745,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
goto error_cleanup_mc_io; goto error_cleanup_mc_io;
} }
memset(&obj_desc, 0, sizeof(struct dprc_obj_desc));
error = get_dprc_version(mc_io, container_id, error = get_dprc_version(mc_io, container_id,
&obj_desc.ver_major, &obj_desc.ver_minor); &obj_desc.ver_major, &obj_desc.ver_minor);
if (error < 0) if (error < 0)
......
...@@ -94,12 +94,14 @@ struct fsl_mc_resource_pool { ...@@ -94,12 +94,14 @@ struct fsl_mc_resource_pool {
* from the physical DPRC. * from the physical DPRC.
* @irq_resources: Pointer to array of IRQ objects for the IRQ pool * @irq_resources: Pointer to array of IRQ objects for the IRQ pool
* @scan_mutex: Serializes bus scanning * @scan_mutex: Serializes bus scanning
* @dprc_attr: DPRC attributes
*/ */
struct fsl_mc_bus { struct fsl_mc_bus {
struct fsl_mc_device mc_dev; struct fsl_mc_device mc_dev;
struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES]; struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES];
struct fsl_mc_device_irq *irq_resources; struct fsl_mc_device_irq *irq_resources;
struct mutex scan_mutex; /* serializes bus scanning */ struct mutex scan_mutex; /* serializes bus scanning */
struct dprc_attributes dprc_attr;
}; };
#define to_fsl_mc_bus(_mc_dev) \ #define to_fsl_mc_bus(_mc_dev) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment