integrating KSZ8795 on imx8mplus

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

integrating KSZ8795 on imx8mplus

62件の閲覧回数
sanum19
Contributor II

This is how I changed the device tree:

&eqos { //no-change-(for a qualcomm based eth chip)
pinctrl-names = "default"; //eth1
pinctrl-0 = <&pinctrl_eqos>;
phy-mode = "rgmii-id";
phy-handle = <&ethphy0>;
status = "okay";

mdio {
compatible = "snps,dwmac-mdio";
#address-cells = <1>;
#size-cells = <0>;

ethphy0: ethernet-phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0>;
reset-assert-us = <10000>;
reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
reset-deassert-us = <30000>;
eee-broken-1000t;
at803x,vddio-1p8v;
at803x,vddio-disable;
};
};
};

&fec { //linked to ksz8795
pinctrl-names = "default"; //eth0
pinctrl-0 = <&pinctrl_fec>;
phy-mode = "rgmii-id";
fsl,magic-packet;

status = "okay";

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

};
-----------------------------------------------------------------------------------------

&ecspi2 {
#address-cells = <1>;
#size-cells = <0>;
fsl,spi-num-chipselects = <3>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2 &pinctrl_ecspi2_cs>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>, /*SS0*/
<&gpio4 4 GPIO_ACTIVE_LOW>, /*SS1*/
<&gpio4 5 GPIO_ACTIVE_LOW>; /*SS2*/
clocks = <&clk IMX8MP_CLK_ECSPI2_ROOT>,
<&clk IMX8MP_CLK_ECSPI2_ROOT>;
clock-names = "ipg", "per";

status = "okay";

ksz8795: switch@0 {
reg = <0>;
compatible = "microchip,ksz8795";
spi-max-frequency = <5000000>;
pinctrl-names = "default";
/* spi-cpha;
spi-cpol; */
status = "okay";

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

port@0 {
reg = <0>;
label = "lan1";
phy-mode = "rgmii-id";
fixed-link {
speed = <100>;
full-duplex;
};
};

port@1 {
reg = <1>;
label = "lan2";
phy-mode = "rgmii-id";
fixed-link {
speed = <100>;
full-duplex;
};
};

port@2 {
reg = <2>;
label = "lan3";
phy-mode = "rgmii-id";
fixed-link {
speed = <100>;
full-duplex;
};
};


port@4 {
reg = <3>;
label = "cpu";
phy-mode = "rgmii-id";
ethernet = <&fec>;
fixed-link {
speed = <1000>;
full-duplex;
};

};
};

};

spidev1: spi@1 {
reg = <1>;
compatible = "rohm,dh2228fv";
spi-max-frequency = <500000>;
};

spidev2: spi@2 {
reg = <2>;
compatible = "rohm,dh2228fv";
spi-max-frequency = <500000>;
};
};

----------------------------------------------------------------------------

 

The board is booted and i loads the module: ksz_common, ksz8795 and ksz8795_spi

I can see the respective nodes formed.

# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1501
inet6 fe80::8bd8:a721:8c85:3a61 prefixlen 64 scopeid 0x20<link>
ether 38:d5:47:00:2e:9d txqueuelen 1000 (Ethernet)
RX packets 42 bytes 3094 (3.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 73 bytes 12753 (12.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 38:d5:47:00:2e:9e txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 52

lan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::f4f3:314b:f7c3:9bd5 prefixlen 64 scopeid 0x20<link>
ether 38:d5:47:00:2e:9d txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 14 bytes 2434 (2.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lan2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::1bd1:9463:93c0:732c prefixlen 64 scopeid 0x20<link>
ether 38:d5:47:00:2e:9d txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 14 bytes 2434 (2.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lan3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::833e:9b97:6b1e:82ae prefixlen 64 scopeid 0x20<link>
ether 38:d5:47:00:2e:9d txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 14 bytes 2434 (2.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


-----------------------------------------------------------------------------------------------------------------------------
I can also see an error from the spi-driver

from dmesg log:
DBUG: KSZ_common:ksz_switch_register: of_get_phy_mode returned -22
[ 57.561350] DBUG: KSZ_common:ksz_switch_register: Retrieved PHY mode 0
[ 57.561353] DBUG: KSZ_common:ksz_switch_register: Failed to retrieve PHY mode, error -22

 

from ksz_common.c:
if (dev->dev->of_node) {
printk("DBUG: KSZ_common:ksz_switch_register: Device tree node found, retrieving PHY mode\n");
ret = of_get_phy_mode(dev->dev->of_node, &interface);
if (ret == 0) {
dev->compat_interface = interface;
printk("DBUG: KSZ_common:ksz_switch_register: Retrieved PHY mode %d\n", interface);
} else {
printk("DBUG: KSZ_common:ksz_switch_register: Failed to retrieve PHY mode, error %d\n", ret);
}
PRINT was added by me to debug-this is the only "error msg" i see from driver. But the driver loads successsfully
Regarding phy-mode: There are other prints after above error :
[ 57.576542] CLSU:KSZ8795: Configuring addr 0x87, bits 0x8, set 1
[ 57.576597] CLSU:KSZ8795: Configuring port 4, offset 0x0, bits 0x40, set 0
[ 57.576631] CLSU:KSZ8795: Configuring port 4, offset 0x2, bits 0x80, set 0
[ 57.576665] CLSU:KSZ8795: Configuring port 4, offset 0x0, bits 0x20, set 1
[ 57.576717] CLSU:KSZ8795: Configuring CPU port
[ 57.576750] CLSU:KSZ8795: Setting RGMII mode

So i suppose the phy-mode is being set to rgmii

----------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
ISSUE : I connected an ethernet cable between my pc and the board to check the comm ,Set a static ip for eth0 on board. i can see a link is established b/w them . But i cannot ping each other. Data packets are not seem to be receiving at both ends.(Validated that hardware is working fine)

from device to pc
# ping 192.168.1.50
PING 192.168.1.50 (192.168.1.50) 56(84) bytes of data.
From 192.168.1.30 icmp_seq=1 Destination Host Unreachable

Since link is being establish and ping is not happening i suspect - it must be some configuration issue. Either in the device tree or in the Register Writes.
Please help me to troubleshoot the issue.

0 件の賞賛
返信
1 返信

48件の閲覧回数
sanum19
Contributor II

kernel is 5.10

0 件の賞賛
返信