Welcome! Log In Create A New Profile

Advanced

Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing

Posted by bodhi 
Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
August 17, 2015 02:42AM
I've successful built and tested a working U-Boot version for Zyxel NSA310S/320S. Please try and report!

It should be loaded with UART in serial console:

kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2014.07-tld-4.nsa310s.uart.kwb

Warning: this image is not for flashing to NAND.

UPDATE:

The final NAND version was uploaded here:
http://forum.doozan.com/read.php?3,23331,23348#msg-23348

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



Edited 6 time(s). Last edit at 08/20/2015 07:00PM by bodhi.
Attachments:
open | download - uboot.2014.07-tld-4.nsa310s.uart.kwb (433.4 KB)
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
August 17, 2015 04:02AM
Looks like I've missed the Ethernet PHY fix in the previous test version (uboot.2014.07-tld-4.nsa310s.uart.kwb).

Update:

Attached is another test version that bring up the link properly.

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



Edited 4 time(s). Last edit at 08/17/2015 10:02PM by bodhi.
Attachments:
open | download - uboot.2014.07-tld-4-test-2.nsa310s.uart.kwb (433.5 KB)
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
August 17, 2015 08:19PM
Here is the final pre-released version, ready to flash to NAND mtd0. This image can be flashed to mtd0 using the same instruction for the NSA325 u-boot in the U-Boot thread.

Please test it using UART serial console first before flashing:
kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2014.07-tld-4.nsa310s.mtd0.kwb -p

Download at Dropbox:
uboot.2014.07-tld-4.nsa310s.bodhi.tar
md5:
734d2baa84f5a7906443b8adb31652a7

UPDATE:

If you have the NSA310S, then this version is good to go. For the NSA320S, we're troubleshooting the 2nd HDD power up problem.

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



Edited 2 time(s). Last edit at 08/18/2015 03:41PM by bodhi.
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
August 19, 2015 12:01PM
@bodhi,

nicely done! Gonna test it soon.
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
August 24, 2015 02:16AM
moved to the right thread ;-)
sorry for confusing

Sending boot message. Please reboot the target...|
Sending boot image...
  0 % [......................................................................]
  2 % [......................................................................]
  4 % [......................................................................]
...
... 94 % [......................................................................]
 96 % [......................................................................]
 98 % [......................................]
[Type Ctrl-\ + c to quit]


U-Boot 2014.07-tld-4 (Aug 16 2015 - 23:12:30)
ZyXEL NSA3x0S 2-Bay Power Media Server

SoC:   Kirkwood 88F6702_A1
DRAM:  256 MiB
WARNING: Caches not enabled
NAND:  128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   egiga0
MV88E1318 PHY initialized on egiga0
main_loop
Hit any key to stop autoboot:  0

NSA3x0S> ide reset

Reset IDE: ide_preinit failed
NSA3x0S>
NSA3x0S> ide info

IDE device 0: device type unknown
IDE device 1: device type unknown
NSA3x0S>


with two 3,5 '' HDDs:

NSA3x0S> ide reset

Reset IDE: Bus 0: OK Bus 1: not available  
  Device 0: Model: WDC WD20EARS-00MVWB0 Firm: 51.0AB51 Ser#:  WD-WCAZA7371950
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 1907729.0 MB = 1863.0 GB (3907029168 x 512)
NSA3x0S>

NSA3x0S> ide info

IDE device 0: Model: WDC WD20EARS-00MVWB0 Firm: 51.0AB51 Ser#:  WD-WCAZA7371950
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 1907729.0 MB = 1863.0 GB (3907029168 x 512)
NSA3x0S> 
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
August 24, 2015 02:30AM
pengu

> moved to the right thread ;-)
> sorry for confusing
>

Good idea :) let's keep everything about this u-boot testing in this thread from now on.

Here is what I posted in the Debian thread:

Quote

I'm running out of free time to pursue this. If you could, pls continue with similar tests for the other GPIOs. There are 36 GPIOs that are usable (0 to 35). And I've determined those above were the most likely to work, based on my understanding of Kirkwood SoC GPIO implementation.

You could try to test the rest of the GPIOs (excluding the ones already defined in the NSA320S DTS).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Luka Perkov
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
October 10, 2015 08:42AM
Hi Bodhi,

can you please share your sources for NSA310S/320S U-Boot?

DId you make the changes on top of vanilla u-boot?

Thanks a lot!

Regards,
Luka
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
October 10, 2015 02:45PM
Hi Luka,

Yes, it was built based on the 6192 chip source code (by Prafulla Wadaskar and later Peter Schildmann).

I will push it out my GiHub: https://github.com/mibodhi. Have been quite busy so I can only respond to questions in the forum. I've been wanting to rebase my u-boot builds to 2015.07 for a while, and never got out of the planning stage :)

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



Edited 2 time(s). Last edit at 10/10/2015 03:01PM by bodhi.
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
October 10, 2015 08:01PM
Hi Luka,

Sent it by email.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Micky Wicky
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 01, 2016 06:19AM
Hi guys,

Did you make any progress on powering the 2nd HDD for the NSA320s?
Thanks to your u-boot build, I've moved from Stock OS + Debian Wheezy chroot -> straight Debian Jessie, and I'm building a NetBSD install to replace that, running off USB.
But without the 2nd HDD, I have no RAID1 :-/

Happy to help with the investigation, not just the testing!

Cheers
M
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 03, 2016 09:11AM
Micky Wicky Wrote:
-------------------------------------------------------
> Hi guys,
>
> Did you make any progress on powering the 2nd HDD
> for the NSA320s?
> Thanks to your u-boot build, I've moved from Stock
> OS + Debian Wheezy chroot -> straight Debian
> Jessie, and I'm building a NetBSD install to
> replace that, running off USB.
> But without the 2nd HDD, I have no RAID1 :-/
>
> Happy to help with the investigation, not just the
> testing!
>
> Cheers
> M

We could do this investgation in a couple weeks (I am away from home and my development box).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Micky Wicky
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 03, 2016 06:02PM
Sure, thanks for the heads-up.
I'll dive into the Zyxel GPL sources and see what I can make of them in the meantime - I'm very new to u-boot.
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 03, 2016 10:41PM
Micky Wicky Wrote:
-------------------------------------------------------
> Sure, thanks for the heads-up.
> I'll dive into the Zyxel GPL sources and see what
> I can make of them in the meantime - I'm very new
> to u-boot.

We did some investigation in this thread, specifically starting about this post:
http://forum.doozan.com/read.php?2,22847,23392#msg-23392

The idea is to figure out if GPIO 33 can be used for the HDD2 power (or perhaps other GPIO). I think I need to take a closer look a the way we poke the memory (address, offset,..)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 16, 2016 10:55AM
RIght, I've not managed to find out anything beyond GPIO33...
But in the stock u-boot it is definitely the one - maybe u-boot 2015.10 is missing something else?
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 16, 2016 11:08AM
Micky Wicky Wrote:
-------------------------------------------------------
> RIght, I've not managed to find out anything
> beyond GPIO33...
> But in the stock u-boot it is definitely the one -
> maybe u-boot 2015.10 is missing something else?

Nope. NSA3x0S u-boot-2014.07 is the same as u-boot-2015.10. This is a known lack of functionality for the NSA320S, and has not been implemented.

BTW, could you post the stock u-boot code where you've dertermined that " it is definitely the one" ?

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



Edited 2 time(s). Last edit at 01/16/2016 11:11AM by bodhi.
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 16, 2016 12:51PM
Not sure I've been entirely clear... I mean that the only things I can make out in the stock u-boot source code is about GPIO33 being the pin for sata1 power.
2014.07 and 2015.10 must initialise it differently to stock somehow
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 16, 2016 01:09PM
Not really, we are trying to determine whether GPIO 33 is SATA 2 power.

Or if you meant the 2nd SATA (eg. 0, 1) then yes. We are trying to test GPIO 33 for the 2nd HDD power.

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



Edited 1 time(s). Last edit at 01/16/2016 01:35PM by bodhi.
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 18, 2016 12:58PM
You're right I just got confused with the numbers... sometimes it's sata0 and sata1 as I expect, other times it's sata1 and sata2... back to the drawing board.

FWIW I did something potentially very stupid and inserted my 2nd 3.5'' HDD into the 2nd SATA port while it was running... I clearly heard it (attempt to??) spin up for less than 2 seconds before bad things happened. It sounded like there wasn't enough power, as the functioning of 2.5'' HDDs suggests.
I must say I'm stumped, but I'm no expert at low-level programming, so not saying much here.

On a related topic - I want to restore the stock u-boot to see what I can find out there. I think others have done it but I'm understandably wary of doing it wrong, is there a pointer on the forum to doing just that?
I've got a backup of the MTD partitions and the u-boot env in text form...
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 19, 2016 01:11PM
So I've booted stock uboot via kwboot (very cool utility), and the second disk only starts if I issue "mw.l f1010104 c70e0ffd;ide reset" A simple "ide reset" only shows the first disk.

This is probably not news here, but thought I'd put it out there. I'll keep looking.


Conversely, stock uboot won't see my USB drives, but that's another story altogether.
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 19, 2016 02:06PM
Micky Wicky Wrote:
-------------------------------------------------------
> So I've booted stock uboot via kwboot (very cool
> utility), and the second disk only starts if I
> issue "mw.l f1010104 c70e0ffd;ide reset" A simple
> "ide reset" only shows the first disk.
>
> This is probably not news here, but thought I'd
> put it out there. I'll keep looking.
>

Cool :) that's what I'd like to know (since I don't have this box, I can't play with the memory pokes).

> Conversely, stock uboot won't see my USB drives,
> but that's another story altogether.

That's something we already taken care of in the new u-boot.

Could you try kwboot with the new u-boot and do the same mw.l command, see if the behavior is the same? Thanks.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 19, 2016 04:43PM
>Could you try kwboot with the new u-boot and do the same mw.l command, see if the behavior is the same?

Makes no difference with 2015.10, still only just see the one disk. "Bus 1: Not Available"

So, to recap:
- stock uboot needs "mw.l f1010104 c70e0ffd;ide reset" to see the second disk
- 2015.10 doesn't see the disk, even with the same poke

Any other ideas?

I have b0rked my mtd0 in the process, so now I can only reboot with kwboot - NetBSD doesn't have uboot-tools, so I need to re-flash mtd0 from uboot. More fun and games! I guess I need a Debian USB install for these things...
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 19, 2016 11:44PM
Micky Wicky,

> I have b0rked my mtd0 in the process, so now I can
> only reboot with kwboot - NetBSD doesn't have
> uboot-tools, so I need to re-flash mtd0 from
> uboot. More fun and games! I guess I need a Debian
> USB install for these things...

Time to boot Debian, make it easier to flash new u-boot or restore stock u-boot:
http://forum.doozan.com/read.php?2,12096

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 20, 2016 02:12AM
Thanks, I'll do that tonight probably.
In terms of pokes with the stock uboot, this Hungarian chap ported Debian to the 320S with stock uboot (running off USB), and has a few tips: http://www.madadmin.com/zyxel-nsa320s-es-debian-linux-4-resz/
(Google Translate FTW)

Onto the stock uboot - I really don't understand the logic behind Marvell having board-specific IDE init support, AND requiring a memory poke to init the second SATA port.
I need to look at your source code as well for comparison.
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 20, 2016 02:42AM
Micky,

I got the kenel info from madadmin initially. He's our member chrlee.

Stock u-boot has some problem. Zyxel worked around it in their kernel (not Marvell). We are fixing their problem in the new uboot :)

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



Edited 1 time(s). Last edit at 01/20/2016 09:12AM by bodhi.
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 20, 2016 01:26PM
extra info: on stock u-boot, note the emphasis.
I really think this is what powers the 2nd HDD

Marvell>> mw.l f1010104 c70e0ffd;ide reset

Reset IDE: 
Marvell Serial ATA Adapter
Integrated Sata device found
[0 0 0]: Enable DMA mode (6)
  Device 0 @ 0 0:
Model: WDC WD20EZRX-00D8PB0                     Firm: 80.00A80 Ser#:      WD-WCC4MHECYZUX
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512)
[0,1]: device connected event received
[0 1 0]: Enable DMA mode (6)
  Device 1 @ 0 1:
Model: WDC WD20EZRX-00D8PB0                     Firm: 80.00A80 Ser#:      WD-WCC4MCY6Y4AH
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512)

Marvell>>
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 27, 2016 03:09AM
Micky Wicky Wrote:
-------------------------------------------------------
> extra info: on stock u-boot, note the emphasis.
> I really think this is what powers the 2nd HDD
>
>
> Marvell>> mw.l f1010104 c70e0ffd;ide reset
> 
> Reset IDE: 
> Marvell Serial ATA Adapter
> Integrated Sata device found
> [0 0 0]: Enable DMA mode (6)
>   Device 0 @ 0 0:
> Model: WDC WD20EZRX-00D8PB0                    
> Firm: 80.00A80 Ser#:      WD-WCC4MHECYZUX
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 1907729.0 MB = 1863.0 GB
> (-387938128 x 512)
> [0,1]: device connected event received
> [0 1 0]: Enable DMA mode (6)
>   Device 1 @ 0 1:
> Model: WDC WD20EZRX-00D8PB0                    
> Firm: 80.00A80 Ser#:      WD-WCC4MCY6Y4AH
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 1907729.0 MB = 1863.0 GB
> (-387938128 x 512)
> 
> Marvell>>
>

This indicates that stock u-boot might have done some other poke(s) that our new u-boot does not. It sounds like a combo poke must be done.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 29, 2016 01:17PM
Seems like it.
So I found a function that would look right in board/mv_feroceon/mv_kw/mv_main.c :
You'd think all the boards would use this... not mine by the looks of it:

/*******************************************************************************
* mvHddPowerCtrl - 
*
* DESCRIPTION:
*       This function set HDD power on/off acording to env or wait for button push
* INPUT:
*	None
* OUTPUT:
*	None
* RETURN:
*       None
*
*******************************************************************************/
static void mvHddPowerCtrl(void)
{

    MV_32 hddPowerBit;
    MV_32 fanPowerBit;
	MV_32 hddHigh = 0;
	MV_32 fanHigh = 0;
	char* env;
	
    if(RD_88F6281A_ID == mvBoardIdGet() || RD_88F6282A_ID == mvBoardIdGet())
    {
        hddPowerBit = mvBoarGpioPinNumGet(BOARD_GPP_HDD_POWER, 0);
        fanPowerBit = mvBoarGpioPinNumGet(BOARD_GPP_FAN_POWER, 0);

        if (hddPowerBit > 31)
    	{
    		hddPowerBit = hddPowerBit % 32;
    		hddHigh = 1;
    	}
    
    	if (fanPowerBit > 31)
    	{
    		fanPowerBit = fanPowerBit % 32;
    		fanHigh = 1;
    	}
    }

	if ((RD_88F6281A_ID == mvBoardIdGet()) || (RD_88F6192A_ID == mvBoardIdGet()) || 
        (RD_88F6190A_ID == mvBoardIdGet()) || (RD_88F6282A_ID == mvBoardIdGet()))
	{

	        if(RD_88F6281A_ID == mvBoardIdGet())
        	{
            		mvBoardFanPowerControl(MV_TRUE);
            		mvBoardHDDPowerControl(MV_TRUE);
        	}
        	else
        	{
            		/* FAN power on */
    			MV_REG_BIT_SET(GPP_DATA_OUT_REG(fanHigh),(1<<fanPowerBit));
    			MV_REG_BIT_RESET(GPP_DATA_OUT_EN_REG(fanHigh),(1<<fanPowerBit));
            		/* HDD power on */
            		MV_REG_BIT_SET(GPP_DATA_OUT_REG(hddHigh),(1<<hddPowerBit));
            		MV_REG_BIT_RESET(GPP_DATA_OUT_EN_REG(hddHigh),(1<<hddPowerBit));
        	}
        
	}
}

Nothing specific to my board id 88F6702A so this is probably a red herring. I need to work my way backwards through that source code, from first initialisation...
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 29, 2016 01:28PM
Glad you've found this code :) I think if you can figure out from this function which GPIO to set in addition to 33 (I'm not free to do much thinking right now), then we have a good test.

The RD_88F6192A_ID is used for our board 88F6702A in u-boot. This is something that I've discovered after a couple pass through this stock u-boot code. This was an important fact to make the new NSA3x0s u-boot works.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 29, 2016 01:30PM
Yes, I just noticed the RD_88F6192A_ID thing... no offence to the Marvells devs, but this isn't the most readable code I can think of :)

so I need to find the value of hddHigh and hddPowerbit now
Re: Zyxel NSA3x0S u-boot-2014.07-tld-4 for testing
January 29, 2016 01:40PM
Micky Wicky Wrote:
-------------------------------------------------------
> Yes, I just noticed the RD_88F6192A_ID thing... no
> offence to the Marvells devs, but this isn't the
> most readable code I can think of :)
>

Yeah :) But the sloppiness also on Zyxel devs part for not trying to document this!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
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: