Commit ae1ad12e authored by Oleksij Rempel's avatar Oleksij Rempel Committed by Paolo Abeni

net: dsa: microchip: ksz8: Prepare ksz8863_smi for regmap register access validation

This patch prepares the ksz8863_smi part of ksz8 driver to utilize the
regmap register access validation feature.
Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent bb4609d2
...@@ -104,6 +104,7 @@ static const struct regmap_config ksz8863_regmap_config[] = { ...@@ -104,6 +104,7 @@ static const struct regmap_config ksz8863_regmap_config[] = {
.cache_type = REGCACHE_NONE, .cache_type = REGCACHE_NONE,
.lock = ksz_regmap_lock, .lock = ksz_regmap_lock,
.unlock = ksz_regmap_unlock, .unlock = ksz_regmap_unlock,
.max_register = U8_MAX,
}, },
{ {
.name = "#16", .name = "#16",
...@@ -113,6 +114,7 @@ static const struct regmap_config ksz8863_regmap_config[] = { ...@@ -113,6 +114,7 @@ static const struct regmap_config ksz8863_regmap_config[] = {
.cache_type = REGCACHE_NONE, .cache_type = REGCACHE_NONE,
.lock = ksz_regmap_lock, .lock = ksz_regmap_lock,
.unlock = ksz_regmap_unlock, .unlock = ksz_regmap_unlock,
.max_register = U8_MAX,
}, },
{ {
.name = "#32", .name = "#32",
...@@ -122,11 +124,14 @@ static const struct regmap_config ksz8863_regmap_config[] = { ...@@ -122,11 +124,14 @@ static const struct regmap_config ksz8863_regmap_config[] = {
.cache_type = REGCACHE_NONE, .cache_type = REGCACHE_NONE,
.lock = ksz_regmap_lock, .lock = ksz_regmap_lock,
.unlock = ksz_regmap_unlock, .unlock = ksz_regmap_unlock,
.max_register = U8_MAX,
} }
}; };
static int ksz8863_smi_probe(struct mdio_device *mdiodev) static int ksz8863_smi_probe(struct mdio_device *mdiodev)
{ {
struct device *ddev = &mdiodev->dev;
const struct ksz_chip_data *chip;
struct regmap_config rc; struct regmap_config rc;
struct ksz_device *dev; struct ksz_device *dev;
int ret; int ret;
...@@ -136,9 +141,15 @@ static int ksz8863_smi_probe(struct mdio_device *mdiodev) ...@@ -136,9 +141,15 @@ static int ksz8863_smi_probe(struct mdio_device *mdiodev)
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
chip = device_get_match_data(ddev);
if (!chip)
return -EINVAL;
for (i = 0; i < __KSZ_NUM_REGMAPS; i++) { for (i = 0; i < __KSZ_NUM_REGMAPS; i++) {
rc = ksz8863_regmap_config[i]; rc = ksz8863_regmap_config[i];
rc.lock_arg = &dev->regmap_mutex; rc.lock_arg = &dev->regmap_mutex;
rc.wr_table = chip->wr_table;
rc.rd_table = chip->rd_table;
dev->regmap[i] = devm_regmap_init(&mdiodev->dev, dev->regmap[i] = devm_regmap_init(&mdiodev->dev,
&regmap_smi[i], dev, &regmap_smi[i], dev,
&rc); &rc);
......
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