OpenWrt Forum Archive

Topic: Add OpenWRT support for RouterBOARD 951-2n

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am trying to get OpenWRT to run on the Mikrotik Routerboard 951, however I have hit a few roadblocks

1.) Wireless ( ath9k does not initialize )
[    8.210000] ath: phy0: both bands are disabled
[    8.210000] ath: phy0: Unable to initialize hardware; initialization status: -22
[    8.210000] ath9k ar933x_wmac: failed to initialize device
[    8.210000] ath9k: probe of ar933x_wmac failed with error -22

( I'm assuming this has to do with Mikrotik's RLE encryption that was used on the Routerboard 751? )

2.) NAND Flash ( Does not find it )

I'm not sure where to start with the NAND Flash, as you can see in my patchset I had to leave the rb750 AR72XX definitions in there. I realize the AR72XX definitions will not work, as the rb951 has a AR9331 processor. However I am not sure how to figure out which GPIO's are tied to NAND. I'm assuming you can modify the RB750's "enable / disable" pins functions and replace the GPIO's with the AR9331's and it should work?

Any insight on how to get that to work would be very helpful!

3.) Serial UART

For some reason the OpenWRT bootconsole is enabled, and shortly disabled.
"turn off boot console early0"
I am assuming all I need to do is change my kernel command line, is it best to do that in make kernel_menuconfig or somewhere else?

I'm new to this, and i'm simply trying to get the RB951 working on OpenWRT

My progress so far:

Davey-Hutchisons-MacBook-Pro-2:~ idahorazor$ telnet 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
 === IMPORTANT ============================
  Use 'passwd' to set your login password
  this will disable telnet and enable SSH
 ------------------------------------------


