Parallella Linux updates

Forum about Parallella boot process, linux kernel, distros, SD-cards, etc.

Parallella Linux updates

Postby aolofsson » Thu Aug 21, 2014 9:31 pm

Note that the Linux repo is undergoing massive changes.

Note that we have changed the Linux repository name from "parallella-linux-adi" to "parallella-linux".

Code: Select all
git clone https://github.com/parallella/parallella-linux


So far I pulled in all of the latest changes from ADI's 3.14 based repo and things look good (after some device tree changes). Headless operation works fine but there is still some work to be done on the hdmi side.

Ben's new "sudo less" drivers are in there as well and epiphany regression suites pass!!! This is very exciting.

If you care to take a look, please wear a hard hat. :D Please see previous posts for how to compile kernel and device tree.

Andreas
User avatar
aolofsson
 
Posts: 1005
Joined: Tue Dec 11, 2012 6:59 pm
Location: Lexington, Massachusetts,USA

Re: Parallella Linux updates

Postby tajuma » Mon Aug 25, 2014 1:19 pm

With 3.14.12-parallella-gaa3549e the linux ethernet does not work if you touch ethernet in u-boot first, like ping or tftpboot.

Here booting from sd-card (using hdmi-bitstream parallella_e16_hdmi_gpiose_7020.bit.bin):
Code: Select all
U-Boot 2012.10-00003-g792c31c (Jan 03 2014 - 12:24:08)

I2C:   ready
DRAM:  992 MiB
WARNING: Caches not enabled
MMC:   SDHCI: 0
SF: Detected N25Q128 with page size 64 KiB, total 16 MiB
In:    serial
Out:   serial
Err:   serial
Net:   zynq_gem
Hit any key to stop autoboot:  0
Configuring PL and Booting Linux...
Device: SDHCI
Manufacturer ID: 2
OEM: 544d
Name: SD16G
Tran Speed: 50000000
Rd Block Len: 512
SD version 2.0
High Capacity: Yes
Capacity: 14.9 GiB
Bus Width: 4-bit
reading parallella.bit.bin

4045568 bytes read
reading uImage

4910496 bytes read
reading devicetree.dtb

8839 bytes read
## Booting kernel from Legacy Image at 03000000 ...
   Image Name:   Linux-3.14.12-parallella-gaa3549
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4910432 Bytes = 4.7 MiB
   Load Address: 00000800
   Entry Point:  00000800
   Verifying Checksum ... OK
## Flattened Device Tree blob at 02a00000
   Booting using the fdt blob at 0x02a00000
   Loading Kernel Image ... OK
OK
   Loading Device Tree to 1fffa000, end 1ffff286 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.14.12-parallella-gaa3549e-dirty (tm@desktop) (gcc version 4.8.2 (Ubuntu/Linaro 4.8.2-16ubuntu4) ) #5 SMP PREEMPT Sun Aug 24 20:49:20 EEST 2014
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: Parallella Gen1

...

Last login: Mon Aug 25 12:34:01 UTC 2014 on tty1
Welcome to Linaro 14.04 (GNU/Linux 3.14.12-parallella-gaa3549e-dirty armv7l)

 * Documentation:  https://wiki.linaro.org/

Everything as expected, get an IP address from dhcp server and network works:
Code: Select all
root@linaro-nano:~# for s in 10 40 50 60 100 1000 ; do printf "size %4d: " $s ; ping -nq -i 0.01 -c 100 -s $s 192.168.1.2 | grep transmitted ; done
size   10: 100 packets transmitted, 100 received, 0% packet loss, time 989ms
size   40: 100 packets transmitted, 100 received, 0% packet loss, time 989ms
size   50: 100 packets transmitted, 100 received, 0% packet loss, time 989ms
size   60: 100 packets transmitted, 100 received, 0% packet loss, time 990ms
size  100: 100 packets transmitted, 100 received, 0% packet loss, time 989ms
size 1000: 100 packets transmitted, 100 received, 0% packet loss, time 989ms

Good, reboot and in u-boot first ping something (which works):
Code: Select all
U-Boot 2012.10-00003-g792c31c (Jan 03 2014 - 12:24:08)

I2C:   ready
DRAM:  992 MiB
WARNING: Caches not enabled
MMC:   SDHCI: 0
SF: Detected N25Q128 with page size 64 KiB, total 16 MiB
In:    serial
Out:   serial
Err:   serial
Net:   zynq_gem
Hit any key to stop autoboot:  0

zynq-uboot> ping 192.168.1.2
Trying to set up GEM link...
Phy ID: 01410E90
Resetting PHY...

PHY reset complete.
Waiting for PHY to complete auto-negotiation...
Link is now at 1000Mbps!
Using zynq_gem device
host 192.168.1.2 is alive

And then boot the same images from the same sd-card:
Code: Select all
zynq-uboot> boot
Configuring PL and Booting Linux...
Device: SDHCI
Manufacturer ID: 2
OEM: 544d
Name: SD16G
Tran Speed: 50000000
Rd Block Len: 512
SD version 2.0
High Capacity: Yes
Capacity: 14.9 GiB
Bus Width: 4-bit
reading parallella.bit.bin

4045568 bytes read
reading uImage

4910496 bytes read
reading devicetree.dtb

8839 bytes read
## Booting kernel from Legacy Image at 03000000 ...
   Image Name:   Linux-3.14.12-parallella-gaa3549
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4910432 Bytes = 4.7 MiB
   Load Address: 00000800
   Entry Point:  00000800
   Verifying Checksum ... OK
## Flattened Device Tree blob at 02a00000
   Booting using the fdt blob at 0x02a00000
   Loading Kernel Image ... OK
OK
   Loading Device Tree to 1fffa000, end 1ffff286 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.14.12-parallella-gaa3549e-dirty (tm@desktop) (gcc version 4.8.2 (Ubuntu/Linaro 4.8.2-16ubuntu4) ) #5 SMP PREEMPT Sun Aug 24 20:49:20 EEST 2014
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: Parallella Gen1

...

Welcome to Linaro 14.04 (GNU/Linux 3.14.12-parallella-gaa3549e-dirty armv7l)

 * Documentation:  https://wiki.linaro.org/

Network is not up, setting ip manually and running the same ping test
Code: Select all
root@linaro-nano:~# service network-manager stop
network-manager stop/waiting
root@linaro-nano:~# ifconfig eth0 192.168.1.88
root@linaro-nano:~# for s in 10 40 50 60 100 1000 ; do printf "size %4d: " $s ; ping -nq -i 0.01 -c 100 -s $s 192.168.1.2 | grep transmitted ; done
size   10: 100 packets transmitted, 100 received, 0% packet loss, time 990ms
size   40: 100 packets transmitted, 100 received, 0% packet loss, time 1010ms
size   50: 100 packets transmitted, 89 received, 11% packet loss, time 1128ms
size   60: 100 packets transmitted, 72 received, 28% packet loss, time 1288ms
size  100: 100 packets transmitted, 14 received, 86% packet loss, time 1798ms
size 1000: 100 packets transmitted, 0 received, 100% packet loss, time 1948ms


Any fixes available for this as it makes hard to load images or boot over the network?
tajuma
 
Posts: 7
Joined: Tue Jun 10, 2014 4:22 pm

Re: Parallella Linux updates

Postby tajuma » Wed Aug 27, 2014 12:28 pm

Continuing my previous post after some more digging...

It seems that packets are actually sent out from the Parallella box but dropped by the first switch. When connecting to a laptop with direct cable and asking even bad Ethernet frames to be delivered to the ip stack (provided you NIC supports that):
Code: Select all
laptop ~ % sudo ethtool -K eth0 rx-all on
laptop ~ % sudo ethtool -K eth0 rx-fcs on

Then pinging from Parallella and running tcpdump in both machines:
Code: Select all
root@linaro-nano:~# (sleep 2 ; ping -nq -s 1000 192.168.1.108 )&
[1] 2253
root@linaro-nano:~# tcpdump -teni eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
04:4f:8b:00:08:95 > 68:b5:99:f8:b6:df, ethertype IPv4 (0x0800), length 1042: 192.168.1.88 > 192.168.1.108: ICMP echo request, id 2253, seq 1, length 1008
04:4f:8b:00:08:95 > 68:b5:99:f8:b6:df, ethertype IPv4 (0x0800), length 1042: 192.168.1.88 > 192.168.1.108: ICMP echo request, id 2253, seq 2, length 1008
04:4f:8b:00:08:95 > 68:b5:99:f8:b6:df, ethertype IPv4 (0x0800), length 1042: 192.168.1.88 > 192.168.1.108: ICMP echo request, id 2261, seq 3, length 1008

Code: Select all
laptop ~ % sudo tcpdump -teni eth0 host 192.168.1.88
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
04:4f:8b:00:08:95 > 68:b5:99:f8:b6:df, ethertype IPv4 (0x0800), length 118: truncated-ip - 924 bytes missing! 192.168.1.88 > 192.168.1.108: ICMP echo request, id 2429, seq 1, length 1008
04:4f:8b:00:08:95 > 68:b5:99:f8:b6:df, ethertype IPv4 (0x0800), length 89: truncated-ip - 953 bytes missing! 192.168.1.88 > 192.168.1.108: ICMP echo request, id 2429, seq 2, length 1008
04:4f:8b:00:08:95 > 68:b5:99:f8:b6:df, ethertype IPv4 (0x0800), length 153: truncated-ip - 889 bytes missing! 192.168.1.88 > 192.168.1.108: ICMP echo request, id 2429, seq 3, length 1008

So good looking frames are being sent by Parallella but they do not end up correctly in to the wire. This only happens if I use network in u-boot while booting up. No network in u-boot and the network in Linux works just fine with same cables, switches, etc.

Does anyone know where to find datasheet and register info for the Marvell 1318 PHY device?
tajuma
 
Posts: 7
Joined: Tue Jun 10, 2014 4:22 pm

Re: Parallella Linux updates

Postby tajuma » Wed Aug 27, 2014 3:39 pm

I keep talking to myself :D found the reason and solution.

U-boot inits the ethernet and configures to GEM0_CLK_CTRL in https://github.com/parallella/parallella-uboot/blob/parallella-gen1/drivers/net/zynq_gem_wrap.c#L404 and that is then too much for Linux to handle.

The solution is to check the value first (once, it does not change)
Code: Select all
zynq-uboot> md f8000140 1
f8000140: 00100801    ....

do network stuff
Code: Select all
zynq-uboot> ping 192.168.1.2
Trying to set up GEM link...
Phy ID: 01410E90
Resetting PHY...

PHY reset complete.
Waiting for PHY to complete auto-negotiation...
Link is now at 1000Mbps!
Using zynq_gem device
host 192.168.1.2 is alive

and restore it back before booting Linux
Code: Select all
zynq-uboot> mw.w f8000008 df0d
zynq-uboot> mw.w f8000140 00100801
zynq-uboot> mw.w f8000004 767b
zynq-uboot> boot


And then in Linux the network is ok, no more short and dropped packets
Code: Select all
root@linaro-nano:~# for s in 10 40 50 60 100 1000 ; do printf "size %4d: " $s ; ping -nq -i 0.01 -c 100 -s $s 192.168.1.2 | grep transmitted ; done
size   10: 100 packets transmitted, 100 received, 0% packet loss, time 989ms
size   40: 100 packets transmitted, 100 received, 0% packet loss, time 989ms
size   50: 100 packets transmitted, 100 received, 0% packet loss, time 990ms
size   60: 100 packets transmitted, 100 received, 0% packet loss, time 989ms
size  100: 100 packets transmitted, 100 received, 0% packet loss, time 991ms
size 1000: 100 packets transmitted, 100 received, 0% packet loss, time 989ms


Now the question is should this be fixed in u-boot, linux or some how addressed in devicetree?
Last edited by tajuma on Wed Aug 27, 2014 7:49 pm, edited 1 time in total.
tajuma
 
Posts: 7
Joined: Tue Jun 10, 2014 4:22 pm

Re: Parallella Linux updates

Postby greytery » Wed Aug 27, 2014 4:42 pm

tajuma wrote:I keep talking to myself :D

I'm listening :D
Been flattening my forehead trying to set up U-Boot and NFS root filesystem as per shogunx post shogunx post and not getting very far. When I set up NFS root on Pi it worked first time! :x
U-Boot / tftp load works perfectly (and U-Boot scripting, chain scripts, etc. are a whole lotta fun!), the kernel boots fine - but the NFS rootfs mount just hangs.
Multiple NFS timeouts on the minicom output - but with the odd 'NFS OK' message.
Wireshark (on my server, the other side of the switch) shows a few short NFS protocol messages getting through but otherwise - nada.
If the frames are dirty as you show, then that would explain a lot.

tajuma wrote:Now the question is should this be fixed in u-boot, linux or some how addressed in devicetree?

Will leave that to Adapeva.
But in the meantime, I'll have a play with a U-Boot script and get back to you ... Hope I don't brick it!
EDIT:
Those addresses are for the latest build. I don't think I can write sensibly/safely to those addresses on earlier builds.
EDIT #2:
Y E S!! This works on 'current' build. After loading fpga/devtree/kernel but not actually booting, enter zynq-boot and set up following..
Code: Select all
setenv phy_rst 'mw.w f8000008 df0d ; mw.w f8000140 00100801 ; mw.w f8000004 767b'
run phy_rst

Then boot.
Booted 1st time, and so perfecty into linaro login over NFS - I'm almost ... no.. I'm actually weeping. Thankyou tajuma.

So - I think that confirms tajuma's diagnosis. The Ethernet interface needs to be reset after tftp activity before booting kernel.
kernel will then restart from the same state as if booting from the mmc.

Sorry - gotta sleep - will continue/write-up tomorrow.

Cheers,
tery
User avatar
greytery
 
Posts: 205
Joined: Sat Dec 07, 2013 12:19 pm
Location: ^Wycombe, UK

Re: Parallella Linux updates

Postby greytery » Wed Aug 27, 2014 9:35 pm

tajuma wrote:Now the question is should this be fixed in u-boot, linux or some how addressed in devicetree?

Not sure what Adapteva can do about the need to reset the Ethernet interface. But it only matters to those who intend to tftp boot rather than mmc boot. Perhaps that will become a majority, especially for cluster owners.
In which case, part of the tftp boot scripting can easily include the 'reset fix' .

Cheers,
tery
User avatar
greytery
 
Posts: 205
Joined: Sat Dec 07, 2013 12:19 pm
Location: ^Wycombe, UK

Re: Parallella Linux updates

Postby tajuma » Thu Aug 28, 2014 5:08 pm

I would actually vote for u-boot bug... the value 0x00100c31 it writes to GEM0_CLK_CTRL register simply does not make any sense. Those values mean

uboot: 0x00100c31 => select DDR_PLL as the reference clock with divisors 0x0c and 1.
reset: 0x00100801 => select IO_PLL as the reference clock with divisors 0x08 and 1.

The DDR_PLL and IO_PLL are configured as
Code: Select all
zynq-uboot> md f8000104 1     
f8000104: 00030008    ....
zynq-uboot> md f8000108 1
f8000108: 0001e008    ....

So besides using a weird clock source the frequency is not quite there either. For Gbit Ethernet the clock should be 125MHz, what we have are
u-boot (DDR_PLL) => 0x30 * 33MHz / 0x0c => 133MHz, and
reset (IO_PLL) => 0x1e * 33MHz / 0x08 => 125MHz.

That would be an easy fix in u-boot, but to be effective you should dare to flash it too :(

Another option is simply to patch the constant in u-boot image, so that the correct (or better) value would be used in the first place. Finding the address took some time as I can't build u-boot exactly the same way it is in the device (map-file, anyone?). If your u-boot version is the same chances are that the address is same as well.
Code: Select all
zynq-uboot> ver

U-Boot 2012.10-00003-g792c31c (Jan 03 2014 - 12:24:08)
arm-none-eabi-gcc (Sourcery G++ Lite 2011.03-42) 4.5.2
GNU ld (Sourcery G++ Lite 2011.03-42) 2.20.51.20100809

zynq-uboot> md 3df8e90c 1
3df8e90c: 00100c31    1...          <--- check this first
zynq-uboot> mw.w 3df8e90c 00100801  <--- and do this only if match
tajuma
 
Posts: 7
Joined: Tue Jun 10, 2014 4:22 pm

Re: Parallella Linux updates

Postby greytery » Thu Aug 28, 2014 6:24 pm

Makes sense that it's a bug.

Bug fixes come as workarounds, and eventually re-issue/replacement.
In this case, re-flashing the U-Boot could be done, but there's a risk of bricking the board (yeah, yeah, I know about the JTAG pins on the Samtech connectors - but I don't have any).
The U-Boot re-flash instructions would need to be simple and bullet-proof. Here's waiting...

Still cross checking the boot script workaround on my two boards, using the addresses you've identified, but it's looking good.
Whether it's garbage or not :D

Cheers,
tery
User avatar
greytery
 
Posts: 205
Joined: Sat Dec 07, 2013 12:19 pm
Location: ^Wycombe, UK

Re: Parallella Linux updates

Postby jimbaker » Mon Sep 01, 2014 12:21 am

Is there any way to download the source for the kernel that had HDMI working?
I've tried to figure out which 'branch' it might be, with no luck.
I was using the HDMI version and had built a modified kernel and all was well.
Then I decided to start from scratch, create a SD card, modify the kernel, etc. because I had done a lot of thrashing about trying to get the UCA222 usb sound device to work with line-in/line-out, etc., which I did ultimately get working.
However, now the how-to-build-a-kernel link pulls down the latest, where HDMI isn't working, and I'd like to get the "old" version.
jimbaker
 
Posts: 6
Joined: Fri Aug 01, 2014 11:05 pm

Re: Parallella Linux updates

Postby terminal3 » Thu Sep 04, 2014 4:38 pm

jimbaker wrote:Is there any way to download the source for the kernel that had HDMI working?
I've tried to figure out which 'branch' it might be, with no luck.
I was using the HDMI version and had built a modified kernel and all was well.
Then I decided to start from scratch, create a SD card, modify the kernel, etc. because I had done a lot of thrashing about trying to get the UCA222 usb sound device to work with line-in/line-out, etc., which I did ultimately get working.
However, now the how-to-build-a-kernel link pulls down the latest, where HDMI isn't working, and I'd like to get the "old" version.


Yeah, this is really problematic. I'm working on creating build processes for another distro, but can't confirm much without HDMI functioning. I'm using the correct bitstream and zynq-parallella1-hdmi to build the device tree with no luck. I can confirm that the kernel tarball with the official Ubuntu distro works on my board.
terminal3
 
Posts: 3
Joined: Mon Jun 02, 2014 10:14 pm

Next

Return to Linux/U-Boot

Who is online

Users browsing this forum: No registered users and 1 guest

cron