Commit 45c9d966 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by David S. Miller

net: bgmac: support MDIO described in DT

Check ethernet controller DT node for "mdio" subnode and use it with
of_mdiobus_register() when present. That allows specifying MDIO and its
PHY devices in a standard DT based way.

This is required for BCM53573 SoC support. That family is sometimes
called Northstar (by marketing?) but is quite different from it. It uses
different CPU(s) and many different hw blocks.

One of shared blocks in BCM53573 is Ethernet controller. Switch however
is not SRAB accessible (as it Northstar) but is MDIO attached.
Signed-off-by: default avatarRafał Miłecki <rafal@milecki.pl>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b5375509
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/bcma/bcma.h> #include <linux/bcma/bcma.h>
#include <linux/brcmphy.h> #include <linux/brcmphy.h>
#include <linux/of_mdio.h>
#include "bgmac.h" #include "bgmac.h"
static bool bcma_mdio_wait_value(struct bcma_device *core, u16 reg, u32 mask, static bool bcma_mdio_wait_value(struct bcma_device *core, u16 reg, u32 mask,
...@@ -211,6 +212,7 @@ struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac) ...@@ -211,6 +212,7 @@ struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac)
{ {
struct bcma_device *core = bgmac->bcma.core; struct bcma_device *core = bgmac->bcma.core;
struct mii_bus *mii_bus; struct mii_bus *mii_bus;
struct device_node *np;
int err; int err;
mii_bus = mdiobus_alloc(); mii_bus = mdiobus_alloc();
...@@ -229,7 +231,9 @@ struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac) ...@@ -229,7 +231,9 @@ struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac)
mii_bus->parent = &core->dev; mii_bus->parent = &core->dev;
mii_bus->phy_mask = ~(1 << bgmac->phyaddr); mii_bus->phy_mask = ~(1 << bgmac->phyaddr);
err = mdiobus_register(mii_bus); np = of_get_child_by_name(core->dev.of_node, "mdio");
err = of_mdiobus_register(mii_bus, np);
if (err) { if (err) {
dev_err(&core->dev, "Registration of mii bus failed\n"); dev_err(&core->dev, "Registration of mii bus failed\n");
goto err_free_bus; goto err_free_bus;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment