NSA320: eth0 link is not ready

This forum is for Marvell Kirkwood devices such as the GoFlex Home/Net, PogoPlug v1/v2, SheevaPlug, and ZyXEL devices.

NSA320: eth0 link is not ready

Postby absintos » Sat Aug 30, 2014 9:18 pm

Hi guys,

this issue is driving me nuts...NSA320 with stock uboot (not that it matters)...

50% of the time eth0 gets up...50% it does not...

after connecting with the serial cable i can see that the link is not ready for eth0. Seems to me like a driver bug as it only happens with alarm (no such issues with debian or stock)...Since the general performance of alarm is better than that of debian on the nsa320 (and stock is too inflexible), i would like to stick with alarm (especially since i just noticed that sssd is finally available....kudos to whomever made the package). But since eth0 doesn't start reliably...

I seriously don't understand why this device is listed as ALARM supported if something as basic as networking is not implemented properly....

related boot messages:

[ 16.600285] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[ 16.607232] mv643xx_eth smi: probed
[ 16.617099] mv643xx_eth_port mv643xx_eth_port.0: eth0: port 0 with MAC address xx:xx:xx:xx:xx:xx -> mac is correct, replaced with xx by me
[ OK ] Found device /sys/subsystem/net/devices/eth0. -> this one is driving me insane cause when i `ls` it after login, there is none (see bellow)
[ 33.325665] ADDRCONF(NETDEV_UP): eth0: link is not ready

if i try a systemctl restart netctl@eth0 i get a 'The interface of network profile 'eth0' is already up' error....

above mentioned ls:
# ls -la /sys/subsystem/net/devices/eth0
ls: cannot access /sys/subsystem/net/devices/eth0: No such file or directory

netctl profile:

# cat /etc/netctl/eth0
Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('x.x.x.x/24')
#Routes=('192.168.0.0/24 via 192.168.1.2')
Gateway='x.x.x.x'
DNS=('x.x.x.x')
TimeoutUp=15
TimeoutCarrier=15
#SkipNoCarrier=yes


## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6=static
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'

any ideas ?
absintos
 
Posts: 8
Joined: Tue Jun 24, 2014 6:35 pm

Re: NSA320: eth0 link is not ready

Postby WarheadsSE » Sun Aug 31, 2014 3:21 pm

this is a new one to me.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: NSA320: eth0 link is not ready

Postby absintos » Sun Aug 31, 2014 7:05 pm

