Welcome! Log In Create A New Profile

Advanced

TerraMaster F2NAS2 u-boot program

Posted by donbowman 
TerraMaster F2NAS2 u-boot program
February 07, 2018 06:03PM
I have a TerraMaster F2-NAS2. Its a Marvell kirkwood (88F6282). The board is capable of kwboot a u-boot image.

I have constructed a .dts file and used this to build a linux uImage, which boots successfully (I have not attempted to build u-boot w/ this yet tho).

I have the original u-boot image (extracted from the mtd0) and can boot it from kwboot.
But, when i save the image into mtd0, it does not boot from it (nothing happens on the serial).

I have read back out mtd0 after programming it, and all seems well.

if i boot it w/ kwboot, i can save/restore environment variables from the other half of the space.

Does anyone have any suggestions why the board will not boot when this is programmed to flash, but will boot it from kwboot?

The original flash layout was:
mtd0: 00100000 00020000 "bootloader"
mtd1: 00400000 00020000 "data"
mtd2: 01000000 00020000 "backup-kernel"
mtd3: 06400000 00020000 "backup-system"
mtd4: 01000000 00020000 "kernel"
mtd5: 17700000 00020000 "rootfs"

The system has a single nand device (512M).

i've tried writing the u-boot back in using both itself (booted from kwboot) w/ nand write.e 0 0 0x80000 (after loading it w/ tftpboot @ 0). I've also tried writing it back in using linux (both the mfg uImage and my own). in all cases, when i apply power, nothing happens until i kwboot it.

um, suggestions?

(ps, why did it get erased, well, mea culpa as i was playing w/ the partitioning w/ my own uImage :)
Re: TerraMaster F2NAS2 u-boot program
February 07, 2018 07:37PM
donbowman Wrote:
-------------------------------------------------------
> I have a TerraMaster F2-NAS2. Its a Marvell
> kirkwood (88F6282). The board is capable of kwboot
> a u-boot image.
>
> I have constructed a .dts file and used this to
> build a linux uImage, which boots successfully (I
> have not attempted to build u-boot w/ this yet
> tho).
>
> I have the original u-boot image (extracted from
> the mtd0) and can boot it from kwboot.
> But, when i save the image into mtd0, it does not
> boot from it (nothing happens on the serial).
>
> I have read back out mtd0 after programming it,
> and all seems well.
>
> if i boot it w/ kwboot, i can save/restore
> environment variables from the other half of the
> space.
>
> Does anyone have any suggestions why the board
> will not boot when this is programmed to flash,
> but will boot it from kwboot?
>
> The original flash layout was:
> mtd0: 00100000 00020000 "bootloader"
> mtd1: 00400000 00020000 "data"
> mtd2: 01000000 00020000 "backup-kernel"
> mtd3: 06400000 00020000 "backup-system"
> mtd4: 01000000 00020000 "kernel"
> mtd5: 17700000 00020000 "rootfs"
>
> The system has a single nand device (512M).
>
> i've tried writing the u-boot back in using both
> itself (booted from kwboot) w/ nand write.e 0 0
> 0x80000 (after loading it w/ tftpboot @ 0). I've
> also tried writing it back in using linux (both
> the mfg uImage and my own). in all cases, when i
> apply power, nothing happens until i kwboot it.
>
> um, suggestions?
>
> (ps, why did it get erased, well, mea culpa as i
> was playing w/ the partitioning w/ my own uImage
> :)

Please post:

- The log of how you dumped the mtd0 and its output.

- file characteristics, assuming mtd0 is the dump:

ls -lh mtd0

- The kwboot command that you used successfully booting the box.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: TerraMaster F2NAS2 u-boot program
February 07, 2018 07:58PM
/home/don/src/u-boot-kirkwood/tools/kwboot -p -t -B 115200 /dev/ttyUSB0 -b bin/targets/kirkwood/generic/uboot-nand.bin

is how i am booting it. uboot-nand.bin is the contents i extracted from mtd0. it is working (e.g. the board boots up when i do this).

ls -lh bin/targets/kirkwood/generic/uboot-nand.bin
-rw-rw-r-- 1 don don 512K Feb 3 17:36 bin/targets/kirkwood/generic/uboot-nand.bin

is the file.

i extracted it w/ nandump -n. I don't have the log of that from the original system tho when i did it.

i notice that kwboot w/ the -p mode also disables ECC in the header.
Re: TerraMaster F2NAS2 u-boot program
February 07, 2018 11:49PM
donbowman,

Did you flash it back with commands like this in Linux?

Check mtd0 size and location:
cat /proc/mtd

Flash:
flash_erase /dev/mtd0 0 4
nandwrite /dev/mtd0 uboot-nand.bin

You could flash it again and post the log here.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: TerraMaster F2NAS2 u-boot program
February 08, 2018 10:43AM
So attempt method #1:

corrupt the environment. When i boot (via kwboot) this trips it going back and re-program the world. (gist here).

If i then power cycle, nothing happens. This leads me to believe that somehow I have extracted the mtd0 incorrectly, in such a way that it can still boot from kwboot, but not from flash??? [this has programmed the flash as per factory,

OK, reboot again w/ kwboot, w/ the flash in state from previous. Gist here

$ sha256sum uboot-nand.bin
4a1513d294ee16ed18534e3e5f85f7462a08d451e0cc18ae77e3e16a21da4247 uboot-nand.bin
(nas)#./busybox-armv5l head -c 512k /dev/mtd0 > mtd0.img
(nas)#./busybox-armv5l sha256sum mtd0.img
4a1513d294ee16ed18534e3e5f85f7462a08d451e0cc18ae77e3e16a21da4247 mtd0.img

conclusion: first 512k of flash is for sure the same as image.

(nas)#flash_erase /dev/mtd0 0 4
Erasing 128 Kibyte @ 60000 -- 100 % complete
(nas)#nandwrite /dev/mtd0 uboot-nand.bin
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x20000
Writing data to block 2 at offset 0x40000
Writing data to block 3 at offset 0x60000

Read it back:
(nas)#./busybox-armv5l head -c 512k /dev/mtd0 > mtd0.img
(nas)#./busybox-armv5l sha256sum mtd0.img
4a1513d294ee16ed18534e3e5f85f7462a08d451e0cc18ae77e3e16a21da4247 mtd0.img

seems its there.

OK, power cycle: Nothing.

So i don't think i'm making a mistake programming it to mtd0. And, given kwboot of the same image causes it to work, i don't think the image i extracted is corrupt.
Re: TerraMaster F2NAS2 u-boot program
February 08, 2018 11:36AM
(nas)#cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "bootloader"
mtd1: 00400000 00020000 "data"
mtd2: 01000000 00020000 "backup-kernel"
mtd3: 06400000 00020000 "backup-system"
mtd4: 01000000 00020000 "kernel"
mtd5: 17700000 00020000 "rootfs"

is what the original kernel shows.
the mtd1 is all 0xff from factory, not sure what it is.

I have also tried reprogram all 1M instead of just the 512k, no difference.
Re: TerraMaster F2NAS2 u-boot program
February 08, 2018 01:17PM
Ok, some more thinking. I think(?) that i am writing this w/o ECC somehow.

if i program it from u-boot (w/ nand write), and then in linux I read it as

nanddump -o -f mtd0.img /dev/mtd0

then I see a bunch of lines like:

ECC: 8 corrected bitflip(s) at offset 0x000b9000

So what if i have a file which is the post-ecc corrected (e.g. the proper image), but I am writing it somehow such that the ECC is not calculated on the write?
Re: TerraMaster F2NAS2 u-boot program
February 08, 2018 02:34PM
donbowman,

nanddump has many versions. The option syntax sometimes is the opposite of what you think it is.

That's why I asked if you have the log of nanddump sesion. When we dump nand, to make sure the options are correct, we would spell it out

nanddump --noecc --omitoob -l 0x80000 -f mtd0 /dev/mtd0

Now, since you have nothing to loose by flashing with the wrong option, you could try both --noecc and --ecc. The image dump is 512K which indicated that there is no OOB (if you had dumped with OOB then the image would have been > 512K).

As why kwboot behaves differently from a NAND resident image. kwboot manipulate the Marvell header before sending. The bootROM senses that a UART-booting image is transfered by looking at the header. NAND ECC is a don't care when the image is loaded directy to memory from UART port.

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 02/08/2018 02:35PM by bodhi.
Re: TerraMaster F2NAS2 u-boot program
February 08, 2018 03:10PM
Duh! I forgot that you dont have the original FW :)

Is there a GPL for this somewhere?

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 02/08/2018 03:12PM by bodhi.
Re: TerraMaster F2NAS2 u-boot program
February 08, 2018 03:21PM
Yes, but i was thinking of the oob/ecc memory were interleaved in the dump that it wouldn't boot correctly from the serial.

my conclusion also was that given i have 512.0K that it must not have oob info.

and yeah, i got nothing to lose :)

I wonder how one can read the MPP / Boot Device Mode Options register to see what it is expecting from the board strapping.

http://www.marvell.com/embedded-processors/armada-38x/assets/ARMADA-38x-Hardware-Spec.pdf Table 48 on p97.

Linux is saying 1-bit hamming (the uImage from the mfg, not the one I have compiled).
but i wonder if the bootloader partition might be something else. I don't see a 1-bit ECC option in that table.

The header(v0) of the image as saved is
p/x * (struct main_hdr_v0 *)0x7ffff7f4c000
$8 = {
  blockid = 0x8b, 
  nandeccmode = 0x0, 
  nandpagesize = 0x800, 
  blocksize = 0x73d98, 
  rsvd1 = 0x0, 
  srcaddr = 0x200, 
  destaddr = 0x600000, 
  execaddr = 0x670000, 
  satapiomode = 0x0, 
  rsvd3 = 0x0, 
  ddrinitdelay = 0x0, 
  rsvd2 = 0x0, 
  ext = 0x1, 
  checksum = 0x39
}

the v1 of the header is:
(gdb) p/x *hdr
$10 = {
  blockid = 0x8b, 
  flags = 0x0, 
  reserved2 = 0x800, 
  blocksize = 0x73d98, 
  version = 0x0, 
  headersz_msb = 0x0, 
  headersz_lsb = 0x0, 
  srcaddr = 0x200, 
  destaddr = 0x600000, 
  execaddr = 0x670000, 
  options = 0x0, 
  nandblocksize = 0x0, 
  nandbadblklocation = 0x0, 
  reserved4 = 0x0, 
  reserved5 = 0x0, 
  ext = 0x1, 
  checksum = 0x39
}

i guess(?) this is implying no ecc is used in the bootloader.
Re: TerraMaster F2NAS2 u-boot program
February 08, 2018 03:46PM
I have a copy of the mtd0 that i made before i started.
I have the mtd2...N from the manufacturer from their web site.

I have written to them and asked for the source code to both the u-boot and linux bits, but i do not have much hope. They did release some for x86, so i guess they know they should.

I have made my own dts file for linux, and thus my linux uImage will boot (as weil as the original one from mfg).

the mtd0 that i originally extracted from the device will boot it from kwboot, so i believe it is uncorrupted. I believe it is the correct bytes w/ no extra OOB/ECC info.

When i program it from the original mfg linux kernel (2.6.31), it won't boot. same for when i program from u-boot (as booted from kwboot).

So i cannot build a new u-boot (perhaps my dts for linux will work, but i don't want to assume it will just yet). But i do have an image that can get the system loaded to experiment. And i am reasonably confident it is just the image w/o flash overheads.

and this is where i'm stuck.

The system is using a hynix h27u4G8 flash. This does not (from what i can see from its datasheet) implement ecc in its hw.
the kirkwood/armada do implement ecc in their hw. but the original kernel outputs:

Using Hamming 1-bit ECC for NAND device
NAND device: Manufacturer ID: 0xad, Chip ID: 0xdc (Hynix NAND 512MiB 3,3V 8-bit)

and was not capable of a different ECC per mtd partition.

if i do nandwrite -n / nanddump -n, the sha1sum matches, and matches what i put in, so i know i'm writing it correctly.

hmm.
Re: TerraMaster F2NAS2 u-boot program
February 08, 2018 03:49PM
Hmm, the ECC mode of 0 is not disabled in the header. From tools/kwbimage.h:

/* NAND ECC Mode */
#define IBR_HDR_ECC_DEFAULT             0x00
#define IBR_HDR_ECC_FORCED_HAMMING      0x01
#define IBR_HDR_ECC_FORCED_RS           0x02
#define IBR_HDR_ECC_DISABLED            0x03

So maybe i try changing the header to 0x1.
Re: TerraMaster F2NAS2 u-boot program
February 08, 2018 04:05PM
So I tried patching the header to be 1-bit hamming, and nogo.

(nas)#nandwrite /dev/mtd0 uboot-nand-patched.bin 
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x20000
Writing data to block 2 at offset 0x40000
Writing data to block 3 at offset 0x60000
(nas)#nanddump -l 0x80000 -f /tmp/mtd0.img /dev/mtd0
ECC failed: 0
ECC corrected: 0
Number of bad blocks: 0
Number of bbt blocks: 0
Block size 131072, page size 2048, OOB size 64
Dumping data starting at 0x00000000 and ending at 0x00080000...
(nas)#cmp uboot-nand-patched.bin mtd0.img 
Re: TerraMaster F2NAS2 u-boot program
February 08, 2018 08:05PM
donbowman Wrote:
-------------------------------------------------------
> So I tried patching the header to be 1-bit
> hamming, and nogo.
>
>
> (nas)#nandwrite /dev/mtd0 uboot-nand-patched.bin 
> Writing data to block 0 at offset 0x0
> Writing data to block 1 at offset 0x20000
> Writing data to block 2 at offset 0x40000
> Writing data to block 3 at offset 0x60000
> (nas)#nanddump -l 0x80000 -f /tmp/mtd0.img
> /dev/mtd0
> ECC failed: 0
> ECC corrected: 0
> Number of bad blocks: 0
> Number of bbt blocks: 0
> Block size 131072, page size 2048, OOB size 64
> Dumping data starting at 0x00000000 and ending at
> 0x00080000...
> (nas)#cmp uboot-nand-patched.bin mtd0.img 
>

Ok Don. For sanity check, let’s compare 2 drivers: which NAND driver is used by stock OS? And which NAND driver you are running in this kernel (in dmesg does it show: orion, armada, px_xxx_nand....)?

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 02/09/2018 06:23AM by bodhi.
Re: TerraMaster F2NAS2 u-boot program
February 09, 2018 09:35AM
this is all w/ the stock (mfg-supplied) kernel, i've temporarily parked my uImage.

   Image Name:   Linux-2.6.31.8
   Created:      2014-03-16   8:51:43 UTC

Its not really obvious what its using for a driver:

# dmesg |egrep -i "nand|orion|armada|marvell|mv|mtd"
CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
Kernel command line: console=ttyS0,115200 mtdparts=nand_mtd:0x00100000@0x00000000(bootloader),0x00400000@0x00100000(data),0x01000000@0x00500000(backup-kernel),0x06400000@0x01500000(backup-system),0x01000000@0x07900000(kernel),0x17700000@0x08900000(rootfs); rootfstype=jffs2 root=/dev/mtdblock5 init=/linuxrc mem=1024m
  Marvell Development Board (LSP Version KW_LSP_5.1.3_patch29)-- DB-88F6282A-BP  Soc: 88F6282 A1 LE
MV Buttons Device Load
Marvell USB EHCI Host controller #0: 9000d540
rtc mv_rtc: rtc core: registered kw-rtc as rtc0
mvCesaInit: sessions=640, queue=64, pSram=f0000000
MV Buttons Driver Load
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
IRQ 21/mvSata: IRQF_DISABLED is not guaranteed on shared IRQs
scsi0 : Marvell SCSI to SATA adapter
scsi1 : Marvell SCSI to SATA adapter
Loading Marvell Ethernet Driver:
     o register under mv88fx_eth platform
mvFpRuleDb (90780000): 16384 entries, 65536 bytes
Using Hamming 1-bit ECC for NAND device
NAND device: Manufacturer ID: 0xad, Chip ID: 0xdc (Hynix NAND 512MiB 3,3V 8-bit)
mtd: no mtd-id
6 cmdlinepart partitions found on MTD device nand_mtd
Creating 6 MTD partitions on "nand_mtd":
ehci_marvell ehci_marvell.70059: Marvell Orion EHCI
ehci_marvell ehci_marvell.70059: new USB bus registered, assigned bus number 1
ehci_marvell ehci_marvell.70059: irq 19, io base 0xf1050100
ehci_marvell ehci_marvell.70059: USB 2.0 started, EHCI 1.00
usb usb1: Product: Marvell Orion EHCI
usb usb1: SerialNumber: ehci_marvell.70059
Orion Watchdog Timer: Initial timeout 21 sec
Marvell Kirkwood Power Management Initializing
rtc mv_rtc: setting system clock to 2033-10-19 23:42:44 UTC (2013378164)

full dmesg is below
Linux version 2.6.31.8 (root@rds-02) (gcc version 4.3.2 (sdk3.2rc1-ct-ng-1.4.1) ) #8 PREEMPT Sun Mar 16 16:51:41 CST 2014
CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
CPU: VIVT data cache, VIVT instruction cache
Machine: Feroceon-KW
Using UBoot passing parameters structure
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 259840
Kernel command line: console=ttyS0,115200 mtdparts=nand_mtd:0x00100000@0x00000000(bootloader),0x00400000@0x00100000(data),0x01000000@0x00500000(backup-kernel),0x06400000@0x01500000(backup-system),0x01000000@0x07900000(kernel),0x17700000@0x08900000(rootfs); rootfstype=jffs2 root=/dev/mtdblock5 init=/linuxrc mem=1024m
PID hash table entries: 2048 (order: 11, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 512MB 512MB = 1024MB total
Memory: 1033092KB available (4532K code, 274K data, 128K init, 524288K highmem)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
NR_IRQS:128
Console: colour dummy device 80x30
Calibrating delay loop... 1599.07 BogoMIPS (lpj=7995392)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
xor: measuring software checksum speed
   arm4regs  :  1454.000 MB/sec
   8regs     :  1102.000 MB/sec
   32regs    :  1076.800 MB/sec
xor: using function: arm4regs (1454.000 MB/sec)
NET: Registered protocol family 16
Feroceon L2: Enabling L2
Feroceon L2: Cache support initialised, in WT override mode.

CPU Interface
-------------
SDRAM_CS0 ....base 00000000, size 512MB 
SDRAM_CS1 ....base 20000000, size 512MB 
SDRAM_CS2 ....disable
SDRAM_CS3 ....disable
PEX0_MEM ....base e0000000, size 128MB 
PEX0_IO ....base f2000000, size   1MB 
PEX1_MEM ....base e8000000, size 128MB 
PEX1_IO ....base f2100000, size   1MB 
INTER_REGS ....base f1000000, size   1MB 
NFLASH_CS ....base fa000000, size   2MB 
SPI_CS ....base f4000000, size  16MB 
BOOT_ROM_CS ....no such
DEV_BOOTCS ....no such
CRYPT_ENG ....base f0000000, size   2MB 

  Marvell Development Board (LSP Version KW_LSP_5.1.3_patch29)-- DB-88F6282A-BP  Soc: 88F6282 A1 LE

 Detected Tclk 200000000 and SysClk 533333333 
MV Buttons Device Load
Marvell USB EHCI Host controller #0: 9000d540
PEX0 interface detected no Link.
PEX1 interface detected no Link.
PCI: bus0: Fast back to back transfers enabled
PCI: bus1: Fast back to back transfers enabled
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
raid6: int32x1    147 MB/s
raid6: int32x2    174 MB/s
raid6: int32x4    156 MB/s
raid6: int32x8    135 MB/s
raid6: using algorithm int32x2 (174 MB/s)
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
IP route cache hash table entries: 16384 (order: 4, 65536 bytes)
TCP established hash table entries: 65536 (order: 7, 524288 bytes)
TCP bind hash table entries: 65536 (order: 6, 262144 bytes)
TCP: Hash tables configured (established 65536 bind 65536)
TCP reno registered
NET: Registered protocol family 1
rtc mv_rtc: rtc core: registered kw-rtc as rtc0
RTC registered
Kirkwood hwmon thermal sensor initialized.
XOR registered 2 channels
XOR 2nd invalidate WA enabled
cesadev_init(8000df1c)
mvCesaInit: sessions=640, queue=64, pSram=f0000000
MV Buttons Driver Load
highmem bounce pool size: 64 pages
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 995
alg: No test for cipher_null (cipher_null-generic)
alg: No test for ecb(cipher_null) (ecb-cipher_null)
alg: No test for digest_null (digest_null-generic)
alg: No test for compress_null (compress_null-generic)
alg: No test for stdrng (krng)
alg: No test for hmac(digest_null) (hmac(digest_null-generic))
async_tx: api initialized (sync-only)
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
io scheduler noop registered
io scheduler anticipatory registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
console [ttyS0] enabled
serial8250.0: ttyS1 at MMIO 0xf1012100 (irq = 34) is a 16550A
brd: module loaded
loop: module loaded
Integrated Sata device found
IRQ 21/mvSata: IRQF_DISABLED is not guaranteed on shared IRQs
scsi0 : Marvell SCSI to SATA adapter
scsi1 : Marvell SCSI to SATA adapter
scst: User interface thread started, PID 171
scst: Processing thread scstd0 (PID 172) started
scst: Init thread started, PID 173
scst: Task management thread started, PID 174
scst: SCST version 3.0.0-pre2 loaded successfully (max mem for commands 124MB, per device 49MB)
scst: Device handler "dev_disk" for type 0 registered successfully
scst: Device handler "dev_disk_perf" for type 0 registered successfully
scst: Device handler "dev_raid" for type 12 registered successfully
scst: Virtual device handler vdisk_fileio for type 0 registered successfully
scst: Virtual device handler vdisk_blockio for type 0 registered successfully
scst: Virtual device handler vdisk_nullio for type 0 registered successfully
scst: Virtual device handler vcdrom for type 5 registered successfully
scst: Virtual device handler "scst_user" registered successfully
scst: Management thread started, PID 175
iscsi-scst: iSCSI SCST Target - version 3.0.0-pre2
scst: Target template iscsi registered successfully
scst_user: Cleanup thread started, PID 176
iscsi-scst: Read thread for pool 903f8640 started, PID 177
iscsi-scst: Read thread for pool 903f8640 started, PID 178
iscsi-scst: Write thread for pool 903f8640 started, PID 179
scst: Target template scst_local registered successfully
iscsi-scst: Write thread for pool 903f8640 started, PID 180
scst: Target scst_local_tgt for template scst_local registered successfully
scst: Using security group "scst_local_tgt" for initiator "scst_local_host" (target scst_local_tgt)
scsi2 : scst_local
Loading Marvell Ethernet Driver:
  o Cached descriptors in DRAM
  o DRAM SW cache-coherency
  o 2 Giga ports supported
  o Single RX Queue support - ETH_DEF_RXQ=0
  o Single TX Queue support - ETH_DEF_TXQ=0
  o TCP segmentation offload (TSO) supported
  o UDP fragmentation offload (UFO) supported
  o Large Receive offload (LRO) supported
  o Receive checksum offload supported
  o Transmit checksum offload supported
  o Network Fast Processing (Routing) supported - (Disabled)
  o Proc tool API enabled
  o SKB Reuse supported - (Disabled)
  o SKB Recycle supported - (Disabled)
  o Rx descripors: q0=128
  o Tx descripors: q0=512
  o Loading network interface(s):
     o register under mv88fx_eth platform
eth0: mixed HW and IP checksum settings.
     o eth0, ifindex = 2, GbE port = 0

Warning: Giga 1 is Powered Off

mvFpRuleDb (90780000): 16384 entries, 65536 bytes
Using Hamming 1-bit ECC for NAND device
NAND device: Manufacturer ID: 0xad, Chip ID: 0xdc (Hynix NAND 512MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 789 at 0x0000062a0000
mtd: no mtd-id
6 cmdlinepart partitions found on MTD device nand_mtd
Using command line partition definition
Creating 6 MTD partitions on "nand_mtd":
0x000000000000-0x000000100000 : "bootloader"
0x000000100000-0x000000500000 : "data"
0x000000500000-0x000001500000 : "backup-kernel"
0x000001500000-0x000007900000 : "backup-system"
0x000007900000-0x000008900000 : "kernel"
0x000008900000-0x000020000000 : "rootfs"
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci_marvell ehci_marvell.70059: Marvell Orion EHCI
ehci_marvell ehci_marvell.70059: new USB bus registered, assigned bus number 1
ehci_marvell ehci_marvell.70059: irq 19, io base 0xf1050100
ehci_marvell ehci_marvell.70059: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: Marvell Orion EHCI
usb usb1: Manufacturer: Linux 2.6.31.8 ehci_hcd
usb usb1: SerialNumber: ehci_marvell.70059
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
usbcore: registered new interface driver usblp
usbcore: registered new interface driver cdc_wdm
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver ums-alauda
usbcore: registered new interface driver ums-cypress
usbcore: registered new interface driver ums-datafab
usbcore: registered new interface driver ums-freecom
usbcore: registered new interface driver ums-isd200
usbcore: registered new interface driver ums-jumpshot
usbcore: registered new interface driver ums-karma
usbcore: registered new interface driver ums-onetouch
usbcore: registered new interface driver ums-sddr09
usbcore: registered new interface driver ums-sddr55
usbcore: registered new interface driver ums-usbat
i2c /dev entries driver
Orion Watchdog Timer: Initial timeout 21 sec
md: linear personality registered for level -1
md: raid0 personality registered for level 0
md: raid1 personality registered for level 1
md: raid10 personality registered for level 10
md: raid6 personality registered for level 6
md: raid5 personality registered for level 5
md: raid4 personality registered for level 4
cpuidle: using governor ladder
NET: Registered protocol family 17
lib80211: common routines for IEEE802.11 drivers
Marvell Kirkwood Power Management Initializing
rtc mv_rtc: setting system clock to 2033-10-19 23:42:44 UTC (2013378164)
md: Skipping autodetection of RAID arrays. (raid=autodetect will force)
VFS: Mounted root (jffs2 filesystem) on device 31:5.
Freeing init memory: 128K
mount etc as tmpfs
can't create lock file /etc/mtab~187: No such file or directory (use -n flag to override)
device-mapper: uevent: version 1.0.3
device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
dm_crypt using the OCF package.
Loading iSCSI transport class v2.0-870.
iscsi: registered transport (tcp)
usbcore: registered new interface driver r871x_usb_drv
NTFS driver 2.1.29 [Flags: R/W MODULE].
eth0: link up, full duplex, speed 100 Mbps
eth0: started
Password for 'root' changed
utelnetd starting
mdadm: cannot open device /dev/btns: Invalid argument
mdadm: /dev/btns has no superblock - assembly aborted
*****************************************************************************************************************
480
service avahi start
service cupsd start
service dbus start
service iscsi start
service lprng start
service nfs start
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
NET: Registered protocol family 10
svc: failed to register lockdv1 RPC service (errno 97).
NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
NFSD: starting 90-second grace period
service nginx start
service regcloud start
service samba start
service smbftpd start
service sshd start
service syslog start
service upnp start
service upnpportmap start
service utelnetd start
<30>udev[1235]: starting version 167
64

Processing /etc/profile... (nas)#Error resolving time.nist.gov: System error (-11)
19 Oct 23:43:48 ntpdate[1252]: Can't find host time.nist.gov: System error (-11)
19 Oct 23:43:48 ntpdate[1252]: no servers can be used, exiting
Re: TerraMaster F2NAS2 u-boot program
February 09, 2018 10:13AM
In the original uboot, there are two commands to program the boot nand.

nbubt -- this fetches a file (nboot.bin) w/ tftp, and then erases 0-4096, and programs that.
bubt -- this fetches a file w/ tftp (u-boot.bin), and then erases 0-655360 and programs that.

i'm not sure what to make of this, is the small one for some mfg process that auto programs the rest? is it a 2-stage boot?
Re: TerraMaster F2NAS2 u-boot program
February 09, 2018 10:53AM
after it programs the u-boot from u-boot (using the bubt). If i try to read the nand, it gives error:

Marvell>> nand read 0 0 0x10000

NAND read: device 0 offset 0x0, size 0x10000
 65536 bytes read: ERROR

leading me to believe its trying to do ecc on the u-boot block

whereas if i read from the uImage partition, it works:
 nand read 0 0x7900000 0x10000

NAND read: device 0 offset 0x7900000, size 0x10000
 65536 bytes read: OK

OK, so now if i load the image into memory w/ tftpboot and then program to flash w/ nand write:

Marvell>> tftpboot 0x2000000 uboot-nand.bin
Using egiga0 device
TFTP from server 10.18.13.102; our IP address is 10.18.13.254
Filename 'uboot-nand.bin'.
Load address: 0x2000000
Loading: #################################################################
	 ######################################
done
Bytes transferred = 524288 (80000 hex)
Marvell>> nand erase 0 0x80000

NAND erase: device 0 offset 0x0, size 0x80000
Erasing at 0x60000 -- 100% complete.
OK
Marvell>> nand write 0x2000000 0 0x80000

NAND write: device 0 offset 0x0, size 0x80000
 524288 bytes written: OK
Marvell>> nand read 0 0 0x80000

NAND read: device 0 offset 0x0, size 0x80000
 524288 bytes read: OK
Marvell>> cmp 0 0x2000000 0x80000
word at 0x00080000 (0xffffffff) != word at 0x02080000 (0xfffffeff)
Total of 131072 words were the same

ok, so now it is programmed in w/ ECC.

if i dump it w/ OOB:
Marvell>> nand dump 0
Page 00000000 dump:
	8b 00 00 08 98 3d 07 00  00 00 00 00 00 02 00 00
	00 00 60 00 00 00 67 00  00 00 00 00 00 00 01 39
	40 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	e0 00 d1 ff 9b 1b 1b 1b  00 14 d0 ff 3c 50 01 43
	04 14 d0 ff 00 30 84 ba  08 14 d0 ff 63 76 13 33
	0c 14 d0 ff 55 0c 00 16  10 14 d0 ff 00 00 00 04
	14 14 d0 ff 00 00 00 00  18 14 d0 ff 00 00 00 00
	1c 14 d0 ff 72 06 00 00  20 14 d0 ff 04 00 00 00
	24 14 d0 ff 4f 31 00 00  28 14 d0 ff 20 67 0d 00
	7c 14 d0 ff 71 b5 00 00  04 15 d0 ff f1 ff ff 1f
	08 15 d0 ff 00 00 00 20  0c 15 d0 ff f5 ff ff 1f
	14 15 d0 ff 00 00 00 00  1c 15 d0 ff 00 00 00 00
	94 14 d0 ff 00 00 12 00  98 14 d0 ff 00 00 00 00
	9c 14 d0 ff 03 e8 00 00  d0 15 d0 ff 30 06 00 00
	d4 15 d0 ff 46 00 00 00  d8 15 d0 ff 08 00 00 00
	dc 15 d0 ff 00 00 00 00  e0 15 d0 ff 23 00 00 00
	e4 15 d0 ff 18 3c 20 00  20 16 d0 ff 00 48 38 00
	80 14 d0 ff 01 00 00 00  34 01 d2 ff 66 66 66 66
	38 01 d2 ff 66 66 06 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 c2
	12 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5
	14 f0 9f e5 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5
	a0 01 60 00 00 02 60 00  60 02 60 00 c0 02 60 00
	20 03 60 00 80 03 60 00  e0 03 60 00 ef be ad de
	00 00 60 00 00 00 60 00  f0 ff 67 00 80 fd 6c 00
	00 00 0f e1 1f 00 c0 e3  d3 00 80 e3 00 f0 29 e1
	17 00 00 eb 6c 00 4f e2  30 10 1f e5 01 00 50 e1
	07 00 00 0a 38 20 1f e5  38 30 1f e5 02 20 43 e0
	02 20 80 e0 f8 07 b0 e8  f8 07 a1 e8 02 00 50 e1
	fb ff ff da 5c 00 1f e5  80 00 40 e2 10 d0 40 e2
	60 00 1f e5 60 10 1f e5  00 20 a0 e3 00 20 80 e5
	04 00 80 e2 01 00 50 e1  fb ff ff da 04 f0 1f e5
	d8 0e 62 00 10 0f 10 ee  20 02 a0 e1 6c 13 9f e5
	01 00 00 e0 68 13 9f e5  01 00 50 e1 03 00 00 0a
	00 00 a0 e3 17 0f 07 ee  17 0f 08 ee 02 00 00 ea
	00 00 a0 e3 15 0f 07 ee  16 0f 07 ee 10 0f 11 ee
	07 00 c0 e3 02 00 80 e3  01 0a 80 e3 10 0f 01 ee
	30 13 9f e5 00 60 91 e5  03 10 a0 e3 ff 60 06 e2
	06 00 51 e1 01 00 00 1a  00 00 a0 e3 10 0f 09 ee
	0e c0 a0 e1 c9 00 00 eb  0c e0 a0 e1 0e f0 a0 e1
	00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
	0f 10 2d e9 1c 20 1f e5  1c 30 1f e5 1c 00 1f e5
	1c 10 1f e5 02 c0 80 e1  5e cf 07 ee 03 c0 4c e0
	02 00 1c e1 fb ff ff 1a  5e cf 07 ee 01 00 50 e0
	f7 ff ff 5a 0f 10 bd e8  0e f0 a0 e1 01 00 2d e9
	00 00 a0 e3 15 0f 07 ee  01 00 bd e8 0e f0 a0 e1
	64 d1 1f e5 01 d6 4d e2  88 d0 4d e2 00 e0 8d e5
	00 e0 4f e1 04 e0 8d e5  13 d0 a0 e3 0d f0 69 e1
	88 d1 1f e5 0f e0 a0 e1  0e f0 b0 e1 48 d0 4d e2
	ff 1f 8d e8 98 21 1f e5  01 26 42 e2 88 20 42 e2
	0c 00 92 e8 48 00 8d e2  34 50 8d e2 0e 10 a0 e1
	0f 00 85 e8 0d 00 a0 e1  f0 82 00 eb 00 00 a0 e1
	c4 d1 1f e5 01 d6 4d e2  88 d0 4d e2 00 e0 8d e5
	00 e0 4f e1 04 e0 8d e5  13 d0 a0 e3 0d f0 69 e1
	e8 d1 1f e5 0f e0 a0 e1  0e f0 b0 e1 48 d0 4d e2
	ff 1f 8d e8 f8 21 1f e5  01 26 42 e2 88 20 42 e2
	0c 00 92 e8 48 00 8d e2  34 50 8d e2 0e 10 a0 e1
	0f 00 85 e8 0d 00 a0 e1  cf 82 00 eb 00 00 a0 e1
	24 d2 1f e5 01 d6 4d e2  88 d0 4d e2 00 e0 8d e5
	00 e0 4f e1 04 e0 8d e5  13 d0 a0 e3 0d f0 69 e1
	48 d2 1f e5 0f e0 a0 e1  0e f0 b0 e1 48 d0 4d e2
	ff 1f 8d e8 58 22 1f e5  01 26 42 e2 88 20 42 e2
	0c 00 92 e8 48 00 8d e2  34 50 8d e2 0e 10 a0 e1
	0f 00 85 e8 0d 00 a0 e1  ae 82 00 eb 00 00 a0 e1
	84 d2 1f e5 01 d6 4d e2  88 d0 4d e2 00 e0 8d e5
	00 e0 4f e1 04 e0 8d e5  13 d0 a0 e3 0d f0 69 e1
	a8 d2 1f e5 0f e0 a0 e1  0e f0 b0 e1 48 d0 4d e2
	ff 1f 8d e8 b8 22 1f e5  01 26 42 e2 88 20 42 e2
	0c 00 92 e8 48 00 8d e2  34 50 8d e2 0e 10 a0 e1
	0f 00 85 e8 0d 00 a0 e1  8d 82 00 eb 00 00 a0 e1
	e4 d2 1f e5 01 d6 4d e2  88 d0 4d e2 00 e0 8d e5
	00 e0 4f e1 04 e0 8d e5  13 d0 a0 e3 0d f0 69 e1
	08 d3 1f e5 0f e0 a0 e1  0e f0 b0 e1 48 d0 4d e2
	ff 1f 8d e8 18 23 1f e5  01 26 42 e2 88 20 42 e2
	0c 00 92 e8 48 00 8d e2  34 50 8d e2 0e 10 a0 e1
	0f 00 85 e8 0d 00 a0 e1  6c 82 00 eb 00 00 a0 e1
	44 d3 1f e5 01 d6 4d e2  88 d0 4d e2 00 e0 8d e5
	00 e0 4f e1 04 e0 8d e5  13 d0 a0 e3 0d f0 69 e1
	68 d3 1f e5 0f e0 a0 e1  0e f0 b0 e1 48 d0 4d e2
	ff 1f 8d e8 78 23 1f e5  01 26 42 e2 88 20 42 e2
	0c 00 92 e8 48 00 8d e2  34 50 8d e2 0e 10 a0 e1
	0f 00 85 e8 0d 00 a0 e1  42 82 00 eb 00 00 a0 e1
	a4 d3 1f e5 01 d6 4d e2  88 d0 4d e2 00 e0 8d e5
	00 e0 4f e1 04 e0 8d e5  13 d0 a0 e3 0d f0 69 e1
	c8 d3 1f e5 0f e0 a0 e1  0e f0 b0 e1 48 d0 4d e2
	ff 1f 8d e8 d8 23 1f e5  01 26 42 e2 88 20 42 e2
	0c 00 92 e8 48 00 8d e2  34 50 8d e2 0e 10 a0 e1
	0f 00 85 e8 0d 00 a0 e1  33 82 00 eb 00 00 a0 e1
	ff 0f 00 00 46 09 00 00  08 00 04 d0 00 00 a0 e1
	00 00 a0 e1 00 00 a0 e1  00 00 a0 e1 00 00 a0 e1
	f1 44 a0 e3 50 10 9f e5  00 40 81 e5 0e 20 a0 e1
	48 10 9f e5 00 40 91 e5  18 40 84 e3 3c 10 9f e5
	00 40 81 e5 34 10 9f e5  00 40 91 e5 00 00 a0 e3
	1b 0f 2f ee 0b 00 00 eb  24 10 9f e5 00 60 91 e5
	1f 60 c6 e3 14 60 86 e3  14 10 9f e5 00 60 81 e5
	ff ff ff ea 02 e0 a0 e1  0e f0 a0 e1 80 00 02 d0
	28 01 02 f1 04 06 01 f1  0e 90 a0 e1 00 00 a0 e3
	e0 12 9f e5 00 00 81 e5  08 00 00 eb 07 00 00 eb
	4b 60 a0 e3 d0 12 9f e5  00 60 81 e5 c4 60 a0 e3
	c8 12 9f e5 00 60 81 e5  00 00 00 eb 09 f0 a0 e1
	01 a6 a0 e3 01 a0 5a e2  fd ff ff 1a 0e f0 a0 e1
	0e 90 a0 e1 a4 12 9f e5  00 60 91 e5 20 60 86 e3
	98 12 9f e5 00 60 81 e5  05 a8 a0 e3 01 a0 5a e2
	03 00 00 0a 88 12 9f e5  00 60 91 e5 20 00 16 e3
	f9 ff ff 0a 05 a8 a0 e3  01 a0 5a e2 03 00 00 0a
	68 12 9f e5 00 60 91 e5  20 00 16 e3 f9 ff ff 1a
	05 a8 a0 e3 01 a0 5a e2  03 00 00 0a 48 12 9f e5
	00 60 91 e5 08 00 56 e3  f9 ff ff 1a 84 60 a0 e1
	40 12 9f e5 00 60 81 e5  dc ff ff eb 2c 12 9f e5
	00 60 91 e5 08 60 c6 e3  20 12 9f e5 00 60 81 e5
	d6 ff ff eb 18 12 9f e5  00 60 91 e5 20 00 16 e3
	fb ff ff 0a 05 a8 a0 e3  01 a0 5a e2 01 00 00 1a
	00 40 a0 e3 7a 00 00 ea  ec 11 9f e5 00 60 91 e5
	18 00 56 e3 f7 ff ff 1a  02 01 17 e3 02 00 00 1a
	e0 11 9f e5 00 70 81 e5  16 00 00 ea 27 a4 a0 e1
	ff a0 0a e2 cc 11 9f e5  00 a0 81 e5 bf ff ff eb
OOB:
	ff ff ff ff ff ff ff ff
	ff ff ff ff ff ff ff ff
	ff ff ff ff ff ff ff ff
	ff ff ff ff ff ff ff ff
	ff ff ff ff ff ff ff ff
	a5 56 67 0f 0c 33 03 33
	cf c3 cc ff 56 95 ab 95
	99 57 59 95 97 fc 03 03

but that doesn't boot either.

so, the built-in commands (bubt) to program the boot either don't use ECC, or use a different ECC (e.g. 4-bit).
the nand write does use ecc, but that doesn't boot.

The auto-recovery (e.g. corrupt the env, boot it from kwboot) programs in such a way that the nand read also gives this error.

There is an env variable, nandEcc=1bit. Lets try changing it:

setenv nandEcc=4bit

nogo either.

hmm.
Re: TerraMaster F2NAS2 u-boot program
February 09, 2018 02:46PM
Hmm, further...

if i let i program mtd0 using u-boot (nbubt command), and then do a nand read of that to ram, and boot there, it works.
e.g. the contents of that nand are readable by u-boot properly.

So it means that (?) the header doesn't match what the soc boot loader wants (?)

nand read 0x2000000 0 0x80000

NAND read: device 0 offset 0x0, size 0x80000
 524288 bytes read: ERROR
Marvell>> go 0x2000200
## Starting application at 0x02000200 ...

         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_ 
| | | |___|  _ \ / _ \ / _ \| __| 
| |_| |___| |_) | (_) | (_) | |_ 
 \___/    |____/ \___/ \___/ \__| 
 ** MARVELL BOARD: DB-88F6282A-BP LE 
 ...
Re: TerraMaster F2NAS2 u-boot program
February 09, 2018 04:03PM
donbowman,

> if i let i program mtd0 using u-boot (nbubt
> command), and then do a nand read of that to ram,
> and boot there, it works.
> e.g. the contents of that nand are readable by
> u-boot properly.
>
> So it means that (?) the header doesn't match what
> the soc boot loader wants (?)
>

Right! When you chainload it like this, it is similar to kwboot. The header does not come into play.

By the way this box is a close cousin of the NSA325 (Kirkwood). Stock OS uses nand_mtd driver. When you boot with the new kernel, this should be orion_nand.

Quote

Kernel command line: console=ttyS0,115200 mtdparts=nand_mtd:0x00100000@0x00000000(bootloader),0x00400000@0x00100000(data),0x01000000@0x00500000(backup-kernel),0x06400000@0x01500000(backup-system),0x01000000@0x07900000(kernel),0x17700000@0x08900000(rootfs); rootfstype=jffs2 root=/dev/mtdblock5 init=/linuxrc mem=1024m

Quote

6 cmdlinepart partitions found on MTD device nand_mtd
Using command line partition definition
Creating 6 MTD partitions on "nand_mtd":
0x000000000000-0x000000100000 : "bootloader"
0x000000100000-0x000000500000 : "data"
0x000000500000-0x000001500000 : "backup-kernel"
0x000001500000-0x000007900000 : "backup-system"
0x000007900000-0x000008900000 : "kernel"
0x000008900000-0x000020000000 : "rootfs"

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: TerraMaster F2NAS2 u-boot program
February 10, 2018 11:53AM
OK sleeves rolled up, i have created a board support in u-boot, compiled it, loaded it from kwboot, and programmed it to flash.
and it works.

I was able to program it w/ tftpload / nand write

will clean up the fixes and send a PR in github.

it is similar to the NAS325, but w/ a different Ethernet PHY and init registers / ram.
Re: TerraMaster F2NAS2 u-boot program
February 10, 2018 10:28PM
donbowman Wrote:
-------------------------------------------------------
> OK sleeves rolled up, i have created a board
> support in u-boot, compiled it, loaded it from
> kwboot, and programmed it to flash.
> and it works.
>
> I was able to program it w/ tftpload / nand write
>
> will clean up the fixes and send a PR in github.
>
> it is similar to the NAS325, but w/ a different
> Ethernet PHY and init registers / ram.

Cool :)

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: TerraMaster F2NAS2 u-boot program
February 12, 2018 10:36AM
So, almost success.
I have everything working, from u-boot through linux, ram is setup, usb works, ethernet works, etc.

But, this system has a sata expander (88SM4140). And i'm not seeing either it or the two disk slots. And this is the primary mission for a NAS :)

So I think i have some GPIO setup issues is my conclusion.
The board has no LED's that are sw controlled.
It does have an MCU for some purpose.
When i tap the power switch, linux doesn't hear about it, and 5s later the power is yanked. so that must be an input.

does anyone have any suggestions on how to find the GPIO setup? I have the original u-boot binary, i guess i could disassemble it, but i'm not overly keen on that since i'm not very familiar w/ arm arch (more mips for me).

and yes i've written to terramaster a couple of times asking for the GPL code, no answer.
Re: TerraMaster F2NAS2 u-boot program
February 12, 2018 12:37PM
I have access to a command 'ir' in the old u-boot. I'm not sure if it takes an absolute address (base+reg) or a register address, or what.

But, assuming its just the register address, this is what i get from the original u-boot.

## KW_REG_UNDOC_0x1470
Marvell>> ir 0x1470
Internal register 0x1470 value : 0x1d181e19

    31      24        16         8         0
     |       |         |         |         |
OLD: 0001-1101-0001-1000-0001-1110-0001-1001
NEW:
Marvell>> ## KW_REG_UNDOC_0x1478
Marvell>> ir 0x1478
Internal register 0x1478 value : 0x0

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-0000-0000-0000-0000-0000
NEW:
Marvell>> ## MVEBU_SDRAM_BASE
Marvell>> ir 0x1500
Internal register 0x1500 value : 0x0

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-0000-0000-0000-0000-0000
NEW:
Marvell>> ## KW_TWSI_BASE
Marvell>> ir 0x11000
Internal register 0x11000 value : 0x0

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-0000-0000-0000-0000-0000
NEW:
Marvell>> ## KW_UART0_BASE
Marvell>> ir 0x12000
Internal register 0x12000 value : 0xa0a0a0a

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-1010-0000-1010-0000-1010-0000-1010
NEW: ## KW_UART1_BASE


New value = 0x69696969

Marvell>> r 0x12100
Marvell>>
Marvell>> ## KW_MPP_BASE
Marvell>> ir 0x10000
Internal register 0x10000 value : 0x21111111

    31      24        16         8         0
     |       |         |         |         |
OLD: 0010-0001-0001-0001-0001-0001-0001-0001
NEW:
Marvell>> ## MVEBU_GPIO0_BASE
Marvell>> ir 0x10100
Internal register 0x10100 value : 0x0

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-0000-0000-0000-0000-0000
NEW:
Marvell>> ## MVEBU_GPIO1_BASE
Marvell>> ir 0x10140
Internal register 0x10140 value : 0x0

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-0000-0000-0000-0000-0000
NEW:
Marvell>> ## KW_RTC_BASE
Marvell>> ir 0x10300
Internal register 0x10300 value : 0x2183059

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0010-0001-1000-0011-0000-0101-1001
NEW:
Marvell>> ## KW_NANDF_BASE
Marvell>> ir 0x10418
Internal register 0x10418 value : 0xc0282

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-1100-0000-0010-1000-0010
NEW:
Marvell>> ## MVEBU_SPI_BASE
Marvell>> ir 0x10600
Internal register 0x10600 value : 0x2

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-0000-0000-0000-0000-0010
NEW:
Marvell>> ## KW_CPU_WIN_BASE
Marvell>> ir 0x20000
Internal register 0x20000 value : 0x7ffe841

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0111-1111-1111-1110-1000-0100-0001
NEW:
Marvell>> ## KW_CPU_REG_BASE
Marvell>> ir 0x20100
Internal register 0x20100 value : 0x130032

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0001-0011-0000-0000-0011-0010
NEW:
Marvell>> ## MVEBU_TIMER_BASE
Marvell>> ir 0x20300
Internal register 0x20300 value : 0x3

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-0000-0000-0000-0000-0011
NEW:
Marvell>> ## KW_REG_PCIE_BASE
Marvell>> ir 0x40000
Internal register 0x40000 value : 0x628211ab

    31      24        16         8         0
     |       |         |         |         |
OLD: 0110-0010-1000-0010-0001-0001-1010-1011
NEW:
Marvell>> ## KW_USB20_BASE
Marvell>> ir 0x50000
Internal register 0x50000 value : 0x40fa05

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0100-0000-1111-1010-0000-0101
NEW:
Marvell>> ## KW_EGIGA0_BASE
Marvell>> ir 0x72000
Internal register 0x72000 value : 0x0

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-0000-0000-0000-0000-0000
NEW:
Marvell>> ## KW_EGIGA1_BASE
Marvell>> ir 0x76000
Internal register 0x76000 value : 0x21

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-0000-0000-0000-0010-0001
NEW:
Marvell>> ## KW_SATA_BASE
Marvell>> ir 0x80000
Internal register 0x80000 value : 0x107ff

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-0001-0000-0111-1111-1111
NEW:
Marvell>> ## KW_SDIO_BASE
Marvell>> ir 0x90000
Internal register 0x90000 value : 0x0

    31      24        16         8         0
     |       |         |         |         |
OLD: 0000-0000-0000-0000-0000-0000-0000-0000
NEW:
Marvell>>

Re: TerraMaster F2NAS2 u-boot program
February 12, 2018 01:51PM
donbowman,

>
> So I think i have some GPIO setup issues is my
> conclusion.
> The board has no LED's that are sw controlled.
> It does have an MCU for some purpose.
> When i tap the power switch, linux doesn't hear
> about it, and 5s later the power is yanked. so
> that must be an input.
>
> does anyone have any suggestions on how to find
> the GPIO setup? I have the original u-boot binary,
> i guess i could disassemble it, but i'm not overly
> keen on that since i'm not very familiar w/ arm
> arch (more mips for me).
>
> and yes i've written to terramaster a couple of
> times asking for the GPL code, no answer.

Without the GPL, you would have to peek/poke until you find the correct one for something. These are values for the 2 bases.

KW_GPIO0_BASE = 0xF1010100
KW_GPIO1_BASE = 0xF1010140

-bodhi
===========================
Forum Wiki
bodhi's corner
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: