Message ID | 20230524123220.2481565-5-o.rempel@pengutronix.de (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Microchip DSA Driver Improvements | expand |
Context | Check | Description |
---|---|---|
netdev/series_format | success | Posting correctly formatted |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 8 this patch: 8 |
netdev/cc_maintainers | success | CCed 10 of 10 maintainers |
netdev/build_clang | success | Errors and warnings before: 8 this patch: 8 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/deprecated_api | success | None detected |
netdev/check_selftest | success | No net selftest shell script |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 8 this patch: 8 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 43 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
On Wed, May 24, 2023 at 02:32:19PM +0200, Oleksij Rempel wrote: > This patch prepares the ksz8863_smi part of ksz8 driver to utilize the > regmap register access validation feature. > > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> > --- > drivers/net/dsa/microchip/ksz8863_smi.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/net/dsa/microchip/ksz8863_smi.c b/drivers/net/dsa/microchip/ksz8863_smi.c > index 2af807db0b45..303a4707c759 100644 > --- a/drivers/net/dsa/microchip/ksz8863_smi.c > +++ b/drivers/net/dsa/microchip/ksz8863_smi.c > @@ -104,6 +104,7 @@ static const struct regmap_config ksz8863_regmap_config[] = { > .cache_type = REGCACHE_NONE, > .lock = ksz_regmap_lock, > .unlock = ksz_regmap_unlock, > + .max_register = BIT(8) - 1, Maybe SZ_256 - 1 is more readable? > }, > { > .name = "#16", > @@ -113,6 +114,7 @@ static const struct regmap_config ksz8863_regmap_config[] = { > .cache_type = REGCACHE_NONE, > .lock = ksz_regmap_lock, > .unlock = ksz_regmap_unlock, > + .max_register = BIT(8) - 2, - 2? Is this the 16 bit regmap? So it has 1/2 the number of registers of the 8 bit regmap? So i would of thought it should be BIT(7)-1, or SZ_128-1 ? Andrew
On Wed, May 24, 2023 at 06:59:28PM +0200, Andrew Lunn wrote: > On Wed, May 24, 2023 at 02:32:19PM +0200, Oleksij Rempel wrote: > > This patch prepares the ksz8863_smi part of ksz8 driver to utilize the > > regmap register access validation feature. > > > > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> > > --- > > drivers/net/dsa/microchip/ksz8863_smi.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/drivers/net/dsa/microchip/ksz8863_smi.c b/drivers/net/dsa/microchip/ksz8863_smi.c > > index 2af807db0b45..303a4707c759 100644 > > --- a/drivers/net/dsa/microchip/ksz8863_smi.c > > +++ b/drivers/net/dsa/microchip/ksz8863_smi.c > > @@ -104,6 +104,7 @@ static const struct regmap_config ksz8863_regmap_config[] = { > > .cache_type = REGCACHE_NONE, > > .lock = ksz_regmap_lock, > > .unlock = ksz_regmap_unlock, > > + .max_register = BIT(8) - 1, > > Maybe SZ_256 - 1 is more readable? It is the same way used in other regmap_config in this driver. As for me, U8_MAX is probably more understandable way, since addressing since is 8bit. > > }, > > { > > .name = "#16", > > @@ -113,6 +114,7 @@ static const struct regmap_config ksz8863_regmap_config[] = { > > .cache_type = REGCACHE_NONE, > > .lock = ksz_regmap_lock, > > .unlock = ksz_regmap_unlock, > > + .max_register = BIT(8) - 2, > > - 2? > > Is this the 16 bit regmap? So it has 1/2 the number of registers of > the 8 bit regmap? So i would of thought it should be BIT(7)-1, or > SZ_128-1 ? Sorry, it is a typo.
diff --git a/drivers/net/dsa/microchip/ksz8863_smi.c b/drivers/net/dsa/microchip/ksz8863_smi.c index 2af807db0b45..303a4707c759 100644 --- a/drivers/net/dsa/microchip/ksz8863_smi.c +++ b/drivers/net/dsa/microchip/ksz8863_smi.c @@ -104,6 +104,7 @@ static const struct regmap_config ksz8863_regmap_config[] = { .cache_type = REGCACHE_NONE, .lock = ksz_regmap_lock, .unlock = ksz_regmap_unlock, + .max_register = BIT(8) - 1, }, { .name = "#16", @@ -113,6 +114,7 @@ static const struct regmap_config ksz8863_regmap_config[] = { .cache_type = REGCACHE_NONE, .lock = ksz_regmap_lock, .unlock = ksz_regmap_unlock, + .max_register = BIT(8) - 2, }, { .name = "#32", @@ -122,11 +124,14 @@ static const struct regmap_config ksz8863_regmap_config[] = { .cache_type = REGCACHE_NONE, .lock = ksz_regmap_lock, .unlock = ksz_regmap_unlock, + .max_register = BIT(8) - 4, } }; 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 ksz_device *dev; int ret; @@ -136,9 +141,15 @@ static int ksz8863_smi_probe(struct mdio_device *mdiodev) if (!dev) return -ENOMEM; + chip = device_get_match_data(ddev); + if (!chip) + return -EINVAL; + for (i = 0; i < __KSZ_NUM_REGMAPS; i++) { rc = ksz8863_regmap_config[i]; 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, ®map_smi[i], dev, &rc);
This patch prepares the ksz8863_smi part of ksz8 driver to utilize the regmap register access validation feature. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> --- drivers/net/dsa/microchip/ksz8863_smi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)