[Letux-kernel] jz4730 Ethernet - works now (unreliable and with some deficiencies)

H. Nikolaus Schaller hns at goldelico.com
Sat Mar 20 22:29:33 CET 2021

> Am 12.03.2021 um 14:58 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>> So (again) we have a problem that the IRQ mask is not set up properly or automatically.
>> We may have another bug in irq-ingenic.c
> after hacking some unmask/mask code for the IRQ it seems to basically work!

Finally found it...

Well, it is so simple that I never looked into the jz4730.dtsi entry
which is simply missing the interrupt-parent=/interrupt= entries...

--- a/arch/mips/boot/dts/ingenic/jz4730.dtsi
+++ b/arch/mips/boot/dts/ingenic/jz4730.dtsi
@@ -351,6 +351,9 @@ ethernet: ethernet at 13100000 {
                compatible = "ingenic,jz4730-ethernet";
                reg = <0x13100000 0x1000>;
+               interrupt-parent = <&intc>;
+               interrupts = <19>;
                mdio: mdio {
                        #address-cells = <1>;
                        #size-cells = <0>;

And a bug handling the return value did prevent the probe function from
printing an error and did use interrupt #0 instead of #19. But didn't enable
bit 19... This is why I didn't detect it earlier.

So now ethernet interrupts work without hacks. One more bug fixed! The list is getting shorter :)

Only thing with ethernet is that transmission may get stuck (tx timeouts) and ping time is mostly
very high. Looks as if interrupts are not scheduled timely. Or, the rx/tx buffer management delays
all packets by one trigger (ping likely sends a single packet every second).

root at letux:~# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:21:4d:01:00:ef  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::221:4dff:fe01:ef/64 Scope:Link
          inet6 addr: 2001:16b8:267e:bd00:221:4dff:fe01:ef/64 Scope:Global
          RX packets:190 errors:0 dropped:88 overruns:0 frame:0
          TX packets:117 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:20492 (20.0 KiB)  TX bytes:11473 (11.2 KiB)

root at letux:~# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=119 time=1425 ms
64 bytes from icmp_seq=2 ttl=119 time=1796 ms
64 bytes from icmp_seq=3 ttl=119 time=1018 ms
64 bytes from icmp_seq=4 ttl=119 time=1017 ms
64 bytes from icmp_seq=5 ttl=119 time=2052 ms
64 bytes from icmp_seq=6 ttl=119 time=1050 ms
64 bytes from icmp_seq=7 ttl=119 time=1017 ms
64 bytes from icmp_seq=8 ttl=119 time=1021 ms
64 bytes from icmp_seq=9 ttl=119 time=1024 ms
64 bytes from icmp_seq=10 ttl=119 time=1018 ms
64 bytes from icmp_seq=11 ttl=119 time=1018 ms
64 bytes from icmp_seq=12 ttl=119 time=1018 ms
--- ping statistics ---
13 packets transmitted, 12 received, 7% packet loss, time 12085ms
rtt min/avg/max/mdev = 1017.537/1206.735/2052.843/343.628 ms, pipe 3
root at letux:~# 


PS: sound also works to some extent now. aplay -l lists a sound card,
amixer reports reasonable mixers but aplay hangs. Maybe the I2S interface
gets stuck.

root at letux:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: A400 [Alpha 400], device 0: 10020000.i2s-ak4642-hifi ak4642-hifi-0 [10020000.i2s-ak4642-hifi ak4642-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root at letux:~# amixer
Simple mixer control 'Headphone Enable',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'ALC',0
  Capabilities: cswitch cswitch-joined
  Capture channels: Mono
  Mono: Capture [off]
Simple mixer control 'ALC Capture ZC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Digital',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Front Left: Playback 231 [91%] [0.00dB]
  Front Right: Playback 231 [91%] [0.00dB]
Simple mixer control 'LINEOUT Mixer DACL',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
root at letux:~# aplay /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
^CAborted by signal Interrupt...
aplay: pcm_write:1939: write error: Interrupted system call
root at letux:~# 

More information about the Letux-kernel mailing list