This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to connect CPSW MII with Marvell switch in kernel code?

Other Parts Discussed in Thread: AM3352

Hi, There:

We design a board with AM3352, Marvell switch acting as a PHY to CPSW port 0.

I modify the code in the u-boot, the network is up and work. 

I did similar modification in kernel code. The davinci_mdio detected there is a phy at phy[0]

[    3.674072] davinci_mdio davinci_mdio.0: davinci mdio revision 1.6
[    3.680297] davinci_mdio davinci_mdio.0: detected phy mask e0000ff8
[    3.686920] phy 1410cb1 at 0 is registered
[    3.691467] davinci_mdio.0: probed
[    3.694946] davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver Marvell 88E6133

But when CPSW is up, it seems never did phy connect with the Marvell switch.

Can somebody tell me what did I do is wrong or what is missing?

Thank you!


Jin

  • You should compare your modifications in u-boot and kernel. Since we don't know what you did modify in both there is no way of telling what's wrong.
  • Unfortunately it is not quiet so simple.

    There are some difference of the net driver code in the U-BOOT and the kernel.

    I can post my code somewhere if you provide me a site. Also how can I access all the PHY registers in the user space?

    Thank you!
    Jin

  • Check your pinmuxing, pad configuration, and clock configurations. 99% of the time, when an interface works in uBoot but fails in Linux, if comes down to one of these variables.

  • How can I access the TI registers and the PHY register in user space?

  • devmem2 can be used to R/W the TI registers from user space. The PHYUSERACCESSn register can be used to access attached Ethernet PHYs via MDIO, again, from user space.

  • Hi DK:

    I found there is a typo in my code to get the PHY link information. Now the network is working. DHCP is running.

    Thank you!


    Also in the meanwhile I like to modify the Marvell switch VLAN setting and get Marvell switch statistics. What is the easy way you suggest to do. I see there is a driver in the net/dsa for Marvell switch. What is the right way to so this, One side I define the Marvel switch is CPSW's phy, and another side I need to modify the switch at run time.

  • Hi Jin,

    Perhaps one of the software experts can comment on the suitability of the existing driver for the Marvell device you wish to interface with, but from a hardware perspective, I can offer you the PHYUSERACCESSn register set which allows you to directly R/W to any attached PHY from user space. Using this register, you can access the PHY registers directly via MDIO.

  • I can access the switch through REGISTERs. but I saw the Marvell switch driver in ../net/dsa. I like to use it.

    Can some software expert to answer my question that how can I manage Marvell switch while it is connected as a PHY to CPSW. What is the best way to approach this design.


    Thank you!