Ethernet fails on MPC5200 based target
Hi all,
I have a problem with ethernet on my MPC5200 based board.
Ethernet is failing on my target with both 2.6.16.11-rt18 from Freescale BSP (based on the ltib tool) and 2.6.16-rc1-g7cdaf877 from Sylvain Munaut's git tree. On the opposite, it works fine with a relatively old (April 2006) 2.6.16 from Denx.
What I see is that network is not working (corruption occur). I use a ramdisk rootfs to boot and I get an up-and-running system. Then, if I ping it from a remote host I get the following errors:
Quoted 7 lines
ping 192.168.0.183
PING 192.168.0.183 (192.168.0.183) 56(84) bytes of data. 64 bytes from 192.168.0.183: icmp_seq=1 ttl=64 time=8.00 ms 64 bytes from 192.168.0.183: icmp_seq=2 ttl=64 time=0.188 ms wrong data byte #20 should be0x14but was0xc0
#8 8 9 a b c d e f 10 11 12 13 c0 15 16 17 18 19 1a 1b 1c 1d 1e
1f 20 21 22 23 24 25 26 27
Quoted 8 lines
#40 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
64 bytes from 192.168.0.183: icmp_seq=3 ttl=64 time=0.217 ms 64 bytes from 192.168.0.183: icmp_seq=5 ttl=64 time=0.216 ms wrong data byte #20 should be0x14but was0x0
#8 8 9 a b c d e f 10 11 12 13 0 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20 21 22 23 24 25 26 27
#40 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
64 bytes from 192.168.0.183: icmp_seq=6 ttl=64 time=0.187 ms
Since my target is heavily based on the Lite5200 I tryed all three kernels on the Lite5200 too and they all show working ethernet.
This may suggest something related with the different phy hardware, but consider that the kernel from Denx works fine on it!
My target hardware uses MPC5200B CPU and AMD NetPhy AM79C874 for the network phy.
Can you suggest what source file may be responsible for this behaviour in order to dig the trees and maybe, hopefully, fix the problem? I tryed a first diffing between the Denx and the Freescale trees (this last one being mostly based on Sylvain's patches) but I can't figure out any reasonable answer.
Consider I can't unfortunately switch to 2.6.16 from Denx because it does not support ATA/IDE that I need; also switching to the new powerpc architecture is not an option at moment, since it would require changes to the system at whole.
TIA and let me know if you need more details
Signature · 1 line
Andrea Galbusera
Hi andrea,
Could you tell me exactly what kernel you use from me ? (a commit id would do)
And did you write your own platform file ?
Maybe some things (like xlb pipelining, cache snooping, ...) is not properly setup in you platform support code ?
Or maybe since the ethernet code currently only "knows" about the intel phy, something is wrong in the "generic" phy code included in the driver itself.
Sylvain
Quoted 54 lines · Andrea Galbusera
Hi all,
I have a problem with ethernet on my MPC5200 based board.
Ethernet is failing on my target with both 2.6.16.11-rt18 from Freescale BSP (based on the ltib tool) and 2.6.16-rc1-g7cdaf877 from Sylvain Munaut's git tree. On the opposite, it works fine with a relatively old (April 2006) 2.6.16 from Denx.
What I see is that network is not working (corruption occur). I use a ramdisk rootfs to boot and I get an up-and-running system. Then, if I ping it from a remote host I get the following errors:
Quoted 7 lines
ping 192.168.0.183
PING 192.168.0.183 (192.168.0.183) 56(84) bytes of data. 64 bytes from 192.168.0.183: icmp_seq=1 ttl=64 time=8.00 ms 64 bytes from 192.168.0.183: icmp_seq=2 ttl=64 time=0.188 ms wrong data byte #20 should be0x14but was0xc0
#8 8 9 a b c d e f 10 11 12 13 c0 15 16 17 18 19 1a 1b 1c 1d 1e
1f 20 21 22 23 24 25 26 27Quoted 9 lines
#40 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
64 bytes from 192.168.0.183: icmp_seq=3 ttl=64 time=0.217 ms 64 bytes from 192.168.0.183: icmp_seq=5 ttl=64 time=0.216 ms wrong data byte #20 should be0x14but was0x0
#8 8 9 a b c d e f 10 11 12 13 0 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20 21 22 23 24 25 26 27
#40 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
64 bytes from 192.168.0.183: icmp_seq=6 ttl=64 time=0.187 msSince my target is heavily based on the Lite5200 I tryed all three kernels on the Lite5200 too and they all show working ethernet.
This may suggest something related with the different phy hardware, but consider that the kernel from Denx works fine on it!
My target hardware uses MPC5200B CPU and AMD NetPhy AM79C874 for the network phy.Can you suggest what source file may be responsible for this behaviour in order to dig the trees and maybe, hopefully, fix the problem? I tryed a first diffing between the Denx and the Freescale trees (this last one being mostly based on Sylvain's patches) but I can't figure out any reasonable answer.
Consider I can't unfortunately switch to 2.6.16 from Denx because it does not support ATA/IDE that I need; also switching to the new powerpc architecture is not an option at moment, since it would require changes to the system at whole.
TIA and let me know if you need more details
Hi Sylvain! Thanks for quick reply!
I'll try go give you more details.
Quoted 2 lines
Could you tell me exactly what kernel you use from me ? (a commit id would do)
Sorry but I have very poor git knowledge. Hope the following "git log" output answers your question. Otherwise please tell me how to get the correct commit id you need.
commit 7cdaf877678d49e9f8a79d102a12eae7d9772f4b
Merge: a7e235cba9aa805aab4614f2029924ee2d1a1cb7 380c897f96e9084082e538f34623ce4e78935915
Author: Andrea Galbusera <[email protected]>
Date: Tue Dec 12 10:41:21 2006 +0100
Merge branch 'bestcomm' of http://gitbits.246tNt.com/gitbits/linux-2.6-mpc52xx
commit a7e235cba9aa805aab4614f2029924ee2d1a1cb7
Merge: f0aca16fba1f102dd2c33ff8b8bb66ec7f830ee2 af4f75fd6c64917cd3e21f28b17ed49aeac06075
Author: Sylvain Munaut <[email protected]>
Date: Sun Feb 5 17:13:29 2006 +0100
Merge with git+ssh://gitbits.246tNt.com/home/users/tnt/gitbits/linux-2.6-mpc52xx.git
(to bring recent cpu init changes into the ide branch)
Quoted 3 lines
And did you write your own platform file ?
Maybe some things (like xlb pipelining, cache snooping, ...) is not properly setup in you platform support code ?
No, I did not. I use the original platform file
in ./arch/ppc/platforms/lite5200.c. At moment I only had to add initialization code for a few more UARTs: no other changes from original. In fact this is one of the file showing differences between Denx tree and yours. I'll experiment a while reverting those changes.
Quoted 3 lines
Or maybe since the ethernet code currently only "knows" about the intel phy, something is wrong in the "generic" phy code included in the driver itself.
Could you please clarify this concept a little more? I still have an incomplete undertanding of the many source components needed to make eth work. I'm focusing on understanding why Denx code works while yours/ltib fails, but this may not be the best way to walk on...
Andrea
Hi Sylvain,
some new elements in trying to solve my ethernet issue...
Quoted 2 lines · Sylvain Munaut
Maybe some things (like xlb pipelining, cache snooping, ...) is not properly setup in you platform support code ?
Following your suggestion, I started from here... Comparing the unaffected kernel (from DENX) with yours I tryed commenting out the following in mpc52xx_setup_cpu() :
/* Disable XLB pipelining */
/* (cfr errate 292. We could do this only just before ATA PIO
transaction and re-enable it after ...) */
out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS);
In fact this gives much better results, but does not completely solve the problem. Network packets corruption seems to be gone, but, after massive pinging (about 1k ping packets) it comes back with about the same frequency as before the change.
Not tested yet the impact of this change on ATA/IDE functionality/performance, but, if I'm not wrong, disabling the XLB pipelining was due to a hardware bug of the CPU (errata 292), which should be solved in 5200B, the version that I use.
I can't figure out what is the impact of keeping XLB pipelining enabled on the eth behavior. I'm sharing this results in the hope someone have any other valuable suggestion
Regards,
Signature · 1 line
Andrea
Quoted 13 lines · Andrea Galbusera
Quoted 3 lines
Maybe some things (like xlb pipelining, cache snooping, ...) is not properly setup in you platform support code ?
Following your suggestion, I started from here... Comparing the unaffected kernel (from DENX) with yours I tryed commenting out the following in
mpc52xx_setup_cpu():/* Disable XLB pipelining */
/* (cfr errate 292. We could do this only just before ATA PIO
transaction and re-enable it after ...) */
out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS);
Quoted 5 lines
In fact this gives much better results, but does not completely solve the problem. Network packets corruption seems to be gone, but, after massive pinging (about 1k ping packets) it comes back with about the same frequency as before the change.
And does the problem also appears on the denx kernel after 1k ping packets ?
Are the fec driver the same ?
Are the fec task code the same ? (in bestcomm/fec.c )
Quoted 4 lines
I can't figure out what is the impact of keeping XLB pipelining enabled on the eth behavior. I'm sharing this results in the hope someone have any other valuable suggestion
Well me neither, it should only affect performance, not create corruption ...
AFAI understand it anyway.
Sylvain
Hi Sylvain,
Quoted 1 line · Sylvain Munaut
And does the problem also appears on the denx kernel after 1k ping packets ?
I never did a long run test before on the denx kernel... seemed quite robust even on intense root over NFS usage... But I did it today and... I also see some corrupted packets :-(. They are a lot less frequent than with your kernel: I see just about 5/6 corruptions over 2000 pkts. On the opposite, the kernel from you (with XLB pipelining enabled) goes smootly till about 1k packets and then starts behaving very bad with a lot of corrupted ping packets in sequence. I repeated both tests a few times with similar results.
I tend to exclude any other network source of corruption because I can't see anything similar by pinging other hosts.
Quoted 3 lines
Are the fec driver the same ?
Are the fec task code the same ? (inbestcomm/fec.c)
Still understanding what files exactly are involved, but, diffing the following among the two source trees I found no differences:
arch/ppc/syslib/bestcomm/fec.carch/ppc/syslib/bestcomm/sdma_fec_rx_task.carch/ppc/syslib/bestcomm/sdma_fec_tx_task.cdrivers/net/fec_mpc52xx/fec.cdrivers/net/fec_mpc52xx/fec_phy.carch/ppc/syslib/bestcomm/bestcomm.c
If you think it may help, I can attach a full arch/ppc/syslib/bestcomm/* diff result. There are some changes (apart from ATA code that is missing in denx tree), mainly in inline code included in header files (bestcomm.h).
I also noticed that corruption always affects 20th or 52nd data byte which, expected to be repectively 0x14 and 0x52 sometimes turns out to be one of 0x0, 0x0c, 0x14. This sounds very repetitive over hundreds of corrupted packets. I paste some examples in case the could help:
Quoted 8 lines
wrong data byte #52 should be
0x34but was0x0
#8 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27
#40 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 0 35 36 37wrong data byte #52 should be
0x34but was0xc0
#8 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27
#40 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 c0 35 36 37
Quoted 7 lines
wrong data byte #52 should be
0x34but was0x14
#8 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27
#40 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 14 35 36 37wrong data byte #20 should be
0x14but was0xc0
#8 8 9 a b c d e f 10 11 12 13 c0 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27
#40 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
Doing some more tests in the while...
One more aspects that may help. Looking at MPC5200B errata from
http://www.freescale.com/files/32bit/doc/errata/MPC5200BE.pdf?fsrch=1 , I noticed that issues 353 and 463 are ethernet related and where not present in the previous errata. Do you think they can be related with my problem?
Andrea