actually, it resembles a lot to this (i think it's actually the same issue - works every time after rebooting from within stock): viewtopic.php?f=27&t=3851

i see that stock does (/etc/init.d/rcS):

# Turn on the auto-negotiation function in NSA320
if [ "$MODEL_ID" == "DD01" ]; then
echo "Turn on the auto-negotiation function"
phypoke 0x1 0x4 0x1e1
phypoke 0x1 0x9 0x300
phypoke 0x1 0x0 0x9140
fi

after restart from stock to_linux (eth0 working):

# phypeek 0x1 0x4
base address = 40257000
words[0] = phypeek
words[1] = 0x1
words[2] = 0x4
:GbitPhy[0x00000001:0x00000004] => 0x1e1
0x00000001
# phypeek 0x1 0x9
base address = 402c9000
words[0] = phypeek
words[1] = 0x1
words[2] = 0x9
:GbitPhy[0x00000001:0x00000009] => 0x200
0x00000001
# phypeek 0x1 0x0
base address = 40374000
words[0] = phypeek
words[1] = 0x1
words[2] = 0x0
:GbitPhy[0x00000001:0x00000000] => 0x1000
0x00000001

after `shutdown -h now` in alarm (restart due to serial cable being connected - eth0 not working):

# phypeek 0x1 0x4
base address = 4037b000
words[0] = phypeek
words[1] = 0x1
words[2] = 0x4
:GbitPhy[0x00000001:0x00000004] => 0x0
0x00000001
# phypeek 0x1 0x9
base address = 402df000
words[0] = phypeek
words[1] = 0x1
words[2] = 0x9
:GbitPhy[0x00000001:0x00000009] => 0x0
0x00000001
# phypeek 0x1 0x0
base address = 402a1000
words[0] = phypeek
words[1] = 0x1
words[2] = 0x0
:GbitPhy[0x00000001:0x00000000] => 0x0
0x00000001

unfortunately, when trying to set them with phypoke (after copying from stock /sbin/reg_access and creating the two symlinks phypoke & phypeek), although the command returns ok, when checking them with phypoke, they still return as 0x0

this is reg_access

# reg_access
base address = 40279000
words[0] = reg_access
:!!-- You should use mapping address. --!!
peek <address> [<count>]
poke <address> <value>
phypeek <location> <address> [<count>]
phypoke <location> <address> <value>
phyid
memtest <start address> <end address>

All numbers are hex.
Base Address:
APB_BRIDGE_A_BASE 0x0
APB_BRIDGE_B_BASE 0x04000000
SATA_DATA_BASE 0x05000000
DPE_BASE 0x06000000
USB_BASE 0x07000000
MAC_BASE 0x08000000
PCI_CSRS_BASE 0x0A000000
STATIC_CS0_BASE 0x0B000000
STATIC_CS1_BASE 0x0C000000
STATIC_CS2_BASE 0x0D000000
ROM_BASE 0x0E000000
SDRAM_CTRL_BASE 0x0F000000
LEON_IMAGE_BASE 0x10000000
SRAM_BASE 0x11000000
Last edited by absintos on Sun Aug 31, 2014 7:39 pm, edited 1 time in total.
absintos
 
Posts: 8
Joined: Tue Jun 24, 2014 6:35 pm

Re: NSA320: eth0 link is not ready

Postby absintos » Sun Aug 31, 2014 7:33 pm

viewtopic.php?f=27&t=3708&start=30#p22861 (power_resume.sh) doesn't seem to work ...nothing happens after running it...should anything special be performed after running that script ?
absintos
 
Posts: 8
Joined: Tue Jun 24, 2014 6:35 pm

Re: NSA320: eth0 link is not ready

Postby WarheadsSE » Sun Aug 31, 2014 7:57 pm

Nope, should be all that is needed.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: NSA320: eth0 link is not ready

Postby absintos » Sun Aug 31, 2014 8:38 pm

uboot reports:

NSA320>> sg
PHY 0 :
---------
Auto negotiation: Disabled
Speed: 10 Mbps
Speed: Uknown
Duplex: Half
Link: down

PHY 1 :
---------
Auto negotiation: Enabled
Speed: Uknown
Duplex: Full
Link: up

if i could just set autonegotiation (PHY 0) to on from within uboot...or force some settings..networking should work on every boot...

edit: tried

phyWrite 1 4 0x1e1
phyWrite 1 9 0x200
phyWrite 1 0 0x1000

in uboot but with no luck (they don't seem to apply as phyRead returns 0x0 - same as phypeek from above) - http://forum.nas-central.org/viewtopic. ... 49&t=14093 seems to work for this guy...

edit2: ofcourse, after booting to stock:

NSA320>> sg
PHY 0 :
---------
Auto negotiation: Enabled
Speed: 1000 Mbps
Duplex: Full
Link: up

PHY 1 :
---------
Auto negotiation: Enabled
Speed: Uknown
Duplex: Full
Link: up

&

NSA320>> phyRead 1 4
0x1e1
NSA320>> phyRead 1 0
0x1140
NSA320>> phyRead 1 9
0x300

Hmm..but they are editable...something else is locking them down...taking a look again in the stock init scripts...
absintos
 
Posts: 8
Joined: Tue Jun 24, 2014 6:35 pm

Re: NSA320: eth0 link is not ready

Postby absintos » Mon Sep 01, 2014 6:49 pm

if anyone has any other idea, let me know and i'll give it a try...

basically the problem is:

*************************
after booting to stock (and rebooting into linux):
*************************

# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: external
Auto-negotiation: on
Link detected: yes
# lsmod
Module Size Used by
nsa3xx_hwmon 389 0
mv_cesa 9362 0
ipv6 272990 57
autofs4 22305 2
raid1 26118 3
md_mod 102934 4 raid1



*************************
after shutdown -h:
*************************

# ethtool eth0
Settings for eth0:
Supported ports: [ TP AUI BNC MII FIBRE ]
Supported link modes: Not reported
Supported pause frame use: No
Supports auto-negotiation: No
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: No
Speed: 10Mb/s
Duplex: Half
Port: MII
PHYAD: 1
Transceiver: external
Auto-negotiation: on
Link detected: no
# lsmod
Module Size Used by
nsa3xx_hwmon 389 0
mv_cesa 9362 0
ipv6 272990 45
autofs4 22305 2
raid1 26118 3
md_mod 102934 4 raid1

hmm...stock shutdown also makes eth0 unusable:

stock rc.reboot does more or less nothing.

stock rc.shutdown on the other hand contains:

# pwr_resume
if [ ! -e /etc/zyxel/storage/pwron.status ]; then
pwr_resume disable
fi

i can only suspect this action to be the one causing the network malfunction. this means my problem is the same that the power_resume.sh is supposed to solve...

#./pwr_resume enable
Fail to enable power resume

# strace ./pwr_resume enable
execve("./pwr_resume", ["./pwr_resume", "enable"], [/* 14 vars */]) = 0
brk(0) = 0x12000
uname({sys="Linux", node="requendis.rou.local", ...}) = 0
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=80248, ...}) = 0
mmap2(NULL, 80248, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40031000
close(3) = 0
open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\f\204\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1564833, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40063000
mmap2(NULL, 1283464, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x40118000
mprotect(0x40245000, 28672, PROT_NONE) = 0
mmap2(0x4024c000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12c000) = 0x4024c000
mmap2(0x4024f000, 9608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4024f000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4009d000
set_tls(0x4009d4c0, 0x4009dba8, 0x400f2000, 0x4009d4c0, 0x400f2000) = 0
mprotect(0x4024c000, 8192, PROT_READ) = 0
mprotect(0x10000, 4096, PROT_READ) = 0
mprotect(0x400f1000, 4096, PROT_READ) = 0
munmap(0x40031000, 80248) = 0
open("/dev/btncpy", O_RDWR) = -1 ENOENT (No such file or directory)
ioctl(-1, 0x6720, 0) = -1 EBADF (Bad file descriptor)
write(2, "Fail to enable power resume\n", 28Fail to enable power resume
) = 28
exit_group(0) = ?
+++ exited with 0 +++

a kernel patch for debian that i found:

+/* Power resume control */
+ gpio_request(49, "Power-clk");
+ gpio_direction_output(49, 1);
+ gpio_request(47, "Power-data");
+// Clear power resume
+// gpio_direction_output(47, 0);
+// Set power resume
+ gpio_direction_output(47, 1);
+ udelay(1000);
+// gpio_direction_output(49, 0);
+ gpio_set_value(49, 0);
+// release GPIO?
+//test
+ gpio_free(47);
+ gpio_free(49);
+ printk(KERN_INFO "NSA310: Power resume enabled\n");

only difference from script seems to be a delay (udelay(1000))...

still no luck though....warhead, any ideas why it doesn't seem to work in my case ?
absintos
 
Posts: 8
Joined: Tue Jun 24, 2014 6:35 pm

Re: NSA320: eth0 link is not ready

Postby WarheadsSE » Tue Sep 02, 2014 1:23 am

You could add a 'sleep 1' to that bash script. I tried that at the kernel level, but have not found it to work.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: NSA320: eth0 link is not ready

Postby absintos » Tue Sep 02, 2014 5:38 pm

tried it, doesn't work :(

pwr_resume enable does:

open("/dev/btncpy", O_RDWR) = 3
ioctl(3, 0x6720, 0) = 0

while

pwr_resume disable does:

open("/dev/btncpy", O_RDWR) = 3
ioctl(3, GADGET_GET_PRINTER_STATUS, 0) = 0

everything else is the same...
absintos
 
Posts: 8
Joined: Tue Jun 24, 2014 6:35 pm

Re: NSA320: eth0 link is not ready

Postby absintos » Wed Sep 17, 2014 5:50 pm

revisited this with a bit of patience and it seems to work as mentioned....

run script (setting gpio pins 47 & 49) - on every boot preferably...
shutdown -h 0 (just to make sure that you gracefully shutdown without data loss) - can be done via pressing the power button (after setting up input-event-daemon)
unplug power cable
wait 10-15 secs
plug cable back in (power should turn on automatically)...eth0 will come up

as this is currently the only way to make eth0 work with alarm, i think it would be justified to change the installation script (set gpio pins on each boot and config power button to shutdown)...so that you wouldn't need a serial cable in oder to install alarm...just power off when it doesn't work, unplug cable, wait 10-15 secs, and plug back in....
Last edited by absintos on Wed Sep 17, 2014 6:42 pm, edited 3 times in total.
absintos
 
Posts: 8
Joined: Tue Jun 24, 2014 6:35 pm

Next

Return to Marvell Kirkwood

Who is online

Users browsing this forum: No registered users and 12 guests