Commit 6a986993 authored by Vadim Pasternak's avatar Vadim Pasternak Committed by David S. Miller

mlxsw: i2c: Extend initialization by querying resources data

Extend initialization flow by query requests for chip resources data in
order to obtain chip's specific capabilities, like the number of ports.
Signed-off-by: default avatarVadim Pasternak <vadimp@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 95b75cbd
......@@ -14,6 +14,7 @@
#include "cmd.h"
#include "core.h"
#include "i2c.h"
#include "resources.h"
#define MLXSW_I2C_CIR2_BASE 0x72000
#define MLXSW_I2C_CIR_STATUS_OFF 0x18
......@@ -499,10 +500,19 @@ mlxsw_i2c_init(void *bus_priv, struct mlxsw_core *mlxsw_core,
struct mlxsw_res *res)
{
struct mlxsw_i2c *mlxsw_i2c = bus_priv;
char *mbox;
int err;
mlxsw_i2c->core = mlxsw_core;
return 0;
mbox = mlxsw_cmd_mbox_alloc();
if (!mbox)
return -ENOMEM;
err = mlxsw_core_resources_query(mlxsw_core, mbox, res);
mlxsw_cmd_mbox_free(mbox);
return err;
}
static void mlxsw_i2c_fini(void *bus_priv)
......
......@@ -338,6 +338,7 @@ static struct mlxsw_driver mlxsw_m_driver = {
.init = mlxsw_m_init,
.fini = mlxsw_m_fini,
.profile = &mlxsw_m_config_profile,
.res_query_enabled = true,
};
static const struct i2c_device_id mlxsw_m_i2c_id[] = {
......
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