cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
13,712 Views
Registered: ‎03-25-2014

Micrel PHY ksz9031 not working

I have added the entry of Micrel PHY in devicetree. on hardware the PHY address is 2 but when I add 0 in devicetree it gets detected and Link is up. I can self ping but cannot ping the other system in network. I have connected the board and my PC bith on static IP. still I am unable to ping my PC. My devicetree part looks as follow.

 

&gem0 {
    status = "okay";
    phy-mode = "rgmii-id";
    phy-handle = <&phy0>;

    phy0: phy@7 {
        reg = <7>;
        compatible = "micrel,ksz9031";
               device_type = "ethernet-phy";
    };
};

 

Why is this happening when I have connected the PHY address to 2 on my hardware it is being deteced on 0 instead of 2. and why I am unable to ping my PC.

0 Kudos
7 Replies
milosoftware
Scholar
Scholar
13,705 Views
Registered: ‎10-26-2012

Your devicetree puts it at ID=7, not 2.

ID 0 is a "broadcast" address, all PHYs respond to that.

0 Kudos
13,690 Views
Registered: ‎03-25-2014

 

&gem0 {
    status = "okay";
    phy-mode = "rgmii-id";
    phy-handle = <&phy0>;

    phy0: phy@2 {
        reg = <2>;
        compatible = "micrel,ksz9031";
               device_type = "ethernet-phy";
    };

 

 

This is my new devicetree but still the problem is same PHY does not respond to 2 address and responses to 0 address. PING is not working but self loop is working. For PHY address 2 in devicetree it states that PHY is missing.

0 Kudos
kvas
Visitor
Visitor
13,661 Views
Registered: ‎06-11-2015

Does the ethernet work in 100 MBit mode? 

 

In order to get the ksz9031 running in GBit mode, I had to us modified fsbl_hook.c to configure the delay registers of the ksz9031

 

Note: Zynq on Enclustra ZX3 mars module, petalinux 2014.2

0 Kudos
milosoftware
Scholar
Scholar
13,647 Views
Registered: ‎10-26-2012

When we integrated the 9031 on our boards I had to patch the kernel to make it work. The patch went into mainline, check that your kernel has it:

 

https://lkml.org/lkml/2014/9/11/547

 

I think without the patch, you could get it to work by unplugging and replugging the cable after starting the network.

0 Kudos
13,595 Views
Registered: ‎03-25-2014

No the ethernet is not working in 100 Mbit mode. The phy is not getting detected. Thanks
0 Kudos
w.helsby@dl.ac.uk
Participant
Participant
7,890 Views
Registered: ‎10-15-2015

I have been trying to use Linux 4.6.0

I have just found that the phy is detected correctly only if the compatible string is removed from the device tree entry.

Looking at the kernel is see why, but am not sure whether it is a stable fix into the future. I think it must be.

 

drivers/net/ethernet/cadence/macb.c : macb_mii_init looks for any nodes under the etherent node.

If there is a node caleed mdio, then anything under it is considered to see if is a phy.

Any other node directly under the ethernet node are considered to be added as a phy.

Either way uses 

drivers/of/of_mdio.c : of_mdiobus_register

This scans the child nodes to see if any are a phy using of_mdiobus_child_is_phy

This looks for various compatible strings compatible=”ethernet-phy-id%4x.%4x”

Then compatible = “ethernet-phy-ieee802.3-c45” and Compatible="ethernet-phy-ieee802.3-c22"

 It looks through a whitelist of strings like "marvell,88E1111"

Which the notes in the kernel say should be removed from device trees.

It also accepts nodes with no comaptible.

As far as I can tell, some part of the kernel will then read the device code (binary) from the phy my MDIO and check it against 

 PHY_ID_KSZ9031  in drivers/net/phy/micrel.c

 

This may help generally, not just for micrel.

William.

bhushanladde01
Visitor
Visitor
1,544 Views
Registered: ‎11-28-2018

which are the registers of ksz9031? I am facing an exact same problem.
0 Kudos