Message ID | 20221008185152.2411007-4-colin.foster@in-advantage.com |
---|---|
State | New |
Headers | show |
Series | add support for the the vsc7512 internal copper phys | expand |
On Sat, Oct 08, 2022 at 11:51:38AM -0700, Colin Foster wrote: > The ocelot_stats_layout array is common between several different chips, > some of which can only be controlled externally. Export this structure so > it doesn't have to be duplicated in these other drivers. > > Rename the structure as well, to follow the conventions of other shared > resources. > > Signed-off-by: Colin Foster <colin.foster@in-advantage.com> > --- I see that ocelot->stats_layout has become a redundant indirection. It no longer contains anything hardware-specific. The register offsets are now part of the switch-specific sys_regmap. Could you please refactor the code to use a single static const struct ocelot_stats_layout in ocelot_stats.c, and remove felix->info->stats_layout and ocelot->stats_layout?
diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 6d695375b14b..4fb525f071ac 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -42,10 +42,6 @@ static const u32 *ocelot_regmap[TARGET_MAX] = { [DEV_GMII] = vsc7514_dev_gmii_regmap, }; -static const struct ocelot_stat_layout ocelot_stats_layout[OCELOT_NUM_STATS] = { - OCELOT_COMMON_STATS, -}; - static void ocelot_pll5_init(struct ocelot *ocelot) { /* Configure PLL5. This will need a proper CCF driver @@ -80,7 +76,7 @@ static int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops) int ret; ocelot->map = ocelot_regmap; - ocelot->stats_layout = ocelot_stats_layout; + ocelot->stats_layout = vsc7514_stats_layout; ocelot->num_mact_rows = 1024; ocelot->ops = ops; diff --git a/drivers/net/ethernet/mscc/vsc7514_regs.c b/drivers/net/ethernet/mscc/vsc7514_regs.c index 123175618251..d665522e18c6 100644 --- a/drivers/net/ethernet/mscc/vsc7514_regs.c +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -9,6 +9,11 @@ #include <soc/mscc/vsc7514_regs.h> #include "ocelot.h" +const struct ocelot_stat_layout vsc7514_stats_layout[OCELOT_NUM_STATS] = { + OCELOT_COMMON_STATS, +}; +EXPORT_SYMBOL(vsc7514_stats_layout); + const struct reg_field vsc7514_regfields[REGFIELD_MAX] = { [ANA_ADVLEARN_VLAN_CHK] = REG_FIELD(ANA_ADVLEARN, 11, 11), [ANA_ADVLEARN_LEARN_MIRROR] = REG_FIELD(ANA_ADVLEARN, 0, 10), diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h index 9b40e7d00ec5..d2b5b6b86aff 100644 --- a/include/soc/mscc/vsc7514_regs.h +++ b/include/soc/mscc/vsc7514_regs.h @@ -8,8 +8,11 @@ #ifndef VSC7514_REGS_H #define VSC7514_REGS_H +#include <soc/mscc/ocelot.h> #include <soc/mscc/ocelot_vcap.h> +extern const struct ocelot_stat_layout vsc7514_stats_layout[]; + extern const struct reg_field vsc7514_regfields[REGFIELD_MAX]; extern const u32 vsc7514_ana_regmap[];
The ocelot_stats_layout array is common between several different chips, some of which can only be controlled externally. Export this structure so it doesn't have to be duplicated in these other drivers. Rename the structure as well, to follow the conventions of other shared resources. Signed-off-by: Colin Foster <colin.foster@in-advantage.com> --- v2-v4 * No change v1 from previous RFC: * Utilize OCELOT_COMMON_STATS --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 6 +----- drivers/net/ethernet/mscc/vsc7514_regs.c | 5 +++++ include/soc/mscc/vsc7514_regs.h | 3 +++ 3 files changed, 9 insertions(+), 5 deletions(-)