Re: Debian on NSA310S?
July 22, 2015 05:07PM
bodhi Wrote:
-------------------------------------------------------
> JohnnyUSA Wrote:
> --------------------------------------------------
> -----
> > Finally home and i've tried superelchi's
> solution
> > with phypoke and fixed ip, works like a charm.
> So,
> > until you guys work out something better, i'm
> > happy with what we have at the moment ;)
> >
> > Cheers!
> >
> > PS: It seems my box doesn't want to resume
> after
> > power loss and i wonder what can i do to solve
> > this.
>
> Perhaps rootfs was corrupted. Create a new rootfs
> on USB stick and boot with it. Run fsck on the
> existing rootfs after booted into Debian.

Thanks bodhi!
Re: Debian on NSA310S?
July 23, 2015 04:06AM
superelchi,

I've booted back to Zyxel stock on my NSA325v2 and then shutdown and observed this.

/ # /sbin/halt 
led_state_map_addr = 4e
Jul 23 08:50:57 NSA325-v2 linuxrc: starting pid 2781, tty '': '/etc/init.d/rc.shutdown'
/ # Starting "/etc/init.d/zypkg_controller.sh".
Stopping all zypkgs via "/etc/init.d/zypkg_controller.sh" ...
- shutdowning package "NFS" ...

....

The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system halt
md: stopping all md devices.
Power down.
egiga0: link down
reg(3, 18) = 4985
egiga0: link up, full duplex, speed 1 Gbps
reg(0, 18) = 0
egiga0: link down
reg(17, 16) = 4500
reg(17, 25) = 9e4c
reg(17, 24) = 41ff
reg(17, 23) = ffa5
egiga0: link up, full duplex, speed 1 Gbps
ADDRCONF(NETDEV_CHANGE): egiga0: link becomes ready

All power was off, except Ethernet. This is what I expected. The link was down by the halt action, but it was brought right back up by stock OS. And the Ethernet light stays green after the system was halt. Pressing power button booted it back. During boot, stock u-boot did not do anything that affect the link. So the NSA325v2 FW incorporated the power resume action at the end.

So I think that migth be the difference between pengu's system and yours/Johnny. Some shutdown actions have made the difference? pengu rootfs must have not brought the link down, and yours did. That's my theory. You could try different ways to shutdown to see which has same the effect.

In any case, I'll come up with a NSA310S u-boot build sometime next week, hopefully it will make this problem go away once and for all.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on NSA310S?
July 23, 2015 05:46AM
@bodhi, thing is, i've tested Pengu's rootfs myself and had the same problem.
Re: Debian on NSA310S?
July 23, 2015 05:51AM
JohnnyUSA Wrote:
-------------------------------------------------------
> @bodhi, thing is, i've tested Pengu's rootfs
> myself and had the same problem.

Ah! OK then, the theory is shot :) I won't bother with the shutdown anymore.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on NSA310S?
July 23, 2015 06:08AM
This is what I get on shutting down the stock OS:
/ # /sbin/halt
save exit: isCheckpointed 1
led_state_map_addr = 4e
Jan  1 00:02:10 NSA310S linuxrc: starting pid 2603, tty '': '/etc/init.d/rc.shutdown'
/ # Starting "/etc/init.d/zypkg_controller.sh".
Stopping all zypkgs via "/etc/init.d/zypkg_controller.sh" ...
- shutdowning package "NFS" ...
.
.
.
The system is going down NOW!

Sent SIGTERM to all processes

Sent SIGKILL to all processes

Requesting system halt
md: stopping all md devices.
Power down.
reg(0, 4) = 0x21
reg(0, 9) = 0x0
egiga0: link down
reg(0, 0) = 0x1140
reg(3, 18) = 0x4985
reg(3, 17) = 0x4420
reg(0, 18) = 0x0
reg(17, 16) = 0x4500
reg(17, 25) = 0xf45c
reg(17, 24) = 0x2fab
reg(17, 23) = 0x28fe
Last part looks the same on "halt" and "poweroff". Only a "link down" message. No "link up". Switch says "10HDX".

Seem to come from trunk/linux-2.6.31.8/arch/arm/mach-feroceon-kw/gpio_ctrl.c, line 1122:
void zyxel_power_off(void *no_used)
{

	if(atomic_read(&shutdown_enable))
	{
#if defined CONFIG_MV_PHY_88E1310_WOL || defined CONFIG_MitraStar_STG315 || defined CONFIG_MitraStar_STG326
		unsigned char	mac_addr[6];
		int	ethPortNum = 0;
		MV_U16	phy_reg;

		mvEthMacAddrGet(0, mac_addr);

		/* Power Saving */
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x0);
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),4,0x21);      // Page 0 Register 4 = 0x21
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 4, &phy_reg);
		printk(KERN_ERR"reg(0, 4) = 0x%x\n", phy_reg);
		
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x0);
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),9,0x0);      // Page 0 Register 9 = 0x0
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 9, &phy_reg);
		printk(KERN_ERR"reg(0, 9) = 0x%x\n", phy_reg);
		
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x0);
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),0,0x9140);      // reset eth-phy
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 0, &phy_reg);
		printk(KERN_ERR"reg(0, 0) = 0x%x\n", phy_reg);

		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x3);
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),18,0x4985);      /* Page 3 Register 18 = 0x4985 */
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 18, &phy_reg);
		printk(KERN_ERR"reg(3, 18) = 0x%x\n", phy_reg);

		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x3);
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),17,0x4420);      // Page 3 Register 17 = 0x4420
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 17, &phy_reg);
		printk(KERN_ERR"reg(3, 17) = 0x%x\n", phy_reg);

		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x0);
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),18,0x80);        /* Page 0 Register 18 = 0x80 */
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 18, &phy_reg);
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 13, &phy_reg);
		printk(KERN_ERR"reg(0, 18) = 0x%x\n", phy_reg);

		
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x11);

		if(atomic_read(&wol_enable))
			mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),16,0x5500);      /* Page 17 Register16 = 0x5500 */
		else
			mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),16, 0x5500 & ~(0x1 << 14));/* bit14 Magic Packet Match Enable*/
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 16, &phy_reg);
		printk(KERN_ERR"reg(17, 16) = 0x%x\n", phy_reg);

		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x11);
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),25,mac_addr[1] << 8 | mac_addr[0]);  /* Page 17 Register 25 = mac[1]mac[0] */
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 25, &phy_reg);
		printk(KERN_ERR"reg(17, 25) = 0x%x\n", phy_reg);


		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x11);
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),24,mac_addr[3] << 8 | mac_addr[2]);   /* Page 17 Register 24 = mac[3]mac[2] */
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 24, &phy_reg);
		printk(KERN_ERR"reg(17, 24) = 0x%x\n", phy_reg);

		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x11);
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),23,mac_addr[5] << 8 | mac_addr[4]);   /* Page 17 Register 23 = mac[5]mac[4] */
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 23, &phy_reg);
		printk(KERN_ERR"reg(17, 23) = 0x%x\n", phy_reg);

		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x0);
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 0x13, &phy_reg);
#endif

		/* Output low */
		gpio_out(POWER_OFF_GPIO_REG_OFFSET, 0x1);
	}
}
Note the "reset eth-phy" comment in line 1142!
Re: Debian on NSA310S?
July 23, 2015 06:39AM
Hold on!

egiga0: link down
reg(0, 0) = 0x1140


mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x0);
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),0,0x9140);      // reset eth-phy
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 0, &phy_reg);
		printk(KERN_ERR"reg(0, 0) = 0x%x\n", phy_reg);

Where did that bit go :) did they overwrite something right before that bit in register 0?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on NSA310S?
July 23, 2015 06:47AM
Yeah, noticed this also.
There is more:
mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x0);
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),18,0x80);        /* Page 0 Register 18 = 0x80 */
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 18, &phy_reg);
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 13, &phy_reg);
		printk(KERN_ERR"reg(0, 18) = 0x%x\n", phy_reg);

		
		mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),22 ,0x11);

		if(atomic_read(&wol_enable))
			mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),16,0x5500);      /* Page 17 Register16 = 0x5500 */
		else
			mvEthPhyRegWrite(mvBoardPhyAddrGet(ethPortNum),16, 0x5500 & ~(0x1 << 14));/* bit14 Magic Packet Match Enable*/
		mvEthPhyRegRead(mvBoardPhyAddrGet(ethPortNum), 16, &phy_reg);
		printk(KERN_ERR"reg(17, 16) = 0x%x\n", phy_reg);
reg(0, 18) = 0x0
reg(17, 16) = 0x4500
But I only think the output comes from there. May come from somewhere completly different...



Edited 1 time(s). Last edit at 07/23/2015 06:48AM by superelchi.
Re: Debian on NSA310S?
July 23, 2015 03:36PM
the NSA310s isn't capable of kwboot
only the NSA310 and NSA320
Re: Debian on NSA310S?
July 23, 2015 05:03PM
pengu Wrote:
-------------------------------------------------------
> the NSA310s isn't capable of kwboot
> only the NSA310 and NSA320

It is if you get any response such as receiving the image.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
osa
Re: Debian on NSA310S?
July 24, 2015 11:03AM
>
Quote
osa
> I have alse "link not ready" fixed with this patch
>

>
> Can I somehow try this with phypeek and phypoke?
> Tried with
>
> phypoke 1 22 3
>
> Gives error "illegal address"...
Hi!
22 = 0x16 so try
phypoke 1 16 3

I have tried on my box
phypoke 1 16 3
phypoke 1 16 0
My network works after restart ( patch hacks regs earier so it works "at boot")

I have posted this patch for nsa325 but get no response so i don't know if it worked
http://archlinuxarm.org/forum/viewtopic.php?f=53&t=7441#p40728
Re: Debian on NSA310S?
July 25, 2015 06:38AM
pengu,

Try kwboot with the nsa325 small u-boot (note the correct command is without -p):
http://forum.doozan.com/read.php?2,14351,17193#msg-17193

I expect to see the image loaded, but it won't execute (because it is of a different SoC).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on NSA310S?
July 25, 2015 12:16PM
osa Wrote:
-------------------------------------------------------
> Hi!
> 22 = 0x16 so try
>
> phypoke 1 16 3
>
>
> I have tried on my box
>
> phypoke 1 16 3
> phypoke 1 16 0
>
> My network works after restart ( patch hacks regs
> earier so it works "at boot")
>
> I have posted this patch for nsa325 but get no
> response so i don't know if it worked
> http://archlinuxarm.org/forum/viewtopic.php?f=53&t
> =7441#p40728

:-*>
Very embarrassing. More than 30 years in programming and not able to spot a decimal constant! Pleeeease don't tell anyone! ;)

I've tried it:
root@debian:~# 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
	Supports Wake-on: d
	Wake-on: d
	Link detected: no
root@debian:~# phypoke 1 16 0
base address = b5dbf000
[   86.679122] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 100 Mb/s, full duplex, flow control disabled
words[0] = phypoke
words[1] = 1
words[2] = 16
words[3] = 0
:GbitPhy[0x00000001:0x00000016] <= 0x00000000
root@debian:~# 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
	Link partner advertised link modes:  10baseT/Half 10baseT/Full 
	                                     100baseT/Half 100baseT/Full 
	Link partner advertised pause frame use: No
	Link partner advertised auto-negotiation: Yes
	Speed: 100Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 1
	Transceiver: external
	Auto-negotiation: on
	Supports Wake-on: d
	Wake-on: d
	Link detected: yes
root@debian:~#
So: phy inititalzed but link not working. But: will work after next reboot!
If I do the following:
root@debian:~# 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
	Supports Wake-on: d
	Wake-on: d
	Link detected: no
root@debian:~# phypoke 1 16 0
base address = b5dbf000
[   86.679122] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 100 Mb/s, full duplex, flow control disabled
words[0] = phypoke
words[1] = 1
words[2] = 16
words[3] = 0
:GbitPhy[0x00000001:0x00000016] <= 0x00000000
root@debian:~# 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
	Link partner advertised link modes:  10baseT/Half 10baseT/Full 
	                                     100baseT/Half 100baseT/Full 
	Link partner advertised pause frame use: No
	Link partner advertised auto-negotiation: Yes
	Speed: 100Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 1
	Transceiver: external
	Auto-negotiation: on
	Supports Wake-on: d
	Wake-on: d
	Link detected: yes
