カテゴリー: LEDE / OpenWrt

WN-AX1167GR2 / WN-DX1167RがKernel 5.4でstuckする問題メモ

2020/04/29 追記: 既に修正済み (ramips: mt7621: backport more pcie driver fixes · openwrt/openwrt@51c6b14)

– pcie有効

PCIe周りでブートが止まる


===================================================================
                MT7621   stage1 code 10:33:11 (ASIC)
                CPU=50000000 HZ BUS=16666666 HZ
==================================================================
Change MPLL source from XTAL to CR...
do MEMPLL setting..
MEMPLL Config : 0x11100000
3PLL mode + External loopback
=== XTAL-40Mhz === DDR-1200Mhz ===
PLL3 FB_DL: 0x5, 1/0 = 557/467 15000000
PLL4 FB_DL: 0x8, 1/0 = 776/248 21000000
PLL2 FB_DL: 0x1b, 1/0 = 602/422 6D000000
do DDR setting..[00320381]
Apply DDR3 Setting...(use customer AC)
          0    8   16   24   32   40   48   56   64   72   80   88   96  104  112  120
      --------------------------------------------------------------------------------
0000:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0001:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0002:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0003:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0004:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0005:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0006:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0007:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0008:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0009:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000A:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000B:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000C:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000D:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000E:|    0    0    0    0    0    0    0    0    0    0    0    1    1    1    1    1
000F:|    0    0    0    0    0    0    1    1    1    1    1    1    1    1    1    1
0010:|    1    1    1    1    1    1    1    1    1    1    1    0    0    0    0    0
0011:|    1    1    1    1    1    0    0    0    0    0    0    0    0    0    0    0
0012:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0013:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0014:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0015:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0016:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0017:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0018:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0019:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001A:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001B:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001C:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001D:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001E:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001F:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
rank 0 coarse = 16
rank 0 fine = 40
B:|    0    0    0    0    0    0    0    1    1    1    0    0    0    0    0    0
opt_dle value:8
DRAMC_R0DELDLY[018]=00002122
==================================================================
                RX      DQS perbit delay software calibration 
==================================================================
1.0-15 bit dq delay value
==================================================================
bit|     0  1  2  3  4  5  6  7  8  9
--------------------------------------
0 |    9 8 9 9 6 7 8 6 7 6 
10 |    9 8 9 9 7 9 
--------------------------------------

==================================================================
2.dqs window
x=pass dqs delay value (min~max)center 
y=0-7bit DQ of every group
input delay:DQS0 =34 DQS1 = 33
==================================================================
bit     DQS0     bit      DQS1
0  (1~66)33  8  (1~63)32
1  (1~66)33  9  (1~64)32
2  (2~66)34  10  (1~65)33
3  (1~66)33  11  (1~61)31
4  (1~64)32  12  (1~62)31
5  (1~67)34  13  (1~63)32
6  (1~65)33  14  (1~65)33
7  (1~68)34  15  (1~64)32
==================================================================
3.dq delay value last
==================================================================
bit|    0  1  2  3  4  5  6  7  8   9
--------------------------------------
0 |    10 9 9 10 8 7 9 6 8 7 
10 |    9 10 11 10 7 10 
==================================================================
==================================================================
     TX  perbyte calibration 
==================================================================
DQS loop = 15, cmp_err_1 = ffff0000 
dqs_perbyte_dly.last_dqsdly_pass[0]=15,  finish count=1 
dqs_perbyte_dly.last_dqsdly_pass[1]=15,  finish count=2 
DQ loop=15, cmp_err_1 = ffff0082
dqs_perbyte_dly.last_dqdly_pass[1]=15,  finish count=1 
DQ loop=14, cmp_err_1 = ffff0000
dqs_perbyte_dly.last_dqdly_pass[0]=14,  finish count=2 
byte:0, (DQS,DQ)=(8,8)
byte:1, (DQS,DQ)=(8,8)
20,data:88
[EMI] DRAMC calibration passed

===================================================================
                MT7621   stage1 code done 
                CPU=50000000 HZ BUS=16666666 HZ
===================================================================


U-Boot 1.1.3 (Dec  9 2016 - 10:20:35)

Board: Ralink APSoC DRAM:  128 MB
relocate_code Pointer at: 87fac000

Config XHCI 40M PLL 
Allocate 16 byte aligned buffer: 87fdf010
Enable NFI Clock
# MTK NAND # : Use HW ECC
NAND ID [01 F1 80 1D 01]
Device found in MTK table, ID: 1f1, EXT_ID: 801d01
Support this Device in MTK table! 1f1 
select_chip
[NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
Signature matched and data read!
load_fact_bbt success 1023
load fact bbt success
[mtk_nand] probe successfully!
mtd->writesize=2048 mtd->oobsize=64,    mtd->erasesize=131072  devinfo.iowidth=8
....============================================ 
Ralink UBoot Version: 5.0.0.0
-------------------------------------------- 
ASIC MT7621A DualCore (MAC to MT7530 Mode)
DRAM_CONF_FROM: Auto-Detection 
DRAM_TYPE: DDR3 
DRAM bus: 16 bit
Xtal Mode=3 OCP Ratio=1/3
Flash component: NAND Flash
Date:Dec  9 2016  Time:10:20:35
============================================ 
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 880 MHZ #### 
 estimate memory size =128 Mbytes
#Reset_MT7530
set LAN/WAN WLLLL
.## Starting application at 0x81E00000 ...


Z-LOADER V1.24 | 12/09/2016 10:20:37


..Hit ESC key to stop autoboot: 1

Checking image 1...
   Image Name:   3.10(XBC.1)b10
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    7506867 Bytes =  7.2 MB
   Load Address: 80001000
   Entry Point:  80001000
...................................................................................................................   Verifying Combo Checksum ... ...................................................................................................................## Booting image at bc400000 ...
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80001000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

[    0.000000] Linux version 5.4.28 (musashino205@Taiha.Net) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r0+12840-8cc9839c92)) #0 SMP Sun Apr 5 06:16:37 2020
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is I-O DATA WN-AX1167GR2
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] percpu: Embedded 14 pages/cpu s26672 r8192 d22480 u57344
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Writing ErrCtl register=0000c001
[    0.000000] Readback ErrCtl register=0000c001
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 116048K/131072K available (5549K kernel code, 203K rwdata, 1208K rodata, 6276K init, 229K bss, 15024K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] NR_IRQS: 256
[    0.000000] random: get_random_bytes called from start_kernel+0x340/0x554 with crng_init=0
[    0.000000] CPU Clock: 880MHz
[    0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4343773742 ns
[    0.000009] sched_clock: 32 bits at 440MHz, resolution 2ns, wraps every 4880645118ns
[    0.015481] Calibrating delay loop... 583.68 BogoMIPS (lpj=1167360)
[    0.055821] pid_max: default: 32768 minimum: 301
[    0.065157] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.079561] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.097479] rcu: Hierarchical SRCU implementation.
[    0.107535] smp: Bringing up secondary CPUs ...
[    0.129503] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.129513] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.129525] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.129622] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.144677] Synchronize counters for CPU 1: done.
[    0.220318] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.220327] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.220334] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.220391] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.243144] Synchronize counters for CPU 2: done.
[    0.315731] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.315739] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.315747] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.315804] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.330748] Synchronize counters for CPU 3: done.
[    0.390348] smp: Brought up 1 node, 4 CPUs
[    0.402614] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.421919] futex hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.435859] pinctrl core: initialized pinctrl subsystem
[    0.447624] NET: Registered protocol family 16
[    0.486592] clocksource: Switched to clocksource GIC
[    0.496979] random: fast init done
[    0.497538] NET: Registered protocol family 2
[    0.513019] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.529544] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.544733] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.558748] TCP: Hash tables configured (established 1024 bind 1024)
[    0.571462] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.584347] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.598393] NET: Registered protocol family 1
[    0.606966] PCI: CLS 0 bytes, default 32
[    6.742558] 4 CPUs re-calibrate udelay(lpj = 1163264)
[    6.754161] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    6.778244] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    6.789727] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    6.811882] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    6.823219] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    6.834457] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    6.846298] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    6.860280] printk: console [ttyS0] disabled
[    6.868715] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 19, base_baud = 3125000) is a 16550A
[    6.886659] printk: console [ttyS0] enabled
[    6.886659] printk: console [ttyS0] enabled
[    6.903203] printk: bootconsole [early0] disabled
[    6.903203] printk: bootconsole [early0] disabled
[    6.924134] mt7621-nand 1e003000.nand: Using programmed access timing: 31c07388
[    6.938978] nand: device found, Manufacturer ID: 0x01, Chip ID: 0xf1
[    6.951627] nand: AMD/Spansion S34ML01G2
[    6.959432] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    6.974505] mt7621-nand 1e003000.nand: ECC strength adjusted to 4 bits
[    6.987534] mt7621-nand 1e003000.nand: Using programmed access timing: 21005134
[    7.002087] mt7621-nand 1e003000.nand: Using programmed access timing: 21005134
[    7.016642] Scanning device for bad blocks
[    9.001152] 11 fixed-partitions partitions found on MTD device mt7621-nand
[    9.014845] Creating 11 MTD partitions on "mt7621-nand":
[    9.025428] 0x000000000000-0x000000100000 : "u-boot"
[    9.036590] 0x000000100000-0x000000200000 : "u-boot-env"
[    9.048276] 0x000000200000-0x000000300000 : "factory"
[    9.059423] 0x000000300000-0x000000400000 : "SecondBoot"
[    9.071150] 0x000000400000-0x000000800000 : "kernel"
[    9.082131] 0x000000800000-0x000003600000 : "ubi"
[    9.092822] 0x000003600000-0x000003700000 : "Config"
[    9.103819] 0x000003700000-0x000006900000 : "firmware_2"
[    9.115780] 0x000006900000-0x000006a00000 : "Config_2"
[    9.127170] 0x000006a00000-0x000006b00000 : "persist"
[    9.138320] 0x000006b00000-0x000007f80000 : "Backup"
[    9.150162] libphy: Fixed MDIO Bus: probed
[    9.184958] libphy: mdio: probed
[    9.191648] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    9.205602] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 20
[    9.224369] mt7621-pci 1e140000.pcie: Parsing DT failed
[    9.237170] NET: Registered protocol family 10
[    9.247693] Segment Routing with IPv6
[    9.255116] NET: Registered protocol family 17
[    9.264287] 8021q: 802.1Q VLAN Support v1.8
[    9.274325] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[   10.075087] libphy: dsa slave smi: probed
[   10.094612] mt7530 mdio-bus:1f wan (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY]
[   10.122622] mt7530 mdio-bus:1f lan4 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY]
[   10.150618] mt7530 mdio-bus:1f lan3 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY]
[   10.178625] mt7530 mdio-bus:1f lan2 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY]
[   10.206624] mt7530 mdio-bus:1f lan1 (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY]
[   10.270566] mt7530 mdio-bus:1f: configuring for fixed/rgmii link mode
[   10.894561] mt7530 mdio-bus:1f: Link is Up - 1Gbps/Full - flow control off
[   10.978593] DSA: tree 0 setup
[   10.984829] rt2880-pinmux pinctrl: pcie is already enabled
[   10.995766] mt7621-pci 1e140000.pcie: Error applying setting, reverse things back
[   11.010801] mt7621-pci-phy 1e149000.pcie-phy: PHY for 0xbe149000 (dual port = 1)
[   11.025679] mt7621-pci-phy 1e14a000.pcie-phy: PHY for 0xbe14a000 (dual port = 0)
[   11.140078] mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz
[   11.151191] mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz
[   11.261887] mt7621-pci 1e140000.pcie: pcie0 no card, disable it (RST & CLK)

– pcie0のみ無効

ブートはするがMT7615Dが接続されるpcie1が検出されない

変更内容

$ git diff HEAD
diff --git a/target/linux/ramips/dts/mt7621_iodata_wn-ax1167gr2.dts b/target/linux/ramips/dts/mt7621_iodata_wn-ax1167gr2.dts
index 251caf4250..46973a5257 100644
--- a/target/linux/ramips/dts/mt7621_iodata_wn-ax1167gr2.dts
+++ b/target/linux/ramips/dts/mt7621_iodata_wn-ax1167gr2.dts
@@ -16,6 +16,10 @@
        };
 };

+&pcie0 {
+       status = "disabled";
+};
+
 &pcie1 {
        wifi@0,0 {
                compatible = "mediatek,mt76";
===================================================================
                MT7621   stage1 code 10:33:11 (ASIC)
                CPU=50000000 HZ BUS=16666666 HZ
==================================================================
Change MPLL source from XTAL to CR...
do MEMPLL setting..
MEMPLL Config : 0x11100000
3PLL mode + External loopback
=== XTAL-40Mhz === DDR-1200Mhz ===
PLL3 FB_DL: 0x5, 1/0 = 646/378 15000000
PLL4 FB_DL: 0x7, 1/0 = 556/468 1D000000
PLL2 FB_DL: 0x19, 1/0 = 598/426 65000000
do DDR setting..[00320381]
Apply DDR3 Setting...(use customer AC)
          0    8   16   24   32   40   48   56   64   72   80   88   96  104  112  120
      --------------------------------------------------------------------------------
0000:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0001:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0002:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0003:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0004:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0005:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0006:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0007:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0008:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0009:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000A:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000B:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000C:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000D:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000E:|    0    0    0    0    0    0    0    0    0    0    0    1    1    1    1    1
000F:|    0    0    0    0    0    0    1    1    1    1    1    1    1    1    1    1
0010:|    1    1    1    1    1    1    1    1    1    1    1    0    0    0    0    0
0011:|    1    1    1    1    1    0    0    0    0    0    0    0    0    0    0    0
0012:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0013:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0014:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0015:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0016:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0017:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0018:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0019:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001A:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001B:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001C:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001D:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001E:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001F:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
rank 0 coarse = 16
rank 0 fine = 40
B:|    0    0    0    0    0    0    0    0    1    1    1    0    0    0    0    0
opt_dle value:9
DRAMC_R0DELDLY[018]=00002121
==================================================================
                RX      DQS perbit delay software calibration 
==================================================================
1.0-15 bit dq delay value
==================================================================
bit|     0  1  2  3  4  5  6  7  8  9
--------------------------------------
0 |    9 8 9 10 6 7 8 6 7 6 
10 |    9 8 9 9 7 9 
--------------------------------------

==================================================================
2.dqs window
x=pass dqs delay value (min~max)center 
y=0-7bit DQ of every group
input delay:DQS0 =33 DQS1 = 33
==================================================================
bit     DQS0     bit      DQS1
0  (1~64)32  8  (1~63)32
1  (0~64)32  9  (1~61)31
2  (2~64)33  10  (1~63)32
3  (1~65)33  11  (1~62)31
4  (1~65)33  12  (1~64)32
5  (1~66)33  13  (1~63)32
6  (1~63)32  14  (1~64)32
7  (1~66)33  15  (1~65)33
==================================================================
3.dq delay value last
==================================================================
bit|    0  1  2  3  4  5  6  7  8   9
--------------------------------------
0 |    10 9 9 10 6 7 9 6 8 8 
10 |    10 10 10 10 8 9 
==================================================================
==================================================================
     TX  perbyte calibration 
==================================================================
DQS loop = 15, cmp_err_1 = ffff0000 
dqs_perbyte_dly.last_dqsdly_pass[0]=15,  finish count=1 
dqs_perbyte_dly.last_dqsdly_pass[1]=15,  finish count=2 
DQ loop=15, cmp_err_1 = ffff0082
dqs_perbyte_dly.last_dqdly_pass[1]=15,  finish count=1 
DQ loop=14, cmp_err_1 = ffff0000
dqs_perbyte_dly.last_dqdly_pass[0]=14,  finish count=2 
byte:0, (DQS,DQ)=(8,8)
byte:1, (DQS,DQ)=(8,8)
20,data:88
[EMI] DRAMC calibration passed

===================================================================
                MT7621   stage1 code done 
                CPU=50000000 HZ BUS=16666666 HZ
===================================================================


U-Boot 1.1.3 (Dec  9 2016 - 10:20:35)

Board: Ralink APSoC DRAM:  128 MB
relocate_code Pointer at: 87fac000

Config XHCI 40M PLL 
******************************
Software System Reset Occurred
******************************
Allocate 16 byte aligned buffer: 87fdf010
Enable NFI Clock
# MTK NAND # : Use HW ECC
NAND ID [01 F1 80 1D 01]
Device found in MTK table, ID: 1f1, EXT_ID: 801d01
Support this Device in MTK table! 1f1 
select_chip
[NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
Signature matched and data read!
load_fact_bbt success 1023
load fact bbt success
[mtk_nand] probe successfully!
mtd->writesize=2048 mtd->oobsize=64,    mtd->erasesize=131072  devinfo.iowidth=8
....============================================ 
Ralink UBoot Version: 5.0.0.0
-------------------------------------------- 
ASIC MT7621A DualCore (MAC to MT7530 Mode)
DRAM_CONF_FROM: Auto-Detection 
DRAM_TYPE: DDR3 
DRAM bus: 16 bit
Xtal Mode=3 OCP Ratio=1/3
Flash component: NAND Flash
Date:Dec  9 2016  Time:10:20:35
============================================ 
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 880 MHZ #### 
 estimate memory size =128 Mbytes
#Reset_MT7530
set LAN/WAN WLLLL
.## Starting application at 0x81E00000 ...


Z-LOADER V1.24 | 12/09/2016 10:20:37


..Hit ESC key to stop autoboot: 1

Checking image 1...
   Image Name:   3.10(XBC.1)b10
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    7506547 Bytes =  7.2 MB
   Load Address: 80001000
   Entry Point:  80001000
...................................................................................................................   Verifying Combo Checksum ... ...................................................................................................................## Booting image at bc400000 ...
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80001000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

[    0.000000] Linux version 5.4.28 (musashino205@Taiha.Net) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r0+12840-8cc9839c92)) #0 SMP Sun Apr 5 13:18:45 2020
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is I-O DATA WN-AX1167GR2
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] percpu: Embedded 14 pages/cpu s26672 r8192 d22480 u57344
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Writing ErrCtl register=0002e000
[    0.000000] Readback ErrCtl register=0002e000
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 116048K/131072K available (5549K kernel code, 203K rwdata, 1208K rodata, 6276K init, 229K bss, 15024K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] NR_IRQS: 256
[    0.000000] random: get_random_bytes called from start_kernel+0x340/0x554 with crng_init=0
[    0.000000] CPU Clock: 880MHz
[    0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4343773742 ns
[    0.000009] sched_clock: 32 bits at 440MHz, resolution 2ns, wraps every 4880645118ns
[    0.015486] Calibrating delay loop... 583.68 BogoMIPS (lpj=1167360)
[    0.055841] pid_max: default: 32768 minimum: 301
[    0.065183] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.079588] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.097639] rcu: Hierarchical SRCU implementation.
[    0.107728] smp: Bringing up secondary CPUs ...
[    0.118762] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.118773] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.118785] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.118886] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.144910] Synchronize counters for CPU 1: done.
[    0.209841] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.209849] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.209857] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.209914] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.243435] Synchronize counters for CPU 2: done.
[    0.305043] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.305051] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.305059] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.305117] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.331039] Synchronize counters for CPU 3: done.
[    0.390641] smp: Brought up 1 node, 4 CPUs
[    0.402933] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.422239] futex hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.436180] pinctrl core: initialized pinctrl subsystem
[    0.447958] NET: Registered protocol family 16
[    0.487568] clocksource: Switched to clocksource GIC
[    0.497634] random: fast init done
[    0.498712] NET: Registered protocol family 2
[    0.513656] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.530181] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.545380] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.559358] TCP: Hash tables configured (established 1024 bind 1024)
[    0.572101] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.584987] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.599035] NET: Registered protocol family 1
[    0.607618] PCI: CLS 0 bytes, default 32
[    6.747539] 4 CPUs re-calibrate udelay(lpj = 1163264)
[    6.759028] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    6.781619] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    6.793129] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    6.814739] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    6.826013] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    6.837241] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    6.848902] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    6.862660] printk: console [ttyS0] disabled
[    6.871121] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 19, base_baud = 3125000) is a 16550A
[    6.889052] printk: console [ttyS0] enabled
[    6.889052] printk: console [ttyS0] enabled
[    6.905592] printk: bootconsole [early0] disabled
[    6.905592] printk: bootconsole [early0] disabled
[    6.926326] mt7621-nand 1e003000.nand: Using programmed access timing: 31c07388
[    6.941183] nand: device found, Manufacturer ID: 0x01, Chip ID: 0xf1
[    6.953852] nand: AMD/Spansion S34ML01G2
[    6.961671] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    6.976759] mt7621-nand 1e003000.nand: ECC strength adjusted to 4 bits
[    6.989798] mt7621-nand 1e003000.nand: Using programmed access timing: 21005134
[    7.004368] mt7621-nand 1e003000.nand: Using programmed access timing: 21005134
[    7.018942] Scanning device for bad blocks
[    9.008487] 11 fixed-partitions partitions found on MTD device mt7621-nand
[    9.022185] Creating 11 MTD partitions on "mt7621-nand":
[    9.032781] 0x000000000000-0x000000100000 : "u-boot"
[    9.043919] 0x000000100000-0x000000200000 : "u-boot-env"
[    9.055667] 0x000000200000-0x000000300000 : "factory"
[    9.066775] 0x000000300000-0x000000400000 : "SecondBoot"
[    9.078505] 0x000000400000-0x000000800000 : "kernel"
[    9.089521] 0x000000800000-0x000003600000 : "ubi"
[    9.100301] 0x000003600000-0x000003700000 : "Config"
[    9.111266] 0x000003700000-0x000006900000 : "firmware_2"
[    9.123175] 0x000006900000-0x000006a00000 : "Config_2"
[    9.134502] 0x000006a00000-0x000006b00000 : "persist"
[    9.145663] 0x000006b00000-0x000007f80000 : "Backup"
[    9.157397] libphy: Fixed MDIO Bus: probed
[    9.189915] libphy: mdio: probed
[    9.196580] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    9.210415] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 20
[    9.229091] mt7621-pci 1e140000.pcie: Parsing DT failed
[    9.241689] NET: Registered protocol family 10
[    9.252234] Segment Routing with IPv6
[    9.259691] NET: Registered protocol family 17
[    9.268879] 8021q: 802.1Q VLAN Support v1.8
[    9.279010] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[   10.080064] libphy: dsa slave smi: probed
[   10.099609] mt7530 mdio-bus:1f wan (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY]
[   10.127608] mt7530 mdio-bus:1f lan4 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY]
[   10.155617] mt7530 mdio-bus:1f lan3 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY]
[   10.183613] mt7530 mdio-bus:1f lan2 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY]
[   10.211621] mt7530 mdio-bus:1f lan1 (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY]
[   10.275557] mt7530 mdio-bus:1f: configuring for fixed/rgmii link mode
[   10.899547] mt7530 mdio-bus:1f: Link is Up - 1Gbps/Full - flow control off
[   10.983577] DSA: tree 0 setup
[   10.989778] rt2880-pinmux pinctrl: pcie is already enabled
[   11.000733] mt7621-pci 1e140000.pcie: Error applying setting, reverse things back
[   11.015843] mt7621-pci-phy 1e14a000.pcie-phy: PHY for 0xbe14a000 (dual port = 0)
[   11.130454] mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz
[   11.241369] mt7621-pci 1e140000.pcie: pcie1 no card, disable it (RST & CLK)
[   11.255240] mt7621-pci 1e140000.pcie: pcie2 no card, disable it (RST & CLK)
[   11.269118] mt7621-pci 1e140000.pcie: Nothing is connected in virtual bridges. Exiting...
[   11.286603] UBI error: no valid UBI magic found inside mtd5
[   11.297775] hctosys: unable to open rtc device (rtc0)
[   11.330891] Freeing unused kernel memory: 6276K
[   11.339977] This architecture does not have kernel memory protection.
[   11.352808] Run /init as init process
[   11.400355] init: Console is alive
[   11.407378] init: - watchdog -
[   11.426047] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[   11.444855] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[   11.463875] init: - preinit -
[   11.590833] mtk_soc_eth 1e100000.ethernet eth0: configuring for fixed/rgmii link mode
[   11.606977] mtk_soc_eth 1e100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   11.623884] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   11.698943] random: jshn: uninitialized urandom read (4 bytes read)
[   11.757721] random: jshn: uninitialized urandom read (4 bytes read)
[   11.800132] random: jshn: uninitialized urandom read (4 bytes read)
[   12.011560] mt7530 mdio-bus:1f lan1: configuring for phy/gmii link mode
[   12.051710] 8021q: adding VLAN 0 to HW filter on device lan1
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[   16.274945] procd: - early -
[   16.280810] procd: - watchdog -
[   16.823707] procd: - watchdog -
[   16.830307] procd: - ubus -
[   16.841021] urandom_read: 5 callbacks suppressed
[   16.841032] random: ubusd: uninitialized urandom read (4 bytes read)
[   16.888103] random: ubusd: uninitialized urandom read (4 bytes read)
[   16.902047] procd: - init -
Please press Enter to activate this console.
[   17.196497] kmodloader: loading kernel modules from /etc/modules.d/*
[   17.215857] nat46: module (version 683fbd2b765506332a1af141545652bf58f03166) loaded.
[   17.244562] Loading modules backported from Linux version v5.4.27-0-g585e0cc08069
[   17.259588] Backport generated by backports.git v5.4.27-1-0-gf6e8852f
[   17.302039] xt_time: kernel timezone is -0000
[   17.377972] PPP generic driver version 2.4.2
[   17.387970] NET: Registered protocol family 24
[   17.388039] urngd: v1.0.2 started.
[   17.411303] kmodloader: done loading kernel modules from /etc/modules.d/*
[   17.539686] random: crng init done
[   88.076743] mtk_soc_eth 1e100000.ethernet eth0: Link is Down
[   88.096656] mtk_soc_eth 1e100000.ethernet eth0: configuring for fixed/rgmii link mode
[   88.112785] mtk_soc_eth 1e100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   88.183582] mt7530 mdio-bus:1f lan1: configuring for phy/gmii link mode
[   88.215799] 8021q: adding VLAN 0 to HW filter on device lan1
[   88.227356] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   88.240546] br-lan: port 1(lan1) entered blocking state
[   88.251045] br-lan: port 1(lan1) entered disabled state
[   88.283587] device lan1 entered promiscuous mode
[   88.292803] device eth0 entered promiscuous mode
[   88.427757] mt7530 mdio-bus:1f lan2: configuring for phy/gmii link mode
[   88.467956] 8021q: adding VLAN 0 to HW filter on device lan2
[   88.480017] br-lan: port 2(lan2) entered blocking state
[   88.490496] br-lan: port 2(lan2) entered disabled state
[   88.551599] device lan2 entered promiscuous mode
[   88.703562] mt7530 mdio-bus:1f lan3: configuring for phy/gmii link mode
[   88.743733] 8021q: adding VLAN 0 to HW filter on device lan3
[   88.755508] br-lan: port 3(lan3) entered blocking state
[   88.765992] br-lan: port 3(lan3) entered disabled state
[   88.859584] device lan3 entered promiscuous mode
[   88.995563] mt7530 mdio-bus:1f lan4: configuring for phy/gmii link mode
[   89.035742] 8021q: adding VLAN 0 to HW filter on device lan4
[   89.047604] br-lan: port 4(lan4) entered blocking state
[   89.058037] br-lan: port 4(lan4) entered disabled state
[   89.175585] device lan4 entered promiscuous mode
[   89.323563] mt7530 mdio-bus:1f wan: configuring for phy/gmii link mode
[   89.363828] 8021q: adding VLAN 0 to HW filter on device wan
[   92.839574] mt7530 mdio-bus:1f lan2: Link is Up - 1Gbps/Full - flow control rx/tx
[   92.854552] br-lan: port 2(lan2) entered blocking state
[   92.865037] br-lan: port 2(lan2) entered forwarding state
[   92.923595] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready

– Kernel 4.14 (3ec70052c5d82ffbc8d13e597f2833a1c30bec54) にrevert

問題無し

===================================================================
                MT7621   stage1 code 10:33:11 (ASIC)
                CPU=50000000 HZ BUS=16666666 HZ
==================================================================
Change MPLL source from XTAL to CR...
do MEMPLL setting..
MEMPLL Config : 0x11100000
3PLL mode + External loopback
=== XTAL-40Mhz === DDR-1200Mhz ===
PLL3 FB_DL: 0x5, 1/0 = 656/368 15000000
PLL4 FB_DL: 0x7, 1/0 = 544/480 1D000000
PLL2 FB_DL: 0x1a, 1/0 = 720/304 69000000
do DDR setting..[00320381]
Apply DDR3 Setting...(use customer AC)
          0    8   16   24   32   40   48   56   64   72   80   88   96  104  112  120
      --------------------------------------------------------------------------------
0000:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0001:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0002:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0003:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0004:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0005:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0006:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0007:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0008:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0009:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000A:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000B:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000C:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000D:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000E:|    0    0    0    0    0    0    0    0    0    0    0    1    1    1    1    1
000F:|    0    0    0    0    0    0    1    1    1    1    1    1    1    1    1    1
0010:|    1    1    1    1    1    1    1    1    1    1    1    0    0    0    0    0
0011:|    1    1    1    1    1    0    0    0    0    0    0    0    0    0    0    0
0012:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0013:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0014:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0015:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0016:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0017:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0018:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0019:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001A:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001B:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001C:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001D:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001E:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001F:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
rank 0 coarse = 16
rank 0 fine = 40
B:|    0    0    0    0    0    0    0    0    1    1    1    0    0    0    0    0
opt_dle value:9
DRAMC_R0DELDLY[018]=00002021
==================================================================
                RX      DQS perbit delay software calibration 
==================================================================
1.0-15 bit dq delay value
==================================================================
bit|     0  1  2  3  4  5  6  7  8  9
--------------------------------------
0 |    10 9 9 10 6 7 8 6 7 6 
10 |    9 8 9 10 7 9 
--------------------------------------

==================================================================
2.dqs window
x=pass dqs delay value (min~max)center 
y=0-7bit DQ of every group
input delay:DQS0 =33 DQS1 = 32
==================================================================
bit     DQS0     bit      DQS1
0  (1~66)33  8  (1~61)31
1  (1~66)33  9  (1~61)31
2  (2~62)32  10  (1~62)31
3  (1~66)33  11  (1~61)31
4  (1~65)33  12  (1~64)32
5  (1~66)33  13  (1~63)32
6  (1~64)32  14  (1~63)32
7  (1~66)33  15  (1~64)32
==================================================================
3.dq delay value last
==================================================================
bit|    0  1  2  3  4  5  6  7  8   9
--------------------------------------
0 |    10 9 10 10 6 7 9 6 8 7 
10 |    10 9 9 10 7 9 
==================================================================
==================================================================
     TX  perbyte calibration 
==================================================================
DQS loop = 15, cmp_err_1 = ffff0000 
dqs_perbyte_dly.last_dqsdly_pass[0]=15,  finish count=1 
dqs_perbyte_dly.last_dqsdly_pass[1]=15,  finish count=2 
DQ loop=15, cmp_err_1 = ffff0082
dqs_perbyte_dly.last_dqdly_pass[1]=15,  finish count=1 
DQ loop=14, cmp_err_1 = ffff0000
dqs_perbyte_dly.last_dqdly_pass[0]=14,  finish count=2 
byte:0, (DQS,DQ)=(8,8)
byte:1, (DQS,DQ)=(8,8)
20,data:88
[EMI] DRAMC calibration passed

===================================================================
                MT7621   stage1 code done 
                CPU=50000000 HZ BUS=16666666 HZ
===================================================================


U-Boot 1.1.3 (Dec  9 2016 - 10:20:35)

Board: Ralink APSoC DRAM:  128 MB
relocate_code Pointer at: 87fac000

Config XHCI 40M PLL 
******************************
Software System Reset Occurred
******************************
Allocate 16 byte aligned buffer: 87fdf010
Enable NFI Clock
# MTK NAND # : Use HW ECC
NAND ID [01 F1 80 1D 01]
Device found in MTK table, ID: 1f1, EXT_ID: 801d01
Support this Device in MTK table! 1f1 
select_chip
[NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
Signature matched and data read!
load_fact_bbt success 1023
load fact bbt success
[mtk_nand] probe successfully!
mtd->writesize=2048 mtd->oobsize=64,    mtd->erasesize=131072  devinfo.iowidth=8
....============================================ 
Ralink UBoot Version: 5.0.0.0
-------------------------------------------- 
ASIC MT7621A DualCore (MAC to MT7530 Mode)
DRAM_CONF_FROM: Auto-Detection 
DRAM_TYPE: DDR3 
DRAM bus: 16 bit
Xtal Mode=3 OCP Ratio=1/3
Flash component: NAND Flash
Date:Dec  9 2016  Time:10:20:35
============================================ 
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 880 MHZ #### 
 estimate memory size =128 Mbytes
#Reset_MT7530
set LAN/WAN WLLLL
.## Starting application at 0x81E00000 ...


Z-LOADER V1.24 | 12/09/2016 10:20:37


..Hit ESC key to stop autoboot: 1

Checking image 1...
   Image Name:   3.10(XBC.1)b10
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    7188163 Bytes =  6.9 MB
   Load Address: 80001000
   Entry Point:  80001000
..............................................................................................................   Verifying Combo Checksum ... ..............................................................................................................## Booting image at bc400000 ...
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80001000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

[    0.000000] Linux version 4.14.172 (musashino205@Taiha.Net) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r0+12840-8cc9839c92)) #0 SMP Fri Apr 3 13:33:27 2020
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is I-O DATA WN-AX1167GR2
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] random: get_random_bytes called from start_kernel+0x9c/0x4d8 with crng_init=0
[    0.000000] percpu: Embedded 14 pages/cpu s26064 r8192 d23088 u57344
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=00032000
[    0.000000] Readback ErrCtl register=00032000
[    0.000000] Memory: 116880K/131072K available (4802K kernel code, 249K rwdata, 1052K rodata, 6236K init, 253K bss, 14192K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 256
[    0.000000] CPU Clock: 880MHz
[    0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4343773742 ns
[    0.000009] sched_clock: 32 bits at 440MHz, resolution 2ns, wraps every 4880645118ns
[    0.015496] Calibrating delay loop... 586.13 BogoMIPS (lpj=2930688)
[    0.087829] pid_max: default: 32768 minimum: 301
[    0.097185] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.110208] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.126278] Hierarchical SRCU implementation.
[    0.135788] smp: Bringing up secondary CPUs ...
[    0.157722] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.157730] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.157741] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.157875] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.205124] Synchronize counters for CPU 1: done.
[    0.281466] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.281475] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.281482] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.281555] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.326039] Synchronize counters for CPU 2: done.
[    0.398585] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.398594] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.398604] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.398677] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.445605] Synchronize counters for CPU 3: done.
[    0.505202] smp: Brought up 1 node, 4 CPUs
[    0.517391] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.536871] futex hash table entries: 1024 (order: 3, 32768 bytes)
[    0.549407] pinctrl core: initialized pinctrl subsystem
[    0.561084] NET: Registered protocol family 16
[    0.579260] pull PCIe RST: RALINK_RSTCTRL = 0
[    0.888232] release PCIe RST: RALINK_RSTCTRL = 7000000
[    0.898296] ***** Xtal 40MHz *****
[    0.905030] release PCIe RST: RALINK_RSTCTRL = 7000000
[    0.915236] Port 0 N_FTS = 1b102800
[    0.922135] Port 1 N_FTS = 1b102800
[    0.929060] Port 2 N_FTS = 1b102800
[    2.087472] PCIE0 no card, disable it(RST&CLK)
[    2.096162] PCIE2 no card, disable it(RST&CLK)
[    2.104963]  -> 20107f2
[    2.109813] PCIE1 enabled
[    2.114992] PCI host bridge /pcie@1e140000 ranges:
[    2.124519]  MEM 0x0000000060000000..0x000000006fffffff
[    2.134873]   IO 0x000000001e160000..0x000000001e16ffff
[    2.145243] PCI coherence region base: 0xbfbf8000, mask/settings: 0x60000000
[    2.168504] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    2.179800] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    2.191063] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    2.203751] PCI host bridge to bus 0000:00
[    2.211762] pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff]
[    2.225441] pci_bus 0000:00: root bus resource [io  0xffffffff]
[    2.237170] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    2.250658] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    2.266803] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    2.283185] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[    2.296226] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[    2.310040] pci 0000:00:00.0: BAR 8: assigned [mem 0x60000000-0x600fffff]
[    2.323508] pci 0000:00:00.0: BAR 1: assigned [mem 0x60100000-0x6010ffff]
[    2.337000] pci 0000:01:00.0: BAR 0: assigned [mem 0x60000000-0x600fffff 64bit]
[    2.351512] pci 0000:00:00.0: PCI bridge to [bus 01]
[    2.361328] pci 0000:00:00.0:   bridge window [mem 0x60000000-0x600fffff]
[    2.376185] clocksource: Switched to clocksource GIC
[    2.387830] NET: Registered protocol family 2
[    2.397072] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    2.410809] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[    2.423420] TCP: Hash tables configured (established 1024 bind 1024)
[    2.436185] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    2.447688] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    2.460349] NET: Registered protocol family 1
[    8.716166] 4 CPUs re-calibrate udelay(lpj = 2924544)
[    8.727689] Crashlog allocated RAM at address 0x3f00000
[    8.738333] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    8.759745] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    8.771252] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    8.794390] io scheduler noop registered
[    8.802068] io scheduler deadline registered (default)
[    8.812321] random: fast init done
[    8.819937] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    8.833897] console [ttyS0] disabled
[    8.840943] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 19, base_baud = 3125000) is a 16550A
[    8.858884] console [ttyS0] enabled
[    8.858884] console [ttyS0] enabled
[    8.872675] bootconsole [early0] disabled
[    8.872675] bootconsole [early0] disabled
[    8.890644] MediaTek Nand driver init, version v2.1 Fix AHB virt2phys error
[    8.904681] Enable NFI Clock
[    8.910425] # MTK NAND # : Use HW ECC
[    8.917740] Device found in MTK table, ID: 1f1, EXT_ID: 801d01
[    8.929353] Support this Device in MTK table! 1f1 
[    8.939082] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[    8.951951] nand: device found, Manufacturer ID: 0x01, Chip ID: 0xf1
[    8.964603] nand: AMD/Spansion NAND 128MiB 3,3V 8-bit
[    8.974662] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    8.989752] Scanning device for bad blocks
[    9.283424] 11 fixed-partitions partitions found on MTD device MT7621-NAND
[    9.297131] Creating 11 MTD partitions on "MT7621-NAND":
[    9.307724] 0x000000000000-0x000000100000 : "u-boot"
[    9.318610] 0x000000100000-0x000000200000 : "u-boot-env"
[    9.330148] 0x000000200000-0x000000300000 : "factory"
[    9.341189] 0x000000300000-0x000000400000 : "SecondBoot"
[    9.352714] 0x000000400000-0x000000800000 : "kernel"
[    9.363563] 0x000000800000-0x000003600000 : "ubi"
[    9.374267] 0x000003600000-0x000003700000 : "Config"
[    9.385092] 0x000003700000-0x000006900000 : "firmware_2"
[    9.397052] 0x000006900000-0x000006a00000 : "Config_2"
[    9.408243] 0x000006a00000-0x000006b00000 : "persist"
[    9.419251] 0x000006b00000-0x000007f80000 : "Backup"
[    9.430260] [mtk_nand] probe successfully!
[    9.439168] Signature matched and data read!
[    9.447676] load_fact_bbt success 1023
[    9.455907] libphy: Fixed MDIO Bus: probed
[    9.528741] libphy: mdio: probed
[   10.949400] mtk_soc_eth 1e100000.ethernet: loaded mt7530 driver
[   10.961905] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 20
[   10.981063] NET: Registered protocol family 10
[   10.991491] Segment Routing with IPv6
[   10.998951] NET: Registered protocol family 17
[   11.007883] 8021q: 802.1Q VLAN Support v1.8
[   11.019156] UBI error: no valid UBI magic found inside mtd5
[   11.030356] hctosys: unable to open rtc device (rtc0)
[   11.063299] Freeing unused kernel memory: 6236K
[   11.072369] This architecture does not have kernel memory protection.
[   11.097930] init: Console is alive
[   11.104907] init: - watchdog -
[   11.124467] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[   11.142830] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[   11.166491] init: - preinit -
[   11.333924] mtk_soc_eth 1e100000.ethernet: PPE started
[   11.357189] random: procd: uninitialized urandom read (4 bytes read)
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[   12.822180] mtk_soc_eth 1e100000.ethernet eth0: port 3 link up
[   15.481869] mtk_soc_eth 1e100000.ethernet: 0x100 = 0x6060000c, 0x10c = 0x80818
[   15.503780] procd: - early -
[   15.509691] procd: - watchdog -
[   16.136308] procd: - watchdog -
[   16.142906] procd: - ubus -
[   16.153579] random: ubusd: uninitialized urandom read (4 bytes read)
[   16.206775] random: ubusd: uninitialized urandom read (4 bytes read)
[   16.219830] random: ubusd: uninitialized urandom read (4 bytes read)
[   16.233393] procd: - init -
Please press Enter to activate this console.
[   16.513934] kmodloader: loading kernel modules from /etc/modules.d/*
[   16.533085] nat46: module (version 683fbd2b765506332a1af141545652bf58f03166) loaded.
[   16.554273] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   16.575636] Loading modules backported from Linux version v5.4.27-0-g585e0cc08069
[   16.590595] Backport generated by backports.git v5.4.27-1-0-gf6e8852f
[   16.606094] ip_tables: (C) 2000-2006 Netfilter Core Team
[   16.628009] nf_conntrack version 0.5.0 (2048 buckets, 8192 max)
[   16.674856] Netfilter messages via NETLINK v0.30.
[   16.700676] xt_time: kernel timezone is -0000
[   16.738196] urngd: v1.0.2 started.
[   16.755753] bus=0x1, slot = 0x0, irq=0x0
[   16.763675] PCI: Enabling device 0000:00:00.0 (0004 -> 0006)
[   16.776569] mt7615e 0000:01:00.0: Invalid MAC address, using random address 8e:f7:91:ec:48:8a
[   16.805917] ctnetlink v0.93: registering with nfnetlink.
[   16.816694] mt7615e 0000:01:00.0: HW/SW Version: 0x8a108a10, Build Time: 20180518100604a
[   16.816694] 
[   16.819496] PPP generic driver version 2.4.2
[   16.846223] NET: Registered protocol family 24
[   16.853082] mt7615e 0000:01:00.0: N9 Firmware Version: 2.0, Build Time: 20200131181812
[   16.858395] kmodloader: done loading kernel modules from /etc/modules.d/*
[   16.882143] mt7615e 0000:01:00.0: CR4 Firmware Version: _reserved_, Build Time: 20190121161307
[   16.924946] random: crng init done
[   16.931853] random: 6 urandom warning(s) missed due to ratelimiting
[   33.423647] mtk_soc_eth 1e100000.ethernet: PPE started
[   33.440455] br-lan: port 1(eth0.1) entered blocking state
[   33.451322] br-lan: port 1(eth0.1) entered disabled state
[   33.462795] device eth0.1 entered promiscuous mode
[   33.472391] device eth0 entered promiscuous mode
[   33.485267] br-lan: port 1(eth0.1) entered blocking state
[   33.496106] br-lan: port 1(eth0.1) entered forwarding state
[   33.507612] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   34.496820] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready

WSR-2533DHP2 進捗報告

長らくRTL8367Sがどうにもできずに放置に近い状態になってしまっていたが、TL-R600VPN v4でRTL8367Sに再会したのをきっかけに作業を行い、だいぶ進捗を出せたので記録として。

WSR-2533DHP2仕様

  • SoC: MediaTek MT7622B
    • ARM Cortex-A53 (aarch64)
    • 1.35GHz, 2C2T
  • RAM: DDR3 256MiB
  • Flash: NAND 128MiB
  • Ethernet: 10/100/1000
    • Realtek RTL8367S
  • WLAN: 2.4/5GHz 4T4R
    • 2.4GHz: SoC (MT7622B)
    • 5GHz: MT7615

OpenWrtと絡めた雑感

targetが成熟途中
MT7622はmediatek targetの “mt7622” subtargetに属するが、mediatek target全体としてまだramipsやar71xx/ath79のような程度の成熟度合いには遠い印象。ウォッチしていると、既存デバイスのDTSの内容がコロコロ変わる。
イーサネットスイッチのノードでcompatibleの関連付けが全く違うものに変更されたときは愕然とした。(たぶん計画段階とは違うものをボードの正式版で載せた為だろう)
RTL8367Sスイッチのサポートが無くて厳しい
WSR-2533DHP2は上記仕様のとおりRTL8367Sスイッチを搭載する。このスイッチはSoCなどコントローラとの接続において、RGMIIやSGMIIのほか、2.5Gbpsでの通信が可能なHSGMIIに対応する。OpenWrtでは、このスイッチをサポートするドライバが記事を書いた時点で存在していない。
サポートを追加するpatchは投げられているが、reviewに対してauthorの反応が無く、マージされるか非常に怪しい。(また、そのpatchではRGMIIのサポートしか追加されていないためWSR-2533DHP2では不足)
RTL8367Sスイッチを搭載するデバイスが他になくて色々厳しい
正確には、WSR-2533DHP2のサポート作業を始めた当初は同じと思われるノードが記述されていたが、後になってMediaTek MT753xに変更された。現状他にRTL8367S系のスイッチを搭載するボードはOpenWrt内に存在せず、ネットワーク周りの構成が参考にできない。

サポート作業進捗状況

項目 状態 備考
Kernelバージョン 5.4 4.19では、MT7622のイーサネット周辺の実装に問題があるようで、大量のbackportが必要となりconflictを起こしやすいため。Kernel 5.4では修正済みの模様であることから、そちらのみを使用。作業開始当初は4.14だったことを考えると、遠くまで来たものだ。
initramfsでのブート OK
NAND Flashの認識 OK Kernel 5.4ではraw NANDのサポートの有効化に必要なconfigが変更されており、なかなかNAND Flashの認識を有効化できず手間取った。
MT7622 GMACの認識/動作 OK 上記の通り、修正が行われた状態のため見た範囲では動作に問題無し。2.5GbpsのHSGMIIでもしっかり動作。
RTL8367S
  • 認識: OK
  • HSGMII: OK
  • VLAN: OK
TP-Link TL-R600VPN v4を最近購入し、それのGPLソースコードを基にOpenWrtに既存のRTL8367Bドライバ (RTL8367RB, RTL8367R-VB) へRTL8367Sのサポートを追加した。ベースとしては、前述の既に投げられているRGMIIのみのpatchと、以前やり取りして行われたhauke氏による追加の改変を利用した。
sysupgradeでのブート WIP

当初KernelのみTRXに押し込みRootFSはUBIで持たせることを考えたが、Kernelをブートできずエラーも無しに止まってしまうためTRXにすべて押し込むことでブートはできるようになった。
ただし、Flashからブートした場合RTL8367Sのprobeに失敗する。RESET線か電源線の問題と予想。
SoC内蔵無線機能の認識 保留 いずれやる必要はあるが、優先度は低く、他に重要な問題が上記の通り在るので後回し。

以上。引き続き頑張る。

余談: NATをLAN -> WANで計測したところ、Netfilter Flow Offloadingの有無にかかわらず750Mbps超出ていた。その状態でもCPUのidleは平均63%ほどだった。(Flow Offloadingが機能していないような気もする?)

WHR-300HP2でI2Cを使ったメモ

最近急に思い立ち、I2Cを用いてLED等を制御してみたくなった。
その際、I2Cをどうやって使うか、という点で、WHR-300HP2を利用してみたメモ。

WHR-300HP2

基板のフロント寄りAOSSボタン付近にJTAG用らしきピンが並んでいる(2行7列)ため、ここに2.54mmピッチのピンヘッダを足を外側に曲げたうえでハンダ付け。
IMG_20171224_140819.jpg

IMG_20171226_163853.jpg

基板表面をフロントLEDが右、RJ-45ポートを左、UARTを上として見た場合
(I2Cに必要なピン数のみ調べた)

GND GND 3.3V
GPIO
#41
GPIO
#40

3.3VはUARTの3.3Vと同回路。

#40, #41 の各ピンは JTAG or EPHY LED or GPIO でMUXできるピンであり、OpenWrtではデフォルトでEPHY LEDとして構成されているため、WHR-300HP2のDTSを書き換えてGPIOに向ける。

diff --git a/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts b/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts
index 8bdf87501e..ef1f5af6a4 100644
--- a/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts
+++ b/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts
@@ -133,15 +133,15 @@
 &pinctrl {
        state_default: pinctrl0 {
                gpio {
-                       ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd";
+                       ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd", "ephy";
                        ralink,function = "gpio";
                };
        };
 };

 ðernet {
-       pinctrl-names = "default";
-       pinctrl-0 = <&ephy_pins>;
+/*     pinctrl-names = "default";
+       pinctrl-0 = <&ephy_pins>;*/
        mtd-mac-address = <&factory 0x4>;
        mediatek,portmap = "llllw";
 };

書き換えたDTSを用いてビルドし実機へインストール。
ビルド時に使用したconfigは以下の通り。I2C関連のドライバとツールを含める。無線は要らないから大体落とした。

CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7620=y
CONFIG_TARGET_ramips_mt7620_DEVICE_buffalo_whr-300hp2=y
# CONFIG_DRIVER_11N_SUPPORT is not set
# CONFIG_DRIVER_11W_SUPPORT is not set
CONFIG_KERNEL_BUILD_DOMAIN="Taiha.Net"
CONFIG_KERNEL_BUILD_USER="musashino205"
CONFIG_LIBCURL_COOKIES=y
CONFIG_LIBCURL_FILE=y
CONFIG_LIBCURL_FTP=y
CONFIG_LIBCURL_HTTP=y
CONFIG_LIBCURL_MBEDTLS=y
CONFIG_LIBCURL_NO_SMB="!"
CONFIG_LIBCURL_PROXY=y
CONFIG_LUCI_LANG_ja=y
CONFIG_OPENSSL_ENGINE=y
CONFIG_OPENSSL_PREFER_CHACHA_OVER_GCM=y
CONFIG_OPENSSL_WITH_ASM=y
CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y
CONFIG_OPENSSL_WITH_CMS=y
CONFIG_OPENSSL_WITH_DEPRECATED=y
CONFIG_OPENSSL_WITH_ERROR_MESSAGES=y
CONFIG_OPENSSL_WITH_PSK=y
CONFIG_OPENSSL_WITH_SRP=y
CONFIG_OPENSSL_WITH_TLS13=y
CONFIG_PACKAGE_ca-bundle=y
CONFIG_PACKAGE_ca-certificates=y
CONFIG_PACKAGE_cgi-io=y
CONFIG_PACKAGE_curl=y
# CONFIG_PACKAGE_hostapd-common is not set
CONFIG_PACKAGE_i2c-tools=y
# CONFIG_PACKAGE_iw is not set
# CONFIG_PACKAGE_iwinfo is not set
# CONFIG_PACKAGE_iw is not set                                                                                                                                                                                                                                        [0/21126]
# CONFIG_PACKAGE_iwinfo is not set
# CONFIG_PACKAGE_kmod-cfg80211 is not set
CONFIG_PACKAGE_kmod-i2c-algo-bit=y
CONFIG_PACKAGE_kmod-i2c-core=y
CONFIG_PACKAGE_kmod-i2c-gpio=y
CONFIG_PACKAGE_kmod-i2c-gpio-custom=y
CONFIG_PACKAGE_kmod-ledtrig-heartbeat=y
CONFIG_PACKAGE_kmod-ledtrig-timer=y
# CONFIG_PACKAGE_kmod-mac80211 is not set
# CONFIG_PACKAGE_kmod-rt2800-soc is not set
# CONFIG_PACKAGE_kmod-rt2x00-lib is not set
CONFIG_PACKAGE_libcurl=y
CONFIG_PACKAGE_libi2c=y
CONFIG_PACKAGE_libiwinfo-lua=y
CONFIG_PACKAGE_liblua=y
CONFIG_PACKAGE_liblucihttp=y
CONFIG_PACKAGE_liblucihttp-lua=y
CONFIG_PACKAGE_libmbedtls=y
CONFIG_PACKAGE_libopenssl=y
CONFIG_PACKAGE_libpcre=y
CONFIG_PACKAGE_librt=y
CONFIG_PACKAGE_libubus-lua=y
CONFIG_PACKAGE_lua=y
CONFIG_PACKAGE_luci=y
CONFIG_PACKAGE_luci-app-commands=y
CONFIG_PACKAGE_luci-app-firewall=y
CONFIG_PACKAGE_luci-app-opkg=y
CONFIG_PACKAGE_luci-base=y
CONFIG_PACKAGE_luci-compat=y
CONFIG_PACKAGE_luci-i18n-base-ja=y
CONFIG_PACKAGE_luci-i18n-commands-ja=y
CONFIG_PACKAGE_luci-i18n-firewall-ja=y
CONFIG_PACKAGE_luci-i18n-opkg-ja=y
CONFIG_PACKAGE_luci-lib-ip=y
CONFIG_PACKAGE_luci-lib-jsonc=y
CONFIG_PACKAGE_luci-lib-nixio=y
CONFIG_PACKAGE_luci-mod-admin-full=y
CONFIG_PACKAGE_luci-mod-network=y
CONFIG_PACKAGE_luci-mod-status=y
CONFIG_PACKAGE_luci-mod-system=y
CONFIG_PACKAGE_luci-proto-ipv6=y
CONFIG_PACKAGE_luci-proto-ppp=y
CONFIG_PACKAGE_luci-theme-bootstrap=y
CONFIG_PACKAGE_rpcd=y
CONFIG_PACKAGE_rpcd-mod-file=y
CONFIG_PACKAGE_rpcd-mod-iwinfo=y
CONFIG_PACKAGE_rpcd-mod-luci=y
CONFIG_PACKAGE_rpcd-mod-rrdns=y
CONFIG_PACKAGE_uhttpd=y
CONFIG_PACKAGE_wget=y
# CONFIG_PACKAGE_wireless-regdb is not set
# CONFIG_PACKAGE_wpad-basic is not set
CONFIG_PACKAGE_zlib=y

I2Cエキスパンダ周辺回路

以下の図の通り構成。改善点あればご指摘ください。

WHR-300HP2-MCP23017.png

MCP23017のスレーブアドレスを 0x20 へ設定するため、A0, A1, A2はブリッジしてGNDに落とす。
最初RESETの接続を忘れ、i2cdetect の際検出されないタイミングがあるなど不安定な状態になった。

DSC_0700.JPG

コンソール

insmod i2c-gpio-custom bus0=0,40,41
指定したGPIOをI2Cとして登録する
ログ:

root@OpenWrt:/tmp# insmod i2c-gpio-custom bus0=0,40,41
[  130.582520] Custom GPIO-based I2C driver version 0.1.1
[  130.593327] i2c-gpio i2c-gpio.0: using pins 40 (SDA) and 41 (SCL)
      
i2cdetect -y 0
指定したI2Cにぶら下がっているスレーブを検出する

root@OpenWrt:/tmp# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --
      
i2cset -y 0 0x20 0x0 0
MCP23017のGPAxのdirectionを全てoutに設定
i2cset -y 0 0x20 0x12 <設定値>
MCP23017のGPAxのうち、HIGHに設定するピンを設定する。ピン番号 (GPA0, GPA1, …) の番号がビット位置に対応する。

例: GPA1をHIGHにする

i2cset -y 0 0x20 0x12 2
      

例: GPA1, GPA2をHIGHにする

i2cset -y 0 0x20 0x12 3
      

その他

雑スクリプト(GPA0からGPA3まで使用している場合)

#!/bin/sh

for i in $(seq 0 100); do
	for j in $(seq 0 7); do
		i2cset -y 0 0x20 0x12 $j
		sleep 1
	done
done

i2cset -y 0 0x20 0x12 0x00

以上。

WSR-2533DHPL factoryメモ

WSR-2533DHPLにおいて、”firmware” 領域内のKernel, RootFSを格納するtrxのMagicは特定のもの(0x5C436F74 (\Cot))でなければ、メーカーファーム上でのチェックで弾かれる模様。
こうなると、initramfsでfactoryを作るしかない。通常のsquashfsでは、trxのMagicをデフォルトの 0x48445230 (HDR0) から変更した場合、OpenWrtがRootFS領域の検出に失敗してマウントできず、boot loopを引き起こすと予想されるため。
WCR-1166DSでは、これが原因でfactoryファーム投入時にboot loopが発生していると思われる。

OpenWrtのコードで関係するのは ここここ

initramfsでのfactoryファーム生成は非常に面倒な上コード量が膨大になり、かつ可読性が著しく低下する傾向にあるので、正直やりたくない。やはり、factoryファームは無しにしてinitramfsファームを用いてブートの上sysupgradeするのが手っ取り早いか。

The tail length is 48! Update len to 7078136!
decodesize 7077892...
cp: can't stat '/usr/sbin/ubi*': No such file or directory
cp: can't stat '/usr/sbin/uboot_env': No such file or directory
token=tools, line=default
token=partitions, line=Kernel
token=Kernel, line=0x0:-
sector: Kernel -> offset=[0x0], write_len=[0x6c0004]
[get_all_mtd] MTD[0]: /dev/mtd0, 0x1000000, 0x10000, ALL
[get_all_mtd] MTD[1]: /dev/mtd1, 0x30000, 0x10000, Bootloader
[get_all_mtd] MTD[2]: /dev/mtd2, 0x10000, 0x10000, Config
[get_all_mtd] MTD[3]: /dev/mtd3, 0x10000, 0x10000, Factory
[get_all_mtd] MTD[4]: /dev/mtd4, 0x7c0000, 0x10000, Kernel
[get_all_mtd] MTD[5]: /dev/mtd5, 0x53b8f0, 0x10000, RootFS
[get_all_mtd] MTD[6]: /dev/mtd6, 0x7c0000, 0x10000, Kernel2
[get_all_mtd] MTD[7]: /dev/mtd7, 0x53b8f0, 0x10000, RootFS2
[get_all_mtd] MTD[8]: /dev/mtd8, 0x10000, 0x10000, glbcfg
[get_all_mtd] MTD[9]: /dev/mtd9, 0x10000, 0x10000, board_data
[merge_sector_info] sector[0]: name=[Kernel], dev=[/dev/mtd4], offset=[0], write_len=[7077892], max_allow_size=[8126464]
[validate_file] /tmp/upload2ev4Qs: Bad trx header, magic=810697800l
[update_image] Validate CRC fail!
[WARN]: upgrade failed!
upload return: 65280
Restarting system.

WSR-2533DHPL stock -> OpenWrt (Fail)

長らくメーカーファーム上でのチェックを通せずにいたが、buffalo-tagを弄ったところパスできるようになったが、その後OpenWrtでブートした際にRootFSをマウントできず止まった。

The tail length is 48! Update len to 7078136!
decodesize 7077892...
cp: can't stat '/usr/sbin/ubi*': No such file or directory
cp: can't stat '/usr/sbin/uboot_env': No such file or directory
token=tools, line=default
token=partitions, line=Kernel
token=Kernel, line=0x0:-
sector: Kernel -> offset=[0x0], write_len=[0x6c0004]
[get_all_mtd] MTD[0]: /dev/mtd0, 0x1000000, 0x10000, ALL
[get_all_mtd] MTD[1]: /dev/mtd1, 0x30000, 0x10000, Bootloader
[get_all_mtd] MTD[2]: /dev/mtd2, 0x10000, 0x10000, Config
[get_all_mtd] MTD[3]: /dev/mtd3, 0x10000, 0x10000, Factory
[get_all_mtd] MTD[4]: /dev/mtd4, 0x7c0000, 0x10000, Kernel
[get_all_mtd] MTD[5]: /dev/mtd5, 0x53b8f0, 0x10000, RootFS
[get_all_mtd] MTD[6]: /dev/mtd6, 0x7c0000, 0x10000, Kernel2
[get_all_mtd] MTD[7]: /dev/mtd7, 0x53b8f0, 0x10000, RootFS2
[get_all_mtd] MTD[8]: /dev/mtd8, 0x10000, 0x10000, glbcfg
[get_all_mtd] MTD[9]: /dev/mtd9, 0x10000, 0x10000, board_data
[merge_sector_info] sector[0]: name=[Kernel], dev=[/dev/mtd4], offset=[0], write_len=[7077892], max_allow_size=[8126464]
[validate_file] freeram=[59179008] bufferram=[3739648]
/tmp/uploadMs88aC: CRC OK
[do_default_update] filesize=[7077892], offset=[0]
[do_default_update] Erase MTD[Kernel]: start
[do_default_update] Erase MTD[Kernel]: end
[do_default_update] Write MTD[Kernel]: start
[do_default_update] Write MTD[Kernel]: end
[switch_bank] to 0, return 0
upload return: 0
MReconnect to midcore failed.
[mapi_tx_transc_req] write msg length fail Connection refused
Restarting system.

===================================================================
                MT7621   stage1 code 10:33:55 (ASIC)
                CPU=500000000 HZ BUS=166666666 HZ
==================================================================
Change MPLL source from XTAL to CR...
do MEMPLL setting..
MEMPLL Config : 0x11100000
3PLL mode + External loopback
=== XTAL-40Mhz === DDR-1200Mhz ===
PLL2 FB_DL: 0xb, 1/0 = 547/477 2D000000
PLL3 FB_DL: 0x15, 1/0 = 580/444 55000000
PLL4 FB_DL: 0x18, 1/0 = 744/280 61000000
do DDR setting..[01F40000]
Apply DDR3 Setting...(use customer AC)
          0    8   16   24   32   40   48   56   64   72   80   88   96  104  112  120
      --------------------------------------------------------------------------------
0000:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0001:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0002:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0003:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0004:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0005:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0006:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0007:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0008:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0009:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000A:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000B:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000C:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000D:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    1
000E:|    0    0    0    0    0    0    0    0    0    1    1    1    1    1    1    1
000F:|    0    0    0    0    1    1    1    1    1    1    1    1    1    1    0    0
0010:|    1    1    1    1    1    1    1    1    1    0    0    0    0    0    0    0
0011:|    1    1    1    1    0    0    0    0    0    0    0    0    0    0    0    0
0012:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0013:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0014:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0015:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0016:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0017:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0018:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0019:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001A:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001B:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001C:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001D:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001E:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001F:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
rank 0 coarse = 15
rank 0 fine = 72
B:|    0    0    0    0    0    0    0    0    0    0    1    1    1    0    0    0
opt_dle value:11
DRAMC_R0DELDLY[018]=00001E1F
==================================================================
                RX      DQS perbit delay software calibration 
==================================================================
1.0-15 bit dq delay value
==================================================================
bit|     0  1  2  3  4  5  6  7  8  9
--------------------------------------
0 |    13 13 15 15 11 12 13 10 9 10 
10 |    11 11 13 13 11 12 
--------------------------------------

==================================================================
2.dqs window
x=pass dqs delay value (min~max)center 
y=0-7bit DQ of every group
input delay:DQS0 =31 DQS1 = 30
==================================================================
bit     DQS0     bit      DQS1
0  (1~58)29  8  (1~56)28
1  (1~56)28  9  (1~54)27
2  (1~60)30  10  (1~59)30
3  (1~61)31  11  (1~57)29
4  (1~58)29  12  (1~58)29
5  (1~59)30  13  (1~55)28
6  (1~61)31  14  (1~60)30
7  (1~60)30  15  (1~57)29
==================================================================
3.dq delay value last
==================================================================
bit|    0  1  2  3  4  5  6  7  8   9
--------------------------------------
0 |    15 15 15 15 13 13 13 11 11 13 
10 |    11 12 14 15 11 13 
==================================================================
==================================================================
     TX  perbyte calibration 
==================================================================
DQS loop = 15, cmp_err_1 = ffff0000 
dqs_perbyte_dly.last_dqsdly_pass[0]=15,  finish count=1 
dqs_perbyte_dly.last_dqsdly_pass[1]=15,  finish count=2 
DQ loop=15, cmp_err_1 = ffff01ae
DQ loop=14, cmp_err_1 = ffff0180
DQ loop=13, cmp_err_1 = ffff0080
dqs_perbyte_dly.last_dqdly_pass[1]=13,  finish count=1 
DQ loop=12, cmp_err_1 = ffff0000
dqs_perbyte_dly.last_dqdly_pass[0]=12,  finish count=2 
byte:0, (DQS,DQ)=(9,8)
byte:1, (DQS,DQ)=(9,8)
20,data:99
[EMI] DRAMC calibration passed

===================================================================
                MT7621   stage1 code done 
                CPU=500000000 HZ BUS=166666666 HZ
===================================================================


U-Boot 1.1.3 (Aug  5 2016 - 17:01:25) 0.02

Board: Ralink APSoC DRAM:  128 MB
relocate_code Pointer at: 87fb8000

Config XHCI 40M PLL 
******************************
Software System Reset Occurred
******************************
flash manufacture id: ef, device id 40 18
find flash: W25Q128BV
============================================ 
Ralink UBoot Version: 5.0.0.0
-------------------------------------------- 
ASIC MT7621A DualCore (MAC to MT7530 Mode)
DRAM_CONF_FROM: Auto-Detection 
DRAM_TYPE: DDR3 
DRAM bus: 16 bit
Xtal Mode=3 OCP Ratio=1/3
Flash component: 16 MBytes NOR Flash
Date:Aug  5 2016  Time:17:01:25
============================================ 
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 880 MHZ #### 
 estimate memory size =128 Mbytes
#Reset_MT7530
set LAN/WAN WLLLL

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP.                                                                  0 
   
3: System Boot system code via Flash0.
## Booting image at bc050000 ...

=================================================
Check image validation:
Image1 Trx Check --> 
## check_trx, crc=-575298866, *crc_ret=-575298866.
OK
Image1 Header Magic Number --> OK
Image1 Header Checksum --> OK
Image1 Data Checksum --> OK

=================================================

=================================================
Check image validation:
Image2 Trx Check --> 
## check_trx, crc=-1234505007, *crc_ret=-1234505007.
OK
Image2 Header Magic Number --> OK
Image2 Header Checksum --> OK
Image2 Data Checksum --> OK

=================================================
## check Image1 return 0, check Image2 return 0, Image1 crc=-575298866, Image2 crc=-1234505007.
Image1 is ok!
Image2 is not same as Image1, copy Image1 to Image2!

Copy Image:
Image1(0x50000) to Image2(0x810000), size=0x68E000
........................................................................................................
........................................................................................................
.
.
Done!
   Image Name:   MIPS OpenWrt Linux-4.14.143
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    2006978 Bytes =  1.9 MB
   Load Address: 80001000
   Entry Point:  80001000
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80001000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

[    0.000000] Linux version 4.14.143 (musashino205@Taiha.Net) (gcc version 7.4.0 (OpenWrt GCC 7.4.0 r0+11016-9bf7431d38)) #0 SMP Sun Sep 15 14:46:05 2019
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is Buffalo WSR-2533DHPL
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] random: get_random_bytes called from start_kernel+0x9c/0x4d8 with crng_init=0
[    0.000000] percpu: Embedded 14 pages/cpu s26064 r8192 d23088 u57344
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=000492b0
[    0.000000] Readback ErrCtl register=000492b0
[    0.000000] Memory: 121868K/131072K available (4789K kernel code, 246K rwdata, 1036K rodata, 1276K init, 254K bss, 9204K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 256
[    0.000000] CPU Clock: 880MHz
[    0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4343773742 ns
[    0.000009] sched_clock: 32 bits at 440MHz, resolution 2ns, wraps every 4880645118ns
[    0.015496] Calibrating delay loop... 586.13 BogoMIPS (lpj=2930688)
[    0.087822] pid_max: default: 32768 minimum: 301
[    0.097183] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.110205] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.126315] Hierarchical SRCU implementation.
[    0.135850] smp: Bringing up secondary CPUs ...
[    0.146319] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.146329] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.146340] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.146477] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.205169] Synchronize counters for CPU 1: done.
[    0.276364] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.276372] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.276381] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.276458] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.326109] Synchronize counters for CPU 2: done.
[    0.387189] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.387197] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.387205] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.387279] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.445677] Synchronize counters for CPU 3: done.
[    0.505287] smp: Brought up 1 node, 4 CPUs
[    0.517696] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.537183] futex hash table entries: 1024 (order: 3, 32768 bytes)
[    0.549730] pinctrl core: initialized pinctrl subsystem
[    0.561419] NET: Registered protocol family 16
[    0.579962] pull PCIe RST: RALINK_RSTCTRL = 4000000
[    0.890005] release PCIe RST: RALINK_RSTCTRL = 7000000
[    0.900071] ***** Xtal 40MHz *****
[    0.906803] release PCIe RST: RALINK_RSTCTRL = 7000000
[    0.917011] Port 0 N_FTS = 1b105000
[    0.923908] Port 1 N_FTS = 1b105000
[    0.930833] Port 2 N_FTS = 1b102800
[    2.089681] PCIE2 no card, disable it(RST&CLK)
[    2.098375]  -> 21007f2
[    2.103193] PCIE0 enabled
[    2.108394] PCIE1 enabled
[    2.113573] PCI host bridge /pcie@1e140000 ranges:
[    2.123096]  MEM 0x0000000060000000..0x000000006fffffff
[    2.133463]   IO 0x000000001e160000..0x000000001e16ffff
[    2.143829] PCI coherence region base: 0xbfbf8000, mask/settings: 0x60000000
[    2.167190] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    2.178509] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    2.189746] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    2.202416] PCI host bridge to bus 0000:00
[    2.210435] pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff]
[    2.224099] pci_bus 0000:00: root bus resource [io  0xffffffff]
[    2.235844] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    2.249312] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    2.267225] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[    2.280256] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[    2.294069] pci 0000:00:01.0: BAR 0: no space for [mem size 0x80000000]
[    2.307198] pci 0000:00:01.0: BAR 0: failed to assign [mem size 0x80000000]
[    2.321029] pci 0000:00:00.0: BAR 8: assigned [mem 0x60000000-0x600fffff]
[    2.334502] pci 0000:00:01.0: BAR 8: assigned [mem 0x60100000-0x601fffff]
[    2.347983] pci 0000:00:00.0: BAR 1: assigned [mem 0x60200000-0x6020ffff]
[    2.361468] pci 0000:00:01.0: BAR 1: assigned [mem 0x60210000-0x6021ffff]
[    2.374952] pci 0000:01:00.0: BAR 0: assigned [mem 0x60000000-0x600fffff 64bit]
[    2.389463] pci 0000:00:00.0: PCI bridge to [bus 01]
[    2.399292] pci 0000:00:00.0:   bridge window [mem 0x60000000-0x600fffff]
[    2.412791] pci 0000:02:00.0: BAR 0: assigned [mem 0x60100000-0x601fffff 64bit]
[    2.427308] pci 0000:00:01.0: PCI bridge to [bus 02]
[    2.437130] pci 0000:00:01.0:   bridge window [mem 0x60100000-0x601fffff]
[    2.452070] clocksource: Switched to clocksource GIC
[    2.463868] NET: Registered protocol family 2
[    2.473126] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    2.486864] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[    2.499464] TCP: Hash tables configured (established 1024 bind 1024)
[    2.512225] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    2.523722] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    2.536386] NET: Registered protocol family 1
[    2.782013] 4 CPUs re-calibrate udelay(lpj = 2924544)
[    2.793455] Crashlog allocated RAM at address 0x3f00000
[    2.804005] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    2.821011] random: fast init done
[    2.831197] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    2.842705] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    2.865629] io scheduler noop registered
[    2.873357] io scheduler deadline registered (default)
[    2.884372] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    2.898171] console [ttyS0] disabled
[    2.905238] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 19, base_baud = 3125000) is a 16550A
[    2.923164] console [ttyS0] enabled
[    2.923164] console [ttyS0] enabled
[    2.936951] bootconsole [early0] disabled
[    2.936951] bootconsole [early0] disabled
[    2.954651] MediaTek Nand driver init, version v2.1 Fix AHB virt2phys error
[    2.968911] spi-mt7621 1e000b00.spi: sys_freq: 220000000
[    2.989274] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    2.998721] 7 fixed-partitions partitions found on MTD device spi0.0
[    3.011375] Creating 7 MTD partitions on "spi0.0":
[    3.020931] 0x000000000000-0x000000030000 : "u-boot"
[    3.031863] 0x000000030000-0x000000040000 : "u-boot-env"
[    3.043397] 0x000000040000-0x000000050000 : "factory"
[    3.054441] 0x000000050000-0x000000810000 : "firmware"
[    3.068725] 0x000000810000-0x000000fd0000 : "Kernel2"
[    3.079818] 0x000000fd0000-0x000000fe0000 : "glbcfg"
[    3.090684] 0x000000fe0000-0x000001000000 : "board_data"
[    3.102869] libphy: Fixed MDIO Bus: probed
[    3.174069] libphy: mdio: probed
[    4.582213] mtk_soc_eth 1e100000.ethernet: loaded mt7530 driver
[    4.594638] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 20
[    4.613452] NET: Registered protocol family 10
[    4.623865] Segment Routing with IPv6
[    4.631241] NET: Registered protocol family 17
[    4.640193] 8021q: 802.1Q VLAN Support v1.8
[    4.650825] hctosys: unable to open rtc device (rtc0)
[    4.661736] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    4.676655] Please append a correct "root=" boot option; here are the available partitions:
[    4.693291] 1f00             192 mtdblock0 
[    4.693298]  (driver?)
[    4.706301] 1f01              64 mtdblock1 
[    4.706306]  (driver?)
[    4.719316] 1f02              64 mtdblock2 
[    4.719321]  (driver?)
[    4.732340] 1f03            7936 mtdblock3 
[    4.732346]  (driver?)
[    4.745348] 1f04            7936 mtdblock4 
[    4.745353]  (driver?)
[    4.758356] 1f05              64 mtdblock5 
[    4.758361]  (driver?)
[    4.771362] 1f06             128 mtdblock6 
[    4.771368]  (driver?)
[    4.784386] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    4.802463] Rebooting in 1 seconds..

WRC-1167FS stock -> OpenWrt

とりあえずfactoryファームを正しい状態にdecodeされる形で組めたので、投入テスト。
stockで SQUASHFS error が大量に吐かれるのは何だろうか…(出ないこともあった)

------- ELECOM1701 Header Info
Image Header Size      : 0x0038
Image Header ID        : ELECOM
Image Product Name     : WRC-1167FS
Image Version          : 0.00
------------------------------
------- Header Info
Image Header Size      : 0x0074
Image Header Magic Code: 0x031d6129
Image Data Size        : 6291456
Image Type             : 0x6 [kernel_elecom1701]
Compression Type       : 0x0
Model ID               : 0x00228000
Build Date             : 1970-01-1
Version Firmware       : 
Version Code SCM       : 
Version Config         :                                 
Data CRC Checksum      : 0x337EBA50
Header CRC Checksum    : 0x0
------------------------------
FWHANDLE, DECODE PASS
Erasing blocks: 96/96 (100%)
Writing data: 6144k/6144k (100%)
Verifying data: 6144k/6144k (100%)
The system is going down NOW!
[43306.704000] SQUASHFS error: zlib_inflate error, data probably corrupt
[43306.728000] SQUASHFS error: squashfs_read_data failed to read block 0x1d6305
[43306.740000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43306.756000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43306.768000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43306.780000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43306.796000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43306.808000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43306.820000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43306.836000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43306.848000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43306.864000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43306.876000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43306.888000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43306.904000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43306.916000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43306.928000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43306.944000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43306.956000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43306.972000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43306.984000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43306.996000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43307.012000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43307.024000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43307.036000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43307.052000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43307.064000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43307.080000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[43307.092000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[43307.104000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
Sent SIGKILL to all processes
Requesting system reboot
[43308.712000] Restarting system.
[04060C09][04060C09]
DDR Calibration DQS reg = 00008787


U-Boot 1.1.3 (Oct 23 2017 - 16:14:35)

Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fa0000
******************************
Software System Reset Occurred
******************************
flash manufacture id: ef, device id 40 18
find flash: W25Q128BV
============================================ 
Ralink UBoot Version: 5.0.0.0
-------------------------------------------- 
ASIC 7628_MP (Port5None)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Oct 23 2017  Time:16:14:35
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 580 MHZ #### 
 estimate memory size = 64 Mbytes
RESET MT7628 PHY!!!!!!
Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 
default: 3                                                                                                                 0 
   
3: System Boot system code via Flash.
## Booting image at bc050000 ...
   Image Name:   MIPS OpenWrt Linux-4.14.143
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1669570 Bytes =  1.6 MB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 64

Starting kernel ...

[    0.000000] Linux version 4.14.143 (musashino205@Taiha.Net) (gcc version 7.4.0 (OpenWrt GCC 7.4.0 r0+11022-f01af852e5)) #0 Sun Sep 15 03:19:24 2019
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7628AN ver:1 eco:2
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
[    0.000000] MIPS: machine is ELECOM WRC-1167FS
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] random: get_random_bytes called from start_kernel+0x98/0x4a0 with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=000779f0
[    0.000000] Readback ErrCtl register=000779f0
[    0.000000] Memory: 58372K/65536K available (3919K kernel code, 185K rwdata, 892K rodata, 1204K init, 206K bss, 7164K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] intc: using register map from devicetree
[    0.000000] CPU Clock: 580MHz
[    0.000000] timer_probe: no matching timers found
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000010] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.015371] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.087589] pid_max: default: 32768 minimum: 301
[    0.096986] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.109944] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.130499] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.149876] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.162027] pinctrl core: initialized pinctrl subsystem
[    0.173329] NET: Registered protocol family 16
[    0.290156] mt7620-pci 10140000.pcie: Port 0 N_FTS = 1b105000
[    0.451172] PCI host bridge /pcie@10140000 ranges:
[    0.460516]  MEM 0x0000000020000000..0x000000002fffffff
[    0.470830]   IO 0x0000000010160000..0x000000001016ffff
[    0.500056] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.511272] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.522397] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.534247] PCI host bridge to bus 0000:00
[    0.542215] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[    0.555863] pci_bus 0000:00: root bus resource [io  0xffffffff]
[    0.567501] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.580917] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.597737] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[    0.610732] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[    0.624454] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x200fffff]
[    0.637870] pci 0000:00:00.0: BAR 9: assigned [mem 0x20100000-0x201fffff pref]
[    0.652146] pci 0000:00:00.0: BAR 1: assigned [mem 0x20200000-0x2020ffff]
[    0.665570] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff 64bit]
[    0.680026] pci 0000:01:00.0: BAR 6: assigned [mem 0x20100000-0x2010ffff pref]
[    0.694282] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.704078] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x200fffff]
[    0.717505] pci 0000:00:00.0:   bridge window [mem 0x20100000-0x201fffff pref]
[    0.736698] clocksource: Switched to clocksource MIPS
[    0.747967] NET: Registered protocol family 2
[    0.757384] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.771089] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.783600] TCP: Hash tables configured (established 1024 bind 1024)
[    0.796304] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.807770] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.820453] NET: Registered protocol family 1
[    0.832838] Crashlog allocated RAM at address 0x3f00000
[    0.844881] workingset: timestamp_bits=14 max_order=14 bucket_order=0
[    0.864744] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.876196] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.908291] io scheduler noop registered
[    0.915904] io scheduler deadline registered (default)
[    0.927039] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.940675] console [ttyS0] disabled
[    0.947712] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
[    0.965533] console [ttyS0] enabled
[    0.965533] console [ttyS0] enabled
[    0.979266] bootconsole [early0] disabled
[    0.979266] bootconsole [early0] disabled
[    0.996371] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    1.021181] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    1.030557] 5 fixed-partitions partitions found on MTD device spi0.0
[    1.043143] Creating 5 MTD partitions on "spi0.0":
[    1.052647] 0x000000000000-0x000000030000 : "u-boot"
[    1.063444] 0x000000030000-0x000000040000 : "u-boot-env"
[    1.074905] 0x000000040000-0x000000050000 : "factory"
[    1.085896] 0x000000050000-0x000000780000 : "firmware"
[    1.100090] 2 uimage-fw partitions found on MTD device firmware
[    1.111878] Creating 2 MTD partitions on "firmware":
[    1.121728] 0x000000000000-0x000000197a02 : "kernel"
[    1.132503] 0x000000197a02-0x000000730000 : "rootfs"
[    1.143221] mtd: device 5 (rootfs) set to be root filesystem
[    1.156083] 1 squashfs-split partitions found on MTD device rootfs
[    1.168396] 0x0000005f0000-0x000000730000 : "rootfs_data"
[    1.180046] 0x000000780000-0x000000800000 : "storage"
[    1.191697] libphy: Fixed MDIO Bus: probed
[    1.212238] rt3050-esw 10110000.esw: link changed 0x00
[    1.224104] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    1.242355] NET: Registered protocol family 10
[    1.255536] Segment Routing with IPv6
[    1.262985] NET: Registered protocol family 17
[    1.271879] 8021q: 802.1Q VLAN Support v1.8
[    1.286868] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    1.307441] Freeing unused kernel memory: 1204K
[    1.316404] This architecture does not have kernel memory protection.
[    1.970141] init: Console is alive
[    1.977215] init: - watchdog -
[    2.550349] random: fast init done
[    2.756372] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    2.937396] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    2.962292] init: - preinit -
[    4.384411] rt3050-esw 10110000.esw: link changed 0x00
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3[    4.583806] random: procd: uninitialized urandom read (4 bytes read)
] or [4] key and hit [enter] to select the debug level
[    7.720341] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[    7.764542] urandom-seed: Seed file not found (/etc/urandom.seed)
[    7.904087] procd: - early -
[    7.909996] procd: - watchdog -
[    7.920624] rt3050-esw 10110000.esw: link changed 0x10
[    8.505187] procd: - watchdog -
[    8.511829] procd: - ubus -
[    8.593332] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.605999] rt3050-esw 10110000.esw: link changed 0x18
[    8.727290] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.740510] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.754288] procd: - init -
Please press Enter to activate this console.
[    9.916960] kmodloader: loading kernel modules from /etc/modules.d/*
[   10.140706] urngd: v1.0.0 started.
[   10.235574] nat46: module (version 683fbd2b765506332a1af141545652bf58f03166) loaded.
[   10.283603] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   10.316489] Loading modules backported from Linux version v5.3-rc4-0-gd45331b00ddb
[   10.331554] Backport generated by backports.git v5.3-rc4-1-0-g4ec72687
[   10.398397] ip_tables: (C) 2000-2006 Netfilter Core Team
[   10.442233] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
[   10.682682] xt_time: kernel timezone is -0000
[   10.977902] random: crng init done
[   10.984640] random: 6 urandom warning(s) missed due to ratelimiting
[   11.034113] mt76_wmac 10300000.wmac: ASIC revision: 76280001
[   12.068989] mt76_wmac 10300000.wmac: Firmware Version: 20151201
[   12.080789] mt76_wmac 10300000.wmac: Build Time: 20151201183641
[   12.106712] mt76_wmac 10300000.wmac: firmware init done
[   12.320920] mt76x2e 0000:01:00.0: card - bus=0x1, slot = 0x0 irq=4
[   12.333476] mt76x2e 0000:01:00.0: ASIC revision: 76120044
[   13.305510] mt76x2e 0000:01:00.0: ROM patch build: 20141115060606a
[   13.323665] mt76x2e 0000:01:00.0: Firmware Version: 0.0.00
[   13.334612] mt76x2e 0000:01:00.0: Build: 1
[   13.342731] mt76x2e 0000:01:00.0: Build Time: 201507311614____
[   13.376709] mt76x2e 0000:01:00.0: Firmware running!
[   13.413026] PPP generic driver version 2.4.2
[   13.434463] NET: Registered protocol family 24
[   13.457255] kmodloader: done loading kernel modules from /etc/modules.d/*
[   81.007133] rt3050-esw 10110000.esw: link changed 0x00
[   84.725977] rt3050-esw 10110000.esw: link changed 0x10
[   85.210456] rt3050-esw 10110000.esw: link changed 0x18
[   87.717761] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   87.766439] br-lan: port 1(eth0.1) entered blocking state
[   87.777384] br-lan: port 1(eth0.1) entered disabled state
[   87.788486] device eth0.1 entered promiscuous mode
[   87.798020] device eth0 entered promiscuous mode
[   87.822336] jffs2_build_filesystem(): unlocking the mtd device... 
[   87.822399] done.
[   87.838517] jffs2_build_filesystem(): erasing all blocks after the end marker... 
[   87.963432] br-lan: port 1(eth0.1) entered blocking state
[   87.989006] br-lan: port 1(eth0.1) entered forwarding state
[   88.000788] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   88.797252] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   92.168458] done.
[   92.172311] jffs2: notice: (1302) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   92.572867] overlayfs: upper fs does not support tmpfile.



BusyBox v1.31.0 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r0+11022-f01af852e5
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:/#

WRC-1167FS factoryトラブルメモ

OpenWrtのfactoryを投げ込んだらFlashに書き込まれたデータが何故か化けていて、ブートに失敗した。
blocksizeか何かでピッタリでなければ正しい状態にdecodeできない?要検証

rm: '/tmp/nginx' is a directory
------- ELECOM1701 Header Info
Image Header Size      : 0x0038
Image Header ID        : ELECOM
Image Product Name     : WRC-1167FS
Image Version          : 0.00
------------------------------
------- Header Info
Image Header Size      : 0x0074
Image Header Magic Code: 0x031d6129
Image Data Size        : 6291460
Image Type             : 0x6 [kernel_elecom1701]
Compression Type       : 0x0
Model ID               : 0x00228000
Build Date             : 1970-01-1
Version Firmware       : 
Version Code SCM       : 
Version Config         :                                 
Data CRC Checksum      : 0x56D08D59
Header CRC Checksum    : 0x0
------------------------------
FWHANDLE, DECODE PASS
Erasing blocks: 97/97 (100%)
Writing data: 6144k/6144k (100%)
Verifying data: 6144k/6144k (100%)
The system is going down NOW!
[12500.716000] SQUASHFS error: zlib_inflate error, data probably corrupt
[12500.728000] SQUASHFS error: squashfs_read_data failed to read block 0x1d6305
[12500.744000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12500.756000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12500.772000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12500.784000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12500.796000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12500.812000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12500.824000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12500.836000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12500.852000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12500.864000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12500.880000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12500.892000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12500.904000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12500.920000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12500.932000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12500.944000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12500.960000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12500.972000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12500.988000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12501.000000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12501.012000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12501.028000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12501.040000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12501.052000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12501.068000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12501.080000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
[12501.096000] SQUASHFS error: Unable to read fragment cache entry [1d6305]
[12501.108000] SQUASHFS error: Unable to read page, block 1d6305, size 9161
Sent SIGKILL to all processes
Requesting system reboot
[12502.724000] Restarting system.
[04060C09][04060C09]
DDR Calibration DQS reg = 00008787


U-Boot 1.1.3 (Oct 23 2017 - 16:14:35)

Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fa0000
******************************
Software System Reset Occurred
******************************
flash manufacture id: ef, device id 40 18
find flash: W25Q128BV
============================================ 
Ralink UBoot Version: 5.0.0.0
-------------------------------------------- 
ASIC 7628_MP (Port5None)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Oct 23 2017  Time:16:14:35
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 580 MHZ #### 
 estimate memory size = 64 Mbytes
RESET MT7628 PHY!!!!!!
Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 
default: 3                                                                                                                 0 
   
3: System Boot system code via Flash.
## Booting image at bc050000 ...
Bad Magic Number,23071856
[04060C0A][04060C09]
DDR Calibration DQS reg = 00008788


U-Boot 1.1.3 (Oct 23 2017 - 16:14:35)

Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fa0000
flash manufacture id: ef, device id 40 18
find flash: W25Q128BV
============================================ 
Ralink UBoot Version: 5.0.0.0
-------------------------------------------- 
ASIC 7628_MP (Port5None)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Oct 23 2017  Time:16:14:35
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 580 MHZ #### 
 estimate memory size = 64 Mbytes
RESET MT7628 PHY!!!!!!
Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 
default: 3

You choosed 4
                                                                                                                           0 

   
4: System Enter Boot Command Line Interface.

U-Boot 1.1.3 (Oct 23 2017 - 16:14:35)
MT7628 # md.l 0xbc050000
bc050000: 56180723 80312a9f de177f59 81781b04    #..V.*1.Y.....x.
bc050010: 00010284 00010284 2aa7bc3c 03030701    ........<..*....
bc050020: 53514b49 65714d24 7473556a 6e684e24    IKQS$MqejUst$Nhn
bc050030: 342c7a71 2e35332a 00323635 00010204    qz,4*35.562.....
bc050040: 80010269 509b7404 00010204 6f010204    i....t.P.......o
bc050050: a3fefdf9 8ef57db3 13fd43af a5c420ff    .....}...C... ..
bc050060: ef8d81a3 e0847128 5535138d 2fec8ed9    ....(q....5U.../
bc050070: b265d1b9 891febac 2bb7882c ef2ca1a3    ..e.....,..+..,.
bc050080: d602d7fa 951fb8c1 e13b60b3 2c0ed234    .........`;.4..,
bc050090: 79e713b1 9f5bb1be 2a74e0d2 bdd5abff    ...y..[...t*....
bc0500a0: 866b3de9 e8ff9092 e276aa26 13a4f17f    .=k.....&.v.....
bc0500b0: a8c306b1 4c7be526 71891b32 2e649c65    ....&.{L2..qe.d.
bc0500c0: 2926ac8c 2c41af92 e5322fbd 0c4b90df    ..&)..A,./2...K.
bc0500d0: f3f5cf52 814c5b0b b0db23da d50388b3    R....[L..#......
bc0500e0: c9e33000 5781c900 832dea55 a2f5d883    .0.....WU.-.....
bc0500f0: 21604dcd b38d66cb 44bd8db4 9affad64    .M`!.f.....Dd...
MT7628 # 

WXR-2533DHPのブート不可問題あれこれ

5chでの報告によって気付き対処にあたった、WXR-2533DHPが最近のファームではブートしなくなっていた問題についての備忘録。

発端

5chのOpenWrt現行スレにて、 “最新のsnapshotでブートできない” と書き込みがあり、2019/09/06 0時頃スレを見に行った際それに気付いた。

原因予想

そこから寝るまで、あれこれ思考開始。とりあえず思い当たるところを色々考えつつ、 openwrt/openwrt のcommitを target/linux/ipq806x 中心に見てみる。
が、特にブートを阻害するような変更は見つからず。

WXR-2533DHPはブート時にU-BootがRootFSの末尾に付加されるchecksumをチェックし、それがRootFSから実際に算出した値と一致していれば正常としてブートを行う。全く確証は無いものの、これで問題が起きている可能性もあるかなーとぼんやり。

しかしながら、 downloads.openwrt.org からダウンロードしてきたイメージをtarで展開し、 “root” を確認しても末尾のチェックサムは正しく付加されており、手元で実際に算出した値とも一致した。わけわかめ。

実機検証

2019/09/06は外出から帰宅後気力が尽きており、検証は7日に持ち越し。

翌7日にWXR-2533DHPを引っ張り出し、OpenWrt公式のイメージを使用してFlashに書き込みブートを試行。すると、以下のエラーによりU-BootがOpenWrtのブートに失敗していた。

Hit any key to stop autoboot:  0 
Checking Bank1 Image ... 
Creating 1 MTD partitions on "nand0":
0x000000000000-0x000004000000 : "mtd=0"
Rootfs Checksum Error
Bank1 Image is fail

U-BootがNAND Flashに2組格納されているOSイメージのうち最初の “Bank1” をチェックした際、RootFSのchecksumが正しくないとしてエラーを吐いていた。
本来ならば “Bank2” も存在するためメーカーファームではBank2から正常なファームウェアがBank1へ書き込まれて復旧しブートするが、OpenWrtでは諸事情によりファームウェアのアップグレード時にBank2については消去を行っている。このため、上記ログの後Bank2のチェックに移るが、Bank2も正常ではないため結局どうにもできず、WXR-2533DHPのLANポートに何らかの接続がある場合はTFTPによる待ち受けが開始され、無ければそのまま再起動される。

原因探し/特定

ブートできない問題が何故引き起こされているのかは分かったが、それの原因についてはこの時点では未だ不明。
NAND Flash内にUBIによってボリュームが作成される際、checksumがボリューム内の最後に来なければならないのかと推測したものの、WXR-2533DHPのサポート作業初期に取ったメーカーファームのバックアップを確認したところ、特に最後ではなかった。残念。

とここで、問題のあるOpenWrtファームウェアとバックアップ済みのメーカーファームで、RootFS内のchecksumの位置が異なることに気付く。メーカーファームではRootFSのデータ本体と思われる部分のすぐ後にchecksumが付加されていた

WXR-2533DHP Ver.1.33
末尾 D3 がchecksum

        00010203 04050607 08090A0B 0C0D0E0F  0123456789ABCDEF
E864A0  87A841C7 D8E8DCF2 046C4252 669CC63B  ..A......lBRf..;
E864B0  164BDAC2 3D59E88F A96CD931 92BAF43D  .K..=Y...l.1...=
E864C0  B9EFD51F 0E747DE0 7B5081FC 985296CC  .....t}.{P...R..
E864D0  A245A256 CA52D000 000052A7 91A50001  .E.V.R....R.....
E864E0  9608D020 00003B95 03263E30 0D8B0200  ... ..;..&>0....
E864F0  00000001 595ABC41 E8000000 00006649  ....YZ.A......fI
E86500  E8000000 0000D050 E8000000 00000659  .......P.......Y
E86510  E8000000 0000B860 E8000000 00000480  .......`........
E86520  00000000 1E65E800 00000000 D3        .....e.......   

が、OpenWrtファームウェアではデータ本体部分と思われる後、さらにpaddingと思われる部分が続き、その後ろにchecksumが付加されていた。

問題のあるOpenWrtファームウェア(再現)
末尾 A3 がchecksum

        00010203 04050607 08090A0B 0C0D0E0F  0123456789ABCDEF
BDD4F0  00000000 00000000 00000000 00000000  ................
BDD500  00000000 00000000 00000000 00000000  ................
BDD510  00000000 00000000 00000000 00000000  ................
BDD520  00000000 00000000 00000000 00000000  ................
BDD530  00000000 00000000 00000000 00000000  ................
BDD540  00000000 00000000 00000000 00000000  ................
BDD550  00000000 00000000 00000000 00000000  ................
BDD560  00000000 00000000 00000000 00000000  ................
BDD570  A3                                   .       

で、確かsquashfsはヘッダ内にsquashfsのサイズ値を持っていたはず…と思い出し、binwalkで確認したところ、メーカーファームではsquashfsのサイズ値とchecksumのoffsetが一致していた。対照的に問題のあるOpenWrtファームウェアでは、サイズ値とoffsetが一致しない。どうも、paddingされているサイズだけchecksumのoffsetが後ろにズレているのでは…とぼんやり。

とぼんやりしていたら、最近というか少し前くらいにML (openwrt-devel) 辺りで “squashfsのpaddingがどうのこうの” というやり取りがされていたことを思い出した。
たぶん自分には関係ないなと特段気にしてはいなかったが、しばらく見かけていなかったから気になりopenwrt/openwrtのcommitを確認。すると、以下のcommitを見つけた。

build: remove harmful -nopad option from mksquashfs
Fri, 30 Aug 2019 16:52:25 +0200
commit: 1c0290c5cc6258c48b8ba46b4f9c85a21de4f875

機種によっては正しくsquashfsが読み取れずにマウントに失敗し、ブートが止まるらしく、これの解決の為mksquashfsから -nopad オプションが削除されていた。この結果、mksquashfsによりsquashfsが生成される際に、出力データが4KiBで割り切れるサイズまでpaddingされるようになった模様。
ただし、この際問題になるのがsquashfsのヘッダに記録されるサイズ値であり、paddingの有無にかかわらず実データのサイズを格納する模様。その結果、paddingが行われるようになってもpadding前のサイズでサイズ値が記録されてしまい、WXR-2533DHPで必要なRootFS末尾のchecksumのoffsetと合わなくなってしまっていた。
雑に表すと以下のような感じ。

       OpenWrt (incorrect state)                                stock firmware
+---------------------------------------+         +---------------------------------------+
|                                       |         |                                       |
|                                       |         |                                       |
|            squashfs data              |         |            squashfs data              |
|                                       |         |                                       |
|                                       |         |                                       |
|                   +-------------------+         |                   +-------------------+
|                   |                   |         |                   |  |  <- checksum
+-------------------+                   |         +-------------------+--+
|                padding                |
+---------------------------------------+         size value      = data size
|  |  <- checksum                                 checksum offset = data size
+--+
                                                  size value = checksum offset
size value      = data size
checksum offset = data size + padding size

squashfs size ≠ checksum offset

このため、WXR-2533DHPのU-Bootがsquashfsのヘッダに格納されているサイズ値を元に取得したchecksumは末尾に付加された正しいものではなく、paddingにより付加された “0x00” であり、その結果不正なchecksumであるとしてBankのイメージが正しくないと判定されていた。
一旦当該commitをrevertしてビルドしたところ正常にブートしたため、これが原因となっていると確定。

対処

原因となったcommitもトラブルを起こす機種の修正という目的をもって取り込まれたものであり、どちらかというとchecksumを必要とするWXR-2533DHPが特殊であるため、-nopadオプションを削除したcommitはそのままで対処する方針とした。

結局のところsquashfsのヘッダ内に格納されるサイズ値をoffsetとした場所にchecksumが存在していれば良いのであり、その結果ビルド時にsquashfsヘッダからサイズ値を読み取って、そのoffsetにddコマンドでchecksumを埋め込むこととした。

以下は変更内容

WXR-2533DHPのsysupgradeイメージを生成する際squashfsにchecksumを付加するために用意した、既存の Build/buffalo-rootfs-cksum に改変を加える

 target/linux/ipq806x/image/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
index 81f14b47567..0d704cf8e95 100644
--- a/target/linux/ipq806x/image/Makefile
+++ b/target/linux/ipq806x/image/Makefile
@@ -5,9 +5,11 @@ include $(INCLUDE_DIR)/image.mk
 
 define Build/buffalo-rootfs-cksum
 	( \
-		echo -ne "\x$$(od -A n -t u1 $@ | tr -s ' ' '\n' | \
-			$(STAGING_DIR_HOST)/bin/awk '{s+=$$0}END{printf "%x", 255-s%256}')"; \
-	) >> $@
+		squashfs_size="$$(dd if=$@ bs=4 skip=10 count=1 2> /dev/null | od -An -tu4 | tr -d ' \n')"; \
+		od -An -tu1 $@ | tr -s ' ' '\n' | \
+			$(STAGING_DIR_HOST)/bin/awk '{s+=$$0}END{printf "%c", 255-s%256}' | \
+				dd of=$@ bs=1 seek=$${squashfs_size} count=1 conv=notrunc 2> /dev/null; \
+	)
 endef
 
 define Device/Default

上記を実際にビルドして確認の上、openwrt/openwrtのPRに投げ込んだ。

その後

PRを投げ込んだまでは良かったが、その後なんとなくopenwrt/openwrtのcommitを見に行ったら、なんとまぁ、今回の問題の原因になった -nopad オプションを削除するcommitがrevertされていた。なんてこったい。
どうもsquashfsをpaddingされると今度は別でトラブルが引き起こされる環境が出てくるらしく、それでrevertとなった模様。

結局、投げたPRの方は特段何も無いまま原因が消失してしまったので、そのままクローズ。
あっけなく解決してしまい、えぇ…という感じだけれども、まあ問題は無くなったのだから良し。以上。

WRC-733GHBK ブート時TFTP (RESETボタン)

WRC-733GHBKは、デバイスの電源投入時にRESETボタンを押しながら行うとTFTPサーバが開始される。
その時投入してみたログ。

U-Boot 1.1.3 (Jun  2 2015 - 17:05:47)

Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fac000
enable ephy clock...done. rf reg 29 = 5
SSC disabled.
spi_wait_nsec: 29 
spi device id: c2 20 17 c2 20 (2017c220)
find flash: MX25L6405D
raspi_read: from:30000 len:1000 
*** Warning - bad CRC, using default environment

============================================ 
Ralink UBoot Version: 4.1.2.0
-------------------------------------------- 
ASIC 7620_MP (Port5GigaSW)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Jun  2 2015  Time:17:05:47
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =64 Mbytes

 Realtek giga Mac init!

 Realtek giga Mac done!

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   5: Load ucos code to SDRAM via TFTP Client. 
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 

raspi_read: from:40028 len:6 

   
5: System Load Boot Loader | F/W  then write to Flash via TFTP Client. 
 Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N)
 Please Input new ones /or Ctrl-C to discard
        Input device IP (192.168.2.81)  Input server IP (192.168.2.89)  Input Linux Kernel filename () 
 netboot_common, argc= 3 

 NetTxPacket = 0x83FE3E80 

 KSEG1ADDR(NetTxPacket) = 0xA3FE3E80 

 NetLoop,call eth_halt ! 

 NetLoop,call eth_init ! 
Trying Eth0 (10/100-M)

 Waitting for RX_DMA_BUSY status Start... done


 Realtek giga Mac init!
regData1 = 0000 regData2 = 0000, RTL8367R
(rtk_switch_init 11983) init_rgmii done 

 Realtek giga Mac support done

 ETH_STATE_ACTIVE!! 
(NetLoop 408) bd->bi_enetaddr = 00:00:aa:bb:cc:dd
(NetLoop 409) NetOurEther = 00:00:aa:bb:cc:dd
Select server or client model: 1/2
server model start
SERVER IP address : 192.168.1.6 port:69
Load address: 0x80a00000
Loading: checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
Got ARP REQUEST, return our IP
Peer IP:192.168.1.89
Got ARP REPLY, set server/gtwy eth addr (3c:97:0e:60:44:30)
Got it
Peer IP:192.168.1.89
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ######################
done
Bytes transferred = 5767953 (580311 hex)
NetBootFileXferSize= 00580311

****************Parse Head**************
signature=CSYS startAddr=0x01100000 burnAddr=0x00070000 nmodTag=RN62 len=0x0057ac72 

****************CheckSume**************
CheckSum ok!
****************Start Upgrade Kernel**************
raspi_erase_write: offs:70000, count:57ac86
raspi_erase: offs:70000 len:570000
.......................................................................................
raspi_write: to:70000 len:570000 
.......................................................................................
raspi_read: from:70000 len:10000 
raspi_read: from:80000 len:10000 
raspi_read: from:90000 len:10000 
raspi_read: from:a0000 len:10000 
raspi_read: from:b0000 len:10000 
raspi_read: from:c0000 len:10000 
raspi_read: from:d0000 len:10000 
raspi_read: from:e0000 len:10000 
raspi_read: from:f0000 len:10000 
raspi_read: from:100000 len:10000 
raspi_read: from:110000 len:10000 
raspi_read: from:120000 len:10000 
raspi_read: from:130000 len:10000 
raspi_read: from:140000 len:10000 
raspi_read: from:150000 len:10000 
raspi_read: from:160000 len:10000 
raspi_read: from:170000 len:10000 
raspi_read: from:180000 len:10000 
raspi_read: from:190000 len:10000 
raspi_read: from:1a0000 len:10000 
raspi_read: from:1b0000 len:10000 
raspi_read: from:1c0000 len:10000 
raspi_read: from:1d0000 len:10000 
raspi_read: from:1e0000 len:10000 
raspi_read: from:1f0000 len:10000 
raspi_read: from:200000 len:10000 
raspi_read: from:210000 len:10000 
raspi_read: from:220000 len:10000 
raspi_read: from:230000 len:10000 
raspi_read: from:240000 len:10000 
raspi_read: from:250000 len:10000 
raspi_read: from:260000 len:10000 
raspi_read: from:270000 len:10000 
raspi_read: from:280000 len:10000 
raspi_read: from:290000 len:10000 
raspi_read: from:2a0000 len:10000 
raspi_read: from:2b0000 len:10000 
raspi_read: from:2c0000 len:10000 
raspi_read: from:2d0000 len:10000 
raspi_read: from:2e0000 len:10000 
raspi_read: from:2f0000 len:10000 
raspi_read: from:300000 len:10000 
raspi_read: from:310000 len:10000 
raspi_read: from:320000 len:10000 
raspi_read: from:330000 len:10000 
raspi_read: from:340000 len:10000 
raspi_read: from:350000 len:10000 
raspi_read: from:360000 len:10000 
raspi_read: from:370000 len:10000 
raspi_read: from:380000 len:10000 
raspi_read: from:390000 len:10000 
raspi_read: from:3a0000 len:10000 
raspi_read: from:3b0000 len:10000 
raspi_read: from:3c0000 len:10000 
raspi_read: from:3d0000 len:10000 
raspi_read: from:3e0000 len:10000 
raspi_read: from:3f0000 len:10000 
raspi_read: from:400000 len:10000 
raspi_read: from:410000 len:10000 
raspi_read: from:420000 len:10000 
raspi_read: from:430000 len:10000 
raspi_read: from:440000 len:10000 
raspi_read: from:450000 len:10000 
raspi_read: from:460000 len:10000 
raspi_read: from:470000 len:10000 
raspi_read: from:480000 len:10000 
raspi_read: from:490000 len:10000 
raspi_read: from:4a0000 len:10000 
raspi_read: from:4b0000 len:10000 
raspi_read: from:4c0000 len:10000 
raspi_read: from:4d0000 len:10000 
raspi_read: from:4e0000 len:10000 
raspi_read: from:4f0000 len:10000 
raspi_read: from:500000 len:10000 
raspi_read: from:510000 len:10000 
raspi_read: from:520000 len:10000 
raspi_read: from:530000 len:10000 
raspi_read: from:540000 len:10000 
raspi_read: from:550000 len:10000 
raspi_read: from:560000 len:10000 
raspi_read: from:570000 len:10000 
raspi_read: from:580000 len:10000 
raspi_read: from:590000 len:10000 
raspi_read: from:5a0000 len:10000 
raspi_read: from:5b0000 len:10000 
raspi_read: from:5c0000 len:10000 
raspi_read: from:5d0000 len:10000 
raspi_read: from:5e0000 len:10000 
raspi_erase: offs:5e0000 len:10000
.
raspi_write: to:5e0000 len:10000 
.
raspi_read: from:5e0000 len:10000 
Done!
## Booting image at bc070000 ...
raspi_read: from:70000 len:40 
Magic number at 0xBC070000 
   Image Name:   MIPS OpenWrt Linux-4.14.138
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1670238 Bytes =  1.6 MB
   Load Address: 80000000
   Entry Point:  80000000
raspi_read: from:70054 len:197c5e 
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 64

Starting kernel ...

[    0.000000] Linux version 4.14.138 (musashino205@Taiha.Net) (gcc version 7.4.0 (OpenWrt GCC 7.4.0 r0+10854-852f048b82)) #0 Fri Aug 23 16:55:26 2019
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[    0.000000] MIPS: machine is ELECOM WRC-733GHBK
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] random: get_random_bytes called from start_kernel+0x98/0x4a0 with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=0007fabe
[    0.000000] Readback ErrCtl register=0007fabe
[    0.000000] Memory: 58360K/65536K available (3917K kernel code, 190K rwdata, 892K rodata, 1200K init, 213K bss, 7176K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[    0.000000] systick: enable autosleep mode
[    0.000000] systick: running - mult: 214748, shift: 32
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000010] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.015467] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.087707] pid_max: default: 32768 minimum: 301
[    0.097160] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.110182] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.131221] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.150708] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.162924] pinctrl core: initialized pinctrl subsystem
[    0.173787] NET: Registered protocol family 16
[    0.665950] PCI host bridge /pcie@10140000 ranges:
[    0.675350]  MEM 0x0000000020000000..0x000000002fffffff
[    0.685722]   IO 0x0000000010160000..0x000000001016ffff
[    0.714206] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.725244] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.737497] GPIO line 0 (rtl8367rb-reset) hogged as output/high
[    0.750035] PCI host bridge to bus 0000:00
[    0.758035] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[    0.771751] pci_bus 0000:00: root bus resource [io  0xffffffff]
[    0.783477] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.796976] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.813215] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.830199] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[    0.843254] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[    0.857062] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x201fffff]
[    0.870562] pci 0000:00:00.0: BAR 1: assigned [mem 0x20200000-0x2020ffff]
[    0.884071] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff]
[    0.897568] pci 0000:01:00.1: BAR 0: assigned [mem 0x20100000-0x201fffff]
[    0.911066] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.920917] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x201fffff]
[    0.938629] clocksource: Switched to clocksource systick
[    0.950480] NET: Registered protocol family 2
[    0.959938] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.973721] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.986303] TCP: Hash tables configured (established 1024 bind 1024)
[    0.999087] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    1.010614] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    1.023350] NET: Registered protocol family 1
[    1.035064] rt-timer 10000100.timer: maximum frequency is 1220Hz
[    1.047873] Crashlog allocated RAM at address 0x3f00000
[    1.060080] workingset: timestamp_bits=14 max_order=14 bucket_order=0
[    1.080014] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.091518] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    1.124159] io scheduler noop registered
[    1.131868] io scheduler deadline registered (default)
[    1.142881] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    1.156522] console [ttyS0] disabled
[    1.163578] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[    1.183243] console [ttyS0] enabled
[    1.183243] console [ttyS0] enabled
[    1.197059] bootconsole [early0] disabled
[    1.197059] bootconsole [early0] disabled
[    1.213531] cacheinfo: Failed to find cpu0 device node
[    1.223811] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    1.241020] spi spi0.0: force spi mode3
[    1.249524] m25p80 spi0.0: mx25l6405d (8192 Kbytes)
[    1.259355] 6 fixed-partitions partitions found on MTD device spi0.0
[    1.272021] Creating 6 MTD partitions on "spi0.0":
[    1.281598] 0x000000000000-0x000000030000 : "u-boot"
[    1.292477] 0x000000030000-0x000000040000 : "u-boot-env"
[    1.304022] 0x000000040000-0x000000050000 : "factory"
[    1.315022] 0x000000050000-0x000000070000 : "nvram"
[    1.325661] 0x000000070000-0x0000007f0000 : "firmware"
[    1.340588] 2 edimax-fw partitions found on MTD device firmware
[    1.352442] Creating 2 MTD partitions on "firmware":
[    1.362354] 0x000000000000-0x000000197cb2 : "kernel"
[    1.373202] 0x000000197cb2-0x000000780000 : "rootfs"
[    1.383991] mtd: device 6 (rootfs) set to be root filesystem
[    1.396927] 1 squashfs-split partitions found on MTD device rootfs
[    1.409321] 0x00000057b000-0x000000780000 : "rootfs_data"
[    1.421034] 0x0000007f0000-0x000000800000 : "hwconfig"
[    1.433043] libphy: Fixed MDIO Bus: probed
[    1.451060] gsw: setting port4 to ephy mode
[    1.459500] mtk_soc_eth 10100000.ethernet: generated random MAC address 62:be:ad:3f:f9:38
[    1.475838] mtk_soc_eth 10100000.ethernet: using fixed link parameters
[    1.488931] mtk_soc_eth 10100000.ethernet: loaded mt7620 driver
[    1.501443] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    1.518465] rt2880_wdt 10000120.watchdog: Initialized
[    1.529931] NET: Registered protocol family 10
[    1.542959] Segment Routing with IPv6
[    1.550459] NET: Registered protocol family 17
[    1.559409] 8021q: 802.1Q VLAN Support v1.8
[    1.578909] VFS: Mounted root (squashfs filesystem) readonly on device 31:6.
[    1.599546] Freeing unused kernel memory: 1200K
[    1.608595] This architecture does not have kernel memory protection.
[    2.623338] init: Console is alive
[    2.630457] init: - watchdog -
[    2.798590] random: fast init done
[    3.878900] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    4.104077] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.121329] init: - preinit -
[    5.573772] mtk_soc_eth 10100000.ethernet eth0: port 5 link up (1000Mbps/Full duplex)
[    5.590196] 8021q: adding VLAN 0 to HW filter on device eth0
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3[    5.753384] random: procd: uninitialized urandom read (4 bytes read)
] or [4] key and hit [enter] to select the debug level
[    6.316998] mount_root: no usable overlay filesystem found, using tmpfs overlay
[    6.364486] urandom-seed: Seed file not found (/etc/urandom.seed)
[    6.461068] mtk_soc_eth 10100000.ethernet eth0: port 5 link down
[    6.485387] procd: - early -
[    6.491235] procd: - watchdog -
[    6.698076] procd: - watchdog -
[    6.704756] procd: - ubus -
[    6.862689] random: ubusd: uninitialized urandom read (4 bytes read)
[    6.981070] random: ubusd: uninitialized urandom read (4 bytes read)
[    6.994384] random: ubusd: uninitialized urandom read (4 bytes read)
[    7.008207] procd: - init -
Please press Enter to activate this console.
[    7.922544] urandom_read: 5 callbacks suppressed
[    7.922555] random: jshn: uninitialized urandom read (4 bytes read)
[    8.361984] kmodloader: loading kernel modules from /etc/modules.d/*
[    8.541834] urngd: jent-rng init failed, err: 2
[    8.652330] nat46: module (version 683fbd2b765506332a1af141545652bf58f03166) loaded.
[    8.675599] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    8.697423] rtl8367b rtl8367rb: cannot find mdio node phandle
[    8.708988] rtl8367b rtl8367rb: using GPIO pins 22 (SDA) and 23 (SCK)
[    8.722970] rtl8367b rtl8367rb: RTL8367RB chip found
[    9.966115] libphy: rtl8367rb: probed
[   10.083435] Loading modules backported from Linux version v5.3-rc4-0-gd45331b00ddb
[   10.098595] Backport generated by backports.git v5.3-rc4-1-0-g4ec72687
[   10.115153] ip_tables: (C) 2000-2006 Netfilter Core Team
[   10.136997] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
[   10.230487] xt_time: kernel timezone is -0000
[   10.404182] PPP generic driver version 2.4.2
[   10.415835] NET: Registered protocol family 24
[   10.440335] mt76x0e 0000:01:00.0: card - bus=0x1, slot = 0x0 irq=4
[   10.452952] mt76x0e 0000:01:00.0: ASIC revision: 76100002
[   10.466491] mt76x0e 0000:01:00.0: Firmware Version: 0.1.00
[   10.507031] mt76x0e 0000:01:00.0: EEPROM ver:01 fae:00
[   10.568137] ieee80211 phy1: rt2x00lib_request_eeprom_file: Info - Loading EEPROM data from 'soc_wmac.eeprom'.
[   10.588143] rt2800_wmac 10180000.wmac: Direct firmware load for soc_wmac.eeprom failed with error -2
[   10.606373] rt2800_wmac 10180000.wmac: Falling back to user helper
[   11.536487] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected
[   11.551999] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 7620 detected
[   11.602846] kmodloader: done loading kernel modules from /etc/modules.d/*
[   51.845474] mtk_soc_eth 10100000.ethernet eth0: port 5 link up (1000Mbps/Full duplex)
[   51.861628] 8021q: adding VLAN 0 to HW filter on device eth0
[   51.946429] device eth0 entered promiscuous mode
[   51.997223] br-lan: port 1(eth0.1) entered blocking state
[   52.008062] br-lan: port 1(eth0.1) entered disabled state
[   52.019216] device eth0.1 entered promiscuous mode
[   52.094894] br-lan: port 1(eth0.1) entered blocking state
[   52.105723] br-lan: port 1(eth0.1) entered forwarding state
[   52.117038] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   52.873138] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   55.379325] jffs2: Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes
[   55.396188] jffs2: empty_blocks 0, bad_blocks 0, c->nr_blocks 517
[   63.886220] random: crng init done



BusyBox v1.31.0 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r0+10852-a5aab6f68e
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:/# 

なんだかJFFS2周りがおかしいが、とりあえずこれで投入することが可能なことを確認。
JFFS2のエラーによりユーザー領域 (rootfs_data) が構築されない問題が発生するが、 firstboot 実施の上再起動することで正常に機能するようになった。

OpenWrtサポート作業状況+予定

WRC-733GHBK
factory投入テスト、最終的なコードチェックで投げ込み
 → 投げ込んだ
WRC-1167GHBK2-I
WRC-1167GHBK2, WRC-1167GHBK2-Cとの互換性をファームからのみ再調査、投げ込みはWRC-733GHBKの様子を見て判断
ただし、投げ込むとしてもWRC-1167GHBK2(-C)実機が手元で確認できない限り、WRC-1167GHBK2(-C)のサポートは含めない
WN-DX1167R
某フリマアプリにて購入済みのWN-AX1167GR2が届き次第、それのサポート作業と同時にDXとのDeviceTreeやsysupgrade周辺コード擦り合わせ実施
WNPR2600G
PRへのOpenWrtチームからの反応があまり無い
NetBSDなNEC機 (WR8750N, WR9500N, WG600HP)
通常のLinux機優先しているため投げ込みは保留中、自repo (musashino-build/openwrt) でのメンテナンスは継続
WR8175N, WG300HPはFlashが4MBのみのため、NetBSD機を投げ込むかどうかに関わらず独自のサポートに留める予定
WSR-2533DHPL
サポート作業は大体完了、あとはOpenWrt化のテストなどいくらか
WSR-2533DHP2
openwrt-devel MLに来ていたRTL8367Sドライバをウォッチ中、それの動向次第

作業予定

WCR-1166DS(入手予定)
MACアドレス構成コード周りの簡略化(mtd_get_mac_ascii へ置換), factoryのbrick問題検証
WSR-1166DHP(2)
MACアドレス構成コード周りの簡略化(mtd_get_mac_asciiへ置換)