UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor jan_ch
Visitor
862 Views
Registered: ‎05-17-2019

Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

I am working on custom board with Zynq7000, where there is one Ethernet connector drived by the KSZ9031. I've connected in as an ENET0, through MIO16-27 and MDIO through MIO52-53. The ethernet reset is connected to GPIO MIO 15. 

I am booting the Linux OS, with the devicetree as below:

&gem0 {
        phy-mode = "rgmii-id";
        status = "okay";
        xlnx,ptp-enet-clock = <0x6750918>;

        mdio {
                #address-cells = <0x1>;
                #size-cells = <0x0>;

                phy@2 {
                        reg = <0x2>;
                        device_type = "ethernet-phy";
                        phandle = <0x5>;
                };
        };
};

Note: my PHY address is 2. I am assuming that my devicetree is good, because if change phy address, the drivers is not loaded. If i set it to 2 the drivers is loaded, but ethernet is not working.

The boot log fragments:

....
libphy: Fixed MDIO Bus: probed
CAN device driver interface
libphy: MACB_mii_bus: probed
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 27 (00:0a:35:00:01:22)
Micrel KSZ9031 Gigabit PHY e000b000.ethernet-ffffffff:02: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:02, irq=POLL)
e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
...
Starting network: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc: started, v1.29.3
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: no lease, failing
FAIL
Starting dropbear sshd: OK
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519 
Starting sshd: OK

Ipconfig:

# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:0A:35:00:01:22  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:27 Base address:0xb000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

sit0      Link encap:IPv6-in-IPv4  
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Any advices?

 

0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
771 Views
Registered: ‎12-04-2016

Re: Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

Hi

Check to see if you have enabled XILINX_PHY support in linux kernel config?

 

Best Regards

Shabbir

0 Kudos
10 Replies
Moderator
Moderator
828 Views
Registered: ‎12-04-2016

Re: Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

Hi @jan_ch 

You need to set compatible name for this micrel PHY. See this related post here for device tree entries

https://forums.xilinx.com/t5/Embedded-Linux/Ethernet-not-working-on-custom-board-with-Zynq-7020-and-Micrel/td-p/824640

0 Kudos
Visitor jan_ch
Visitor
819 Views
Registered: ‎05-17-2019

Re: Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

I've tried, with exactly the same result. Moreover, if I correctly set the phy address the Micrel driver is loaded whether I define compatible or not.

0 Kudos
Visitor jan_ch
Visitor
807 Views
Registered: ‎05-17-2019

Re: Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

Maybe its and reset problem? Should I define any gpio-reset or it is just somehow handled? The Ethernet reset is connected via GPIO to MIO15

0 Kudos
Moderator
Moderator
803 Views
Registered: ‎12-04-2016

Re: Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

Hi @jan_ch 

Can you try applying the changes attached in patch, which basically defers ethernet driver loading till GPIO is loaded. Also add these device tree changes if using GPIO Phy reset

phy-reset-gpio = <&gpio 15 0>;
phy-reset-active-low;

 

0 Kudos
Visitor jan_ch
Visitor
792 Views
Registered: ‎05-17-2019

Re: Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

Hi Shabbirk, I've applied Your patch, and reboot. I am still receiving 

Starting network: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

I've added debug printk in the macb_reset_phy function to be sure that it is rebuilded. Below is the linux boot log, and the pcw.dtsi. Please take a look on the gpio0 and check if this is correct. The devicetree is generated in the SDK, and I've only modified the gem section.

Boot log:

libphy: Fixed MDIO Bus: probed
CAN device driver interface
[debug] resetphy1
libphy: MACB_mii_bus: probed
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 27 (00:0a:35:00:01:22)
Micrel KSZ9031 Gigabit PHY e000b000.ethernet-ffffffff:02: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:02, irq=POLL)
e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
....
Starting syslogd: OK
Starting klogd: OK
Initializing random number generator... done.
Starting network: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc: started, v1.29.3
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: no lease, failing
FAIL
Starting dropbear sshd: OK
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519 
Starting sshd: OK
...
# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:0A:35:00:01:22  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:27 Base address:0xb000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

pcw.dtsi

/ {
        cpus {
                cpu@0 {
                        operating-points = <650000 1000000 325000 1000000>;
                };
        };
};
&gpio0 {
        emio-gpio-width = <64>;
        gpio-mask-high = <0x0>;
        gpio-mask-low = <0x5600>;
};
&intc {
        num_cpus = <2>;
        num_interrupts = <96>;
};
&qspi {
        is-dual = <0>;
        num-cs = <1>;
        spi-rx-bus-width = <4>;
        spi-tx-bus-width = <4>;
        status = "okay";
};
&sdhci0 {
        status = "okay";
        xlnx,has-cd = <0x1>;
        xlnx,has-power = <0x0>;
        xlnx,has-wp = <0x1>;
};
&uart1 {
        cts-override ;
        device_type = "serial";
        port-number = <0>;
        status = "okay";
};
&gem0 {
        phy-mode = "rgmii-id";
        status = "okay";
        xlnx,ptp-enet-clock = <0x6750918>;
        mdio {
                #address-cells = <0x1>;
                #size-cells = <0x0>;
                phy@2 {
                        reg = <0x2>;
                        device_type = "ethernet-phy";
                        phy-reset-gpio = <&gpio0 15 0>;
                        phy-reset-active-low;
                };
        };
};
&clkc {
        fclk-enable = <0x1>;
        ps-clk-frequency = <33333333>;
};
         
0 Kudos
Visitor jan_ch
Visitor
789 Views
Registered: ‎05-17-2019

Re: Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

if I remove this section:

&gpio0 {
        emio-gpio-width = <64>;
        gpio-mask-high = <0x0>;
        gpio-mask-low = <0x5600>;
};

the result is the same.. 

0 Kudos
Moderator
Moderator
772 Views
Registered: ‎12-04-2016

Re: Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

Hi

Check to see if you have enabled XILINX_PHY support in linux kernel config?

 

Best Regards

Shabbir

0 Kudos
Visitor jan_ch
Visitor
766 Views
Registered: ‎05-17-2019

Re: Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

Hi, I think it is enabled, but I will check in a few hours. 

I was experimenting and with the device tree and /etc/network/interfaces like below I successfully connect via ethernet, but not to the router (DHCP). Only the direct connection with host PC is working (The PC ipv4 and ipv4 settings are set to link-local). I was able to connect via SSH from board to HOST and vice versa. It is good news because we are definitely sure now that hardware is working. Does it look like software some software issue? Let me know what do you think. 

 

 

&gpio0 {
     emio-gpio-width = <64>;
     gpio-mask-high = <0x0>;
     gpio-mask-low = <0x5600>;
};
...

&gem0 {
    phy-mode = "rgmii-id";
    status = "okay";
    xlnx,ptp-enet-clock = <0x6750918>;
    /*phy-mode = "rgmii-id";*/

    mdio {
        #address-cells = <0x1>;
        #size-cells = <0x0>;

        phy@2 {
            reg = <0x2>;
            phy-reset-gpio = <&gpio0 15 0>;
            phy-reset-active-low;
            device_type = "ethernet-phy";
        };
}
  3 auto lo
  4 iface lo inet loopback
  5 auto eth0
  6 iface eth0 inet static
  7         address 169.254.157.24
  8         netmask 255.255.255.0

 

0 Kudos
Visitor jan_ch
Visitor
752 Views
Registered: ‎05-17-2019

Re: Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

Hi Shabbir,

Thank you for your help. It looks like it was XILINX_PHY problem. It was not enabled. When I enabled it the link becomes ready and network works. There is a small problem still, the link becomes ready about 2 seconds after boot, so I have to restart the network, but it is the configuration, and I think i can handle it. 

As a summary:

I am using your macb patch, and the final device tree looks like below (without the mdio label).

&gem0 {
        phy-mode = "rgmii-id";
        status = "okay";
        xlnx,ptp-enet-clock = <0x6750918>;

        phy@2 {
                reg = <0x2>;
                compatible = "micrel,ksz9031";
                phy-reset-gpio = <&gpio0 15 0>;
                phy-reset-active-low;
                device_type = "ethernet-phy";
        };
};
0 Kudos
Moderator
Moderator
749 Views
Registered: ‎09-12-2007

Re: Yet another KSZ9031 with Zynq7000 question [LINUX]

Jump to solution

I don't see your phy-handle in the gem node. This should be phy-handle = <0x2>;

0 Kudos