Device tree configuration for Imx8M Plus with Ksz9563 ethernet switch

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Device tree configuration for Imx8M Plus with Ksz9563 ethernet switch

1,751 次查看
gaurav_bankar
Contributor II

Hii, 

   I am configuring ethernet switch ksz9563 from microchip in my i.mx8mp custom board. I have configured the switch in DTS as follows 

&fec {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_fec>;
phy-mode = "rgmii-id";
fsl,magic-packet;
status = "okay";
 
#phy-reset-duration = <20>;
#phy-reset-gpios = <&gpio4 2 GPIO_ACTIVE_LOW>;
#phy-reset-post-delay=<20>;
 
fixed-link {
speed = <1000>;
full-duplex;
};
 
mdio {
#address-cells = <1>;
#size-cells = <0>;
 
ksz9563: ksz9563@0 {
compatible = "microchip,ksz9893";
reg = <0>;
 
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "eth1";
local-mac-address = [ 38 d5 47 00 2a ad];
};
 
port@1 {
reg = <1>;
label = "eth2";
local-mac-address = [ 38 d5 47 00 2a af];
};
 
port@2 {
reg = <2>;
label = "cpu";
ethernet = <&fec>;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
};
};
};
 
pinctrl 
pinctrl_fec: fecgrp {
fsl,pins = <
MX8MP_IOMUXC_SAI1_RXD7__ENET1_RGMII_RD3 0x91
MX8MP_IOMUXC_SAI1_RXD6__ENET1_RGMII_RD2 0x91
MX8MP_IOMUXC_SAI1_RXD5__ENET1_RGMII_RD1 0x91
MX8MP_IOMUXC_SAI1_RXD4__ENET1_RGMII_RD0 0x91
MX8MP_IOMUXC_SAI1_TXC__ENET1_RGMII_RXC 0x91
MX8MP_IOMUXC_SAI1_TXFS__ENET1_RGMII_RX_CTL 0x91
MX8MP_IOMUXC_SAI1_TXD3__ENET1_RGMII_TD3 0x1f
MX8MP_IOMUXC_SAI1_TXD2__ENET1_RGMII_TD2 0x1f
MX8MP_IOMUXC_SAI1_TXD1__ENET1_RGMII_TD1 0x1f
MX8MP_IOMUXC_SAI1_TXD0__ENET1_RGMII_TD0 0x1f
MX8MP_IOMUXC_SAI1_TXD5__ENET1_RGMII_TXC 0x1f
MX8MP_IOMUXC_SAI1_TXD4__ENET1_RGMII_TX_CTL 0x1f
MX8MP_IOMUXC_SAI1_RXD2__ENET1_MDC 0x3
MX8MP_IOMUXC_SAI1_RXD3__ENET1_MDIO 0x3
MX8MP_IOMUXC_SAI1_RXD1__GPIO4_IO03 0x19
MX8MP_IOMUXC_SAI1_RXD0__GPIO4_IO02 0x19
>;
};
 
Please note we are using mdio bus and not SPI/I2C. 
I am not able to get the switch to work.
 
After downloading the Image the dmesg are as follows 
 root@taswp500:~# dmesg | grep eth0
[ 0.994040] fec 30be0000.ethernet eth0: registered PHC device 0
[ 5.029033] fec 30be0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[ 6.046866] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
 
ifconfig output is 
eth0 Link encap:Ethernet HWaddr CE:8F:BF:69:DE:9F
inet6 addr: fe80::cc8f:bfff:fe69:de9f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:125 errors:0 dropped:0 overruns:0 frame:0
TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8327 (8.1 KiB) TX bytes:3296 (3.2 KiB)
 
as I have configured two ports I only observe 1 port. That port is active but I am not able to assign an IPv4 address to it. 
I have referred these links/documents 
ksz.txt from linux-kernel/Documentation/devicetree/bindings/net/dsa
I have also attached the ethernet switch schematic. 
Please help me to make this work. 
标签 (1)
标记 (1)
0 项奖励
回复
2 回复数

2 次查看
BhavinJoisar
Contributor I

Hi @gaurav_bankar  were you able to solve the problem?

I am using ksz8794 in the MDIO mode as well and I have also created almost similar fec node as you.

&fec1{
phy-mode = "rgmii-id";
phy-handle = <&switch0port0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_fec1>;
status = "okay";

fixed-link {
speed = <1000>;
full-duplex;
};

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


ksz8794: ksz8794@0 {
compatible = "microchip,ksz8794";
reg = <0>;
reset-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
ports {
#address-cells = <1>;
#size-cells = <0>;

switch0port0:port@0 {
reg = <0>;
label = "cpu";
ethernet = <&fec1>;

fixed-link {
speed = <1000>;
full-duplex;
};
};

port@1 {
reg = <1>;
label = "port1";

};

port@2 {
reg = <2>;
label = "port2";
};

port@3 {
reg = <3>;
label = "port3";
};

port@4 {
reg = <4>;
label = "port4";
};

};
};
};
};


And in dmesg I get the following logs

dmesg | grep "eth"
fec 30be0000.ethernet: Invalid MAC address: 00:00:00:00:00:00
fec 30be0000.ethernet: Using random MAC address: 1e:f5:75:fa:7b:78
fec 30be0000.ethernet eth0: registered PHC device 0
fec 30be0000.ethernet eth0: Unable to connect to phy
fec 30be0000.ethernet eth0: Unable to connect to phy


If you have successfully solved the issue can you please provide the solution

0 项奖励
回复

1,187 次查看
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @gaurav_bankar,

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.

Thanks & Regards,
Dhruvit Vasavada

0 项奖励
回复