root@debian:~# phypoke 9 300
base address = b5db8000
words[0] = phypoke
words[1] = 1
words[2] = 9
words[3] = 300
:GbitPhy[0x00000001:0x00000009] <= 0x00000300
root@debian:~# 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
	Link partner advertised link modes:  10baseT/Half 10baseT/Full 
	                                     100baseT/Half 100baseT/Full 
	Link partner advertised pause frame use: No
	Link partner advertised auto-negotiation: Yes
	Speed: 100Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 1
	Transceiver: external
	Auto-negotiation: on
	Supports Wake-on: d
	Wake-on: d
	Link detected: yes
root@debian:~# phypoke 1 0 9140
base address = b5e6e000
[  120.042058] mv643xx_eth_port mv643xx_eth_port.0 eth0: link down
words[0] = phypoke
words[1] = 1
words[2] = 0
words[3] = 9140
:GbitPhy[0x00000001:0x00000000] <= 0x00009140
[  122.347532] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000 Mb/s, full duplex, flow control disabled
root@debian:~# 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
	Link partner advertised link modes:  10baseT/Half 10baseT/Full 
	                                     100baseT/Half 100baseT/Full 
	Link partner advertised pause frame use: No
	Link partner advertised auto-negotiation: Yes
	Speed: 100Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 1
	Transceiver: external
	Auto-negotiation: on
	Supports Wake-on: d
	Wake-on: d
	Link detected: yes
root@debian:~#
Link is brought up immediately. If I leave out the
phypoke 9 300
Link will not come up.
Note that ethtool still says
Speed: 100Mb/s 
Duplex: Full
after the final poke. But my switch tells me its really 1000FDX. Don't ask me why.
Re: Debian on NSA310S?
July 26, 2015 06:43PM
superelchi Wrote:
-------------------------------------------------------
> Sorry. No luck at all.
>
> Called it with:
> $ kwboottool/kwboot -t -B 115200 /dev/ttyUSB0 -b
> uboot.2014.07-tld-3.nsa310.uart.kwb
>
>
> Stops after sending the image:
>  .
>  .
>  92 %
> [.................................................
> .....................]
>  94 %
> [.................................................
> .....................]
>  96 %
> [.................................................
> .....................]
>  99 % [....................................]
> [Type Ctrl-\ + c to quit]
>
> Cursor blinks in the next line. No further output.

OTOH, this indicates that the NSA310S has UART booting, the same way the NSA320S does (it's the same SoC, and the same bootROM it seems).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 07/26/2015 06:49PM by bodhi.
Re: Debian on NSA310S?
July 27, 2015 06:19PM
Ok guys, I think this should fix the PHY problem without doing the poking stuff! Please try this new DTB. I hope this is the correct PHY to use.

And remember to turn off your current script before testing :)

PS.

This seems to be the problem with the driver. If the PHY ID is somehow not the correct one then it will fail to set the registers from DTS.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 2 time(s). Last edit at 07/27/2015 06:37PM by bodhi.
Attachments:
open | download - kirkwood-nsa310s.dtb.tar (20 KB)
Re: Debian on NSA310S?
July 27, 2015 06:45PM
If this does not work. I think I'll better be working on new u-boot for it :))

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on NSA310S?
July 28, 2015 03:22AM
Not working. :(
Same as before. Link is not comming up.
root@debian:~# 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
        Supports Wake-on: d
        Wake-on: d
        Link detected: no

AND: Power LED starts blinking on boot and keeps blinking. With the "old" DTB blinking stops after boot.

EDIT: doing the register poking after boot brings link up.



Edited 1 time(s). Last edit at 07/28/2015 03:24AM by superelchi.
Re: Debian on NSA310S?
July 28, 2015 03:37AM
superelchi Wrote:
-------------------------------------------------------
> Not working. :(
> Same as before. Link is not comming up.
>
> root@debian:~# 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
>         Supports Wake-on: d
>         Wake-on: d
>         Link detected: no
>
>
> AND: Power LED starts blinking on boot and keeps
> blinking. With the "old" DTB blinking stops after
> boot.
>
> EDIT: doing the register poking after boot brings
> link up.

I can confirm this.
Re: Debian on NSA310S?
July 28, 2015 04:10AM
Thanks for testing! it's a chicken and egg type of problem for the kernel :)) I think we might have to either patch the kernel or build new nsa310s u-boot that does the PHY fixup. It seems the problem with the current driver is that it is limited about what it can do (either that or I don't know enough DTS tricks to force it).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on NSA310S?
July 28, 2015 11:47PM
Good news!

My NSA310S arrived today.

Here is UART booting with rebuilt stock u-boot-1.1.4:
../kwboot-tool/kwboot -t -B 115200 /dev/ttyUSB0 -b u-boot-1.1.4-bodhi.nsa310s.uart.bin 
Sending boot message. Please reboot the target...|
Sending boot image...
  0 % [......................................................................]
  1 % [......................................................................]
  3 % [......................................................................]


 92 % [......................................................................]
 94 % [......................................................................]
 96 % [......................................................................]
 97 % [......................................................................]
 99 % [.......]
[Type Ctrl-\ + c to quit]

         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_ 
| | | |___|  _ \ / _ \ / _ \| __| 
| |_| |___| |_) | (_) | (_) | |_ 
 \___/    |____/ \___/ \___/ \__| 
 ** MARVELL BOARD: DB6702A-GMtech LE 

U-Boot 1.1.4 (Jul 28 2015 - 21:10:06) Marvell version: 3.6.0

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CFB00

Soc: 88F6702 A1 CPU running @ 1000Mhz L2 running @ 500Mhz
SysClock = 400Mhz , TClock = 166Mhz 

DRAM (DDR2) CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000   size 256MB 
DRAM Total size 256MB  16bit width
Addresses 10M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (10M - 7M): Done
NAND:128 MB
Flash:  0 kB

CPU : Marvell Feroceon (Rev 1)
Kernel address is 0xc80000.

Streaming disabled 
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME]
Hit any key to stop autoboot:  0

Everything was checked out OK. Of course the Ethernet PHY problem is still presented after shutdown.

I'll upoad this version as a rescue u-boot.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on NSA310S?
July 29, 2015 02:41AM
Here is the UART-able stock u-boot.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Attachments:
open | download - u-boot-1.1.4-bodhi.nsa310s.uart.bin.tar (470 KB)
Re: Debian on NSA310S?
July 29, 2015 04:27AM
That's really good news bodhi, now it will be way easier to troubleshoot things!

PS: Excuse my ignorance, but what's the use of the file you've just uploaded here? Basically, if we destroy our u-boot, we can recover with the one you've just posted?



Edited 1 time(s). Last edit at 07/29/2015 04:29AM by JohnnyUSA.
Re: Debian on NSA310S?
July 29, 2015 04:39AM
Hi Johnny,

That's what I meant is the good news :) you can boot the box using kwboot where it will run this U-Boot image in memory, without touching what's in NAND. This is how we test new u-boot build on box that has this capability. And this capbility makes the NSA310S almost unbrickable :) Not quite 100% unbrickable, but very close. So this can be used as a rescue mechanism where u-boot in NAND got so messed up (or its NAND area went bad, for example) and it can not be started.

I mentioned this in my u-boot thread: before installing new u-boot we should try UART booting first. See the tutorial by davygravy: http://forum.doozan.com/read.php?3,7852,7852

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on NSA310S?
July 29, 2015 12:56PM
bodhi,

thanks for explaining. Now we are a step closer to the finish line since you have the box on your side ;)
Re: Debian on NSA310S?
July 30, 2015 04:24AM
@bodhi
FYI: UART booting the stock u-boot works here also. But - as expected - still no link.

I've tried to execute the phy init script during the boot process. But no luck so far.
Works after boot (executed in rc.local) but not during boot.
Here is my script:
#!/bin/sh -x
### BEGIN INIT INFO
# Provides:          nsa310s-phyup
### Required-Start:    $local_fs $network
# Required-Start:    $local_fs
# Required-Stop:
# X-Start-Before:    $network
# Should-Start:      
### Default-Start:     1 2 3 4 5
# Default-Start:     S
# Default-Stop:
# Short-Description: Fix for ZyXEL NSA-310S ethernet not comming up.
# Description:       Init of ethernet phy for ZyXEL NSA-301S.
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin

do_start () {
## for LED settings
/sbin/phypoke 1 16 3
/sbin/phypoke 1 10 1017
/sbin/phypoke 1 11 4408

#The MCU set the phy to 10-Mb mode as low-power status.
#We have to set it back when booting up.
/sbin/phypoke 1 16 0
/sbin/phypoke 1 4 1e1
/sbin/phypoke 1 9 300
## Downshift enable for network testing
/sbin/phypoke 1 10 3860
/sbin/phypoke 1 0 9140
}

case "$1" in
  start|"")
	echo "ZyXEL NSA-310S ethernet init"
	do_start
	;;
  restart|reload|force-reload)
	echo "Error: argument '$1' not supported" >&2
	exit 3
	;;
  stop|status)
	# No-op
	;;
  *)
	echo "Usage: bootmisc.sh [start|stop]" >&2
	exit 3
	;;
esac

:
Tested different places (before network start / after network start, etc.) but no luck.
Same script works if called from command line after boot.
Re: Debian on NSA310S?
July 30, 2015 05:31AM
superelchi,

> FYI: UART booting the stock u-boot works here
> also. But - as expected - still no link.

Thanks! just knowing this give us lot of freedom to hack. I've started to work on u-boot and think it will be a little slower to bring up because nobody has brought this SoC up in mainline u-boot. So I expect I would have to do a lot of testing. I was right :) I have built an image, but is not working yet! and I'm not sure why...

Nice script! I agree it would be ideal to make it run like you've coded (# Default-Start: S). But you could also solve this in slightly different approach: If you execute it as a normal script (not run level) in /etc/default/rcS it will be early enough in the boot process to bring up the link for DHCP. But you would have to set a global env to avoid repeatedly executing the script during boot.

OTOH, I think it is acceptable to patch the PHY fixup in the kernel. Kirkwood does have some workaround code for certain devices, so I think I'll put osa's routine in the patch so we will have the kernel does the fixup itself and not worrying about scripting it outside.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on NSA310S?
July 30, 2015 05:36AM
@pengu,

Does the 320s have the same PHY problem?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on NSA310S?
July 30, 2015 06:26AM
@bodhi,
where is the LIKE button on these forums? We badly need one :P



Edited 1 time(s). Last edit at 07/30/2015 06:26AM by JohnnyUSA.
Re: Debian on NSA310S?
July 30, 2015 07:14AM
bodhi Wrote:
-------------------------------------------------------
> @pengu,
>
> Does the 320s have the same PHY problem?


it's different I think

power on .. 10 baseT-HD --> green LED

U-Boot: "no link" pinging not possible 10 baseT-HD -> green LED

ZyXEL OS: 1000 baseT-FD -> amber LED

power off: 10 baseT-HD -> green LED

U-Boot: "no link" pinging not possible 10 aseT-HD -> green LED


USB and TFTP boot isn't possible

seems to work (FTP boot after loading your nsa310s uart U-Boot)

[   24.219904] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000 Mb/s, full duplex, flow control disabled
[   24.229738] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[....] Configuring network interfaces...Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/5c:f4:ab:e3:e6:1e
Sending on   LPF/eth0/5c:f4:ab:e3:e6:1e
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.1.1
DHCPACK from 192.168.1.1
Reloading /etc/samba/smb.conf: smbd.
bound to 192.168.1.168 -- renewal in 20943 seconds.
done.



Edited 5 time(s). Last edit at 07/30/2015 09:51AM by pengu.
Re: Debian on NSA310S?
July 30, 2015 07:37AM
bodhi Wrote:
-------------------------------------------------------
> Nice script! I agree it would be ideal to make it
> run like you've coded (# Default-Start: S). But
> you could also solve this in slightly different
> approach: If you execute it as a normal script
> (not run level) in /etc/default/rcS it will be
> early enough in the boot process to bring up the
> link for DHCP. But you would have to set a global
> env to avoid repeatedly executing the script
> during boot.
>

Thanks for the tip. Will try this if I find the time. But new u-boot and / or kernel patch would be much better...


JohnnyUSA Wrote:
-------------------------------------------------------
> @bodhi,
> where is the LIKE button on these forums? We badly
> need one :P

Right! Badly needed!
Re: Debian on NSA310S?
July 30, 2015 09:58AM
bodhi Wrote:
-------------------------------------------------------
...
>I've started to work on u-boot and think
> it will be a little slower to bring up because
> nobody has brought this SoC up in mainline u-boot.

The Medion Life P89634 MD 90221 has the same board / SoC



Edited 1 time(s). Last edit at 07/30/2015 10:01AM by pengu.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: