
On 10/24/24 5:24 PM, Paul Barker wrote:
Several Renesas SoCs in the RZ/G2L family have two Ethernet interfaces. To support this second interface, we extend the bb_miiphy_buses[] array and keep track of the current bus index in ravb_of_to_plat().
Support for an arbitrary number of instances is not implemented - it is expected that bb_miiphy_buses will be replaced with a proper device model/uclass implementation before that is needed.
Signed-off-by: Paul Barker paul.barker.ct@bp.renesas.com
drivers/net/ravb.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c index f1401d2f6ed2..9b33ce929618 100644 --- a/drivers/net/ravb.c +++ b/drivers/net/ravb.c @@ -11,6 +11,7 @@ #include <clk.h> #include <cpu_func.h> #include <dm.h> +#include <dm/device_compat.h> #include <errno.h> #include <log.h> #include <miiphy.h> @@ -494,6 +495,7 @@ static int ravb_probe(struct udevice *dev) { struct eth_pdata *pdata = dev_get_plat(dev); struct ravb_priv *eth = dev_get_priv(dev);
- struct bb_miiphy_bus *phybus; struct mii_dev *mdiodev; void __iomem *iobase; int ret;
@@ -513,7 +515,8 @@ static int ravb_probe(struct udevice *dev)
mdiodev->read = bb_miiphy_read; mdiodev->write = bb_miiphy_write;
- bb_miiphy_buses[0].priv = eth;
phybus = (struct bb_miiphy_bus *)pdata->priv_pdata;
phybus->priv = eth; snprintf(mdiodev->name, sizeof(mdiodev->name), dev->name);
ret = mdio_register(mdiodev);
@@ -625,7 +628,17 @@ int ravb_bb_delay(struct bb_miiphy_bus *bus)
struct bb_miiphy_bus bb_miiphy_buses[] = { {
.name = "ravb",
.name = "ravb0",
.init = ravb_bb_init,
.mdio_active = ravb_bb_mdio_active,
.mdio_tristate = ravb_bb_mdio_tristate,
.set_mdio = ravb_bb_set_mdio,
.get_mdio = ravb_bb_get_mdio,
.set_mdc = ravb_bb_set_mdc,
.delay = ravb_bb_delay,
- },
- {
.init = ravb_bb_init, .mdio_active = ravb_bb_mdio_active, .mdio_tristate = ravb_bb_mdio_tristate,.name = "ravb1",
@@ -646,10 +659,16 @@ static const struct eth_ops ravb_ops = { .write_hwaddr = ravb_write_hwaddr, };
+static int bb_miiphy_index;
- int ravb_of_to_plat(struct udevice *dev) { struct eth_pdata *pdata = dev_get_plat(dev);
- const fdt32_t *cell;
- if (bb_miiphy_index >= bb_miiphy_buses_num) {
dev_err(dev, "ravb driver supports only 1 or 2 devices!\n");
Hmmmm, I really do not like this, can we make this dynamic ?
Unless you want to take a look at this yourself, I can add it into my todo ?