Hello,
we have custom board based on imx6sx connected with ksz8765 switch over spi bus using rgmii interface. we have enabled the fixed link driver in kernel and also configure same in dts file. Port 5 of the switch is connected to imx6sx MAC interface.
device tree configuration:
&fec1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_enet1>;
phy-mode = "mii";
phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
fixed-link = <0 1 100 0 0>;
phy-supply = <®_vref_3v3>;
status = "okay";
};
kernel logs:
fec 2188000.ethernet (unnamed net_device) (uninitialized): Invalid MAC address: 00:00:00:00:00:00
fec 2188000.ethernet (unnamed net_device) (uninitialized): Using random MAC address: 7e:20:8b:ff:4b:22
libphy: fec_enet_mii_bus: probed
fec 2188000.ethernet eth0: registered PHC device 0
fec 2188000.ethernet eth0: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=fixed-0:00, irq=-1)
fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
we could see RX packets are 0, and Tx packet are also in queue.
eth0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:7538 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:828904 (809.4 KiB)
there is spi driver to configure switch over spi for ksz8995...but it should work for ksz8765 after minor modification as chip id and family id is same.
linux-fslc/spi_ks8995.c at 4.1-2.0.x-imx ยท Freescale/linux-fslc ยท GitHub
spi-ks8995 spi3.2: chip family id mismatch: expected 0x87 but 0x00 read
mx51_ecspi_clkdiv: fin: 60000000, fspi: 48000000, post: 0, pre: 1
mx51_ecspi_clkdiv: fin: 60000000, fspi: 48000000, post: 0, pre: 1
spi-ks8995 spi3.2: unsupported chip id for KSZ8795 family: 0x00
but it always reads 0.
Thanks in advance.
Hi everyone
I am using ksz8895 and spi .My connection is as below.
Should I have to use dsa drivers.Is my dts file correct?
&ecspi1{
id = <1>;
status = "okay";
ksz8895: ksz8895@0 {
compatible = "microchip,ksz8895";
reg = <0>;
spi-max-frequency = <40000000>;
spi-cpha;
spi-cpol;
status = "okay";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan1";
};
port@1 {
reg = <1>;
label = "lan2";
};
port@2 {
reg = <2>;
label = "lan3";
};
port@3 {
reg = <3>;
label = "lan4";
};
port@4 {
reg = <4>;
label = "cpu";
ethernet = <ðphy0>;
fixed-link {
speed = <100>;
full-duplex;
};
};
};
};
};
&fec1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_enet1>;
//pinctrl-assert-gpios = <&gpio7 15 GPIO_ACTIVE_LOW>;
clocks = <&clks IMX7D_ENET_AXI_ROOT_CLK>,
<&clks IMX7D_ENET_AXI_ROOT_CLK>,
<&clks IMX7D_ENET1_TIME_ROOT_CLK>,
<&clks IMX7D_PLL_ENET_MAIN_50M_CLK>,
<&clks IMX7D_ENET1_REF_ROOT_CLK>;
clock-names = "ipg", "ahb", "ptp","enet_clk_ref", "no_enet_out";
assigned-clocks = <&clks IMX7D_ENET1_TIME_ROOT_SRC>,
<&clks IMX7D_ENET1_TIME_ROOT_CLK>;
assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
assigned-clock-rates = <0>, <100000000>;
phy-mode = "rmii";
phy-handle = <ðphy0>;
fsl,magic-packet;
status = "okay";
fixed-link {
speed = <100>;
full-duplex;
};
/*mdio {*/
#address-cells = <1>;
#size-cells = <0>;
ethphy0: ethernet-phy@0 {
compatible = "microchip,ksz8895";
reg = <0>;
};
ethphy1: ethernet-phy@1 {
compatible = "microchip,ksz8895";
reg = <1>;
};
/*};*/
};
&fec2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_enet2>;
clocks = <&clks IMX7D_ENET_AXI_ROOT_CLK>,
<&clks IMX7D_ENET_AXI_ROOT_CLK>,
<&clks IMX7D_ENET1_TIME_ROOT_CLK>,
<&clks IMX7D_PLL_ENET_MAIN_50M_CLK>,
<&clks IMX7D_ENET1_REF_ROOT_CLK>;
clock-names = "ipg", "ahb", "ptp","enet_clk_ref", "no_enet_out";
assigned-clocks = <&clks IMX7D_ENET2_TIME_ROOT_SRC>,
<&clks IMX7D_ENET2_TIME_ROOT_CLK>;
assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
assigned-clock-rates = <0>, <100000000>;
phy-mode = "rmii";
phy-handle = <ðphy1>;
fsl,magic-packet;
status = "okay";
};
Hi,
Yes, I have resolved the issue.
check the sys directory /sys/bus/mdio_bus/devices/fixed-0\:00 you should see something like this.
you should configure you switch properly to make it work in phy mode either you put strap in hardware options or write switch register using spi bus.9
is it configure in MII mode? is it configure in MAC(CPU)-PHY(switch) connection?
Regards,
Pavan
Hi pavansingpatil๏ผ
I use the RMII and spi mode, the manual says
Hi pavansingpatil๏ผ
I use the RMII and spi mode, the manual says:
MAC/PHY mode in RMII is different than MAC/PHY mode in MII. There is no strap pin and register configuration request
in RMI. Follow the signals connection in Table 3-11.
Hi pavansingpatil๏ผ
Find this directory with the following information
Can you give me some advice?thanks
Hi,
what issue exactly are you facing? Can you please elaborate?
--Pavan
Hi pavansingpatil,
we could see RX packets are 0, and Tx packet are also in queue.
eth1 Link encap:Ethernet HWaddr 08:00:3E:26:0A:5C
inet addr:192.168.1.127 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:3eff:fe26:a5c%1996281552/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:2722 dropped:0 overruns:0 frame:2722
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:648 (648.0 B)
The information above shows an error in the rx package
Hi lvmh๏ผ
I have a similar problem in debugging KSZ8895RQXCA, Can you give me a reference? Thanks.
root@imx6qsabresd:~# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 56:2e:8f:d5:53:a7
inet addr:192.168.1.4 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::542e:8fff:fed5:53a7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:1123 dropped:0 overruns:0 frame:1123
TX packets:280 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:137336 (134.1 KiB)
Hi ,
่ฏทๆฃๆฅcpu็ซฏ็็ฝๅฃgpio ERๅผ่ๆฏๅฆๆฅไธๆ็ต้ป๏ผๆ่ ไปฃ็ ้ ็ฝฎๆไธๆ.
lvmh@qiyangtech.com
ไฝ ๅฅฝ๏ผๆ็ฐๅจๅบ่ฏฅ้ๅฐไบ่ทไฝ ไธๆ ท็้ฎ้ขใ็ฎๅๆไนๆฏimx6็ๆ็eth0ไธ่ฝๅคping้ไธคไธชไธ่กๅฃ๏ผCPUๆฅๅฃๆฏRGMII๏ผไธไบคๆขๆบ่ฏ็KSZ8775็้่ฎฏๆฅๅฃๆฏspiๆฅๅฃใๆฅ็sys็ฎๅฝๅทฒ็ป็ๆ๏ผ
root@imx6qdlsolo:~# ls /sys/bus/spi/devices/spi5.0/
driver power subsystem sw0 sw2 sw4
modalias registers sw sw1 sw3 uevent
root@imx6qdlsolo:~# ls /sys/bus/mdio_bus/devices/fixed-0\:00
driver phy_id power subsystem uevent
่ฟ่กpingๅฝไปคไธๆฎตๆถ้ดๅ๏ผๅพๅฐๅฆไธ็็ปๆ๏ผ
root@imx6qdlsolo:~#
root@imx6qdlsolo:~# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
^C
--- 192.168.1.1 ping statistics ---
655 packets transmitted, 0 packets received, 100% packet loss
root@imx6qdlsolo:~#
root@imx6qdlsolo:~#
root@imx6qdlsolo:~# ifconfig
eth0 Link encap:Ethernet HWaddr 6A:E2:44:00:BE:96
inet addr:192.168.1.111 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::68e2:44ff:fe00:be96/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1513 errors:0 dropped:0 overruns:0 frame:0
TX packets:891 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:129433 (126.3 KiB) TX bytes:88685 (86.6 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:718 errors:0 dropped:0 overruns:0 frame:0
TX packets:718 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:79872 (78.0 KiB) TX bytes:79872 (78.0 KiB)
ไธ็ฅ้่ฟไบ่ฝไธ่ฝๅๅบไธไบ้ฎ้ขๅข๏ผๆฑ็นๆญใใใใใใใๆ็ฐๅจไธ็กฎๅฎๆฏ่ฝฏไปถ้ฎ้ข่ฟๆฏ็กฌไปถ้ฎ้ข๏ผไธ็ฅ้่ฟไธชๆๆฒกๆไปไนๅๆณ็กฎๅฎๅข๏ผๆๆต้CPU็TXไฟกๅท้ฝๆฏๆ็
ไฝ ๅฅฝ๏ผไฝ ไปฌdtsไธญๆฏๆไน้ ็ฝฎ็๏ผ
ๆๆฏๆ็ งๆฅผไธป้ฃๆ ท้ ็ฝฎ็๏ผไธ็ฅ้่ฝๅฆๅ ไธช่็ณปๆนๅผ่ฎจ่ฎบไธ๏ผๆ็ฎๅไนๆฏๅกๅจ่ฟ้ไบ๏ผQQ๏ผ541237941
Hi lvmh๏ผ
ๆๅไฝ ็้ฎ็ฎฑ(lvmh@qiyangtech.com)ๅไบ้ฎไปถ๏ผ่ฏทๆฅๆถ๏ผ่ฐข่ฐข๏ผ
Hi,
in my case i had hardware issue. cross verify your schematics with micrel LAN service.
fixed-link and fec driver is enough to get Ethernet communication working.
Regards,
--Pavan
Hi,
What's wrong with your hardware?Can you give me a reference?
Hi๏ผ
My problem now is that ksz8794 can be fixed to the CPU, but the network doesn't ping.
Hi pavansingpatil
from log: "spi-ks8995 spi3.2: unsupported chip id for KSZ8795 family: 0x00"
seems driver did not receive correct data and one can check with oscilloscope
what data actually sent from ksz8765.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
right driver is not getting correct data, but i guess driver is just for switch configuration using spi bus.
Do you think Ethernet driver fec_main.c need any modification to detect switch phy using spi bus? or it should work with fixed link driver?
we are able to resolve spi communication issue, now can read/write switch resistor using spi bus. the problem was fec driver ignores the reset flag polarity and always works on active low.
we have configured switch in mii mode and now we see proper 25 MHz clk on ENET_RX_CLK and RX_ENET1_TX_CLK .
eth0 Link encap:Ethernet HWaddr XX::XX:XX:01:1b:b9
inet6 addr: fe80::204:9fff:fe01:1bb9/64 Scope:Link
inet6 addr: fd00:1:2:3:204:9fff:fe01:1bb9/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4189 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:460514 (449.7 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:163 errors:0 dropped:0 overruns:0 frame:0
TX packets:163 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:12460 (12.1 KiB) TX bytes:12460 (12.1 KiB)
imx6 side MAC works fine as I tried loopback and and also localhost ping as you can see lo interface statistics. But we are still having issue with communication as you can see TX packets on eth0 interface but no response from phy. As mentioned earlier we are using fixed link driver as phy is not connected using normal mdio bus.
This is my dmesg output
## dmesg | grep fec
libphy: fec_enet_mii_bus: probed
fec 2188000.ethernet eth0: registered PHC device 0
fec 2188000.ethernet eth0: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=fixed-0:00, irq=-1)
fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
we have verified Clk and Tx data signal on oscilloscope and we some data going out on TX data lines.
so is there any modification required in fec driver to make it work? Thanks in advance.
if there is no response from phy (RX data) one can check phy registers
(dumping them and rechecking with phy datasheet), as incoming data from any port
should appear on port connected to i.mx too. The same one can with reset flag polarity,
printf corresponding gpio data in driver.
Also may be useful to look at linux documentation on
linux-imx.git - i.MX Linux Kernel
linux-imx.git - i.MX Linux Kernel
Best regards
igor