BusyBox v1.19.4 (2013-01-29 15:32:39 GMT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 BARRIER BREAKER (Bleeding Edge, unknown)
 -----------------------------------------------------
  * 1/2 oz Galliano         Pour all ingredients into
  * 4 oz cold Coffee        an irish coffee mug filled
  * 1 1/2 oz Dark Rum       with crushed ice. Stir.
  * 2 tsp. Creme de Cacao
 -----------------------------------------------------
root@OpenWrt:/# dmesg
[    0.000000] Linux version 3.7.4 (bluemesh.net) (gcc version 4.6.4 20121210 (prerelease) (Linaro GCC 4.6-2012.12) ) #7 Tue Jan 29 23:04:27 GMT 2013
[    0.000000] MyLoader: sysp=0d6376f2, boardp=068213b2, parts=ae01804c
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR9330 rev 1
[    0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:40.000MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 02000000 @ 00000000 (usable)
[    0.000000] User-defined physical RAM map:
[    0.000000]  memory: 02000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x01ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x01ffffff]
[    0.000000] On node 0 totalpages: 8192
[    0.000000] free_area_init_node: node 0, pgdat 803118c0, node_mem_map 81000000
[    0.000000]   Normal zone: 64 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 8128 pages, LIFO batch:0
[    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] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line:  GPIO_RESET=yes no-uart boot_part_size=4194304 gpio=554690439 HZ=200000000 mem=32M kmac=D4:CA:6D:50:36:56 board=751UL boot=0 mlc=2 console=ttyS0,115200 rootfstype=yaffs noinitrd
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] __ex_table already sorted, skipping sort
[    0.000000] Writing ErrCtl register=00070001
[    0.000000] Readback ErrCtl register=00070001
[    0.000000] Memory: 27508k/32768k available (2156k kernel code, 5260k reserved, 603k data, 1592k init, 0k highmem)
[    0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.080000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 512
[    0.090000] NET: Registered protocol family 16
[    0.100000] MIPS: machine is Mikrotik Routerboard 951
[    0.130000] ar71xx: using random MAC address for eth0
[    0.360000] bio: create slab <bio-0> at 0
[    0.360000] Switching to clocksource MIPS
[    0.370000] NET: Registered protocol family 2
[    0.370000] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[    0.380000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.390000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.390000] TCP: reno registered
[    0.390000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.400000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.410000] NET: Registered protocol family 1
[    0.410000] PCI: CLS 0 bytes, default 32
[    3.210000] yaffs built Jan 29 2013 17:21:54 Installing.
[    3.210000] 
[    3.210000]
[    3.210000]
[    3.210000]
[    3.210000] YAFFS-WARNING CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED selected.
[    3.210000]
[    3.210000]
[    3.210000]
[    3.210000] msgmni has been set to 53
[    3.210000] io scheduler noop registered
[    3.210000] io scheduler deadline registered (default)
[    3.220000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    3.230000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11) is a AR933X UART
[    3.240000] NAND flash driver for the RouterBOARD 750 version 0.1.0
[    3.240000] No NAND device found
[    3.270000] libphy: ag71xx_mdio: probed
[    3.270000] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    3.820000] ag71xx ag71xx.0 eth0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd041, driver=Generic PHY]
[    3.830000] TCP: cubic registered
[    3.830000] NET: Registered protocol family 17
[    3.840000] 8021q: 802.1Q VLAN Support v1.8
[    3.840000] turn off boot console early0
[    3.850000] Please be patient, while OpenWrt loads ...
[    3.860000] Freeing unused kernel memory: 1592k freed
[    6.820000] eth0: link up (100Mbps/Full duplex)
[    7.710000] eth0: link down
[    7.970000] Compat-drivers backport release: compat-drivers-2013-01-08-3
[    7.970000] Backport based on wireless-testing.git master-2013-01-07
[    7.970000] compat.git: wireless-testing.git
[    8.000000] cfg80211: Calling CRDA to update world regulatory domain
[    8.000000] cfg80211: World regulatory domain updated:
[    8.000000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    8.000000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.000000] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    8.000000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    8.000000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.000000] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.100000] usbcore: registered new interface driver usbfs
[    8.100000] usbcore: registered new interface driver hub
[    8.100000] usbcore: registered new device driver usb
[    8.210000] ath: phy0: both bands are disabled
[    8.210000] ath: phy0: Unable to initialize hardware; initialization status: -22
[    8.210000] ath9k ar933x_wmac: failed to initialize device
[    8.210000] ath9k: probe of ar933x_wmac failed with error -22
[    8.250000] PPP generic driver version 2.4.2
[    8.300000] ip_tables: (C) 2000-2006 Netfilter Core Team
[    8.410000] NET: Registered protocol family 24
[    8.420000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    8.420000] ehci-platform ehci-platform: Generic Platform EHCI Controller
[    8.420000] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[    8.450000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[    8.470000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[    8.470000] hub 1-0:1.0: USB hub found
[    8.470000] hub 1-0:1.0: 1 port detected
[    8.490000] nf_conntrack version 0.5.0 (454 buckets, 1816 max)
[    8.720000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   11.820000] device eth0 entered promiscuous mode
[   12.820000] eth0: link up (100Mbps/Full duplex)
[   12.820000] br-lan: port 1(eth0) entered forwarding state
[   12.820000] br-lan: port 1(eth0) entered forwarding state
[   14.820000] br-lan: port 1(eth0) entered forwarding state
[   76.820000] eth0: link down
[   76.820000] br-lan: port 1(eth0) entered disabled state
[   90.820000] eth0: link up (100Mbps/Full duplex)
[   90.820000] br-lan: port 1(eth0) entered forwarding state
[   90.820000] br-lan: port 1(eth0) entered forwarding state
[   92.820000] br-lan: port 1(eth0) entered forwarding state
root@OpenWrt:/# 

My Changes:

+++ linux-ar71xx_nand/linux-3.7.4/arch/mips/ath79/mach-rb951.c
@@ -0,0 +1,125 @@
+#include <linux/export.h>
+#include <linux/pci.h>
+#include <linux/ath9k_platform.h>
+#include <linux/platform_device.h>
+#include <linux/phy.h>
+#include <linux/ar8216_platform.h>
+#include <linux/rle.h>
+#include <linux/routerboot.h>
+
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/irq.h>
+#include <asm/mach-ath79/mach-rb750.h>
+
+#include "common.h"
+#include "dev-ap9x-pci.h"
+#include "dev-usb.h"
+#include "dev-eth.h"
+#include "machtypes.h"
+#include "routerboot.h"
+
+#include "dev-wmac.h"
+
+static struct rb7xx_nand_platform_data rb750_nand_data;
+static struct platform_device rb750_nand_device = {
+        .name   = "rb750-nand",
+        .id     = -1,
+        .dev    = {
+                .platform_data = &rb750_nand_data,
+        }
+};
+
+static void rb750_latch_change(u32 mask_clr, u32 mask_set)
+{
+        static DEFINE_SPINLOCK(lock);
+        static u32 latch_set = RB750_LED_BITS | RB750_LVC573_LE;
+        static u32 latch_oe;
+        static u32 latch_clr;
+        unsigned long flags;
+        u32 t;
+
+        spin_lock_irqsave(&lock, flags);
+
+        if ((mask_clr & BIT(31)) != 0 &&
+            (latch_set & RB750_LVC573_LE) == 0) {
+                goto unlock;
+        }
+
+        latch_set = (latch_set | mask_set) & ~mask_clr;
+        latch_clr = (latch_clr | mask_clr) & ~mask_set;
+
+        if (latch_oe == 0)
+                latch_oe = __raw_readl(ath79_gpio_base + AR71XX_GPIO_REG_OE);
+
+        if (likely(latch_set & RB750_LVC573_LE)) {
+                void __iomem *base = ath79_gpio_base;
+
+                t = __raw_readl(base + AR71XX_GPIO_REG_OE);
+                t |= mask_clr | latch_oe | mask_set;
+
+                __raw_writel(t, base + AR71XX_GPIO_REG_OE);
+                __raw_writel(latch_clr, base + AR71XX_GPIO_REG_CLEAR);
+                __raw_writel(latch_set, base + AR71XX_GPIO_REG_SET);
+        } else if (mask_clr & RB750_LVC573_LE) {
+                void __iomem *base = ath79_gpio_base;
+
+                latch_oe = __raw_readl(base + AR71XX_GPIO_REG_OE);
+                __raw_writel(RB750_LVC573_LE, base + AR71XX_GPIO_REG_CLEAR);
+                /* flush write */
+                __raw_readl(base + AR71XX_GPIO_REG_CLEAR);
+        }
+
+unlock:
+        spin_unlock_irqrestore(&lock, flags);
+}
+
+static void rb750_nand_enable_pins(void)
+{
+        rb750_latch_change(RB750_LVC573_LE, 0);
+        ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE,
+                                  AR724X_GPIO_FUNC_SPI_EN);
+}
+
+static void rb750_nand_disable_pins(void)
+{
+        ath79_gpio_function_setup(AR724X_GPIO_FUNC_SPI_EN,
+                                  AR724X_GPIO_FUNC_JTAG_DISABLE);
+        rb750_latch_change(0, RB750_LVC573_LE);
+}
+
+static void __init rb951_setup(void)
+{
+        u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+        u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+        /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
+        ath79_setup_ar933x_phy4_switch(false, false);
+
+        ath79_register_usb();
+
+    ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+
+        ath79_register_mdio(0, 0x0);
+        ath79_register_eth(0);
+        ath79_register_wmac(ee, mac);
+    
+    rb750_nand_data.nce_line = RB750_NAND_NCE;
+        rb750_nand_data.enable_pins = rb750_nand_enable_pins;
+        rb750_nand_data.disable_pins = rb750_nand_disable_pins;
+        rb750_nand_data.latch_change = rb750_latch_change;
+        platform_device_register(&rb750_nand_device);    
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_951, "751UL", "Mikrotik Routerboard 951",
+             rb951_setup);

--- /linux-ar71xx_nand/linux-3.7.4/arch/mips/ath79/machtypes.h
+++ /linux-ar71xx_nand/linux-3.7.4/arch/mips/ath79/machtypes.h
@@ -67,6 +67,7 @@
     ATH79_MACH_RB_750G_R3,        /* MikroTik RouterBOARD 750GL */
     ATH79_MACH_RB_751,        /* MikroTik RouterBOARD 751 */
     ATH79_MACH_RB_751G,        /* Mikrotik RouterBOARD 751G */
+    ATH79_MACH_RB_951,        /* Mikrotik RouterBOARD 951 */
     ATH79_MACH_RB_2011G,        /* Mikrotik RouterBOARD 2011UAS-2HnD */
     ATH79_MACH_RB_2011L,        /* Mikrotik RouterBOARD 2011L */
     ATH79_MACH_RW2458N,        /* Redwave RW2458N */

--- linux-ar71xx_nand/linux-3.7.4/arch/mips/ath79/Kconfig
+++ linux-ar71xx_nand/linux-3.7.4/arch/mips/ath79/Kconfig
@@ -337,6 +337,16 @@
     select ATH79_ROUTERBOOT
     select RLE_DECOMPRESS
 
+config ATH79_MACH_RB951
+    bool "MikroTik RouterBOARD 951 support"
+    select SOC_AR933X
+    select ATH79_DEV_ETH
+    select ATH79_DEV_GPIO_BUTTONS
+    select ATH79_DEV_LEDS_GPIO
+    select ATH79_DEV_USB
+    select ATH79_DEV_WMAC
+    select ATH79_ROUTERBOOT
+
 config ATH79_MACH_RB2011
     bool "MikroTik RouterBOARD 2011 support"
     select SOC_AR934x

--- linux-ar71xx_nand/linux-3.7.4/arch/mips/ath79/Makefile
+++ linux-ar71xx_nand/linux-3.7.4/arch/mips/ath79/Makefile
@@ -69,6 +69,7 @@
 obj-$(CONFIG_ATH79_MACH_PB92)        += mach-pb92.o
 obj-$(CONFIG_ATH79_MACH_RB4XX)        += mach-rb4xx.o
 obj-$(CONFIG_ATH79_MACH_RB750)        += mach-rb750.o
+obj-$(CONFIG_ATH79_MACH_RB951)        += mach-rb951.o
 obj-$(CONFIG_ATH79_MACH_RB2011)        += mach-rb2011.o
 obj-$(CONFIG_ATH79_MACH_RW2458N)    += mach-rw2458n.o
 obj-$(CONFIG_ATH79_MACH_TEW_632BRP)    += mach-tew-632brp.o

--- linux-ar71xx_nand/linux-3.7.4/arch/mips/ath79/prom.c
+++ linux-ar71xx_nand/linux-3.7.4/arch/mips/ath79/prom.c
@@ -181,7 +181,9 @@
         }
     }
 
-    if (strstr(arcs_cmdline, "board=750Gr3") ||
+    if (strstr(arcs_cmdline, "board=751UL") ||
+        strstr(arcs_cmdline, "board=750Gr3") ||
         strstr(arcs_cmdline, "board=2011L"))
         ath79_prom_append_cmdline("console", "ttyS0,115200");
 }

(Last edited by idahorazor on 30 Jan 2013, 21:36)

Progress Update:

1.) Wireless ( Untested )

I did add the same RLE_DECODING as the rb2011 and rb750 use, I have no idea if it works. I would assume Mikrotik would still have the same hardconfig definitions in the internal chip.. it's very unlikely that would change.

2.) NAND Flash ( Can get it to find the NAND flash, but having issues with it )

I can see the MTD partitions ( RouterBoard Boot, RouterBoard Main, and RouterBoard Booter ), and can even mount them. However when I go to "mtd erase" or try to read them i get a bunch of "failed to erase block" and "mark as bad block".

My guess is that the rb750_nand.c ( rb751_nand_ecclayout ) needs to be used in the 951. Every routerboard product ( 2011, 750, 4xx use the same ecclayout.

Also a definition for if mtd.pagesize is 512, then set the ecclayout needs to occur somewhere.

I also noticed the rb750 have "enable / disable" pins, and perhaps the 951 needs this too?

I'm kind of at a loss, I can see the devices but have major problems after mounting them...

To load a NAND driver that atleast see's the partitions i've added:

Modified arch/mips/ath79/mach-rb951.c

/* Add a platform definition for ar9330_nand_device */
static struct platform_device ar9330_nand_device = {
        .name   = "ar9330-nand",
       .id     = -1,
};

/* Call platform_device_register(&ar9330_nand_device); in __init rb951_setup */

Add to drivers/mtd/nand/ar9330_nand.c

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mtd/nand.h>
#include <linux/platform_device.h>
#include <asm/rb/rb400.h>

extern int rb_nand_probe(struct nand_chip *nand, int booter);

static struct nand_chip rnand;

#define GPIO_BASE       0x18040000
#define GPIO_OE_REG         0x0000
#define GPIO_IN_REG         0x0004
#define GPIO_O1_REG         0x0008
#define GPIO_S1_REG         0x000c
#define GPIO_S0_REG         0x0010

#define GPIO_REG(x)     (*(volatile unsigned *)((unsigned) gpio_base + (x)))

static void __iomem *gpio_base;

/* ------------------ AR9330 nand driver -------------------- */

#define   GPO_AR9330_NAND_nCE   (1 << 1)
#define   GPO_AR9330_NAND_CLE   (1 << 11)
#define   GPO_AR9330_NAND_ALE   (1 << 12)
#define   GPO_AR9330_NAND_nWE   (1 << 18)
#define   GPO_AR9330_NAND_nRE   (1 << 19)
#define   GPI_AR9330_NAND_RDY   (1 << 24)

#define   GPO_NAND_DATA(x)      ((((x) & 0x1f) << 20) | (((x) & 0xe0) << 21))
#define   GPI_NAND_DATA(x)      ((((x) >> 20) & 0x1f) | (((x) >> 21) & 0xe0))

static int ar9330_dev_ready(struct mtd_info *mtd) {
        return GPIO_REG(GPIO_IN_REG) & GPI_AR9330_NAND_RDY;
}

static void ar9330_write_bytes_gpio(const uint8_t *data, unsigned cnt) {
        int i;
        unsigned gpo;

        GPIO_REG(GPIO_OE_REG) |= GPO_NAND_DATA(0xff);
        gpo = GPIO_REG(GPIO_O1_REG) & ~(GPO_AR9330_NAND_nWE |
                                        GPO_NAND_DATA(0xff));
        /* XXX: any GPIO output val change in parallel (for led) may get lost */

        for (i = 0; i < cnt; ++i) {
                unsigned val = data[i];
                unsigned gpov = gpo | GPO_NAND_DATA(val);

                GPIO_REG(GPIO_O1_REG) = gpov;
                GPIO_REG(GPIO_S1_REG) = GPO_AR9330_NAND_nWE;
        }

        GPIO_REG(GPIO_OE_REG) &= ~GPO_NAND_DATA(0xff);
}

static int ar9330_read_bytes_gpio(uint8_t *data, unsigned cnt,
                                  const uint8_t *verify) {
        int i;
        for (i = 0; i < cnt; ++i) {
                uint8_t val;

                GPIO_REG(GPIO_S0_REG) = GPO_AR9330_NAND_nRE;
                GPIO_REG(GPIO_S0_REG);

                val = GPI_NAND_DATA(GPIO_REG(GPIO_IN_REG));

                GPIO_REG(GPIO_S1_REG) = GPO_AR9330_NAND_nRE;

                if (data) {
                        data[i] = val;
                }
                else if (verify) {
                        if (verify[i] != val) return -EFAULT;
                }
        }
        return 0;
}

static void ar9330_hwcontrol(struct mtd_info *mtd, int cmd,
                             unsigned int ctrl) {
        if (ctrl & NAND_CTRL_CHANGE) {
                unsigned gpo = 0;
                if (!(ctrl & NAND_NCE)) {
                        gpo |= GPO_AR9330_NAND_nCE;
                }
                if (ctrl & NAND_CLE) {
                        gpo |= GPO_AR9330_NAND_CLE;
                }
                if (ctrl & NAND_ALE) {
                        gpo |= GPO_AR9330_NAND_ALE;
                }
                GPIO_REG(GPIO_S1_REG) = gpo;
                GPIO_REG(GPIO_S0_REG) = gpo ^ (GPO_AR9330_NAND_nCE |
                                               GPO_AR9330_NAND_ALE |
                                               GPO_AR9330_NAND_CLE);
        }

        if (cmd != NAND_CMD_NONE) {
                uint8_t data = cmd;
                ar9330_write_bytes_gpio(&data, 1);
        }
}

static uint8_t ar9330_read_byte(struct mtd_info *mtd)
{
        uint8_t data;
        ar9330_read_bytes_gpio(&data, 1, NULL);
        return data;
}

static void ar9330_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
{
        ar9330_write_bytes_gpio(buf, len);
}

static void ar9330_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{
        ar9330_read_bytes_gpio(buf, len, NULL);
}

static int ar9330_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
{
        return ar9330_read_bytes_gpio(NULL, len, buf);
}

#ifdef DEBUG_SPEED
static void ar9330_test_speed(void) {
        char buf[1024];
        unsigned long ticks;
        unsigned kb;

        GPIO_REG(GPIO_S1_REG) = GPO_AR9330_NAND_nCE;
        GPIO_REG(GPIO_S1_REG);

        /* wait for "start of" clock tick */
        kb = 0;
        ticks = jiffies;
        while (ticks == jiffies)
                /* nothing */;
        ticks = jiffies + HZ / 10;

        while ((long)(jiffies - ticks) < 0) {
                ar9330_read_bytes_gpio(buf, 1024, NULL);
                ++kb;
        }
        printk("read speed is %u KB/s\n", kb * 10);

        /* wait for "start of" clock tick */
        kb = 0;
        ticks = jiffies;
        while (ticks == jiffies)
                /* nothing */;
        ticks = jiffies + HZ / 10;

        while ((long)(jiffies - ticks) < 0) {
                ar9330_write_bytes_gpio(buf, 1024);
                ++kb;
        }
        printk("write speed is %u KB/s\n", kb * 10);
}
#endif

static int ar9330_nand_probe(struct platform_device *pdev)
{
        printk("AR9330 nand\n");
#ifdef DEBUG_SPEED
        ar9330_test_speed();
#endif
        memset(&rnand, 0, sizeof(rnand));

        rnand.cmd_ctrl = ar9330_hwcontrol;
        rnand.dev_ready = ar9330_dev_ready;
        rnand.read_byte = ar9330_read_byte;
        rnand.write_buf = ar9330_write_buf;
        rnand.read_buf = ar9330_read_buf;
        //rnand.verify_buf = ar9330_verify_buf;

        return rb_nand_probe(&rnand, 1);
}

static struct platform_driver ar9330_nand_driver = {
        .probe  = ar9330_nand_probe,
        .driver = {
                .name = "ar9330-nand",
                .owner = THIS_MODULE,
        },
};

/* ------------------ common init/exit code -------------------- */

static int __init ar9330_nand_init(void)
{
        gpio_base = ioremap_nocache(GPIO_BASE, PAGE_SIZE);
        if (!gpio_base)
                return -ENOMEM;

        return platform_driver_register(&ar9330_nand_driver);
}

static void __exit ar9330_nand_exit(void)
{
        iounmap(gpio_base);

        platform_driver_unregister(&ar9330_nand_driver);
}

module_init(ar9330_nand_init);
module_exit(ar9330_nand_exit);

Add to drivers/mtd/nand/rb.c

#include <linux/mtd/nand.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/module.h>
#include "../mtdcore.h"

static struct mtd_partition partition_info[] = {
    {
        name: "RouterBoard NAND Boot",
        offset: 0,
        size: 4 * 1024 * 1024
    },
    {
        name: "RouterBoard NAND Main",
        offset: MTDPART_OFS_NXTBLK,
        size: MTDPART_SIZ_FULL
    }
};

static struct mtd_partition partition_info_booter[] = {
    {
        name: "RouterBoard NAND Boot",
        offset: 256 * 1024,
        size: 4 * 1024 * 1024 - 256 * 1024,
    },
    {
        name: "RouterBoard NAND Main",
        offset: MTDPART_OFS_NXTBLK,
        size: MTDPART_SIZ_FULL,
    },
    {
        name: "RouterBoard NAND Booter",
        offset: 0,
        size: 256 * 1024,
    }
};

static struct mtd_info rmtd;
static int rmtd_valid = 0;

extern int nand_lock_and_callback(struct mtd_info *mtd,
                                  int (*callback)(struct mtd_info *, void *),
                                  void *priv);

#ifdef MIPSEL
static int nand_is_bad = 0;

static int check_nand(struct mtd_info *mtd, void *priv) {
        struct nand_chip *chip = mtd->priv;
        unsigned char ids[4];

        chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
        ids[0] = chip->read_byte(mtd);
        ids[1] = chip->read_byte(mtd);
        ids[2] = chip->read_byte(mtd);
        ids[3] = chip->read_byte(mtd);

        nand_is_bad = (ids[0] == 0xad &&
                       ids[1] == 0xf1 &&
                       ids[2] == 0x80 &&
                       ids[3] == 0x1d) ? 1 : 0;
        return 0;
}

int is_nand_bad(void) {
        return nand_is_bad;
}
EXPORT_SYMBOL(is_nand_bad);

static int nand_supports_backup(struct mtd_info *mtd) {
        unsigned ofs;

        for (ofs = mtd->size / 2; ofs < mtd->size; ofs += mtd->erasesize) {
                struct mtd_oob_ops ops;
                uint32_t oobdata;

                ops.ooblen = 4;
                ops.oobbuf = (uint8_t *)&oobdata;
                ops.ooboffs = BACKUP_4xFF_OFFSET;
                ops.datbuf = NULL;
                ops.mode = MTD_OOB_RAW;

                if (mtd->block_isbad(mtd, ofs)) {
                        continue;
                }
                if (mtd->read_oob(mtd, ofs, &ops)) {
                        printk(KERN_INFO "nand backup disabled - "
                               "read error at block %u\n",
                               ofs / mtd->erasesize);
                        return 0;
                }
                if (oobdata != 0xffffffff) {
                        printk(KERN_INFO "nand backup disabled - "
                               "backup area not empty at block %u\n",
                               ofs / mtd->erasesize);
                        return 0;
                }
        }

        printk(KERN_INFO "nand backup enabled\n");
        return 1;
}

int nand_enable_backup(struct mtd_info *mtd_part) {
        struct nand_chip *chip = rmtd.priv;
        if (!rmtd_valid) return 0;
        if (chip->backup_offset) return 0;
        if (!is_nand_bad()) return 0;
        if (!nand_supports_backup(&rmtd)) return 0;

        chip->backup_offset = rmtd.size / 2;
        partition_info[1].size = (chip->backup_offset -
                                  partition_info[0].size);
        if (mtd_part && mtd_part != &rmtd) {
                // reduce mtd partition size
                mtd_part->size -= chip->backup_offset;
        }
        return 1;
}
EXPORT_SYMBOL(nand_enable_backup);
#endif

int rb_nand_probe(struct nand_chip *nand, int booter)
{
        memset(&rmtd, 0, sizeof(rmtd));

        nand->ecc.mode = NAND_ECC_SOFT;
        nand->chip_delay = 25;
        rmtd.priv = nand;

        if (nand_scan(&rmtd, 1) && nand_scan(&rmtd, 1)
            && nand_scan(&rmtd, 1)  && nand_scan(&rmtd, 1)) {
                printk("RBxxx nand device not found\n");
                return -ENXIO;
        }
        rmtd_valid = 1;

#ifdef MIPSEL
        nand_enable_backup(NULL);
#endif

        if (booter) {
                add_mtd_partitions(&rmtd, partition_info_booter, 3);
        }
        else {
                add_mtd_partitions(&rmtd, partition_info, 2);
        }
        return 0;
}

Modified drivers/mtd/nand/Makefile

--- drivers/mtd/nand/Makefile 
+++ drivers/mtd/nand/Makefile
@@ -3,7 +3,7 @@
 #

 obj-$(CONFIG_MTD_NAND)                 += nand.o
obj-$(CONFIG_MTD_NAND_ECC)             += nand_ecc.o
 obj-$(CONFIG_MTD_NAND_BCH)             += nand_bch.o
 obj-$(CONFIG_MTD_NAND_IDS)             += nand_ids.o
 obj-$(CONFIG_MTD_SM_COMMON)            += sm_common.o
@@ -35,11 +35,8 @@
 obj-$(CONFIG_MTD_NAND_PXA3xx)          += pxa3xx_nand.o
 obj-$(CONFIG_MTD_NAND_TMIO)            += tmio_nand.o
 obj-$(CONFIG_MTD_NAND_PLATFORM)                += plat_nand.o
+obj-$(CONFIG_MTD_NAND_RB)              += rb.o
+obj-$(CONFIG_MTD_NAND_RB400)           += ar9330_nand.o
 obj-$(CONFIG_MTD_NAND_RB4XX)           += rb4xx_nand.o
 obj-$(CONFIG_MTD_NAND_RB750)           += rb750_nand.o
 obj-$(CONFIG_MTD_ALAUDA)               += alauda.o
 obj-$(CONFIG_MTD_NAND_PASEMI)          += pasemi_nand.o
 obj-$(CONFIG_MTD_NAND_ORION)           += orion_nand.o

Modified drivers/nand/mtd/Kconfig

--- drivers/mtd/nand/Kconfig
+++ drivers/mtd/nand/Kconfig
@@ -580,6 +580,14 @@
        tristate "NAND flash driver for the RouterBoard 750"
        depends on MTD_NAND && ATH79_MACH_RB750

+config MTD_NAND_RB400
+       bool "Support for RB951 nand"
+       depends on MTD_NAND
+       select MTD_NAND_RB
+
+config MTD_NAND_RB
+       tristate
+
 config MTD_NAND_AR934X
        tristate "NAND flash driver for the Qualcomm Atheros AR934x/QCA955x SoCs"
        depends on (SOC_AR934X || SOC_QCA955X)

Added arch/mips/includes/asm/rb/rb400.h

#ifndef MT_RB400_H
#define MT_RB400_H

#define IRQ_BASE 16
#define PCI_IRQ_BASE 48

static inline unsigned rb400_readl(unsigned addr) {
    return *(volatile unsigned *) addr;
}

static inline void rb400_writel(unsigned val, unsigned addr) {
    *(volatile unsigned *) addr = val;
}

/* SPI commands processed by CPLD */
#define SPI_CMD_WRITE_NAND      0x08    /* send cmd, n x send data, read idle */
#define SPI_CMD_READ_NAND       0x0a    /* send cmd, send idle, n x read data */
#define SPI_CMD_WRITE_CFG       0x09    /* send cmd, n x send cfg */
#define SPI_CMD_READ_FAST       0x0b    /* send cmd, 3 x addr, */
                                        /*           send idle, n x read data */
#define   SPI_READ_NAND_OFS         0x800000
#define SPI_CMD_LED5_ON         0x0c    /* send cmd */
#define SPI_CMD_LED5_OFF        0x0d    /* send cmd */
#define SPI_CMD_SDPWR_ON        0x0e    /* send cmd */
#define SPI_CMD_SDPWR_OFF       0x0f    /* send cmd */
#define SPI_CMD_MON_VOLTAGE     0x11    /* send cmd */
#define SPI_CMD_MON_TEMP        0x12    /* send cmd */
#define SPI_CMD_READ_VOLTS      0x1a    /* send cmd, 3 x read data (LSB 1st) */

struct spi_message;
struct spi_device;

extern struct spi_device *rb400_spi_get(void);
extern int rb400_spi_sync(struct spi_message *message);

extern int rb400_spiflash_read_verify(unsigned addr,
                                      uint8_t *rdata, const uint8_t *vdata,
                                      unsigned cnt);

#define CFG_BIT_nCE     0x80
#define CFG_BIT_CLE     0x40
#define CFG_BIT_ALE     0x20
#define CFG_BIT_FAN     0x10
#define CFG_BIT_nLED4   0x08
#define CFG_BIT_nLED3   0x04
#define CFG_BIT_nLED2   0x02
#define CFG_BIT_nLED1   0x01
#define CFG_BIT_nLED5  0x100

extern void rb400_change_cfg(unsigned off, unsigned on);

#define GPO_SSR_STRB    (1 << 6)
#define SSR_BIT_nLED1   (1 << 0)
#define SSR_BIT_nLED2   (1 << 1)
#define SSR_BIT_nLED3   (1 << 2)
#define SSR_BIT_nLED4   (1 << 3)
#define SSR_BIT_nLED5   (1 << 4)
#define SSR_BIT_FAN_ON  (1 << 6)
#define SSR_BIT_USB_EN  (1 << 7)

extern void rb400_change_ssr_cfg(unsigned off, unsigned on);

#define GPO_RB700_LATCH_EN      (1 << 0)
#define GPO_RB700_nPLED         (1 << 1)
#define GPO_RB700_MON_SEL       (1 << 9)
#define GPO_RB700_NOLATCH_nULED (1 << 11)
#define GPO_RB700_nULED         (1 << 12)
#define GPO_RB700_USB_nPWROFF   (1 << 13)
#define GPO_RB700_nLINK0        (1 << 13)
#define GPO_RB700_nLINK1        (1 << 14)
#define GPO_RB700_nLINK2        (1 << 15)
#define GPO_RB700_nLINK3        (1 << 16)
#define GPO_RB700_nLINK4        (1 << 17)

extern int rb700_change_gpo(unsigned off, unsigned on);
extern void rb700_beepled(int on);

int is_ar7240(void);

unsigned register_wifi_gpo(void *obj,
                           void (*set_gpo)(void *, unsigned, unsigned));

#endif

3.) Serial UART

I fixed the "turn off boot console early0" by adjusting the following:

--- arch/mips/ath79/prom.c
+++ arch/mips/ath79/prom.c
@@ -181,6 +181,11 @@
                }
        }

+       if (strstr(arcs_cmdline, "board=751UL")) {
+               ath79_prom_append_cmdline("console", "ttyATH0,115200");
+       }
+
        if (strstr(arcs_cmdline, "board=750Gr3") ||
            strstr(arcs_cmdline, "board=2011L"))
                ath79_prom_append_cmdline("console", "ttyS0,115200");

My current architecture is:

/*
 *  MikroTik RouterBOARD 951 support
 *
 *  This program is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License version 2 as published
 *  by the Free Software Foundation.
 */

#include <linux/export.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/ath9k_platform.h>
#include <linux/platform_device.h>
#include <linux/phy.h>
#include <linux/ar8216_platform.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
#include <linux/rle.h>
#include <linux/gpio.h>
#include <linux/routerboot.h>

#include <asm/mach-ath79/ar71xx_regs.h>
#include <asm/mach-ath79/ath79.h>
#include <asm/mach-ath79/irq.h>
#include <asm/mach-ath79/mach-rb750.h>

#include "common.h"
#include "dev-ap9x-pci.h"
#include "dev-usb.h"
#include "dev-eth.h"
#include "machtypes.h"
#include "routerboot.h"

#include "dev-wmac.h"

#define RB_HARD_CFG_OFFSET      0xb000
#define RB_HARD_CFG_SIZE        0x1000
#define RB_ART_SIZE             0x10000

static struct platform_device ar9330_nand_device = {
        .name   = "ar9330-nand",
        .id     = -1,
};

static void __init rb951_wlan_init(void)
{
        u8 *hard_cfg = (u8 *) KSEG1ADDR(0x1f000000 + RB_HARD_CFG_OFFSET);
        u16 tag_len;
        u8 *tag;
        char *art_buf;
        u8 wlan_mac[ETH_ALEN];
        int err;

        err = routerboot_find_tag(hard_cfg, RB_HARD_CFG_SIZE, RB_ID_WLAN_DATA,
                                  &tag, &tag_len);
        if (err) {
                pr_err("no calibration data found\n");
                return;
        }

        art_buf = kmalloc(RB_ART_SIZE, GFP_KERNEL);
        if (art_buf == NULL) {
                pr_err("no memory for calibration data\n");
                return;
        }

        err = rle_decode((char *) tag, tag_len, art_buf, RB_ART_SIZE,
                         NULL, NULL);
        if (err) {
                pr_err("unable to decode calibration data\n");
                goto free;
        }

        ath79_init_mac(wlan_mac, ath79_mac_base, 11);
        ath79_register_wmac(art_buf + 0x1000, wlan_mac);

free:
        kfree(art_buf);
}

static void __init rb951_setup(void)
{
        u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
        //u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);

        /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
        ath79_setup_ar933x_phy4_switch(false, false);

        ath79_register_usb();

        ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
        ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);

        ath79_register_mdio(0, 0x0);

        /* WAN Port */
        ath79_register_eth(0);

        /* LAN Ports */
        ath79_register_eth(1);

        rb951_wlan_init();
        platform_device_register(&ar9330_nand_device);
}

MIPS_MACHINE(ATH79_MACH_RB_951, "751UL", "Mikrotik Routerboard 951",
             rb951_setup);

Hello,

Just wondering if you got this working? Also could you print the serial information please.

Thank-you
Iain Fraser

Could you help me compile openwrt support usb for rb750!

I have not gotten this working yet. Although, since it has been so long.. the flash chip might be supported now. If you apply these patches * may have to refresh them * and give it a shot, you may get lucky.

As far as adding USB support to a rb750, you need to add the line: "ath79_register_usb();" to the rb750_setup() function in the mach-rb750.c file. RB750's don't have USB, only the 750UP's, so you may need to make a new rb750up_setup() function along with a new MIPS_MACHINE(ATH79_MACH_RB_750UP, "750UP", "MikroTik RouterBOARD 750UP", rb750up_setup); definition ( Assuming the boot-loader passes "750UP" in the console, I don't know if it does or not )...

idahorazor wrote:

I have not gotten this working yet. Although, since it has been so long.. the flash chip might be supported now. If you apply these patches * may have to refresh them * and give it a shot, you may get lucky.

As far as adding USB support to a rb750, you need to add the line: "ath79_register_usb();" to the rb750_setup() function in the mach-rb750.c file. RB750's don't have USB, only the 750UP's, so you may need to make a new rb750up_setup() function along with a new MIPS_MACHINE(ATH79_MACH_RB_750UP, "750UP", "MikroTik RouterBOARD 750UP", rb750up_setup); definition ( Assuming the boot-loader passes "750UP" in the console, I don't know if it does or not )...

I have just mod USB for RB750, on RouterOS USB work fine.
On 15/10/2014 i compile with add ath79_register_usb();" to the rb750_setup() function in the mach-rb750.c file. But Router can recogzine. Could you help me step by step modify mach-rb750.c for support USB. Thanks!

If it's a modified RB750, and you added "ath79_register_usb();" to the rb750_setup() function and it compiled Ok. The next thing to do is to check menuconfig and ensure you have EHCI and other USB drivers selected.

system log of my router on 15/10/2014, router not recogzine USB,
I compile with add ath79_register_usb();" to the rb750_setup() function in the mach-rb750.c file, i select OHCI not EHCI.

   Wed Oct  8 04:45:27 2014 kern.notice kernel: [    0.000000] Linux version 3.10.49 (dinhchuc@K52Jr) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r42056) ) #1 Wed Oct 8 11:43:40 ICT 2014

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] bootconsole [early0] enabled

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] CPU revision is: 00019374 (MIPS 24Kc)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] SoC: Atheros AR7241 rev 1

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:5.000MHz

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] Determined physical RAM map:

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000]  memory: 02000000 @ 00000000 (usable)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] User-defined physical RAM map:

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000]  memory: 02000000 @ 00000000 (usable)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] Initrd not found or empty - disabling initrd

Wed Oct  8 04:45:27 2014 kern.warn kernel: [    0.000000] Zone ranges:

Wed Oct  8 04:45:27 2014 kern.warn kernel: [    0.000000]   Normal   [mem 0x00000000-0x01ffffff]

Wed Oct  8 04:45:27 2014 kern.warn kernel: [    0.000000] Movable zone start for each node

Wed Oct  8 04:45:27 2014 kern.warn kernel: [    0.000000] Early memory node ranges

Wed Oct  8 04:45:27 2014 kern.warn kernel: [    0.000000]   node   0: [mem 0x00000000-0x01ffffff]

Wed Oct  8 04:45:27 2014 kern.debug kernel: [    0.000000] On node 0 totalpages: 8192

Wed Oct  8 04:45:27 2014 kern.debug kernel: [    0.000000] free_area_init_node: node 0, pgdat 803069b0, node_mem_map 81000000

Wed Oct  8 04:45:27 2014 kern.debug kernel: [    0.000000]   Normal zone: 64 pages used for memmap

Wed Oct  8 04:45:27 2014 kern.debug kernel: [    0.000000]   Normal zone: 0 pages reserved

Wed Oct  8 04:45:27 2014 kern.debug kernel: [    0.000000]   Normal zone: 8192 pages, LIFO batch:0

Wed Oct  8 04:45:27 2014 kern.warn kernel: [    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.

Wed Oct  8 04:45:27 2014 kern.warn kernel: [    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes

Wed Oct  8 04:45:27 2014 kern.debug kernel: [    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768

Wed Oct  8 04:45:27 2014 kern.debug kernel: [    0.000000] pcpu-alloc: [0] 0 

Wed Oct  8 04:45:27 2014 kern.warn kernel: [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128

Wed Oct  8 04:45:27 2014 kern.notice kernel: [    0.000000] Kernel command line:  no-uart parts=1 boot_part_size=4194304 gpio=790343 HZ=200000000 mem=32M kmac=00:0C:42:E6:20:1A board=750i ver=3.17 boot=1 mlc=6 rootfstype=yaffs noinitrd

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] Writing ErrCtl register=00000000

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] Readback ErrCtl register=00000000

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] Memory: 28792k/32768k available (2214k kernel code, 3976k reserved, 613k data, 240k init, 0k highmem)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.000000] NR_IRQS:51

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.080000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.080000] pid_max: default: 32768 minimum: 301

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.080000] Mount-cache hash table entries: 512

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.090000] NET: Registered protocol family 16

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.100000] MIPS: machine is MikroTik RouterBOARD 750

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.510000] bio: create slab <bio-0> at 0

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.520000] Switching to clocksource MIPS

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.530000] NET: Registered protocol family 2

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.530000] TCP established hash table entries: 512 (order: 0, 4096 bytes)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.530000] TCP bind hash table entries: 512 (order: -1, 2048 bytes)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.540000] TCP: Hash tables configured (established 512 bind 512)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.540000] TCP: reno registered

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.550000] UDP hash table entries: 256 (order: 0, 4096 bytes)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.550000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.560000] NET: Registered protocol family 1

Wed Oct  8 04:45:27 2014 kern.debug kernel: [    0.560000] PCI: CLS 0 bytes, default 32

Wed Oct  8 04:45:27 2014 kern.debug kernel: [    0.580000] yaffs: yaffs built Oct  8 2014 11:40:16 Installing.

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.580000] msgmni has been set to 56

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.590000] io scheduler noop registered

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.590000] io scheduler deadline registered (default)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.600000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.620000] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11) is a 16550A

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.630000] console [ttyS0] enabled, bootconsole disabled

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.760000] NAND flash driver for the RouterBOARD 750 version 0.1.0

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.840000] NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit), 64MiB, page size: 512, OOB size: 16

Wed Oct  8 04:45:27 2014 kern.info kernel: [    0.980000] Scanning device for bad blocks

Wed Oct  8 04:45:27 2014 kern.notice kernel: [    1.340000] Creating 3 MTD partitions on "NAND 64MiB 3,3V 8-bit":

Wed Oct  8 04:45:27 2014 kern.notice kernel: [    1.410000] 0x000000000000-0x000000040000 : "booter"

Wed Oct  8 04:45:27 2014 kern.notice kernel: [    1.470000] 0x000000040000-0x000000400000 : "kernel"

Wed Oct  8 04:45:27 2014 kern.notice kernel: [    1.540000] 0x000000400000-0x000004000000 : "rootfs"

Wed Oct  8 04:45:27 2014 kern.notice kernel: [    1.600000] mtd: device 2 (rootfs) set to be root filesystem

Wed Oct  8 04:45:27 2014 kern.alert kernel: [    1.670000] mtdsplit: no squashfs found in "rootfs"

Wed Oct  8 04:45:27 2014 kern.alert kernel: [    1.720000] mtdsplit: no squashfs found in "NAND 64MiB 3,3V 8-bit"

Wed Oct  8 04:45:27 2014 kern.info kernel: [    1.810000] libphy: ag71xx_mdio: probed

Wed Oct  8 04:45:27 2014 kern.info kernel: [    2.410000] ag71xx-mdio.1: Found an AR7240/AR9330 built-in switch

Wed Oct  8 04:45:27 2014 kern.info kernel: [    3.510000] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII

Wed Oct  8 04:45:27 2014 kern.info kernel: [    4.130000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd041, driver=Generic PHY]

Wed Oct  8 04:45:27 2014 kern.info kernel: [    4.240000] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII

Wed Oct  8 04:45:27 2014 kern.info kernel: [    4.310000] TCP: cubic registered

Wed Oct  8 04:45:27 2014 kern.info kernel: [    4.350000] NET: Registered protocol family 17

Wed Oct  8 04:45:27 2014 kern.info kernel: [    4.410000] 8021q: 802.1Q VLAN Support v1.8

Wed Oct  8 04:45:27 2014 kern.info kernel: [    4.460000] yaffs: dev is 32505858 name is "mtdblock2" ro

Wed Oct  8 04:45:27 2014 kern.info kernel: [    4.520000] yaffs: passed flags ""

Wed Oct  8 04:45:27 2014 kern.debug kernel: [    4.570000] yaffs: yaffs: Attempting MTD mount of 31.2,"mtdblock2"

Wed Oct  8 04:45:27 2014 kern.debug kernel: [    5.910000] yaffs: yaffs_read_super: is_checkpointed 0

Wed Oct  8 04:45:27 2014 kern.info kernel: [    5.910000] VFS: Mounted root (yaffs filesystem) readonly on device 31:2.

Wed Oct  8 04:45:27 2014 kern.info kernel: [    5.990000] Freeing unused kernel memory: 240K (80324000 - 80360000)

Wed Oct  8 04:45:27 2014 kern.info kernel: [    7.700000] usbcore: registered new interface driver usbfs

Wed Oct  8 04:45:27 2014 kern.info kernel: [    7.770000] usbcore: registered new interface driver hub

Wed Oct  8 04:45:27 2014 kern.info kernel: [    7.830000] usbcore: registered new device driver usb

Wed Oct  8 04:45:27 2014 kern.notice kernel: [    7.990000] SCSI subsystem initialized

Wed Oct  8 04:45:27 2014 kern.info kernel: [    8.040000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

Wed Oct  8 04:45:27 2014 kern.info kernel: [    8.120000] usbcore: registered new interface driver usb-storage

Wed Oct  8 04:45:27 2014 kern.info kernel: [   11.530000] eth0: link up (1000Mbps/Full duplex)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   12.700000] eth0: link down

Wed Oct  8 04:45:27 2014 kern.info kernel: [   14.410000] NET: Registered protocol family 10

Wed Oct  8 04:45:27 2014 kern.info kernel: [   14.500000] nf_conntrack version 0.5.0 (453 buckets, 1812 max)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   14.660000] ip6_tables: (C) 2000-2006 Netfilter Core Team

Wed Oct  8 04:45:27 2014 kern.info kernel: [   14.800000] Linux video capture interface: v2.00

Wed Oct  8 04:45:27 2014 kern.info kernel: [   14.880000] u32 classifier

Wed Oct  8 04:45:27 2014 kern.info kernel: [   14.920000]     input device check on

Wed Oct  8 04:45:27 2014 kern.info kernel: [   14.960000]     Actions configured

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.000000] Mirror/redirect action on

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.060000] Loading modules backported from Linux version master-2014-05-22-0-gf2032ea

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.160000] Backport generated by backports.git backports-20140320-37-g5c33da0

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.250000] ip_tables: (C) 2000-2006 Netfilter Core Team

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.360000] usbcore: registered new interface driver ums-alauda

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.430000] usbcore: registered new interface driver ums-cypress

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.510000] usbcore: registered new interface driver ums-datafab

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.580000] usbcore: registered new interface driver ums-freecom

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.660000] usbcore: registered new interface driver ums-isd200

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.730000] usbcore: registered new interface driver ums-jumpshot

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.810000] usbcore: registered new interface driver ums-karma

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.880000] usbcore: registered new interface driver ums-sddr09

Wed Oct  8 04:45:27 2014 kern.info kernel: [   15.950000] usbcore: registered new interface driver ums-sddr55

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.030000] usbcore: registered new interface driver ums-usbat

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.110000] usbcore: registered new interface driver usbserial

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.180000] usbcore: registered new interface driver usbserial_generic

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.250000] usbserial: USB Serial support registered for generic

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.340000] usbcore: registered new interface driver uvcvideo

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.400000] USB Video Class driver (1.1.1)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.500000] xt_time: kernel timezone is -0000

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.600000] cfg80211: Calling CRDA to update world regulatory domain

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.700000] cfg80211: World regulatory domain updated:

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.760000] cfg80211:  DFS Master region: unset

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.810000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   16.930000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   17.030000] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   17.120000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   17.220000] cfg80211:   (5170000 KHz - 5250000 KHz @ 160000 KHz), (N/A, 2000 mBm), (N/A)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   17.320000] cfg80211:   (5250000 KHz - 5330000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   17.410000] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   17.510000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   17.610000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   17.830000] PPP generic driver version 2.4.2

Wed Oct  8 04:45:27 2014 kern.info kernel: [   17.890000] NET: Registered protocol family 24

Wed Oct  8 04:45:27 2014 kern.info kernel: [   18.040000] usbcore: registered new interface driver option

Wed Oct  8 04:45:27 2014 kern.info kernel: [   18.110000] usbserial: USB Serial support registered for GSM modem (1-port)

Wed Oct  8 04:45:27 2014 kern.info kernel: [   18.210000] usbcore: registered new interface driver rtl8192cu

Wed Oct  8 04:45:28 2014 user.emerg syslog: Error: Failed to connect to ubus

Wed Oct  8 04:45:30 2014 user.emerg syslog: this file has been obseleted. please call "/sbin/block mount" directly

Wed Oct  8 04:45:32 2014 user.info syslog: module is already loaded - xt_comment

Wed Oct  8 04:45:32 2014 kern.emerg already loaded - xt_comment

Wed Oct  8 04:45:35 2014 user.info syslog: module is already loaded - xt_comment

Wed Oct  8 04:45:35 2014 kern.emerg already loaded - xt_comment

Wed Oct  8 04:45:37 2014 kern.info kernel: [   31.130000] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

Wed Oct  8 04:45:38 2014 kern.info kernel: [   31.350000] device eth0 entered promiscuous mode

Wed Oct  8 04:45:38 2014 kern.info kernel: [   31.520000] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready

Wed Oct  8 04:45:38 2014 daemon.notice netifd: Interface 'lan' is enabled

Wed Oct  8 04:45:38 2014 daemon.notice netifd: Interface 'lan' is setting up now

Wed Oct  8 04:45:38 2014 daemon.notice netifd: Interface 'lan' is now up

Wed Oct  8 04:45:38 2014 daemon.notice netifd: Interface 'loopback' is enabled

Wed Oct  8 04:45:38 2014 daemon.notice netifd: Interface 'loopback' is setting up now

Wed Oct  8 04:45:38 2014 daemon.notice netifd: Interface 'loopback' is now up

Wed Oct  8 04:45:38 2014 daemon.notice netifd: Interface 'wan' is enabled

Wed Oct  8 04:45:38 2014 daemon.warn odhcpd[952]: Failed to send to ff02::1%br-lan (Cannot assign requested address)

Wed Oct  8 04:45:38 2014 user.emerg syslog: setting up led act

Wed Oct  8 04:45:38 2014 kern.info kernel: [   31.740000] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready

Wed Oct  8 04:45:38 2014 daemon.notice netifd: Network device 'lo' link is up

Wed Oct  8 04:45:38 2014 daemon.notice netifd: Interface 'loopback' has link connectivity 

Wed Oct  8 04:45:38 2014 user.emerg syslog: setting up led port1

Wed Oct  8 04:45:38 2014 user.emerg syslog: setting up led port2

Wed Oct  8 04:45:38 2014 user.emerg syslog: setting up led port3

Wed Oct  8 04:45:38 2014 user.emerg syslog: setting up led port4

Wed Oct  8 04:45:38 2014 user.emerg syslog: setting up led port5

Wed Oct  8 04:45:39 2014 user.emerg syslog: - init complete -

Wed Oct  8 04:45:39 2014 user.notice firewall: Reloading firewall due to ifup of lan (br-lan)

Wed Oct  8 04:45:40 2014 kern.info kernel: [   33.230000] eth0: link up (1000Mbps/Full duplex)

Wed Oct  8 04:45:40 2014 kern.info kernel: [   33.370000] br-lan: port 1(eth0) entered forwarding state

Wed Oct  8 04:45:40 2014 kern.info kernel: [   33.430000] br-lan: port 1(eth0) entered forwarding state

Wed Oct  8 04:45:40 2014 kern.info kernel: [   33.490000] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

Wed Oct  8 04:45:40 2014 daemon.notice netifd: Network device 'eth0' link is up

Wed Oct  8 04:45:40 2014 daemon.notice netifd: Bridge 'br-lan' link is up

Wed Oct  8 04:45:40 2014 daemon.notice netifd: Interface 'lan' has link connectivity 

Wed Oct  8 04:45:40 2014 kern.info kernel: [   33.700000] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready

Wed Oct  8 04:45:42 2014 kern.info kernel: [   35.430000] br-lan: port 1(eth0) entered forwarding state

Wed Oct  8 04:45:44 2014 daemon.info dnsmasq[1339]: started, version 2.71 cachesize 150

Wed Oct  8 04:45:44 2014 daemon.info dnsmasq[1339]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-DNSSEC

Wed Oct  8 04:45:44 2014 daemon.info dnsmasq-dhcp[1339]: DHCP, IP range 192.168.1.100 -- 192.168.1.249, lease time 12h

Wed Oct  8 04:45:44 2014 daemon.info dnsmasq[1339]: using local addresses only for domain lan

Wed Oct  8 04:45:44 2014 daemon.warn dnsmasq[1339]: no servers found in /tmp/resolv.conf.auto, will retry

Wed Oct  8 04:45:44 2014 daemon.info dnsmasq[1339]: read /etc/hosts - 1 addresses

Wed Oct  8 04:45:44 2014 daemon.info dnsmasq-dhcp[1339]: read /etc/ethers - 0 addresses

Wed Oct  8 04:45:53 2014 daemon.info dnsmasq-dhcp[1339]: DHCPDISCOVER(br-lan) 192.168.1.147 bc:ae:c5:04:6f:eb 

Wed Oct  8 04:45:53 2014 daemon.info dnsmasq-dhcp[1339]: DHCPOFFER(br-lan) 192.168.1.147 bc:ae:c5:04:6f:eb 

Wed Oct  8 04:45:53 2014 daemon.info dnsmasq-dhcp[1339]: DHCPREQUEST(br-lan) 192.168.1.147 bc:ae:c5:04:6f:eb 

Wed Oct  8 04:45:53 2014 daemon.info dnsmasq-dhcp[1339]: DHCPACK(br-lan) 192.168.1.147 bc:ae:c5:04:6f:eb K52Jr

Wed Oct  8 04:49:38 2014 authpriv.info dropbear[1443]: Not backgrounding

(Last edited by hoatienii on 18 Oct 2014, 02:18)

where to get this patch?

The discussion might have continued from here.