Commit 3b9c7029 authored by Ioana Ciornei's avatar Ioana Ciornei Committed by Greg Kroah-Hartman

staging: dpaa2-ethsw: store version information of the DPSW object

Store the major and minor versions of the DPSW object in the ethsw
structure. This will be used in a subsequent patch to make sure some
commands are only called on the appropriate version of object.
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20200714133431.17532-6-ioana.ciornei@nxp.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 03ad6de9
...@@ -1368,9 +1368,9 @@ static int ethsw_init(struct fsl_mc_device *sw_dev) ...@@ -1368,9 +1368,9 @@ static int ethsw_init(struct fsl_mc_device *sw_dev)
{ {
struct device *dev = &sw_dev->dev; struct device *dev = &sw_dev->dev;
struct ethsw_core *ethsw = dev_get_drvdata(dev); struct ethsw_core *ethsw = dev_get_drvdata(dev);
u16 version_major, version_minor, i;
struct dpsw_stp_cfg stp_cfg; struct dpsw_stp_cfg stp_cfg;
int err; int err;
u16 i;
ethsw->dev_id = sw_dev->obj_desc.id; ethsw->dev_id = sw_dev->obj_desc.id;
...@@ -1388,20 +1388,20 @@ static int ethsw_init(struct fsl_mc_device *sw_dev) ...@@ -1388,20 +1388,20 @@ static int ethsw_init(struct fsl_mc_device *sw_dev)
} }
err = dpsw_get_api_version(ethsw->mc_io, 0, err = dpsw_get_api_version(ethsw->mc_io, 0,
&version_major, &ethsw->major,
&version_minor); &ethsw->minor);
if (err) { if (err) {
dev_err(dev, "dpsw_get_api_version err %d\n", err); dev_err(dev, "dpsw_get_api_version err %d\n", err);
goto err_close; goto err_close;
} }
/* Minimum supported DPSW version check */ /* Minimum supported DPSW version check */
if (version_major < DPSW_MIN_VER_MAJOR || if (ethsw->major < DPSW_MIN_VER_MAJOR ||
(version_major == DPSW_MIN_VER_MAJOR && (ethsw->major == DPSW_MIN_VER_MAJOR &&
version_minor < DPSW_MIN_VER_MINOR)) { ethsw->minor < DPSW_MIN_VER_MINOR)) {
dev_err(dev, "DPSW version %d:%d not supported. Use %d.%d or greater.\n", dev_err(dev, "DPSW version %d:%d not supported. Use %d.%d or greater.\n",
version_major, ethsw->major,
version_minor, ethsw->minor,
DPSW_MIN_VER_MAJOR, DPSW_MIN_VER_MINOR); DPSW_MIN_VER_MAJOR, DPSW_MIN_VER_MINOR);
err = -ENOTSUPP; err = -ENOTSUPP;
goto err_close; goto err_close;
......
...@@ -61,6 +61,7 @@ struct ethsw_core { ...@@ -61,6 +61,7 @@ struct ethsw_core {
struct fsl_mc_io *mc_io; struct fsl_mc_io *mc_io;
u16 dpsw_handle; u16 dpsw_handle;
struct dpsw_attr sw_attr; struct dpsw_attr sw_attr;
u16 major, minor;
int dev_id; int dev_id;
struct ethsw_port_priv **ports; struct ethsw_port_priv **ports;
......
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