net: dsa: felix: remove felix_info :: imdio_base
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 27 Sep 2022 19:15:17 +0000 (22:15 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 29 Sep 2022 02:14:55 +0000 (19:14 -0700)
This address is only relevant for the vsc9959, which is a PCIe device
that holds its switch registers in a different PCIe BAR compared to the
registers for the internal MDIO controller.

Hide this aspect from the common felix driver and move the
pci_resource_start() call to the only place that needs it, which is in
vsc9959_mdio_bus_alloc().

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/ocelot/felix.h
drivers/net/dsa/ocelot/felix_vsc9959.c

index 535a615..4921f5c 100644 (file)
@@ -85,7 +85,6 @@ struct felix {
        struct mii_bus                  *imdio;
        struct phylink_pcs              **pcs;
        resource_size_t                 switch_base;
-       resource_size_t                 imdio_base;
        enum dsa_tag_protocol           tag_proto;
        const struct felix_tag_proto_ops *tag_proto_ops;
        struct kthread_worker           *xmit_worker;
index 2234b4e..4ca9fbe 100644 (file)
@@ -1003,9 +1003,11 @@ static void vsc9959_wm_stat(u32 val, u32 *inuse, u32 *maxuse)
 
 static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)
 {
+       struct pci_dev *pdev = to_pci_dev(ocelot->dev);
        struct felix *felix = ocelot_to_felix(ocelot);
        struct enetc_mdio_priv *mdio_priv;
        struct device *dev = ocelot->dev;
+       resource_size_t imdio_base;
        void __iomem *imdio_regs;
        struct resource res;
        struct enetc_hw *hw;
@@ -1021,10 +1023,12 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)
                return -ENOMEM;
        }
 
+       imdio_base = pci_resource_start(pdev, VSC9959_IMDIO_PCI_BAR);
+
        memcpy(&res, &vsc9959_imdio_res, sizeof(res));
        res.flags = IORESOURCE_MEM;
-       res.start += felix->imdio_base;
-       res.end += felix->imdio_base;
+       res.start += imdio_base;
+       res.end += imdio_base;
 
        imdio_regs = devm_ioremap_resource(dev, &res);
        if (IS_ERR(imdio_regs))
@@ -2665,7 +2669,6 @@ static int felix_pci_probe(struct pci_dev *pdev,
        ocelot->num_flooding_pgids = OCELOT_NUM_TC;
        felix->info = &felix_info_vsc9959;
        felix->switch_base = pci_resource_start(pdev, VSC9959_SWITCH_PCI_BAR);
-       felix->imdio_base = pci_resource_start(pdev, VSC9959_IMDIO_PCI_BAR);
 
        pci_set_master(pdev);