Using KSZ9031 PHY On i.MX8MM and L5.4.24_2.1.0

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

Using KSZ9031 PHY On i.MX8MM and L5.4.24_2.1.0

Using KSZ9031 PHY On i.MX8MM and L5.4.24_2.1.0

 

1. Hardware design

weidong_sun_0-1605669263897.png

KSZ9031

weidong_sun_1-1605669294549.png

Power Rail of KSZ9031

[Comment]
1. VDDIO: KSZ9031 supports 1.8V or 3.3V IO, here we use 1.8V
2. Phy address: 0x07
3. Reset Pin: Using GPIO1_IO07 Pad of CPU
4. 125MHz OUTPUT: not used, left unconnected.

weidong_sun_2-1605669338917.png

2. Software
--In device tree of u-boot
&fec1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_fec1>;
phy-mode = "rgmii-id";
phy-handle = <&ethphy0>;
fsl,magic-packet;
status = "okay";
mdio {
#address-cells = <1>;
#size-cells = <0>;
ethphy0: ethernet-phy@7 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <7>;
            };
       };
};

[comment]
After u-boot booting is done, don’t forget to set MAC address on u-boot command line.
U-Boot > setenv ethaddr 00:01:02:03:04:05
U-Boot > save

--In device tree of linux kernel

pinctrl_fec1: fec1grp {
fsl,pins = <
MX8MM_IOMUXC_ENET_MDC_ENET1_MDC 0x3
MX8MM_IOMUXC_ENET_MDIO_ENET1_MDIO 0x3
MX8MM_IOMUXC_ENET_TD3_ENET1_RGMII_TD3 0x1f
MX8MM_IOMUXC_ENET_TD2_ENET1_RGMII_TD2 0x1f
MX8MM_IOMUXC_ENET_TD1_ENET1_RGMII_TD1 0x1f
MX8MM_IOMUXC_ENET_TD0_ENET1_RGMII_TD0 0x1f
MX8MM_IOMUXC_ENET_RD3_ENET1_RGMII_RD3 0x91
MX8MM_IOMUXC_ENET_RD2_ENET1_RGMII_RD2 0x91
MX8MM_IOMUXC_ENET_RD1_ENET1_RGMII_RD1 0x91
MX8MM_IOMUXC_ENET_RD0_ENET1_RGMII_RD0 0x91
MX8MM_IOMUXC_ENET_TXC_ENET1_RGMII_TXC 0x1f
MX8MM_IOMUXC_ENET_RXC_ENET1_RGMII_RXC 0x91
MX8MM_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL 0x91
MX8MM_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL 0x1f
MX8MM_IOMUXC_GPIO1_IO07_GPIO1_IO7 0x19
>;
};

&fec1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_fec1>;
phy-mode = "rgmii-id";
phy-handle = <&ethphy0>;
phy-reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
phy-reset-post-delay = <150>;
phy-reset-duration = <10>;
fsl,magic-packet;
status = "okay";

mdio {
#address-cells = <1>;
#size-cells = <0>;
ethphy0: ethernet-phy@7 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <7>;

rxc-skew-ps = <1860>;
txc-skew-ps = <1860>;
           };
    };

};

3. About PHY driver
Drivers/net/phy/micrel.c supports following PHYs:

* Support : Micrel Phys:
* Giga phys: ksz9021, ksz9031, ksz9131
* 100/10 Phys : ksz8001, ksz8721, ksz8737, ksz8041
* ksz8021, ksz8031, ksz8051,
* ksz8081, ksz8091,
* ksz8061,
* Switch : ksz8873, ksz886x
* ksz9477
*/

In Linux kernel configuration, the item should be selected:
CONFIG_MICREL_PHY=y

[comment]
If the phy driver is not loaded in u-boot, which mean there is no MAC address for ethernet,
linux will automatically assign a random MAC address for it.

NXP TIC team
Weidong sun
11/18/2020

 

 

 

 

Tags (1)
Attachments
No ratings
Version history
Last update:
‎11-17-2020 08:24 PM
Updated by: