Interfacing KSZ9131 to iMX 8M Plus

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interfacing KSZ9131 to iMX 8M Plus

1,950 Views
vinay_hasyagar
Contributor III

Hi,

We are using ksz9131 phy in one of our designs which is interfaced to iMX 8M Plus SOC. The KSZ9131 phy is connected to fec MAC of the SOC. The micrel phy driver and fec MAC driver are loading properly. The issue is, whenever the OS boots up then phy is not getting properly configured in RGMII mode. In order to make the phy to work we have to execute the below command once OS is booted.

ethtool -s eth0 speed 1000 duplex full

After executing the above command phy will start working. Does anyone know how to make the phy to work without executing this command. What could be the best solution? 

I took the register dump of the phy before and after executing this command. As per my understanding, the register 0x04 (AUTO-NEGOTIATION ADVERTISEMENT REGISTER) has to be set to the value 0x0401. I tried to set this value using micrel driver but it is not reflecting when OS is booted. Please suggest me some better solution.

Thanks

Labels (1)
Tags (3)
0 Kudos
Reply
4 Replies

1,909 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @vinay_hasyagar 

I hope you are doing well.

Please refer to the below example for reference.

&ethernet0 {
status = "okay";
pinctrl-0 = <&ethernet0_rgmii_pins_a>;
pinctrl-1 = <&ethernet0_rgmii_pins_sleep_a>;
pinctrl-names = "default", "sleep";
phy-mode = "rgmii";
max-speed = <1000>;
phy-handle = <&phy0>;

mdio0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "snps,dwmac-mdio";
phy0: ethernet-phy@1 {
reg = <1>;
};
};
};

Please check this configuration is made for the ethernet node in the device tree.

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

Thanks & Regards,
Dhruvit Vasavada

0 Kudos
Reply

1,597 Views
shaswath
Contributor II

Hello,

We are also facing a problem with the ethernet connection. We are using the KSZ9131 as our only PHY connected to our custom board based on IMX8MP-EVK.

We are using Linux 5.15.71-lts from https://github.com/nxp-imx/linux-imx/tree/lf-5.15.y 

Bellow is our device tree configuration.

 

&eqos {
        status = "disabled";
};

&fec {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_eqos>;
	phy-mode = "rgmii-id";
	phy-handle = <&ethphy1>;
	fsl,magic-packet;
	status = "okay";

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

		ethphy1: ethernet-phy@0 {
			compatible = "ethernet-phy-ieee802.3-c22";
			reg = <0>;
			reset-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
			reset-assert-us = <10000>;
			reset-deassert-us = <50000>;
		};
	};
};

pinctrl_eqos: eqosgrp {
  fsl,pins = <
    MX8MP_IOMUXC_ENET_MDC__ENET_QOS_MDC    0x2
    MX8MP_IOMUXC_ENET_MDIO__ENET_QOS_MDIO  0x2

    MX8MP_IOMUXC_ENET_RD0__ENET_QOS_RGMII_RD0  0x90
    MX8MP_IOMUXC_ENET_RD1__ENET_QOS_RGMII_RD1  0x90
    MX8MP_IOMUXC_ENET_RD2__ENET_QOS_RGMII_RD2  0x90
    MX8MP_IOMUXC_ENET_RD3__ENET_QOS_RGMII_RD3  0x90
    MX8MP_IOMUXC_ENET_RXC__CCM_ENET_QOS_CLOCK_GENERATE_RX_CLK  0x90
    MX8MP_IOMUXC_ENET_RX_CTL__ENET_QOS_RGMII_RX_CTL  0x90

    MX8MP_IOMUXC_ENET_TD0__ENET_QOS_RGMII_TD0  0x16
    MX8MP_IOMUXC_ENET_TD1__ENET_QOS_RGMII_TD1  0x16
    MX8MP_IOMUXC_ENET_TD2__ENET_QOS_RGMII_TD2  0x16
    MX8MP_IOMUXC_ENET_TD3__ENET_QOS_RGMII_TD3  0x16
    MX8MP_IOMUXC_ENET_TX_CTL__ENET_QOS_RGMII_TX_CTL  0x16
    MX8MP_IOMUXC_ENET_TXC__CCM_ENET_QOS_CLOCK_GENERATE_TX_CLK 0x16

    MX8MP_IOMUXC_GPIO1_IO15__GPIO1_IO15  0x10
  >;
};

 

 

We can see the leds blink and is possible to control it with ifconfig eth0 up/down.

However, we do not get any connection. Setting IP address and gateway manually also does not allow us to ping or access the device in the network.

 

 dmesg | grep -i ethernet
[    1.379338] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    1.413546] igb: Intel(R) Gigabit Ethernet Network Driver
[    2.110231] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    3.259066] fec 30be0000.ethernet: Invalid MAC address: 00:00:00:00:00:00
[    3.265916] fec 30be0000.ethernet: Using random MAC address: 0e:d0:09:5e:f3:8d
[    3.357940] fec 30be0000.ethernet eth0: registered PHC device 0
[    9.012865] Generic PHY 30be0000.ethernet-1:00: attached PHY driver (mii_bus:phy_addr=30be0000.ethernet-1:00, irq=POLL)

 ethtool eth0
Settings for eth0:
        Supported ports: [ TP    MII ]
        Supported link modes:   Not reported
        Supported pause frame use: Symmetric
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 10Mb/s
        Duplex: Half
        Auto-negotiation: off
        Port: MII
        PHYAD: 0
        Transceiver: external
        Supports Wake-on: g
        Wake-on: d
        Link detected: no

 

 

Any help would be greatly appreciated.

Best regards,

Shaswath

IMX8MPLUS

0 Kudos
Reply

1,574 Views
shaswath
Contributor II
Issue resolved!
0 Kudos
Reply

654 Views
bgaurav1718
Contributor III
Hi, can you share details of the solution? I am in the same situation.
0 Kudos
Reply