RB91x ath79 Device Tree support

Hi Everyone,
I have been working on this for a couple of days, and have managed to get some stuff figured out with device tree.

I have made some hacks to the rb91x_nand driver, so it boots into openwrt, but I haven't tested USB/PCIE/wireless yet.

Is there any guidelines/recommendations for contributing to the device tree initiative?

dmesg output

[    0.000000] Linux version 4.14.44 (silverchris@management) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7093-4fdc6ca)) #0 Fri Jun 1 19:01:03 2018
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001974c (MIPS 74Kc)
[    0.000000] MIPS: machine is Mikrotik RB911/RB912
[    0.000000] SoC: Atheros AR9342 rev 3
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache 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] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 80548150, node_mem_map 81006040
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] random: get_random_bytes called from start_kernel+0x8c/0x43c with crng_init=0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,115200 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=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 58016K/65536K available (3960K kernel code, 144K rwdata, 924K rodata, 1236K init, 212K bss, 7520K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] CPU clock: 600.000 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6370868154 ns
[    0.000010] sched_clock: 32 bits at 300MHz, resolution 3ns, wraps every 7158278654ns
[    0.008877] Calibrating delay loop... 299.82 BogoMIPS (lpj=1499136)
[    0.086015] pid_max: default: 32768 minimum: 301
[    0.091498] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.099006] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.111038] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.122268] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.129289] pinctrl core: initialized pinctrl subsystem
[    0.135818] NET: Registered protocol family 16
[    0.164733] clocksource: Switched to clocksource MIPS
[    0.171753] NET: Registered protocol family 2
[    0.177592] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.185580] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.192808] TCP: Hash tables configured (established 1024 bind 1024)
[    0.200201] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.206899] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.214340] NET: Registered protocol family 1
[    0.219369] PCI: CLS 0 bytes, default 32
[    0.224623] Crashlog allocated RAM at address 0x3f00000
[    0.234954] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.247617] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.254239] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.275450] io scheduler noop registered
[    0.279902] io scheduler deadline registered (default)
[    0.287949] pinctrl-single 1804002c.pinmux: 544 pins at pa b804002c size 68
[    0.297037] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.305143] console [ttyS0] disabled
[    0.309245] 18020000.uart: ttyS0 at MMIO 0x18020000 (irq = 8, base_baud = 1562500) is a 16550A
[    0.319095] console [ttyS0] enabled
[    0.326664] bootconsole [early0] disabled
[    0.354214] m25p80 spi0.0: w25x05 (64 Kbytes)
[    0.359124] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.365749] Creating 4 MTD partitions on "spi0.0":
[    0.370708] 0x000000000000-0x00000000c000 : "routerboot"
[    0.377150] 0x00000000c000-0x000000019000 : "hard_config"
[    0.382739] mtd: partition "hard_config" extends beyond the end of device "spi0.0" -- size truncated to 0x4000
[    0.393955] 0x00000000d000-0x00000001b000 : "bios"
[    0.398984] mtd: partition "bios" extends beyond the end of device "spi0.0" -- size truncated to 0x3000
[    0.409601] 0x00000000e000-0x00000001d000 : "soft_config"
[    0.415256] mtd: partition "soft_config" extends beyond the end of device "spi0.0" -- size truncated to 0x2000
[    0.426751] NAND flash driver for the RouterBOARD 91x series
[    0.432656] rb91x nand device tree loaded
[    0.436866] rb91x nand pdata done
[    0.443591] nand: device found, Manufacturer ID: 0xef, Chip ID: 0xf1
[    0.450224] nand: Winbond W29N01GV
[    0.453739] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.461582] Scanning device for bad blocks
[    0.515286] Creating 3 MTD partitions on "W29N01GV":
[    0.520438] 0x000000000000-0x000000040000 : "booter"
[    0.526546] 0x000000040000-0x000000400000 : "kernel"
[    0.532528] 0x000000400000-0x000008000000 : "ubi"
[    0.540772] libphy: Fixed MDIO Bus: probed
[    0.546403] ag71xx 19000000.eth: invalid MAC address, using random address
[    1.515134] libphy: mdio: probed
[    1.614976] ag71xx 19000000.eth: connected to PHY at mdio-bus.0:00 [uid=004dd074, driver=Atheros 8031 ethernet]
[    1.626183] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:RGMII
[    1.632846] ath79-wdt 18060008.wdt: timeout value must be 0 < timeout < 12, using 12
[    1.645547] NET: Registered protocol family 10
[    1.653873] Segment Routing with IPv6
[    1.657875] NET: Registered protocol family 17
[    1.662528] 8021q: 802.1Q VLAN Support v1.8
[    1.670745] UBI: auto-attach mtd6
[    1.674218] ubi0: attaching mtd6
[    1.882323] ubi0: scanning is finished
[    1.902027] ubi0: attached mtd6 (name "ubi", size 124 MiB)
[    1.907770] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    1.914885] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    1.921895] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    1.929092] ubi0: good PEBs: 992, bad PEBs: 0, corrupted PEBs: 0
[    1.935301] ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128
[    1.942765] ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 248540513
[    1.952113] ubi0: available PEBs: 0, total reserved PEBs: 992, PEBs reserved for bad PEB handling: 20
[    1.961718] ubi0: background thread "ubi_bgt0d" started, PID 302
[    1.969613] block ubiblock0_1: created from ubi0:1(rootfs)
[    1.975365] ubiblock: device ubiblock0_1 (rootfs) set to be root filesystem
[    1.990226] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    2.006500] Freeing unused kernel memory: 1236K
[    2.011198] This architecture does not have kernel memory protection.
[    2.126420] random: fast init done
[    2.550026] init: Console is alive
[    2.553992] init: - watchdog -
[    2.676043] init: - preinit -
[    3.521265] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    6.666673] eth0: link up (1000Mbps/Full duplex)
[    6.675016] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    6.923496] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" started, PID 349
[    6.991567] UBIFS (ubi0:2): recovery needed
[    6.996362] random: procd: uninitialized urandom read (4 bytes read)
[    7.156821] UBIFS (ubi0:2): recovery completed
[    7.161582] UBIFS (ubi0:2): UBIFS: mounted UBI device 0, volume 2, name "rootfs_data"
[    7.169736] UBIFS (ubi0:2): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[    7.180010] UBIFS (ubi0:2): FS size: 117325824 bytes (111 MiB, 924 LEBs), journal size 5840896 bytes (5 MiB, 46 LEBs)
[    7.190990] UBIFS (ubi0:2): reserved for root: 4952683 bytes (4836 KiB)
[    7.197854] UBIFS (ubi0:2): media format: w4/r0 (latest is w5/r0), UUID 853EA9A4-1BC3-4ADE-AC9B-0AE552446252, small LPT model
[    7.212576] mount_root: switching to ubifs overlay
[    7.228900] urandom-seed: Seeding with /etc/urandom.seed
[    7.293696] procd: - early -
[    7.296988] procd: - watchdog -
[    7.704751] eth0: link down
[    7.948434] procd: - watchdog -
[    7.952100] procd: - ubus -
[    8.102369] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.227369] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.234952] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.242673] procd: - init -
[    9.266453] urandom_read: 5 callbacks suppressed
[    9.266463] random: jshn: uninitialized urandom read (4 bytes read)
[   14.538290] export_store: invalid GPIO 52
[   16.505145] br-lan: port 1(eth0) entered blocking state
[   16.510608] br-lan: port 1(eth0) entered disabled state
[   16.516406] device eth0 entered promiscuous mode
[   16.523939] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   19.626623] eth0: link up (1000Mbps/Full duplex)
[   19.631515] br-lan: port 1(eth0) entered blocking state
[   19.637092] br-lan: port 1(eth0) entered forwarding state
[   19.645078] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   33.053078] random: crng init done

Best is to submit your preliminary work to the mailing list as RFC patches.

@silverchris I picked this up yesterday.
Had a Basebox2 laying around so I thought to do something useful.
Did you face the issue of getting stuck on Decompressing kernel?
It will sometimes boot and sometimes get stuck there

Actually weirdly it only happens when nand-utils are included