Welcome! Log In Create A New Profile

Advanced

MEDION P89634 MD 86783 (2x2 TB NAS): Backup Flash

Posted by Peter2017 
At first sight it seems to be stuck in an infinite loop in mpp.c:64. I checked the kirkwood_variant() result: MPP_F6192_MASK. But it seems this board is F6702, so maybe it is linked. If I add an mpp_list++ to make it exit the loop, it seems the board resets, it beeps like it would when powering it but then it is halted and gdb is lost.
Re: MEDION P89634 MD 86783 (2x2 TB NAS): Backup Flash
December 23, 2018 09:37PM
Damien,

The 6702 is a variant of 6192.

Pogo V4 is 6192
NSA310S is 6702

So try kwboot with these 2 latest u-boots here:
https://forum.doozan.com/read.php?3,12381

uboot.2017.07-tld-1.pogo_v4.mtd0.kwb
uboot.2017.07-tld-1.nsa310s.mtd0.kwb

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

It's indeed going further with the nsa310s: there it is failing in arch/arm/mach-mvebu/dram.c:287 in dram_init_banksize in the

if (size > SDRAM_SIZE_MAX)
mvebu_sdram_bs_set(i, 0x40000000);

conditional. It should not trigger but when looking with gdb, the size seems to return random values each time I print it:

(gdb) p gd->bd->bi_dram[0]
$26 = {start = 524288, size = 2148007936}
(gdb) p gd->bd->bi_dram[0]
$27 = {start = 2148057088, size = 3221274624}
(gdb) p gd->bd->bi_dram[0]
$28 = {start = 3221804040, size = 3557347336}
(gdb) p gd->bd->bi_dram[0]
$29 = {start = 3221798912, size = 2148007944}
(gdb) p gd->bd->bi_dram[0]
$30 = {start = 3221798912, size = 3288387840}

and triggers the conditionnal. If I remove the safety check, it fails in setup_reloc which I suppose would make sense as the dram is improperly configured (I suppose setup_reloc is moving stuff in dram after it is properly configured?)
Good knews, with the jtag interface and openocd I managed to dump the multi purpose pin configuration registers and to mofidy the nsa310s.c. Also it's using the uart1 port file to properly configure the pins for this board. U-boot is now loading correctly. I'll try to boot from usb now.

diff --git a/arch/arm/mach-kirkwood/include/mach/config.h b/arch/arm/mach-kirkwood/include/mach/config.h
index 2c954fe..411ac3f 100644
--- a/arch/arm/mach-kirkwood/include/mach/config.h
+++ b/arch/arm/mach-kirkwood/include/mach/config.h
@@ -42,7 +42,7 @@
 #define CONFIG_NR_DRAM_BANKS_MAX       2

 #define CONFIG_I2C_MVTWSI_BASE0        KW_TWSI_BASE
-#define MV_UART_CONSOLE_BASE   KW_UART0_BASE
+#define MV_UART_CONSOLE_BASE   KW_UART1_BASE
 #define MV_SATA_BASE           KW_SATA_BASE
 #define MV_SATA_PORT0_OFFSET   KW_SATA_PORT0_OFFSET
 #define MV_SATA_PORT1_OFFSET   KW_SATA_PORT1_OFFSET
diff --git a/board/zyxel/nsa310s/nsa310s.c b/board/zyxel/nsa310s/nsa310s.c
index eeab4b4..1903462 100644
--- a/board/zyxel/nsa310s/nsa310s.c
+++ b/board/zyxel/nsa310s/nsa310s.c
@@ -39,16 +39,16 @@ int board_early_init_f(void)
                MPP4_NF_IO6,
                MPP5_NF_IO7,
                MPP6_SYSRST_OUTn,
-               MPP7_GPO,
+               MPP7_SPI_SCn,
                MPP8_TW_SDA,
                MPP9_TW_SCK,
-               MPP10_UART0_TXD,
-               MPP11_UART0_RXD,
+               MPP10_SPI_SCK,
+               MPP11_SPI_MISO,
                MPP12_GPO,
                MPP13_GPIO,
                MPP14_GPIO,
-               MPP15_GPIO,
-               MPP16_GPIO,
+               MPP15_UART1_TXD,
+               MPP16_UART1_RXD,
                MPP17_GPIO,
                MPP18_NF_IO0,
                MPP19_NF_IO1,
Re: MEDION P89634 MD 86783 (2x2 TB NAS): Backup Flash
December 26, 2018 03:55PM
Damien,


Good works!

Have you tried to find GPL u-boot source for this box?

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

I asked for it but no news...

I have another problem now linked to the dts. Uboot is correctly configuring the ethernet port:

MD86873> mii info
PHY 0x00: OUI = 0x5043, Model = 0x29, Rev = 0x00, 1000baseT, FDX

And dhcp is working correctly, however, when booting the kernel:

9.106161] libphy: Fixed MDIO Bus: probed
[ 9.111095] libphy: orion_mdio_bus: probed
[ 9.115241] [Firmware Warn]: /ocp@f1000000/mdio-bus@72004/ethernet-phy@1: Whitelisted compatible string. Please remove
[ 9.126103] mdio_bus f1072004.mdio-bus-mii: MDIO device at address 1 is missing.
[ 9.133678] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[ 9.141004] mv643xx_eth_port mv643xx_eth_port.0: DMA mask not set

And eth0 is not detected. Any idea ?

After that I still have to mess around with the gpio to find the one for powering the SATA drives and fixing the led ones, if you have any idea how to proceed besides trying each one by one, you are welcome ;)
Re: MEDION P89634 MD 86783 (2x2 TB NAS): Backup Flash
December 26, 2018 06:48PM
Damien,

> And eth0 is not detected. Any idea ?

Post the DTS that you are using here. And the serial console bootlog.

>
> After that I still have to mess around with the
> gpio to find the one for powering the SATA drives
> and fixing the led ones, if you have any idea how
> to proceed besides trying each one by one, you are
> welcome ;)

Usually, if the DTS is correct, then SATA and USB can be powered by the DTS. Without GPL source, you would have to try one by one :) no other way. That can be done in u-boot, or also in Linux (with DTS populated with all generic GPIOs 1..49, where applicable, and you would set it in command line).

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

Yes it was using the wrong device phy address in the dts. I also tried the gpio one by one, found the one for the two sata drive, added regulator to bring them up and also configured the gpio leds. It seems every thing is ok now! I just miss the 3 buttons now.
Also for reference, I had to force the number of DRAM banks to 1 in the board config to have it configure the dram correctly. No idea why.

Thanks a lot for your help. I'll try to cleanup my mess by creating a new board config in uboot and a new dts for the kernel and I'll submit a pull request for you. Btw, did you try to push your config upstreams ?

Anyway thanks for your help! It was quite fun, I learned a lot these last days ;)
Re: MEDION P89634 MD 86783 (2x2 TB NAS): Backup Flash
December 27, 2018 11:51PM
Damien Wrote:
-------------------------------------------------------
> Hello,
>
> Yes it was using the wrong device phy address in
> the dts. I also tried the gpio one by one, found
> the one for the two sata drive, added regulator to
> bring them up and also configured the gpio leds.
> It seems every thing is ok now! I just miss the 3
> buttons now.

Cool!

> Also for reference, I had to force the number of
> DRAM banks to 1 in the board config to have it
> configure the dram correctly. No idea why.
>
> Thanks a lot for your help. I'll try to cleanup my
> mess by creating a new board config in uboot and a
> new dts for the kernel and I'll submit a pull
> request for you. Btw, did you try to push your
> config upstreams ?

No, I’ve tried once. And it just take too much time for me. And there is some technical difference that will take even longer. So I jus keep my woks in GitHub.


> Anyway thanks for your help! It was quite fun, I
> learned a lot these last days ;)

You’re welcome!

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

I created a pull request, uploaded a gist with the dts and one with an openocd config for those who need it.

pull request: https://github.com/mibodhi/u-boot-kirkwood/pull/9 with my changes for uboot.
device tree: https://gist.github.com/canatella/2a0cef70be722bbafce6094cca44fa14
openocd: https://gist.github.com/canatella/4d6e113e1a95ed715a04d3fae8a756a3

Hoping that other people will find this usefull too!
Re: MEDION P89634 MD 86783 (2x2 TB NAS): Backup Flash
December 28, 2018 05:33PM
damien Wrote:
-------------------------------------------------------
> Hello,
>
> I created a pull request, uploaded a gist with
> the dts and one with an openocd config for those
> who need it.
>
> pull request:
> https://github.com/mibodhi/u-boot-kirkwood/pull/9
> with my changes for uboot.
> device tree:
> https://gist.github.com/canatella/2a0cef70be722bbafce6094cca44fa14
> openocd:
> https://gist.github.com/canatella/4d6e113e1a95ed715a04d3fae8a756a3
>
> Hoping that other people will find this usefull
> too!


Thanks Damien!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: MEDION P89634 MD 86783 (2x2 TB NAS): Backup Flash
February 08, 2019 03:18PM
Hello!

In case somebody also is interessted: Medion did provide the UBOOT sources:
http://cdn.medion.com/downloads/quellcode/Medion-Lifecloud-UBOOT_20101009.zip

I didn't had time to really check the archive but from a first glance it looks prommissing.

As well as your great work damien!

Yours,
Peter2017
So for those wanting to build for this board, first thing is to install the toolchain, I used the gcc-arm-none-eabi provided in ubuntu, I think any arm eabi toolchain should do.

Then you'll need to build bodhi's u-boot using my pull-request: https://github.com/mibodhi/u-boot-kirkwood/pull/9
$ make md86783_config
$ ARCH=arm CROSS_COMPILE=arm-none-eabi- make

You might get some errors at the end but you still should get the u-boot.bin file. That is the one to flash. You can use the instructions at https://forum.doozan.com/read.php?3,12381 to flash it. Beware that this board does not have the magic trick to upload the bootloader over uart so if something goes wrong, you can still recover your board but you'll need to open your NAS, ensure that the JTAG header is there, solder some cables on it, buy a Jlink adapter and use openocd with the config file I posted earlier to flash a new bootloader. Also, do not forget to backup your nand flash so that you still have the old bootloader should you need to flash it.

With u-boot flashed, you now need a kernel with device tree support. Clone the linux kernel and check out the same version bodhi is using to build is own, currently 4.20.6 (see kernel thread ). Apply the patch provided in linux-4.20.6-kirkwood-tld-1-bodhi.tar.bz2 image in that thread to the kernel sources (something along the lines of patch -p1 < linux-4.20.6-kirkwood-tld-1.patch, check first with the --dry-run option to get the -p argument right). Finally, drop the https://gist.github.com/canatella/2a0cef70be722bbafce6094cca44fa14 device tree file in arch/arm/boot/dts/kirkwood-md86783.dts and build using the config-4.20.6-kirkwood-tld-1 file.

You should now be able to follow the https://forum.doozan.com/read.php?2,12096 install thread to install the kernel and the compiled device tree onto the rootfs and boot that rootfs using usb. Just do not forget to replace the .dtb file with the kirkwood-md86783.dtb in the procedures there.

Good luck!

Damien
Re: MEDION P89634 MD 86783 (2x2 TB NAS): Backup Flash
February 11, 2019 12:48PM
Thanks for your contribution Damien!

I'm a little slow getting back to normal pace, but will get to your DTS and u-boot pull request eventually :)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Hey, no problem for me, It's just that I received a mail from Peter2017 on how to build this. I answered here so that everybody can enjoy it ;)
Re: MEDION P89634 MD 86783 (2x2 TB NAS): Backup Flash
March 11, 2019 02:59PM
Maybe you can help me too. I have the same device and flashed a wrong U-BOOT, so I need to use JTAG. I built bodhis U-BOOT with your patches, then I flashed the u-boot.kwb file like in this tutorial: HOW2: Repair Pogo E02 with Raspberry PI (1,2 or 3) JTAG and OpenOCD. After that, I rebootet the board an it seemed to work, at least better than before, because the blue LEDs are working (only the blue ones, two are glowing constantly, one ist flashing. Every 13 seconds or so, they all turn off and on again). But I get no UART console output, neither anything in the JTAG console.

Hopefully you can help.
Re: MEDION P89634 MD 86783 (2x2 TB NAS): Backup Flash
March 16, 2019 09:01AM
Sorry, just wired UART the wrong way. uboot ist working fine! Thanks a lot for your work.
Author:

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: