Nand flash driver for bcm47xx wnr3500lv2

Hi,

I'm trying to have a version working for netgear wnr3500 lv2. As you may know there exists Lede images for this device but they do not work at all, the device getting bricked after flash.

I've found ways to build images that I can flash, and where the kernel boots (openwrt kernel or hand built kernel). But I can't get the flash/nand device to work so I cannot mount any root fs. I've tried to add many drivers in my hand built kernel but it does not change anything for now:

Starting program at 0x80001000
[    0.000000] Linux version 4.4.89 (pparent@pierre-laptop) (gcc version 5.4.0 (LEDE GCC 5.4.0 r4970-a37655b) ) #0 Tue Oct 3 09:07:26 2017
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019749 (MIPS 74Kc)
[    0.000000] bcm47xx: Using bcma bus
-->[    0.000000] bcma: bus0: Found chip with id 0x5357, rev 0x02 and package 0x0A[/b]
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 07fff000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffefff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffefff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffefff]
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32511
[    0.000000] Kernel command line: console=ttyS0,115200  noinitrd init=/bin/sh
[    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=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 124368K/131068K available (3840K kernel code, 164K rwdata, 944K rodata, 224K init, 300K bss, 6700K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:128
[    0.000000] bcma: bus0: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x26, class 0x0)
[    0.000000] bcma: bus0: Core 1 found: IEEE 802.11 (manuf 0x4BF, id 0x812, rev 0x1C, class 0x0)
[    0.000000] bcma: bus0: Core 2 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x03, class 0x0)
[    0.000000] bcma: bus0: Core 3 found: MIPS 74K (manuf 0x4A7, id 0x82C, rev 0x04, class 0x0)
[    0.000000] bcma: bus0: Core 4 found: USB 2.0 Host (manuf 0x4BF, id 0x819, rev 0x05, class 0x0)
[    0.000000] bcma: bus0: Core 5 found: DDR1/DDR2 Memory Controller (manuf 0x4BF, id 0x82E, rev 0x02, class 0x0)
[    0.000000] bcma: bus0: Core 6 found: I2S (manuf 0x4BF, id 0x834, rev 0x02, class 0x0)
[    0.000000] bcma: bus0: Core 7 found: Internal Memory (manuf 0x4BF, id 0x80E, rev 0x0B, class 0x0)
-->[    0.000000] bcma: bus0: Unsupported ST serial flash (id: 0x0, id2: 0x0)[/b]
[    0.000000] bcma: bus0: Early bus registered
[    0.000000] MIPS: machine is Unknown Board
[    0.000000] bcm47xx: Setting up vectored interrupts
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7963585194 ns
[    0.000014] sched_clock: 32 bits at 240MHz, resolution 4ns, wraps every 8947848189ns
[    0.008695] Calibrating delay loop... 239.61 BogoMIPS (lpj=1198080)
[    0.081647] pid_max: default: 32768 minimum: 301
[    0.087017] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.094367] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.106985] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.117978] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.125885] NET: Registered protocol family 16
[    0.170089] SCSI subsystem initialized
[    0.177138] clocksource: Switched to clocksource MIPS
[    0.185749] NET: Registered protocol family 2
[    0.191967] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.199790] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.206806] TCP: Hash tables configured (established 1024 bind 1024)
[    0.214070] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.220613] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.228078] NET: Registered protocol family 1
[    0.250633] can not parse nvram name sb/1/boardnum(null) with value 3500L got -22
[    0.275717] bcma: bus0: Bus registered
[    0.316038] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.322586] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.349553] io scheduler noop registered
[    0.353859] io scheduler deadline registered (default)
[    0.360069] Serial: 8250/16550 driver, 2 ports, IRQ sharing enabled
[    0.392520] serial8250.0: ttyS0 at MMIO 0xb8000300 (irq = 2, base_baud = 1250000) is a U6_16550A
[    0.402326] console [ttyS0] enabled
[    0.402326] console [ttyS0] enabled
[    0.409719] bootconsole [early0] disabled
[    0.409719] bootconsole [early0] disabled
[    0.419666] st: Version 20101219, fixed bufsize 32768, s/g segs 256
[    0.426334] osst :I: Tape driver with OnStream support version 0.99.4
[    0.426334] osst :I: $Id: osst.c,v 1.73 2005/01/01 21:13:34 wriede Exp $
[    0.440843] SCSI Media Changer driver v0.25 
-->][    0.448216] bcm47xxnflash: Device not supported
[    0.452820] bcm47xxnflash: Initialization failed: -524[/b]
[    0.458167] bcma_nflash: probe of bcma_nflash.0 failed with error -524
[    0.479737] libphy: Fixed MDIO Bus: probed
[    0.484247] bgmac_bcma bcma0:2: Found PHY addr: 30 (NOREGS)
[    0.492863] libphy: bcma_mdio mii bus: probed
[    0.497400] bgmac_bcma bcma0:2: Support for Roboswitch not implemented
[    0.655077] b53_common: found switch: BCM53115, rev 8
[    0.661702] bgmac_bcma: Broadcom 47xx GBit MAC driver loaded
[    0.668393] bcm47xx-wdt bcm47xx-wdt.0: BCM47xx Watchdog Timer enabled (30 seconds)
[    0.676575] Synopsys Designware Multimedia Card Interface Driver
[    0.685547] NET: Registered protocol family 10
[    0.698019] NET: Registered protocol family 17
[    0.702706] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    0.715633] 8021q: 802.1Q VLAN Support v1.8
[    0.726297] Key type encrypted registered
[    0.732566] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.744226] Rebooting in 10 seconds.

As a comparaison there is a dd-wrt version compiled by kong which works on wnr3500-lv2 and which outputs the following:

Starting program at 0x80001000
Linux version 3.10.84 (bluebat@opensuse) (gcc version 5.1.0 (OpenWrt GCC 5.1.0 r45933) ) #67 Fri Jul 17 08:06:51 CEST 2015
CPU revision is: 00019749 (MIPS 74Kc)
->Found a AMD NAND flash with 2048B pages or 128KB blocks; total size 128MB
Determined physical RAM map:
 memory: 07fff000 @ 00000000 (usable)
Zone ranges:
  Normal   [mem 0x00000000-0x07ffefff]
  HighMem  empty
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x00000000-0x07ffefff]
Primary instruction cache 32kB, 4-way, VIPT, I-cache aliases, linesize 32 bytes.
Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32511
Kernel command line: console=ttyS0,115200 root=1f05 rootfstype=squashfs noinitrd init=/bin/sh
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Writing ErrCtl register=00000000
Readback ErrCtl register=00000000
Memory: 125144k/131068k available (3180k kernel code, 5924k reserved, 547k data, 300k init, 0k highmem)
NR_IRQS:128
CPU: BCM5357 rev 2 at 480 MHz
bcm947xx_clockevent_set_mode: 1
bcm947xx_clockevent_set_mode: 3
console [ttyS0] enabled
Calibrating delay loop... 239.61 BogoMIPS (lpj=1198080)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
PCI: no core
PCI: no core
PCI: scanning bus 0
PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
pci_bus 0000:00: root bus resource [mem 0x00000000-0xffffffff]
pci_bus 0000:00: root bus resource [bus 00-ff]
PCI: Fixing up bus 0
Switching to clocksource MIPS
NET: Registered protocol family 2
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
WNR3500L V2 GPIO Init
squashfs: version 3.0 (2006/03/15) Phillip Lougher
msgmni has been set to 244
io scheduler noop registered (default)
HDLC line discipline maxframe=4096
N_HDLC line discipline registered.
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250: ttyS0 at MMIO 0x0 (irq = 8) is a U6_16550A
brd: module loaded
pflash: found no supported devices
Found an ST compatible serial flash with 0 64KB blocks; total size 0MB
bcmsflash: found no supported devices
-->Creating 2 MTD partitions on "brcmnand":
-->0x000000500000-0x000002000000 : "linux"
-->0x000004000000-0x000007f00000 : "ddwrt"
-->Boot partition size = 524288(0x80000)
-->lookup_nflash_rootfs_offset: offset = 0x500000
-->found trx at 500000, len =15257600
-->scan filesys at 678000
-->nflash: squash filesystem with lzma found at offset 500000
-->Creating 4 MTD partitions on "nflash":
-->0x000000000000-0x000000080000 : "cfe"
-->0x000000080000-0x000000200000 : "nvram"
-->0x000000500000-0x000002000000 : "nandimage"
-->0x000000678000-0x000002000000 : "rootfs"
-->mtd: partition "rootfs" set to be root filesystem
add netgear boarddata for pflash if exists
add netgear boarddata for sflash if exists
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
PPP generic driver version 2.4.2
PPP BSD Compression module registered
PPP Deflate Compression module registered
PPP MPPE Compression module registered
NET: Registered protocol family 24
Broadcom Watchdog Timer: 0.07 initialized.
GACT probability NOT on
Mirror/redirect action on
Failed to load ipt action
Simple TC action Loaded
netem: version 1.3
u32 classifier
    Performance counters on
    input device check on
    Actions configured
Netfilter messages via NETLINK v0.30.
nf_conntrack version 0.5.0 (1955 buckets, 7820 max)
nf_conntrack_rtsp v0.6.21 loading
xt_time: kernel timezone is -0000
ip_set: protocol 6
gre: GRE over IPv4 demultiplexor driver
nf_nat_rtsp v0.6.21 loading
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP: bic registered
TCP: cubic registered
TCP: westwood registered
TCP: highspeed registered
TCP: hybla registered
TCP: htcp registered
TCP: vegas registered
TCP: veno registered
TCP: scalable registered
TCP: lp registered
TCP: yeah registered
TCP: illinois registered
NET: Registered protocol family 17
Bridge firewalling registered
8021q: 802.1Q VLAN Support v1.8
startup nvram driver
found nvram
VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
Freeing unused kernel memory: 300K (803a5000 - 803f0000)
start service
starting Architecture code for broadcom

Pretty much the same with tomato. Obviously it fails because I don't get "Found a AMD NAND flash", in openwrt or lede. I don't understand what more can be included in dd-wrt kernel, that is not openwrt or lede or my hand-built kernel. Any help would be much welcome!

Pierre.

You need to add support for this NAND controller to the drivers/mtd/nand/bcm47xxnflash/ located driver. You can use Broadcom's SDK (e.g. from DD-WRT) as a reference. Don't expect this to be an easy task.

Ok thanks a lot for your comment!

If this is just a driver missing Why should it be more complicated than copying it from dd-wrt?
I will try to copy and paste drivers/mtd/nand/bcm47xxnflash/ from dd-wrt 3.10 kernel and see what happens.

The output looks awful lot similar to the DIR-868L build I was trying to boot. The DIR-868L has the BCM4708 SOC with 128MB of NAND flash. I managed to get it to boot by changing the NAND flash partition to a size of 0x200000.

I’ve posted the DTS file. I think you can use the same NAND partition configuration. The existing LEDE NAND flash drivers should work fine.

Ps: I found the dts on your other post. Thanks a lot!

Can you explain briefly how to include it in my kernel compilation? Never used dts/dtb without u-boot and CFE is shit. Can you have the dts built-in the kernel??

Ps: BCM4708 seems to be ARM. But BCM5357 in 3500lv2 is MIPS. I'm not sure if device tree is supported for BCM47xx MIPS?

I'm not too sure whether the MIPS CPU kernel supports DTS. You may be right in that it has to be coded into the drivers.

In any case, the error I see posted by you (i.e. the VFS error) seems to suggest that the kernel is unable find the rootfs, so it panicked. I encountered the same error. I compared the dd-wrt bootlog in my case and noticed the NAND flash partition difference, so I changed the DTS file.

For your case, you may want to try changing the kernel driver code where the NAND flash partition is specified and try the partition layout as shown in the DD-WRT boot log for your router.

Hope the above make sense to you.

[Edited]
Re-looked into the log you posted. Looks like driver issue after all. I suppose you can try to port dd-wrt's driver over to lede?

I have a problem with rootfs simply because NAND is not running. I've also tryied to boot on a rootfs located on a USB drive. But the Usb drive does not seems to be detected either (but it is in dd-wrt). (Of course I've added all required USB drivers in my kernel config). I find strange that USB does not work either.

I've tried to copy and paste the folder drivers/mtd/nand/bcm47xxnflash/ from dd-wrt kernel (as rmilecki suggested the driver was in that folder) but it did not changed anything.

Also, somehow I don't succeed in cross-compiling any kernel from dd-wrt tree (many compilation errors with them, I have no problem with cross-compiling mainline, openwrt or lede kernel). Dd-wrt code seems to me as ugly as hell...

Latest kernel log with USB enbled and dd-wrt driver for bcm47xxnflash:

[    0.000000] Linux version 4.4.89 (pparent@pierre-laptop) (gcc version 5.4.0 (LEDE GCC 5.4.0 r4970-a37655b) ) #0 Tue Oct 3 09:07:26 2017
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019749 (MIPS 74Kc)
[    0.000000] bcm47xx: Using bcma bus
[    0.000000] bcma: bus0: Found chip with id 0x5357, rev 0x02 and package 0x0A
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 07fff000 @ 00000000 (usable)
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffefff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffefff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffefff]
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32511
[    0.000000] Kernel command line: console=ttyS0,115200 init=/bin/sh 
[    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=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 123856K/131068K available (4258K kernel code, 179K rwdata, 1060K rodata, 188K init, 302K bss, 7212K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:128
[    0.000000] bcma: bus0: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x26, class 0x0)
[    0.000000] bcma: bus0: Core 1 found: IEEE 802.11 (manuf 0x4BF, id 0x812, rev 0x1C, class 0x0)
[    0.000000] bcma: bus0: Core 2 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x03, class 0x0)
[    0.000000] bcma: bus0: Core 3 found: MIPS 74K (manuf 0x4A7, id 0x82C, rev 0x04, class 0x0)
[    0.000000] bcma: bus0: Core 4 found: USB 2.0 Host (manuf 0x4BF, id 0x819, rev 0x05, class 0x0)
[    0.000000] bcma: bus0: Core 5 found: DDR1/DDR2 Memory Controller (manuf 0x4BF, id 0x82E, rev 0x02, class 0x0)
[    0.000000] bcma: bus0: Core 6 found: I2S (manuf 0x4BF, id 0x834, rev 0x02, class 0x0)
[    0.000000] bcma: bus0: Core 7 found: Internal Memory (manuf 0x4BF, id 0x80E, rev 0x0B, class 0x0)
[    0.000000] bcma: bus0: Unsupported ST serial flash (id: 0x0, id2: 0x0)
[    0.000000] bcma: bus0: Early bus registered
[    0.000000] MIPS: machine is Unknown Board
[    0.000000] bcm47xx: Setting up vectored interrupts
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7963585194 ns
[    0.000014] sched_clock: 32 bits at 240MHz, resolution 4ns, wraps every 8947848189ns
[    0.008694] Calibrating delay loop... 239.61 BogoMIPS (lpj=1198080)
[    0.081648] pid_max: default: 32768 minimum: 301
[    0.087017] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.094369] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.106858] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.117855] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.125759] NET: Registered protocol family 16
[    0.174077] SCSI subsystem initialized
[    0.179206] usbcore: registered new interface driver usbfs
[    0.185523] usbcore: registered new interface driver hub
[    0.191554] usbcore: registered new device driver usb
[    0.199829] clocksource: Switched to clocksource MIPS
[    0.208255] NET: Registered protocol family 2
[    0.214454] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.222269] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.229291] TCP: Hash tables configured (established 1024 bind 1024)
[    0.236568] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.243120] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.250572] NET: Registered protocol family 1
[    0.263847] can not parse nvram name sb/1/boardnum(null) with value 3500L got -22
[    0.288986] bcma: bus0: Bus registered
[    0.339577] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.346125] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.373230] io scheduler noop registered
[    0.377530] io scheduler deadline registered (default)
[    0.383702] Serial: 8250/16550 driver, 2 ports, IRQ sharing enabled
[    0.416142] serial8250.0: ttyS0 at MMIO 0xb8000300 (irq = 2, base_baud = 1250000) is a U6_16550A
[    0.425949] console [ttyS0] enabled
[    0.425949] console [ttyS0] enabled
[    0.433349] bootconsole [early0] disabled
[    0.433349] bootconsole [early0] disabled
[    0.443042] st: Version 20101219, fixed bufsize 32768, s/g segs 256
[    0.449745] osst :I: Tape driver with OnStream support version 0.99.4
[    0.449745] osst :I: $Id: osst.c,v 1.73 2005/01/01 21:13:34 wriede Exp $
[    0.464235] SCSI Media Changer driver v0.25 
[    0.471139] bcm47xxnflash: Device not supported
[    0.475741] bcm47xxnflash: Initialization failed: -524
[    0.481093] bcma_nflash: probe of bcma_nflash.0 failed with error -524
[    0.502419] libphy: Fixed MDIO Bus: probed
[    0.506943] bgmac_bcma bcma0:2: Found PHY addr: 30 (NOREGS)
[    0.515552] libphy: bcma_mdio mii bus: probed
[    0.520095] bgmac_bcma bcma0:2: Support for Roboswitch not implemented
[    0.677782] b53_common: found switch: BCM53115, rev 8
[    0.684410] bgmac_bcma: Broadcom 47xx GBit MAC driver loaded
[    0.691400] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.698045] ehci-platform: EHCI generic platform driver
[    0.704156] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.710602] ohci-platform: OHCI generic platform driver
[    0.728079] ohci-platform ohci-platform.0: Generic Platform OHCI controller
[    0.735661] ohci-platform ohci-platform.0: new USB bus registered, assigned bus number 1
[    0.744161] ohci-platform ohci-platform.0: irq 5, io mem 0x18009000
[    0.814227] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
[    0.821225] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.828567] usb usb1: Product: Generic Platform OHCI controller
[    0.834631] usb usb1: Manufacturer: Linux 4.4.89 ohci_hcd
[    0.840163] usb usb1: SerialNumber: ohci-platform.0
[    0.846596] hub 1-0:1.0: USB hub found
[    0.851261] hub 1-0:1.0: 2 ports detected
[    0.856819] ehci-platform ehci-platform.0: EHCI Host Controller
[    0.863306] ehci-platform ehci-platform.0: new USB bus registered, assigned bus number 2
[    0.871820] ehci-platform ehci-platform.0: irq 5, io mem 0x18004000
[    0.889891] ehci-platform ehci-platform.0: USB 2.0 started, EHCI 1.00
[    0.896852] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    0.903843] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.911226] usb usb2: Product: EHCI Host Controller
[    0.916187] usb usb2: Manufacturer: Linux 4.4.89 ehci_hcd
[    0.921713] usb usb2: SerialNumber: ehci-platform.0
[    0.928117] hub 2-0:1.0: USB hub found
[    0.932765] hub 2-0:1.0: 2 ports detected
[    0.938066] fotg210_hcd: FOTG210 Host Controller (EHCI) Driver
[    0.944086] Warning! fotg210_hcd should always be loaded before uhci_hcd and ohci_hcd, not after
[    0.953891] usbcore: registered new interface driver uas
[    0.959708] usbcore: registered new interface driver usb-storage
[    0.966134] usbcore: registered new interface driver ums-alauda
[    0.972449] usbcore: registered new interface driver ums-cypress
[    0.978726] usbcore: registered new interface driver ums-datafab
[    0.985174] usbcore: registered new interface driver ums_eneub6250
[    0.991772] usbcore: registered new interface driver ums-freecom
[    0.998050] usbcore: registered new interface driver ums-isd200
[    1.004376] usbcore: registered new interface driver ums-jumpshot
[    1.010884] usbcore: registered new interface driver ums-karma
[    1.017028] usbcore: registered new interface driver ums-realtek
[    1.023487] usbcore: registered new interface driver ums-sddr09
[    1.029712] usbcore: registered new interface driver ums-sddr55
[    1.036071] usbcore: registered new interface driver ums-usbat
[    1.042512] Synopsys Designware Multimedia Card Interface Driver
[    1.051139] NET: Registered protocol family 10
[    1.066925] NET: Registered protocol family 17
[    1.071736] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    1.084661] 8021q: 802.1Q VLAN Support v1.8
[    1.095411] Key type encrypted registered
[    1.101542] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

NAND flash stores jffs fs while your USB probably is ext2/3/4?

Maybe you should also include the fs kernel module.

But i’m not sure how that goes tho. Normally the init process will mount filesystems.

I've already added fs drivers for ext2,3,4. The vendor ID and device ID of my USB drive are not even detected to begin with, so that's not the problem.

If the usb drive was detected I could have easily run the system on it specifying root=/dev/sda1 . I've already done that on other devices, it's very easy, when USB works well.

Thanks for your answers and your time!

You may also need to power on the USB port. The BCM53xxx SOC for ARM uses GPIOs for that. Maybe the MIPS one is the same.

Anyway, sorry I can’t help much.

I think that the driver needed for the NAND might be this one:

I've not yet succeeded in compiling it with my kernel though because it has many dependencies to "brcm sdk"

Pierre.

@quarky yes you're right the USB does not seem to be powered with my kernel.

I've add brcm sdk and nand driver to the kernel of openwrt 15.05, and made few modifications so that it compiles.

But it still does not work. Here are the remaining known problem:

*No PCI bus is found event though I have added all relevent PCI drivers. In the driver pci_find_bus(0, 0) returns NULL.
*In brcmand_47xx.c attriubutes "mlock" and "ops" from struct "nand_chip" are requested, but the do not exsit. For now I have commented all the lines with theses references.

You can download my current kernel tree here:
https://www.own-mailbox.com/linux-3.18.71.tar.gz

It is possible to send via tftp the kernel compressed vmlinux-nodictionary.lzma at startup.

Ps: If a developer wants to help me with this I can send free wnr3500lv2

I think I have one of these somewhere. I know mine has a USB port. I'm not certain what version I have.

Looks like dd-wrt is still active with this device:

http://svn.dd-wrt.com/changeset/33170

I don’t want to shoot down this project, but what will you do after you managed to port the NAND driver? I mean, you are still left with a marginal supported WiFi chipset.

Now if you could make WiFi work, that would be more than impressive.

Again, the learning experience from porting and patching the driver in itself could be a “goal”; then using the device with limited WiFi, but with other packages running (dedicated VPN, sort of NAS or torrent client to name something)

I don't understand why the work from dd-wrt can't be leveraged. Is there some proprietary code? What's the problem? I thought dd-wrt works fine on this router. But maybe I am misremembering.

Yes, DD-WRT is using proprietary code for the Broadcom SoC. They have some “wrapper” to use the binary blob and they have some non-disclosure agreement with Broadcom. The problem with that approach seems to be that it limits the kernel version to a v3.x. They have security updates on DDWRT, I saw that they are working on backporting the WPA2 patches.

As for the NAND driver, I don’t see why that wouldn’t be possible to port to LEDE (don’t have one, can’t help with that).

Oh, sounds ugly. I also have a vague memory of some recent exploits for broadcom but can't recall if it was this chip or not. It does start to sound like a bad idea.