提交 ee7e16b6 编写于 作者: A Andrew Lunn 提交者: David S. Miller

net: mdio: Only perform gpio reset for PHYs

Ethernet switch on the MDIO bus have historically performed their own
handling of the GPIO reset line. The resent patch to have the MDIO
core handle the reset has broken the switch drivers, in that they
cannot claim the GPIO. Some switch drivers need more control over the
GPIO line than what the MDIO core provides. So restore the historical
behaviour by only performing a reset of PHYs, not switches.

Fixes: bafbdd52 ("phylib: Add device reset GPIO support")
Reported-by: NSean Wang <sean.wang@mediatek.com>
Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
Reviewed-by: NGeert Uytterhoeven <geert+renesas@glider.be>
Tested-by: NGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 318ff60e
......@@ -47,13 +47,10 @@
#include "mdio-boardinfo.h"
int mdiobus_register_device(struct mdio_device *mdiodev)
static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
{
struct gpio_desc *gpiod = NULL;
if (mdiodev->bus->mdio_map[mdiodev->addr])
return -EBUSY;
/* Deassert the optional reset signal */
if (mdiodev->dev.of_node)
gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode,
......@@ -69,6 +66,22 @@ int mdiobus_register_device(struct mdio_device *mdiodev)
/* Assert the reset signal again */
mdio_device_reset(mdiodev, 1);
return 0;
}
int mdiobus_register_device(struct mdio_device *mdiodev)
{
int err;
if (mdiodev->bus->mdio_map[mdiodev->addr])
return -EBUSY;
if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) {
err = mdiobus_register_gpiod(mdiodev);
if (err)
return err;
}
mdiodev->bus->mdio_map[mdiodev->addr] = mdiodev;
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册