netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dsa: how to set external PHY address of slave MDIO bus
@ 2018-12-21  1:26 John Rama
  2018-12-21  9:56 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: John Rama @ 2018-12-21  1:26 UTC (permalink / raw)
  To: netdev

Hi, Guys, 

I have one question. I'm working following configuration, and implementing a device driver.
Basically, port 1-7 is working fine. I'm now having problem on port8.

- System                                                       
  - i.MX6 and Marvel 88q5050 Switch(PHY addr is 0x10)          
  - port1-5 has integrated PHY
  - port7 is connected to Marvel 88e1510 PHY(PHY addr is 0x1)  
  - port8 is connected to Marvel 88e1510 PHY(PHY addr is 0x0), 
    but it's the slave of MDIO bus whose master is the switch. 
                                                               
                           0x10                                
    +------------+         +-----------------+                 
    |            |         | Marvel 88q5050  |                 
    |            | RGMII   |           port1 |                 
    |   IMX6     +---------+ port6           |                 
    |            |         |           port2 |                 
    |            | MDIO    |                 |                 
    |            +-+-------+           port3 |                 
    |            | |       |                 |                 
    +------------+ |       |           port4 |                 
                   |       |                 |                 
                 +-+-+     |           port5 |     +---+       
                 |   |SGMII|                 |RGMII|   |       
                 |PHY|-----| port7     port8 +-----+PHY+       
                 |   |     |                 |MDIO |   |       
                 +---+     |                 +-----+   |       
            Marvel 88e1510 +-----------------+     +---+       
                 0x1                           Marvel 88e1510  
                                                    0x0        

- Question
In the system above, how should we tell DSA driver the PHY address of the PHY which is connected to port8 ?
It seems to me that port number of ethernet switch and the PHY address of the port should be the same,
and there is no way to tell this info to DSA driver, correct ?

The reason why I think so is based on the code below from linux-next.

# net/dsa/slave.c 

dsa_slave_phy_setup() {
    ....
    /* We could not connect to a designated PHY, so use the switch internal
     * MDIO bus instead
     */
    if (!slave_dev->phydev) {
        ret = dsa_slave_phy_connect(slave_dev, dp->index);
       ....
    }
}

static int dsa_slave_phy_connect(struct net_device *slave_dev, int addr)
{
    ....
    slave_dev->phydev = mdiobus_get_phy(ds->slave_mii_bus, addr);
    ....
}

As shown above, dsa_slave_phy_connect() is called by assigning "dp->index" to "addr".
I think "dp->index" implies the port number of the switch, while "addr" implies the PHY address of the PHY
which connected to the MDIO bus from switch.

Before implementing the solution, I want to confirm if my understanding is correct or not.
Thanks a lot for your help !!

John

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-21 23:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-21  1:26 dsa: how to set external PHY address of slave MDIO bus John Rama
2018-12-21  9:56 ` Andrew Lunn
2018-12-21 23:23   ` John Rama

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).