mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
net: mdio-mt7531-mmio: improve parsing of switch register on probe
The MDIO node is ALWAYS a parent of the MT7531 switch node and the MDIO registers are in the MT7531 register space (in the context of MT7988 it's all memory-mapped) With these assumption, we can simplify and permit better usage of PHY OF automatic probing by binding the mt7531-mdio-mmio driver with the MDIO node instead of the switch node. For OF PHY to be correctly autoprobed, the MDIO driver needs to attached to the MDIO node (the parent of the PHY nodes). The driver will reach the parent node (the switch node) and will parse the register address from there. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
committed by
Tom Rini
parent
145487611f
commit
358f97fcca
@@ -149,8 +149,13 @@ static const struct mdio_ops mt7531_mdio_ops = {
|
||||
static int mt7531_mdio_probe(struct udevice *dev)
|
||||
{
|
||||
struct mt7531_mdio_mmio_priv *priv = dev_get_priv(dev);
|
||||
ofnode switch_node;
|
||||
|
||||
priv->switch_regs = dev_read_addr(dev);
|
||||
switch_node = ofnode_get_parent(dev_ofnode(dev));
|
||||
if (!ofnode_valid(switch_node))
|
||||
return -EINVAL;
|
||||
|
||||
priv->switch_regs = ofnode_get_addr(switch_node);
|
||||
if (priv->switch_regs == FDT_ADDR_T_NONE)
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user