]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: dsa: ocelot: felix: add interface for custom regmaps
authorColin Foster <colin.foster@in-advantage.com>
Tue, 7 Dec 2021 17:00:29 +0000 (09:00 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 8 Dec 2021 05:44:49 +0000 (21:44 -0800)
Add an interface so that non-mmio regmaps can be used

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/ocelot/felix.c
drivers/net/dsa/ocelot/felix.h
drivers/net/dsa/ocelot/felix_vsc9959.c
drivers/net/dsa/ocelot/seville_vsc9953.c

index 4ead3ebe947b95254cc6b0a0e444e754b66922fc..57beab3d3ff33bed599f412393e56f9ca0ef68fd 100644 (file)
@@ -1028,7 +1028,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)
                res.start += felix->switch_base;
                res.end += felix->switch_base;
 
-               target = ocelot_regmap_init(ocelot, &res);
+               target = felix->info->init_regmap(ocelot, &res);
                if (IS_ERR(target)) {
                        dev_err(ocelot->dev,
                                "Failed to map device memory space\n");
@@ -1065,7 +1065,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)
                res.start += felix->switch_base;
                res.end += felix->switch_base;
 
-               target = ocelot_regmap_init(ocelot, &res);
+               target = felix->info->init_regmap(ocelot, &res);
                if (IS_ERR(target)) {
                        dev_err(ocelot->dev,
                                "Failed to map memory space for port %d\n",
index 183dbf832db9ac89f570f91e3e1df2374bcfea2e..515bddc012c0e42ac8d9b6d46926b0f776c7e7a9 100644 (file)
@@ -50,6 +50,8 @@ struct felix_info {
                                 enum tc_setup_type type, void *type_data);
        void    (*port_sched_speed_set)(struct ocelot *ocelot, int port,
                                        u32 speed);
+       struct regmap *(*init_regmap)(struct ocelot *ocelot,
+                                     struct resource *res);
 };
 
 extern const struct dsa_switch_ops felix_switch_ops;
index 0676e204c804f66ea0c5e6c6f3e1f37a2d59a36d..74c5c8cd664a7f50b380dba9cddd1d7310ed7ef9 100644 (file)
@@ -2240,6 +2240,7 @@ static const struct felix_info felix_info_vsc9959 = {
        .prevalidate_phy_mode   = vsc9959_prevalidate_phy_mode,
        .port_setup_tc          = vsc9959_port_setup_tc,
        .port_sched_speed_set   = vsc9959_sched_speed_set,
+       .init_regmap            = ocelot_regmap_init,
 };
 
 static irqreturn_t felix_irq_handler(int irq, void *data)
index b9be889016ce4b485cf470770292c65e2c871417..e110550e3507df60d23f09fb3cc1922e90e76b6b 100644 (file)
@@ -1104,6 +1104,7 @@ static const struct felix_info seville_info_vsc9953 = {
        .mdio_bus_free          = vsc9953_mdio_bus_free,
        .phylink_validate       = vsc9953_phylink_validate,
        .prevalidate_phy_mode   = vsc9953_prevalidate_phy_mode,
+       .init_regmap            = ocelot_regmap_init,
 };
 
 static int seville_probe(struct platform_device *pdev)