I have attached our hardware design of how iMX8 is connected to SJA1105 and then to KSZ8873 and TJA1101.
1. CPU port from iMX8 to SJA is connected on port0
2. KSZ8873 which is MAC+PHY that is it also behaves like switch connected to port4
2. TJA1101 BroadR phy connected to port2
Issue
Unable to ping the device
I think I got the SJA1105 driver up it is verifying the device ID.
KSZ and TJA device ID's are also successfully verified
below is my dts configuration
SJA1105 Configuration
&ecspi1 {
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1 &pinctrl_ecspi1_cs>;
cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>; /* Check this pin if required as we are using SS0 for chip select */
status = "okay";
##address-cells = <1>
#size-cells = <0>;
switch: sja1105@1 {
reg = <0x0>;
#address-cells = <1>;
#size-cells = <0>;
compatible = "nxp,sja1105q";
spi-max-frequency = <4000000>;
spi-cpha;
fsl,spi-cs-sck-delay = <1000>;
fsl,spi-sck-cs-delay = <1000>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
label = "swp0";
ethernet = <&fec>;
phy-mode = "rmii";
reg = <0>;
fixed-link {
speed = <100>;
full-duplex;
};
};
port@1 {
label = "swp1";
fixed-link = <0 1 100 0 0>;
phy-mode = "mii";
reg = <1>;
};
port@2 {
label = "swp2";
phy-handle = <&fec_phy1>;
phy-mode = "mii";
reg = <2>;
};
port@3 {
label = "swp3";
fixed-link = <0 1 100 0 0>;
phy-mode = "mii";
reg = <3>;
};
port@4 {
label = "swp4";
//phy-handle = <&fec_phy2>;
phy-mode = "mii";
reg = <4>;
fixed-link {
speed = <100>;
full-duplex;
};
};
};
};
};
FEC Configuration
&fec {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_fec>;
phy-mode = "rmii";
phy-reset-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
phy-reset-post-delay = <100>;
fsl,magic-packet;
status = "okay";
fixed-link {
speed = <100>;
full-duplex;
};
mdio {
compatible = "snps,dwmac-mdio";
#address-cells = <1>;
#size-cells = <0>;
fec_phy1: fec-phy@0 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0>;
eee-broken-1000t;
tja110x,refclk_in;
};
};
};
Issue
Unable to ping the device
I think I got the SJA1105 driver up it is verifying the device ID.
KSZ and TJA device ID's are also successfully verified
ip link output
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether d2:38:41:00:11:65 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 1e:29:0c:9a:d7:58 brd ff:ff:ff:ff:ff:ff
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can
5: can1: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can
6: swp1@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether d2:38:41:00:11:65 brd ff:ff:ff:ff:ff:ff
7: swp2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether d2:38:41:00:11:65 brd ff:ff:ff:ff:ff:ff
8: swp3@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether d2:38:41:00:11:65 brd ff:ff:ff:ff:ff:ff
9: swp4@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether d2:38:41:00:11:65 brd ff:ff:ff:ff:ff:ff
ip route output
192.168.0.0/24 dev eth1 proto kernel scope link src 192.168.0.30
192.168.0.0/24 dev swp4 proto kernel scope link src 192.168.0.20
I dont know what am i missing but unable to ping our HW.
I have made some more changes as below.
After making these changes now I see ARP packets are going to connected device in my case I have connected PC at KSZ8873.
I check in Wireshark and found the ARP packets are reaching PC and PC is responding back with MAC address.
But looks like these packets are dropped below are ethtool outputs
root@imx8-ccomgx2-base:~# ethtool -S eth0 | grep -v ': 0'
NIC statistics:
mmc_tx_octetcount_gb: 2224
mmc_tx_framecount_gb: 26
mmc_tx_broadcastframe_g: 1
mmc_tx_multicastframe_g: 16
mmc_tx_64_octets_gb: 2
mmc_tx_65_to_127_octets_gb: 24
mmc_tx_unicast_gb: 9
mmc_tx_multicast_gb: 16
mmc_tx_broadcast_gb: 1
mmc_tx_octetcount_g: 2224
mmc_tx_framecount_g: 26
mmc_rx_framecount_gb: 4117
mmc_rx_octetcount_gb: 459131
mmc_rx_octetcount_g: 459131
mmc_rx_broadcastframe_g: 4086
mmc_rx_multicastframe_g: 21
mmc_rx_64_octets_gb: 3339
mmc_rx_65_to_127_octets_gb: 92
mmc_rx_128_to_255_octets_gb: 5
mmc_rx_256_to_511_octets_gb: 681
mmc_rx_unicast_g: 10
mmc_rx_ipc_intr_mask: 1073692671
mmc_rx_ipv4_gd: 777
mmc_rx_ipv4_gd_octets: 231359
mmc_rx_ipv6_gd_octets: 72
mmc_rx_ipv6_gd: 1
mmc_rx_udp_gd: 769
mmc_rx_icmp_gd: 9
mmc_rx_udp_gd_octets: 215307
mmc_rx_icmp_gd_octets: 544
threshold: 1
tx_pkt_n: 26
rx_pkt_n: 4117
normal_irq_n: 4100
rx_normal_irq_n: 4099
napi_poll: 8224
tx_normal_irq_n: 4100
tx_clean: 4125
tx_set_ic_bit: 1
ip_csum_bypassed: 3339
ipv4_pkt_rcvd: 777
ipv6_pkt_rcvd: 1
no_ptp_rx_msg_type_ext: 4117
root@imx8-ccomgx2-base:~# ethtool -S swp4 | grep -v ': 0'
NIC statistics:
tx_packets: 3301
tx_bytes: 139186
n_rxfrm: 2973
n_rxbyte: 312110
n_txfrm: 3904
n_txbyte: 420158
n_egr_disabled: 5
qlevel_hwm_0: 1
root@imx8-ccomgx2-base:~#
Questions
[ 103.534901] sja1105 spi1.0 swp4 (uninitialized
[ 103.560539] sja1105 spi1.0 swp4 (uninitialized
[ 102.452530] sja1105 spi1.0 swp2 (uninitialized
[ 102.477021] sja1105 spi1.0 swp2 (uninitialized
How am I testing
ifconfig eth0 up (Not assigning the IP address, just making interface up )
ifconfig swp4 192.168.1.20 up (This port is were KSZ8873 phy is connected)
ping 192.168.1.103 (PC IP address)
Hi Amol,
Hope you are doing well.
Apologies for delay in response.
Kindly delete the FEC node from FEC configurations and update the device tree as per below link:
https://www.kernel.org/doc/Documentation/devicetree/bindings/net/dsa/sja1105.txt
Thanks & Regards,
Ritesh M Patel
Hope you are doing well.
Apologies for delay in response.
Could you please try doing loopback and share the logs?
Thanks & Regards,
Ritesh M Patel