summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtarget/linux/ramips/patches/100-install-mtk-wifi-drivers.patch199
-rwxr-xr-xtarget/linux/ramips/patches/101-ufsd.patch21
-rwxr-xr-xtarget/linux/ramips/patches/102-unused-api-in-nand.patch20
-rwxr-xr-xtarget/linux/ramips/patches/103-nand-skip-bad-block.patch37
-rwxr-xr-xtarget/linux/ramips/patches/104-splice.patch12
-rwxr-xr-xtarget/linux/ramips/patches/105-weak-reodering-beyond-llsc.patch12
-rwxr-xr-xtarget/linux/ramips/patches/106-fix-arch-ralink-kconfig.patch0
-rwxr-xr-xtarget/linux/ramips/patches/107-mt7628-sysclk.patch13
-rwxr-xr-xtarget/linux/ramips/patches/108-hwnat-ifname.patch21
-rwxr-xr-xtarget/linux/ramips/patches/109-support-wifi-nat-new-api.patch33
-rwxr-xr-xtarget/linux/ramips/patches/110-fix-br0.patch30
-rwxr-xr-xtarget/linux/ramips/patches/111-nand-controller-busy.patch55
-rwxr-xr-xtarget/linux/ramips/patches/112-nvram-init.patch25
-rwxr-xr-xtarget/linux/ramips/patches/113-hwqos-rate-display-error.patch13
-rwxr-xr-xtarget/linux/ramips/patches/114-raeth-udhcpc-pid.patch17
-rwxr-xr-xtarget/linux/ramips/patches/115-rt-timer-build-error.patch14
-rwxr-xr-xtarget/linux/ramips/patches/116-hwnat-info-pos.patch32
-rwxr-xr-xtarget/linux/ramips/patches/117-workaround-for-autobuild.patch13
-rwxr-xr-xtarget/linux/ramips/patches/118-mt7628-usb-phy-build.patch28
-rwxr-xr-xtarget/linux/ramips/patches/119-initramfs.patch16
-rwxr-xr-xtarget/linux/ramips/patches/120-fix-wifi-fwd-crash.patch76
-rwxr-xr-xtarget/linux/ramips/patches/121-use-watchdog-for-soft-reset.patch132
-rwxr-xr-xtarget/linux/ramips/patches/122-hwnat-build-error.patch18
-rwxr-xr-xtarget/linux/ramips/patches/123-mmc-build-warning.patch13
-rwxr-xr-xtarget/linux/ramips/patches/130-5030kernel2op341-sdk.patch279
-rw-r--r--target/linux/ramips/patches/131-hwnat-panic-as-br-name.patch16
26 files changed, 1145 insertions, 0 deletions
diff --git a/target/linux/ramips/patches/100-install-mtk-wifi-drivers.patch b/target/linux/ramips/patches/100-install-mtk-wifi-drivers.patch
new file mode 100755
index 0000000..0416c78
--- /dev/null
+++ b/target/linux/ramips/patches/100-install-mtk-wifi-drivers.patch
@@ -0,0 +1,199 @@
+Index: linux-3.10.14/ralink/Kconfig
+===================================================================
+--- linux-3.10.14.orig/ralink/Kconfig
++++ linux-3.10.14/ralink/Kconfig
+@@ -61,73 +61,81 @@ choice
+ bool "MT7620 for rlt_wifi wifi driver"
+ select RTMP_MAC
+ select RALINK_RT6352
++ select WIFI_MT7620 if SUPPORT_OPENWRT
++ select MT7620_RALINK_RT6352 if SUPPORT_OPENWRT
++ select MT7620_RTMP_MAC if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7628
+ bool "MT7628 for rlt_wifi wifi driver"
+- depends on RALINK_MT7628
+ select MT_MAC
+
+ config FIRST_IF_RT3092
+ bool "RT3092"
+- depends on RALINK_MT7621
+ select RTMP_MAC
+ select RALINK_RT3092
+
+ config FIRST_IF_RT5392
+ bool "RT5392"
+- depends on RALINK_MT7621
+ select RTMP_MAC
+ select RALINK_RT5392
+
+ config FIRST_IF_RT5592
+ bool "RT5592"
+- depends on RALINK_MT7621
+ select RTMP_MAC
+ select RALINK_RT5592
+
+ config FIRST_IF_RT3593
+ bool "RT3593"
+- depends on RALINK_MT7621
+ select RTMP_MAC
+ select RALINK_RT3593
+
+ config FIRST_IF_MT7610E
+ bool "MT7610E"
+- depends on RALINK_MT7621
+ select RLT_MAC
+ select RALINK_MT7610E
++ select WIFI_MT7610E if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7612E
+ bool "MT7612E"
+- depends on RALINK_MT7621
+ select RLT_MAC
+ select RALINK_MT7612E
++ select WIFI_MT7612E if SUPPORT_OPENWRT
++ select MT76X2E_RALINK_MT7612E if SUPPORT_OPENWRT
++ select MT76X2E_RLT_MAC if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7602E
+ bool "MT7602E"
+- depends on RALINK_MT7621
+ select RLT_MAC
+ select RALINK_MT7602E
++ select WIFI_MT7602E if SUPPORT_OPENWRT
++ select MT76X2E_RALINK_MT7602E if SUPPORT_OPENWRT
++ select MT76X2E_RLT_MAC if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7603E
+ bool "MT7603E"
+- depends on RALINK_MT7621
+ select MT_MAC
+ select RALINK_MT7603E
++ select WIFI_MT7603E if SUPPORT_OPENWRT
++ select MT7603E_RALINK_MT7603E if SUPPORT_OPENWRT
++ select MT7603E_MT_MAC if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7637E
+ bool "MT7637E"
+- depends on RALINK_MT7621
+ select WIFI_MT_MAC
+ select MT_MAC
+ select RALINK_MT7637E
++ select WIFI_MT7637E if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7615E
+ bool "MT7615E"
+- depends on RALINK_MT7621
+ select WIFI_MT_MAC
+ select MT_MAC
+ select CHIP_MT7615E
++ select WIFI_MT7615E if SUPPORT_OPENWRT
++ select MT7615E_CHIP_MT7615E if SUPPORT_OPENWRT
++ select MT7615E_MT_MAC if SUPPORT_OPENWRT
++ select MT7615E_WIFI_MT_MAC if SUPPORT_OPENWRT
++
+ endchoice
+
+ choice
+@@ -169,11 +177,13 @@ choice
+ bool "MT7610U"
+ select RLT_MAC
+ select RALINK_MT7610U
++ select WIFI_MT7610U if SUPPORT_OPENWRT
+
+ config SECOND_IF_MT7610E
+ bool "MT7610E"
+ select RLT_MAC
+ select RALINK_MT7610E
++ select WIFI_MT7610E if SUPPORT_OPENWRT
+
+ config SECOND_IF_RT8592
+ bool "RT85592"
+@@ -184,21 +194,32 @@ choice
+ bool "MT7612U"
+ select RLT_MAC
+ select RALINK_MT7612U
++ select WIFI_MT7612U if SUPPORT_OPENWRT
+
+ config SECOND_IF_MT7612E
+ bool "MT7612E"
+ select RLT_MAC
+ select RALINK_MT7612E
++ select WIFI_MT7612E if SUPPORT_OPENWRT
++ select MT76X2E_RALINK_MT7612E if SUPPORT_OPENWRT
++ select MT76X2E_RLT_MAC if SUPPORT_OPENWRT
+
+ config SECOND_IF_MT7602E
+ bool "MT7602E"
+ select RLT_MAC
+ select RALINK_MT7602E
++ select WIFI_MT7602E if SUPPORT_OPENWRT
++ select MT76X2E_RALINK_MT7602E if SUPPORT_OPENWRT
++ select MT76X2E_RLT_MAC if SUPPORT_OPENWRT
+
+ config SECOND_IF_MT7603E
+ bool "MT7603E"
+ select MT_MAC
+ select RALINK_MT7603E
++ select WIFI_MT7603E if SUPPORT_OPENWRT
++ select MT7603E_RALINK_MT7603E if SUPPORT_OPENWRT
++ select MT7603E_MT_MAC if SUPPORT_OPENWRT
++
+
+ config SECOND_IF_MT7637E
+ bool "MT7637E"
+@@ -210,6 +231,10 @@ choice
+ bool "MT7615E"
+ select WIFI_MT_MAC
+ select CHIP_MT7615E
++ select WIFI_MT7615E if SUPPORT_OPENWRT
++ select MT7615E_CHIP_MT7615E if SUPPORT_OPENWRT
++ select MT7615E_MT_MAC if SUPPORT_OPENWRT
++ select MT7615E_WIFI_MT_MAC if SUPPORT_OPENWRT
+ endchoice
+
+ choice
+@@ -222,6 +247,10 @@ choice
+ select WIFI_MT_MAC
+ select MT_MAC
+ select CHIP_MT7615E
++ select WIFI_MT7615E if SUPPORT_OPENWRT
++ select MT7615E_CHIP_MT7615E if SUPPORT_OPENWRT
++ select MT7615E_MT_MAC if SUPPORT_OPENWRT
++ select MT7615E_WIFI_MT_MAC if SUPPORT_OPENWRT
+ endchoice
+
+ config RT_FIRST_CARD
+@@ -354,6 +383,7 @@ choice
+ endchoice
+
+
++source "drivers/net/wireless/mtk/Kconfig"
+ #source "drivers/net/wireless/rt2860v2_ap/Kconfig"
+ #source "drivers/net/wireless/rt2860v2_sta/Kconfig"
+ #source "drivers/net/wireless/RTPCI_ap/Kconfig"
+Index: linux-3.10.14/drivers/net/wireless/Makefile
+===================================================================
+--- linux-3.10.14.orig/drivers/net/wireless/Makefile
++++ linux-3.10.14/drivers/net/wireless/Makefile
+@@ -72,18 +72,8 @@ else
+ obj-$(CONFIG_WIFI_PKT_FWD) += wifi_forward/wifi_fwd/
+ endif
+
+-ifneq ($(CONFIG_RLT_AP_SUPPORT),)
+-obj-$(CONFIG_RLT_AP_SUPPORT) += rlt_wifi_ap/
+-endif
+-ifneq ($(CONFIG_RLT_STA_SUPPORT),)
+-obj-$(CONFIG_RLT_STA_SUPPORT) += rlt_wifi_sta/
+-endif
+-ifneq ($(CONFIG_MT_AP_SUPPORT),)
+-obj-$(CONFIG_MT_AP_SUPPORT) += mt_wifi_ap/
+-endif
+-ifneq ($(CONFIG_MT_STA_SUPPORT),)
+-obj-$(CONFIG_MT_STA_SUPPORT) += mt_wifi_sta/
+-endif
++obj-y += mtk/
++
+ #ifneq ($(CONFIG_WIFI_PKT_FWD),)
+ #obj-y += wifi_forward/wifi_hook/
+ #endif
diff --git a/target/linux/ramips/patches/101-ufsd.patch b/target/linux/ramips/patches/101-ufsd.patch
new file mode 100755
index 0000000..3a2bd8e
--- /dev/null
+++ b/target/linux/ramips/patches/101-ufsd.patch
@@ -0,0 +1,21 @@
+Index: linux-3.10.14/fs/Kconfig
+===================================================================
+--- linux-3.10.14.orig/fs/Kconfig
++++ linux-3.10.14/fs/Kconfig
+@@ -186,7 +186,6 @@ menuconfig MISC_FILESYSTEMS
+
+ if MISC_FILESYSTEMS
+
+-source "fs/ufsd/Kconfig"
+ source "fs/adfs/Kconfig"
+ source "fs/affs/Kconfig"
+ source "fs/ecryptfs/Kconfig"
+Index: linux-3.10.14/fs/Makefile
+===================================================================
+--- linux-3.10.14.orig/fs/Makefile
++++ linux-3.10.14/fs/Makefile
+@@ -129,4 +129,3 @@ obj-$(CONFIG_CEPH_FS) += ceph/
+ obj-$(CONFIG_PSTORE) += pstore/
+ obj-$(CONFIG_EFIVAR_FS) += efivarfs/
+ obj-$(CONFIG_AUFS_FS) += aufs/
+-obj-$(CONFIG_UFSD_FS) += ufsd/
diff --git a/target/linux/ramips/patches/102-unused-api-in-nand.patch b/target/linux/ramips/patches/102-unused-api-in-nand.patch
new file mode 100755
index 0000000..6c986ed
--- /dev/null
+++ b/target/linux/ramips/patches/102-unused-api-in-nand.patch
@@ -0,0 +1,20 @@
+Index: linux-3.10.14/drivers/mtd/nand/mtk_nand.c
+===================================================================
+--- linux-3.10.14.orig/drivers/mtd/nand/mtk_nand.c
++++ linux-3.10.14/drivers/mtd/nand/mtk_nand.c
+@@ -3720,6 +3720,7 @@ static int mtk_nand_write_oob_raw(struct
+ return 0;
+ }
+
++#ifndef NAND_JFFS2_WORKAROUND
+ static int mtk_nand_write_oob_hw(struct mtd_info *mtd, struct nand_chip *chip, int page)
+ {
+ int i, iter;
+@@ -3828,6 +3829,7 @@ static int mtk_nand_write_oob(struct mtd
+
+ return 0;
+ }
++#endif
+
+ int mtk_nand_block_markbad_hw(struct mtd_info *mtd, loff_t offset)
+ {
diff --git a/target/linux/ramips/patches/103-nand-skip-bad-block.patch b/target/linux/ramips/patches/103-nand-skip-bad-block.patch
new file mode 100755
index 0000000..44ff22f
--- /dev/null
+++ b/target/linux/ramips/patches/103-nand-skip-bad-block.patch
@@ -0,0 +1,37 @@
+Index: linux-3.10.14/drivers/mtd/nand/mtk_nand.c
+===================================================================
+--- linux-3.10.14.orig/drivers/mtd/nand/mtk_nand.c
++++ linux-3.10.14/drivers/mtd/nand/mtk_nand.c
+@@ -2280,6 +2280,7 @@ static int get_start_end_block(struct mt
+ *end_blk = *start_blk + (g_pasStatic_Partition[i].size >> chip->phys_erase_shift) - 1;
+ if ((block >= *start_blk) && (block <= *end_blk))
+ {
++#ifndef CONFIG_SUPPORT_OPENWRT
+ #ifdef CONFIG_RT2880_ROOTFS_IN_FLASH
+ if ( i == (NAND_MTD_ROOTFS_PARTITION_NO-1))
+ {
+@@ -2290,6 +2291,7 @@ static int get_start_end_block(struct mt
+ *start_blk -= (g_pasStatic_Partition[i-1].size >> chip->phys_erase_shift);
+ }
+ #endif
++#endif
+ break;
+ }
+ *start_blk = *end_blk + 1;
+@@ -4807,6 +4809,7 @@ int mtk_nand_probe()
+ g_pasStatic_Partition[2].size = LARGE_MTD_CONFIG_PART_SIZE;
+ g_pasStatic_Partition[3].size = LARGE_MTD_FACTORY_PART_SIZE;
+ #ifdef CONFIG_RT2880_ROOTFS_IN_FLASH
++#ifndef CONFIG_SUPPORT_OPENWRT
+ //g_pasStatic_Partition[4].size = CONFIG_MTD_KERNEL_PART_SIZ;
+ g_pasStatic_Partition[5].size = IMAGE1_SIZE - (LARGE_MTD_BOOT_PART_SIZE + LARGE_MTD_CONFIG_PART_SIZE \
+ + LARGE_MTD_FACTORY_PART_SIZE + CONFIG_MTD_KERNEL_PART_SIZ) - MTD_ROOTFS_RESERVED_BLOCK;
+@@ -4842,7 +4845,7 @@ int mtk_nand_probe()
+ }
+
+ #endif
+-
++#endif
+ #ifndef CONFIG_SUPPORT_OPENWRT
+ #ifdef CONFIG_ROOTFS_IN_FLASH_NO_PADDING
+ #error "No code to handle this case in MTK NAND Driver.."
diff --git a/target/linux/ramips/patches/104-splice.patch b/target/linux/ramips/patches/104-splice.patch
new file mode 100755
index 0000000..3504423
--- /dev/null
+++ b/target/linux/ramips/patches/104-splice.patch
@@ -0,0 +1,12 @@
+Index: linux-3.10.14/fs/splice.c
+===================================================================
+--- linux-3.10.14.orig/fs/splice.c
++++ linux-3.10.14/fs/splice.c
+@@ -1817,6 +1817,7 @@ cleanup:
+
+ goto done;
+ }
++EXPORT_SYMBOL(generic_splice_from_socket);
+
+ static int __init init_splice_pools(void)
+ {
diff --git a/target/linux/ramips/patches/105-weak-reodering-beyond-llsc.patch b/target/linux/ramips/patches/105-weak-reodering-beyond-llsc.patch
new file mode 100755
index 0000000..5d5fb15
--- /dev/null
+++ b/target/linux/ramips/patches/105-weak-reodering-beyond-llsc.patch
@@ -0,0 +1,12 @@
+Index: linux-3.10.14/arch/mips/Kconfig
+===================================================================
+--- linux-3.10.14.orig/arch/mips/Kconfig
++++ linux-3.10.14/arch/mips/Kconfig
+@@ -90,6 +90,7 @@ config RALINK_MT7621
+ select SYS_SUPPORTS_MULTITHREADING
+ select SYS_SUPPORTS_SMP
+ select SYS_SUPPORTS_MIPS_CMP
++ select WEAK_REORDERING_BEYOND_LLSC
+ select IRQ_GIC
+ help
+ Ralink evaluation board based on MT7621
diff --git a/target/linux/ramips/patches/106-fix-arch-ralink-kconfig.patch b/target/linux/ramips/patches/106-fix-arch-ralink-kconfig.patch
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/target/linux/ramips/patches/106-fix-arch-ralink-kconfig.patch
diff --git a/target/linux/ramips/patches/107-mt7628-sysclk.patch b/target/linux/ramips/patches/107-mt7628-sysclk.patch
new file mode 100755
index 0000000..15e5150
--- /dev/null
+++ b/target/linux/ramips/patches/107-mt7628-sysclk.patch
@@ -0,0 +1,13 @@
+Index: linux-3.10.14/arch/mips/ralink/init.c
+===================================================================
+--- linux-3.10.14.orig/arch/mips/ralink/init.c
++++ linux-3.10.14/arch/mips/ralink/init.c
+@@ -543,7 +543,7 @@ void prom_init_sysclk(void)
+ #elif defined (CONFIG_RALINK_MT7628)
+ case 0:
+ reg = (*(volatile u32 *)(RALINK_SYSCTL_BASE + 0x10));
+- if (reg & 0x80)
++ if (reg & 0x40)
+ {
+ /* 40MHz Xtal */
+ mips_cpu_feq = 580 * 1000 * 1000;
diff --git a/target/linux/ramips/patches/108-hwnat-ifname.patch b/target/linux/ramips/patches/108-hwnat-ifname.patch
new file mode 100755
index 0000000..6b6fed1
--- /dev/null
+++ b/target/linux/ramips/patches/108-hwnat-ifname.patch
@@ -0,0 +1,21 @@
+Index: linux-3.10.14/net/nat/hw_nat/ra_nat.c
+===================================================================
+--- linux-3.10.14.orig/net/nat/hw_nat/ra_nat.c
++++ linux-3.10.14/net/nat/hw_nat/ra_nat.c
+@@ -4157,6 +4157,16 @@ static void SetAclFwd(uint32_t Ebl)
+ #endif
+ #endif
+ LanInt = ra_dev_get_by_name("br0");
++/* discard above!! */
++#if defined (CONFIG_SUPPORT_OPENWRT)
++#if defined (CONFIG_RALINK_MT7621) || defined (CONFIG_ARCH_MT7623)
++ WanInt = ra_dev_get_by_name("eth1");
++#else
++ WanInt = ra_dev_get_by_name("eth0.2");
++#endif
++ LanInt = ra_dev_get_by_name("br-lan");
++#endif
++
+ for(i = 0;i< 6;i++){
+ value = RegRead(RALINK_ETH_SW_BASE + 0x2004 + (i * 0x100));
+ value |= (0x1 << 10);
diff --git a/target/linux/ramips/patches/109-support-wifi-nat-new-api.patch b/target/linux/ramips/patches/109-support-wifi-nat-new-api.patch
new file mode 100755
index 0000000..010d52e
--- /dev/null
+++ b/target/linux/ramips/patches/109-support-wifi-nat-new-api.patch
@@ -0,0 +1,33 @@
+Index: linux-3.10.14/net/nat/hw_nat/Kconfig
+===================================================================
+--- linux-3.10.14.orig/net/nat/hw_nat/Kconfig
++++ linux-3.10.14/net/nat/hw_nat/Kconfig
+@@ -370,11 +370,10 @@ config PPE_MCAST
+ config RA_HW_NAT_WIFI
+ bool "WiFi Acceleration"
+ depends on RA_HW_NAT
+- select RA_HW_NAT_WIFI_NEW_ARCH if CHIP_MT7615E
+
+ config RA_HW_NAT_WIFI_NEW_ARCH
+ bool "WiFi Acceleration New Architecture"
+- depends on RA_HW_NAT_WIFI && CHIP_MT7615E
++ depends on RA_HW_NAT_WIFI
+
+ config RA_HW_NAT_NIC_USB
+ bool "PCIe Ethernet NIC/USB Acceleration"
+Index: linux-3.10.14/net/nat/hw_nat/ra_nat.c
+===================================================================
+--- linux-3.10.14.orig/net/nat/hw_nat/ra_nat.c
++++ linux-3.10.14/net/nat/hw_nat/ra_nat.c
+@@ -2089,9 +2089,11 @@ static void PpeSetInfoBlk2(struct _info_
+ iblk2->fpidx = fpidx;
+ #endif
+
++#if defined(CONFIG_ARCH_MT7623) || defined(CONFIG_RALINK_MT7621)
+ #if !defined (CONFIG_RAETH_QDMA)
+ iblk2->fqos = 0; /* PDMA MODE should not goes to QoS*/
+ #endif
++#endif
+
+ iblk2->port_mg = port_mg;
+ iblk2->port_ag = port_ag;
diff --git a/target/linux/ramips/patches/110-fix-br0.patch b/target/linux/ramips/patches/110-fix-br0.patch
new file mode 100755
index 0000000..c2c0f59
--- /dev/null
+++ b/target/linux/ramips/patches/110-fix-br0.patch
@@ -0,0 +1,30 @@
+Index: linux-3.10.14/net/nat/hw_nat/ra_nat.c
+===================================================================
+--- linux-3.10.14.orig/net/nat/hw_nat/ra_nat.c
++++ linux-3.10.14/net/nat/hw_nat/ra_nat.c
+@@ -3772,12 +3772,14 @@ static void PpeSetDstPort(uint32_t Ebl)
+ struct net_device *dev;
+ #if defined (CONFIG_SUPPORT_OPENWRT)
+ dev=ra_dev_get_by_name("eth0");
+- printk("eth2 ifindex =%x\n", dev->ifindex);
++ printk("eth0 ifindex =%x\n", dev->ifindex);
+ DstPort[dev->ifindex] = dev;
++ DP_GMAC1 = dev->ifindex;
+ #ifdef CONFIG_RAETH_GMAC2
+ dev=ra_dev_get_by_name("eth1");
+- printk("eth2 ifindex =%x\n", dev->ifindex);
++ printk("eth1 ifindex =%x\n", dev->ifindex);
+ DstPort[dev->ifindex] = dev;
++ DPORT_GMAC2 = dev->ifindex;
+ #endif
+ #else
+ dev=ra_dev_get_by_name("eth2");
+@@ -4159,7 +4161,7 @@ static void SetAclFwd(uint32_t Ebl)
+ #endif
+ #endif
+ LanInt = ra_dev_get_by_name("br0");
+-/* discard above!! */
++/* discard all above! */
+ #if defined (CONFIG_SUPPORT_OPENWRT)
+ #if defined (CONFIG_RALINK_MT7621) || defined (CONFIG_ARCH_MT7623)
+ WanInt = ra_dev_get_by_name("eth1");
diff --git a/target/linux/ramips/patches/111-nand-controller-busy.patch b/target/linux/ramips/patches/111-nand-controller-busy.patch
new file mode 100755
index 0000000..c87bbb5
--- /dev/null
+++ b/target/linux/ramips/patches/111-nand-controller-busy.patch
@@ -0,0 +1,55 @@
+Index: linux-3.10.14/drivers/mtd/ralink/ralink_nand.c
+===================================================================
+--- linux-3.10.14.orig/drivers/mtd/ralink/ralink_nand.c
++++ linux-3.10.14/drivers/mtd/ralink/ralink_nand.c
+@@ -377,7 +377,10 @@ static int nfc_check_wp(void)
+ int ret;
+
+ ret = _nfc_read_status(&result);
+- //FIXME, if ret < 0
++ if (ret) {
++ printk(KERN_WARNING "unable to tell WP. default FALSE.\n");
++ return 0;
++ }
+
+ return !(result & NAND_STATUS_WP);
+ #endif
+@@ -1332,10 +1335,9 @@ nand_get_device(struct ra_nand_chip *ra,
+ int ret = 0;
+
+ #if !defined (__UBOOT__)
+- ret = mutex_lock(ra->controller);
++ mutex_lock(ra->controller);
+ #endif ///
+- if (!ret)
+- ra->state = new_state;
++ ra->state = new_state;
+
+ return ret;
+
+@@ -1596,6 +1598,7 @@ int nand_erase_nand(struct ra_nand_chip
+
+ #ifdef SKIP_BAD_BLOCK
+ do {
++ int newpage = page_remap(ra, page);
+ #if defined (CONFIG_SUPPORT_OPENWRT)
+ if (((page << ra->page_shift) >= (int)rootfs_offset) && ((page << ra->page_shift) < (int)rootfs_data_offset))
+ {
+@@ -1606,8 +1609,6 @@ int nand_erase_nand(struct ra_nand_chip
+ }
+ }
+ #endif
+- int newpage = page_remap(ra, page);
+-
+ if (newpage < 0)
+ {
+ // printk("page_remap failed, page = 0x%x\n", page);
+@@ -2881,7 +2882,7 @@ static int ramtd_nand_writeoob(struct mt
+
+ ra_dbg("%s: \n", __func__);
+
+- nand_get_device(ra, FL_READING);
++ nand_get_device(ra, FL_WRITING);
+
+ ret = nand_do_write_ops(ra, to, ops);
+
diff --git a/target/linux/ramips/patches/112-nvram-init.patch b/target/linux/ramips/patches/112-nvram-init.patch
new file mode 100755
index 0000000..0f595c0
--- /dev/null
+++ b/target/linux/ramips/patches/112-nvram-init.patch
@@ -0,0 +1,25 @@
+Index: linux-3.10.14/arch/mips/ralink/nvram.c
+===================================================================
+--- linux-3.10.14.orig/arch/mips/ralink/nvram.c
++++ linux-3.10.14/arch/mips/ralink/nvram.c
+@@ -797,6 +797,11 @@ char const *nvram_get(int index, char *n
+
+ RANV_CHECK_INDEX(NULL);
+
++ if (!nvram_sem) {
++ printk("%s(%d,%s), sem not inited yet!\n", __FUNCTION__, index, name);
++ return NULL;
++ }
++
+ if (down_interruptible(nvram_sem)) {
+ printk("%s(%d): get nvram_sem fail\n", __func__, __LINE__);
+ return NULL;
+@@ -895,7 +900,7 @@ int nvram_getall(int index, char *buf)
+ module_init(ra_nvram_init);
+ MODULE_LICENSE("GPL");
+ #else
+-late_initcall(ra_nvram_init);
++subsys_initcall(ra_nvram_init);
+ #endif
+ module_exit(ra_nvram_exit);
+ EXPORT_SYMBOL(nvram_get);
diff --git a/target/linux/ramips/patches/113-hwqos-rate-display-error.patch b/target/linux/ramips/patches/113-hwqos-rate-display-error.patch
new file mode 100755
index 0000000..8f68b0d
--- /dev/null
+++ b/target/linux/ramips/patches/113-hwqos-rate-display-error.patch
@@ -0,0 +1,13 @@
+Index: linux-3.10.14/drivers/net/raeth/ra_mac.c
+===================================================================
+--- linux-3.10.14.orig/drivers/net/raeth/ra_mac.c
++++ linux-3.10.14/drivers/net/raeth/ra_mac.c
+@@ -708,7 +708,7 @@ int QDMARead(struct seq_file *seq, void
+ seq_printf(seq, "SCH1 rate control:%d. Rate is %dKbps.\n", max_en, max_rate);
+ max_en = (temp&0x08000000)>>27;
+ max_rate = (temp&0x07F00000)>>20;
+- for(i=0;i<(temp&0x000F0000);i++)
++ for(i=0;i<((temp&0x000F0000) >> 16);i++)
+ max_rate *= 10;
+ seq_printf(seq, "SCH2 rate control:%d. Rate is %dKbps.\n\n", max_en, max_rate);
+
diff --git a/target/linux/ramips/patches/114-raeth-udhcpc-pid.patch b/target/linux/ramips/patches/114-raeth-udhcpc-pid.patch
new file mode 100755
index 0000000..ea36fde
--- /dev/null
+++ b/target/linux/ramips/patches/114-raeth-udhcpc-pid.patch
@@ -0,0 +1,17 @@
+Index: linux-3.10.14/drivers/net/raeth/raether.c
+===================================================================
+--- linux-3.10.14.orig/drivers/net/raeth/raether.c
++++ linux-3.10.14/drivers/net/raeth/raether.c
+@@ -1354,7 +1354,11 @@ void kill_sig_workq(struct work_struct *
+ struct task_struct *p = NULL;
+
+ //read udhcpc pid from file, and send signal USR2,USR1 to get a new IP
+- fp = filp_open("/var/run/udhcpc.pid", O_RDONLY, 0);
++#if defined(CONFIG_RALINK_MT7621) || defined(CONFIG_ARCH_MT7623)
++ fp = filp_open("/var/run/udhcpc-eth1.pid", O_RDONLY, 0);
++#else
++ fp = filp_open("/var/run/udhcpc-eth0.2.pid", O_RDONLY, 0);
++#endif
+ if (IS_ERR(fp))
+ return;
+
diff --git a/target/linux/ramips/patches/115-rt-timer-build-error.patch b/target/linux/ramips/patches/115-rt-timer-build-error.patch
new file mode 100755
index 0000000..223932a
--- /dev/null
+++ b/target/linux/ramips/patches/115-rt-timer-build-error.patch
@@ -0,0 +1,14 @@
+Index: linux-3.10.14/arch/mips/ralink/rt_timer.c
+===================================================================
+--- linux-3.10.14.orig/arch/mips/ralink/rt_timer.c
++++ linux-3.10.14/arch/mips/ralink/rt_timer.c
+@@ -51,7 +51,9 @@
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+ #include <linux/timer.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,14)
+ #include <asm/system.h>
++#endif
+ #include <asm/uaccess.h>
+ #include <asm/rt2880/surfboardint.h>
+ #include <linux/interrupt.h>
diff --git a/target/linux/ramips/patches/116-hwnat-info-pos.patch b/target/linux/ramips/patches/116-hwnat-info-pos.patch
new file mode 100755
index 0000000..2cd6f27
--- /dev/null
+++ b/target/linux/ramips/patches/116-hwnat-info-pos.patch
@@ -0,0 +1,32 @@
+Index: linux-3.10.14/net/nat/hw_nat/ra_nat.h
+===================================================================
+--- linux-3.10.14.orig/net/nat/hw_nat/ra_nat.h
++++ linux-3.10.14/net/nat/hw_nat/ra_nat.h
+@@ -223,18 +223,12 @@ typedef struct {
+ #define FOE_MAGIC_PPE 0x7276
+
+ /* choose one of them to keep HNAT related information in somewhere. */
+-#if defined (CONFIG_SUPPORT_OPENWRT)
+-//#define HNAT_USE_HEADROOM
+-//#define HNAT_USE_TAILROOM
+-#define HNAT_USE_SKB_CB
+-#else
+ //#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) && defined (CONFIG_MT7621_ASIC)
+ //#define HNAT_USE_TAILROOM
+ //#else
+ #define HNAT_USE_HEADROOM
+ //#endif
+ //#define HNAT_USE_SKB_CB
+-#endif
+
+ #if defined (HNAT_USE_HEADROOM)
+ #define IS_SPACE_AVAILABLED(skb) ((skb_headroom(skb) >= FOE_INFO_LEN) ? 1 : 0)
+@@ -287,7 +281,7 @@ typedef struct {
+
+ #elif defined (HNAT_USE_SKB_CB)
+ //change the position of skb_CB if necessary
+-#define CB_OFFSET 32
++#define CB_OFFSET 42
+ #define IS_SPACE_AVAILABLED(skb) 1
+ #define FOE_INFO_START_ADDR(skb) (skb->cb + CB_OFFSET)
+
diff --git a/target/linux/ramips/patches/117-workaround-for-autobuild.patch b/target/linux/ramips/patches/117-workaround-for-autobuild.patch
new file mode 100755
index 0000000..c239525
--- /dev/null
+++ b/target/linux/ramips/patches/117-workaround-for-autobuild.patch
@@ -0,0 +1,13 @@
+Index: linux-3.10.14/scripts/kconfig/conf.c
+===================================================================
+--- linux-3.10.14.orig/scripts/kconfig/conf.c
++++ linux-3.10.14/scripts/kconfig/conf.c
+@@ -77,7 +77,7 @@ static void check_stdin(void)
+ printf(_("aborted!\n\n"));
+ printf(_("Console input/output is redirected. "));
+ printf(_("Run 'make oldconfig' to update configuration.\n\n"));
+- exit(1);
++ //exit(1); // a quick fix for autobuild.
+ }
+ }
+
diff --git a/target/linux/ramips/patches/118-mt7628-usb-phy-build.patch b/target/linux/ramips/patches/118-mt7628-usb-phy-build.patch
new file mode 100755
index 0000000..081f17b
--- /dev/null
+++ b/target/linux/ramips/patches/118-mt7628-usb-phy-build.patch
@@ -0,0 +1,28 @@
+Index: linux-3.10.14/drivers/usb/core/Makefile
+===================================================================
+--- linux-3.10.14.orig/drivers/usb/core/Makefile
++++ linux-3.10.14/drivers/usb/core/Makefile
+@@ -4,8 +4,6 @@
+
+ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
+
+-obj-$(CONFIG_RALINK_MT7628) += ../host/mtk-phy.o ../host/mtk-phy-7628.o ../host/mtk-phy-ahb.o
+-
+ usbcore-y := usb.o hub.o hcd.o urb.o message.o driver.o
+ usbcore-y += config.o file.o buffer.o sysfs.o endpoint.o
+ usbcore-y += devio.o notify.o generic.o quirks.o devices.o
+Index: linux-3.10.14/drivers/usb/host/Makefile
+===================================================================
+--- linux-3.10.14.orig/drivers/usb/host/Makefile
++++ linux-3.10.14/drivers/usb/host/Makefile
+@@ -14,6 +14,10 @@ fhci-$(CONFIG_FHCI_DEBUG) += fhci-dbg.o
+ xhci-hcd-y := xhci.o xhci-mem.o
+ xhci-hcd-y += xhci-ring.o xhci-hub.o xhci-dbg.o
+
++ifneq ($(CONFIG_RALINK_MT7628), )
++obj-y += ../host/mtk-phy.o ../host/mtk-phy-7628.o ../host/mtk-phy-ahb.o
++endif
++
+ ifndef CONFIG_USB_MT7621_XHCI_PLATFORM
+ xhci-hcd-$(CONFIG_PCI) += xhci-pci.o
+ endif
diff --git a/target/linux/ramips/patches/119-initramfs.patch b/target/linux/ramips/patches/119-initramfs.patch
new file mode 100755
index 0000000..53bd283
--- /dev/null
+++ b/target/linux/ramips/patches/119-initramfs.patch
@@ -0,0 +1,16 @@
+Index: linux-3.10.14/scripts/gen_initramfs_list.sh
+===================================================================
+--- linux-3.10.14.orig/scripts/gen_initramfs_list.sh
++++ linux-3.10.14/scripts/gen_initramfs_list.sh
+@@ -303,8 +303,9 @@ if [ ! -z ${output_file} ]; then
+ if [ "${is_cpio_compressed}" = "compressed" ]; then
+ cat ${cpio_tfile} > ${output_file}
+ else
+- (cat ${cpio_tfile} | ${compr} - > ${output_file}) \
+- || (rm -f ${output_file} ; false)
++ #(cat ${cpio_tfile} | ${compr} - > ${output_file}) \
++ #|| (rm -f ${output_file} ; false)
++ ${STAGING_DIR}/../host/bin/lzma_alone e ${cpio_tfile} ${output_file} -d20
+ fi
+ [ -z ${cpio_file} ] && rm ${cpio_tfile}
+ fi
diff --git a/target/linux/ramips/patches/120-fix-wifi-fwd-crash.patch b/target/linux/ramips/patches/120-fix-wifi-fwd-crash.patch
new file mode 100755
index 0000000..a12bf59
--- /dev/null
+++ b/target/linux/ramips/patches/120-fix-wifi-fwd-crash.patch
@@ -0,0 +1,76 @@
+diff -Nur linux-3.10.14-orig/drivers/net/wireless/wifi_forward/wifi_fwd/wifi_fwd.c linux-3.10.14/drivers/net/wireless/wifi_forward/wifi_fwd/wifi_fwd.c
+--- linux-3.10.14-orig/drivers/net/wireless/wifi_forward/wifi_fwd/wifi_fwd.c 2017-04-07 11:55:09.000000000 +0800
++++ linux-3.10.14/drivers/net/wireless/wifi_forward/wifi_fwd/wifi_fwd.c 2017-04-10 14:45:20.898046962 +0800
+@@ -295,7 +295,7 @@
+
+ static void dump_bridge_by_name(void)
+ {
+- br0 = ra_dev_get_by_name("br0");
++ br0 = ra_dev_get_by_name("br-lan");
+ }
+
+ static void wifi_fwd_reset_link_count(void)
+@@ -2548,6 +2548,12 @@
+ unsigned int recv_from = 0, band_from = 0, ret = 0;
+ int idx = 0;
+
++ if (mh == NULL ||skb == NULL)
++ {
++ printk("%s:mh=%p,skb=%p \n",__FUNCTION__,mh,skb);
++ return 1;
++ }
++
+ net_dev = skb->dev;
+ recv_from = WIFI_FWD_GET_PACKET_RECV_FROM(skb, recv_from_cb_offset);
+ band_from = WIFI_FWD_GET_PACKET_BAND(skb, band_cb_offset);
+@@ -2585,6 +2591,12 @@
+ }
+
+ /* forward the packet to bridge no matter unicast or broadcast */
++ if (mh->h_dest == NULL ||br0->dev_addr == NULL)
++ {
++ printk("%s mh->h_dest = %p,br0->dev_addr = %p\n",__FUNCTION__,mh->h_dest,br0->dev_addr);
++ return 1;
++ }
++
+ if ((br0->dev_addr != NULL) && MAC_ADDR_EQUAL(mh->h_dest, br0->dev_addr))
+ return 1;
+
+diff -Nur linux-3.10.14-orig/drivers/net/wireless/wifi_forward/wifi_fwd_v1/wifi_fwd.c linux-3.10.14/drivers/net/wireless/wifi_forward/wifi_fwd_v1/wifi_fwd.c
+--- linux-3.10.14-orig/drivers/net/wireless/wifi_forward/wifi_fwd_v1/wifi_fwd.c 2017-04-07 11:55:09.000000000 +0800
++++ linux-3.10.14/drivers/net/wireless/wifi_forward/wifi_fwd_v1/wifi_fwd.c 2017-04-10 14:45:36.464479582 +0800
+@@ -204,7 +204,7 @@
+ ap1_5g = ra_dev_get_by_name("rai1");
+ apcli1_5g = ra_dev_get_by_name("apclii1");
+
+- br0 = ra_dev_get_by_name("br0");
++ br0 = ra_dev_get_by_name("br-lan");
+
+ dbg_print("[dump]ap_2g=0x%08X, apcli_2g=0x%08X, ap_5g=0x%08X, apcli_5g=0x%08X, br0=0x%08X\n",
+ (int)ap_2g, (int)apcli_2g, (int)ap_5g, (int)apcli_5g, (int)br0);
+@@ -1991,7 +1991,12 @@
+ struct net_device *net_dev = NULL;
+ struct net_device *target = NULL;
+ struct ethhdr *mh = eth_hdr(skb);
+-
++
++ if (mh == NULL ||skb == NULL)
++ {
++ printk("%s:mh=%p,skb=%p \n",__FUNCTION__,mh,skb);
++ return 1;
++ }
+ unsigned char type = ENTRY_TYPE_INVALID;
+ net_dev = skb->dev;
+
+@@ -2026,6 +2031,11 @@
+ }
+
+ /* handle packets from bridge no matter unicast or broadcast */
++ if (mh->h_dest == NULL ||br0->dev_addr == NULL)
++ {
++ printk("%s mh->h_dest = %p,br0->dev_addr = %p\n",__FUNCTION__,mh->h_dest,br0->dev_addr);
++ return 1;
++ }
+ if (MAC_ADDR_EQUAL(mh->h_dest, br0->dev_addr))
+ return 1;
+
diff --git a/target/linux/ramips/patches/121-use-watchdog-for-soft-reset.patch b/target/linux/ramips/patches/121-use-watchdog-for-soft-reset.patch
new file mode 100755
index 0000000..54c4d40
--- /dev/null
+++ b/target/linux/ramips/patches/121-use-watchdog-for-soft-reset.patch
@@ -0,0 +1,132 @@
+Index: linux-3.10.14/arch/mips/ralink/reset.c
+===================================================================
+--- linux-3.10.14.orig/arch/mips/ralink/reset.c
++++ linux-3.10.14/arch/mips/ralink/reset.c
+@@ -42,6 +42,8 @@
+ #include <asm/mach-ralink/generic.h>
+ #include <linux/pm.h>
+ #include <linux/delay.h>
++//#include "../../arch/mips/ralink/rt_timer.h"
++#include "rt_timer.h"
+
+ static void mips_machine_restart(char *command);
+ static void mips_machine_halt(void);
+@@ -49,12 +51,118 @@ static void mips_machine_power_off(void)
+
+ static void mips_machine_restart(char *command)
+ {
++ /* workaround: use watchdog to reset the system. */
++ unsigned int result;
++ printk("wdg reset\n");
++#if defined(CONFIG_RALINK_MT7620)
++ #if defined(CONFIG_RALINK_TIMER_WDG_RESET_OUTPUT)
++ /* switch to watchdog mode */
++ result=sysRegRead(GPIOMODE);
++ result &= ~(0x3<<21);
++ result |= (0x0<<21);
++ sysRegWrite(GPIOMODE,result);
++ #endif
++ /* set timer load */
++ sysRegWrite(TMR1LOAD, (40000000/65536));
++ /* start watchdog timer */
++ result=sysRegRead(TMR1CTL);
++ result |= (1<<7);
++ sysRegWrite(TMR1CTL,result);
++#elif defined(CONFIG_RALINK_MT7621)
++ #if defined(CONFIG_RALINK_TIMER_WDG_RESET_OUTPUT)
++ /* switch to watchdog mode */
++ result=sysRegRead(GPIOMODE);
++ result &= ~(0x3<<8);
++ sysRegWrite(GPIOMODE,result);
++ #endif
++ /* set timer to 100ms */
++ result=sysRegRead(TMR1CTL);
++ result &= 0x0000FFFF;
++ result |= (1000<<16); // 1us * 1000 = 1ms
++ sysRegWrite(TMR1CTL, result);
++ sysRegWrite(TMR1LOAD, 100); // 1ms * 100 = 100ms
++ /* start watchdog timer */
++ result=sysRegRead(TMR1CTL);
++ result |= (1<<7);
++ sysRegWrite(TMR1CTL,result);
++#elif defined(CONFIG_RALINK_MT7628)
++ #if defined(CONFIG_RALINK_TIMER_WDG_RESET_OUTPUT)
++ /* switch to watchdog mode */
++ result=sysRegRead(GPIOMODE);
++ result &= ~(0x1<<14);
++ sysRegWrite(GPIOMODE,result);
++ #endif
++ /* set timer to 100ms */
++ result=sysRegRead(TMR1CTL);
++ result &= 0x0000FFFF;
++ result |= (1000<<16); // 1us * 1000 = 1ms
++ sysRegWrite(TMR1CTL, result);
++ sysRegWrite(TMR1LOAD, 100); // 1ms * 100 = 100ms
++ /* start watchdog timer */
++ result=sysRegRead(TMR1CTL);
++ result |= (1<<7);
++ sysRegWrite(TMR1CTL,result);
++#endif
++ printk("normal reset\n");
+ *(volatile unsigned int*)(SOFTRES_REG) = GORESET;
+ *(volatile unsigned int*)(SOFTRES_REG) = 0;
+ }
+
+ static void mips_machine_halt(void)
+ {
++ /* workaround: use watchdog to reset the system. */
++ unsigned int result;
++ printk("wdg reset\n");
++#if defined(CONFIG_RALINK_MT7620)
++ #if defined(CONFIG_RALINK_TIMER_WDG_RESET_OUTPUT)
++ /* switch to watchdog mode */
++ result=sysRegRead(GPIOMODE);
++ result &= ~(0x3<<21);
++ result |= (0x0<<21);
++ sysRegWrite(GPIOMODE,result);
++ #endif
++ /* set timer load */
++ sysRegWrite(TMR1LOAD, (40000000/65536));
++ /* start watchdog timer */
++ result=sysRegRead(TMR1CTL);
++ result |= (1<<7);
++ sysRegWrite(TMR1CTL,result);
++#elif defined(CONFIG_RALINK_MT7621)
++ #if defined(CONFIG_RALINK_TIMER_WDG_RESET_OUTPUT)
++ /* switch to watchdog mode */
++ result=sysRegRead(GPIOMODE);
++ result &= ~(0x3<<8);
++ sysRegWrite(GPIOMODE,result);
++ #endif
++ /* set timer to 100ms */
++ result=sysRegRead(TMR1CTL);
++ result &= 0x0000FFFF;
++ result |= (1000<<16); // 1us * 1000 = 1ms
++ sysRegWrite(TMR1CTL, result);
++ sysRegWrite(TMR1LOAD, 100); // 1ms * 100 = 100ms
++ /* start watchdog timer */
++ result=sysRegRead(TMR1CTL);
++ result |= (1<<7);
++ sysRegWrite(TMR1CTL,result);
++#elif defined(CONFIG_RALINK_MT7628)
++ #if defined(CONFIG_RALINK_TIMER_WDG_RESET_OUTPUT)
++ /* switch to watchdog mode */
++ result=sysRegRead(GPIOMODE);
++ result &= ~(0x1<<14);
++ sysRegWrite(GPIOMODE,result);
++ #endif
++ /* set timer to 100ms */
++ result=sysRegRead(TMR1CTL);
++ result &= 0x0000FFFF;
++ result |= (1000<<16); // 1us * 1000 = 1ms
++ sysRegWrite(TMR1CTL, result);
++ sysRegWrite(TMR1LOAD, 100); // 1ms * 100 = 100ms
++ /* start watchdog timer */
++ result=sysRegRead(TMR1CTL);
++ result |= (1<<7);
++ sysRegWrite(TMR1CTL,result);
++#endif
++ printk("normal reset\n");
+ *(volatile unsigned int*)(SOFTRES_REG) = (0x1)<<26; // PCIERST
+ mdelay(10);
+ *(volatile unsigned int*)(SOFTRES_REG) = GORESET;
diff --git a/target/linux/ramips/patches/122-hwnat-build-error.patch b/target/linux/ramips/patches/122-hwnat-build-error.patch
new file mode 100755
index 0000000..749d97e
--- /dev/null
+++ b/target/linux/ramips/patches/122-hwnat-build-error.patch
@@ -0,0 +1,18 @@
+Index: linux-3.10.14/net/nat/hw_nat/foe_fdb.c
+===================================================================
+--- linux-3.10.14.orig/net/nat/hw_nat/foe_fdb.c
++++ linux-3.10.14/net/nat/hw_nat/foe_fdb.c
+@@ -565,8 +565,12 @@ int _FoeDropEntry(unsigned int entry_num
+ struct FoeEntry *entry;
+
+ entry = &PpeFoeBase[entry_num];
+-
++
++#if !defined (CONFIG_HNAT_V2)
+ entry->ipv4_hnapt.iblk2.dp = 7;
++#elif defined(CONFIG_ARCH_MT7623) || defined(CONFIG_RALINK_MT7621)
++ entry->ipv4_hnapt.iblk2.dp = 7;
++#endif
+
+ #if defined (CONFIG_HNAT_V2)
+ PpeSetCacheEbl(); /*clear HWNAT cache*/
diff --git a/target/linux/ramips/patches/123-mmc-build-warning.patch b/target/linux/ramips/patches/123-mmc-build-warning.patch
new file mode 100755
index 0000000..2f0235b
--- /dev/null
+++ b/target/linux/ramips/patches/123-mmc-build-warning.patch
@@ -0,0 +1,13 @@
+Index: linux-3.10.14/drivers/mmc/host/mtk-mmc/sd.c
+===================================================================
+--- linux-3.10.14.orig/drivers/mmc/host/mtk-mmc/sd.c
++++ linux-3.10.14/drivers/mmc/host/mtk-mmc/sd.c
+@@ -2999,7 +2999,7 @@ static int __init mt_msdc_init(void)
+ reg1 = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x1360)) & ~(0x1<<26);
+ sdr_write32((volatile u32*)(RALINK_SYSCTL_BASE + 0x1360), reg1);
+ #else
+- reg = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3<<0) & ~(0x3<<6) & ~(0x3<<10) & ~(0x1<<15) & ~(0x3<<20) & ~(0x3<<24) | (0x1<<0) | (0x1<<6) | (0x1<<10) | (0x1<<15) | (0x1<<20) | (0x1<<24);
++ reg = (sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60)) & (~(0x3<<0)) & (~(0x3<<6)) & (~(0x3<<10)) & (~(0x1<<15)) & (~(0x3<<20)) & (~(0x3<<24))) | (0x1<<0) | (0x1<<6) | (0x1<<10) | (0x1<<15) | (0x1<<20) | (0x1<<24);
+ // reg = 0x55158448;
+
+ reg1 = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x1340)) | (0x1<<11); //Normal mode(AP mode) , SDXC CLK=PAD_GPIO0=GPIO11, driving = 8mA
diff --git a/target/linux/ramips/patches/130-5030kernel2op341-sdk.patch b/target/linux/ramips/patches/130-5030kernel2op341-sdk.patch
new file mode 100755
index 0000000..cbe9b96
--- /dev/null
+++ b/target/linux/ramips/patches/130-5030kernel2op341-sdk.patch
@@ -0,0 +1,279 @@
+Index: linux-3.10.14/drivers/net/raeth/raether.c
+===================================================================
+--- linux-3.10.14.orig/drivers/net/raeth/raether.c
++++ linux-3.10.14/drivers/net/raeth/raether.c
+@@ -2103,6 +2103,11 @@ static void esw_link_status_changed(int
+ #endif
+ } else {
+ printk("ESW: Link Status Changed - Port%d Link Down\n", port_no);
++#if defined (CONFIG_WAN_AT_P4)
++ if(port_no==4) {
++ schedule_work(&ei_local->kill_sig_wq);
++ }
++#endif
+
+ }
+ }
+@@ -5947,21 +5952,22 @@ void LANWANPartition(void)
+ mii_mgr_write(31, 0x2204, 0xff0003);//port2
+ mii_mgr_write(31, 0x2304, 0xff0003);//port3
+ mii_mgr_write(31, 0x2404, 0xff0003);//port4
++ mii_mgr_write(31, 0x2504, 0xff0003);//port5
++ mii_mgr_write(31, 0x2604, 0xff0003);//port6
+
+ /*set PVID*/
+ mii_mgr_write(31, 0x2014, 0x10002);//port0
+- mii_mgr_write(31, 0x2114, 0x10001);//port1
+- mii_mgr_write(31, 0x2214, 0x10001);//port2
+- mii_mgr_write(31, 0x2314, 0x10001);//port3
+- mii_mgr_write(31, 0x2414, 0x10001);//port4
+- /*port6 */
++ mii_mgr_write(31, 0x2514, 0x10001);//port5
++
+ /*VLAN member*/
+ IsSwitchVlanTableBusy();
+- mii_mgr_write(31, 0x94, 0x407e0001);//VAWD1
++ //mii_mgr_write(31, 0x94, 0x407e0001);//VAWD1
++ mii_mgr_write(31, 0x94, 0x40DE0001);//VAWD1
+ mii_mgr_write(31, 0x90, 0x80001001);//VTCR, VID=1
+ IsSwitchVlanTableBusy();
+
+- mii_mgr_write(31, 0x94, 0x40610001);//VAWD1
++ //mii_mgr_write(31, 0x94, 0x40610001);//VAWD1
++ mii_mgr_write(31, 0x94, 0x40210001);//VAWD1
+ mii_mgr_write(31, 0x90, 0x80001002);//VTCR, VID=2
+ IsSwitchVlanTableBusy();
+ #endif
+@@ -5974,20 +5980,21 @@ void LANWANPartition(void)
+ mii_mgr_write(31, 0x2204, 0xff0003);//port2
+ mii_mgr_write(31, 0x2304, 0xff0003);//port3
+ mii_mgr_write(31, 0x2404, 0xff0003);//port4
++ mii_mgr_write(31, 0x2504, 0xff0003);//port5
++ mii_mgr_write(31, 0x2604, 0xff0003);//port6
+
+ /*set PVID*/
+- mii_mgr_write(31, 0x2014, 0x10001);//port0
+- mii_mgr_write(31, 0x2114, 0x10001);//port1
+- mii_mgr_write(31, 0x2214, 0x10001);//port2
+- mii_mgr_write(31, 0x2314, 0x10001);//port3
+ mii_mgr_write(31, 0x2414, 0x10002);//port4
++ mii_mgr_write(31, 0x2514, 0x10002);//port5
+
+ /*VLAN member*/
+ IsSwitchVlanTableBusy();
+- mii_mgr_write(31, 0x94, 0x404f0001);//VAWD1
++ //mii_mgr_write(31, 0x94, 0x404f0001);//VAWD1
++ mii_mgr_write(31, 0x94, 0x40CF0001);//VAWD1
+ mii_mgr_write(31, 0x90, 0x80001001);//VTCR, VID=1
+ IsSwitchVlanTableBusy();
+- mii_mgr_write(31, 0x94, 0x40500001);//VAWD1
++ //mii_mgr_write(31, 0x94, 0x40500001);//VAWD1
++ mii_mgr_write(31, 0x94, 0x40300001);//VAWD1
+ mii_mgr_write(31, 0x90, 0x80001002);//VTCR, VID=2
+ IsSwitchVlanTableBusy();
+ #endif
+Index: linux-3.10.14/drivers/net/wireless/Makefile
+===================================================================
+--- linux-3.10.14.orig/drivers/net/wireless/Makefile
++++ linux-3.10.14/drivers/net/wireless/Makefile
+@@ -72,8 +72,18 @@ else
+ obj-$(CONFIG_WIFI_PKT_FWD) += wifi_forward/wifi_fwd/
+ endif
+
+-obj-y += mtk/
+-
++ifneq ($(CONFIG_RLT_AP_SUPPORT),)
++obj-$(CONFIG_RLT_AP_SUPPORT) += rlt_wifi_ap/
++endif
++ifneq ($(CONFIG_RLT_STA_SUPPORT),)
++obj-$(CONFIG_RLT_STA_SUPPORT) += rlt_wifi_sta/
++endif
++ifneq ($(CONFIG_MT_AP_SUPPORT),)
++obj-$(CONFIG_MT_AP_SUPPORT) += mt_wifi_ap/
++endif
++ifneq ($(CONFIG_MT_STA_SUPPORT),)
++obj-$(CONFIG_MT_STA_SUPPORT) += mt_wifi_sta/
++endif
+ #ifneq ($(CONFIG_WIFI_PKT_FWD),)
+ #obj-y += wifi_forward/wifi_hook/
+ #endif
+Index: linux-3.10.14/ralink/Kconfig
+===================================================================
+--- linux-3.10.14.orig/ralink/Kconfig
++++ linux-3.10.14/ralink/Kconfig
+@@ -61,80 +61,80 @@ choice
+ bool "MT7620 for rlt_wifi wifi driver"
+ select RTMP_MAC
+ select RALINK_RT6352
+- select WIFI_MT7620 if SUPPORT_OPENWRT
+- select MT7620_RALINK_RT6352 if SUPPORT_OPENWRT
+- select MT7620_RTMP_MAC if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7628
+ bool "MT7628 for rlt_wifi wifi driver"
++ depends on RALINK_MT7628
+ select MT_MAC
+
+ config FIRST_IF_RT3092
+ bool "RT3092"
++ depends on RALINK_MT7621
+ select RTMP_MAC
+ select RALINK_RT3092
+
+ config FIRST_IF_RT5392
+ bool "RT5392"
++ depends on RALINK_MT7621
+ select RTMP_MAC
+ select RALINK_RT5392
+
+ config FIRST_IF_RT5592
+ bool "RT5592"
++ depends on RALINK_MT7621
+ select RTMP_MAC
+ select RALINK_RT5592
+
+ config FIRST_IF_RT3593
+ bool "RT3593"
++ depends on RALINK_MT7621
+ select RTMP_MAC
+ select RALINK_RT3593
+
+ config FIRST_IF_MT7610E
+ bool "MT7610E"
++ depends on RALINK_MT7621
+ select RLT_MAC
+ select RALINK_MT7610E
+- select WIFI_MT7610E if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7612E
+ bool "MT7612E"
++ depends on RALINK_MT7621
+ select RLT_MAC
+ select RALINK_MT7612E
+- select WIFI_MT7612E if SUPPORT_OPENWRT
+- select MT76X2E_RALINK_MT7612E if SUPPORT_OPENWRT
+- select MT76X2E_RLT_MAC if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7602E
+ bool "MT7602E"
++ depends on RALINK_MT7621
+ select RLT_MAC
+ select RALINK_MT7602E
+- select WIFI_MT7602E if SUPPORT_OPENWRT
+- select MT76X2E_RALINK_MT7602E if SUPPORT_OPENWRT
+- select MT76X2E_RLT_MAC if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7603E
+ bool "MT7603E"
++ depends on RALINK_MT7621
+ select MT_MAC
+ select RALINK_MT7603E
+- select WIFI_MT7603E if SUPPORT_OPENWRT
+- select MT7603E_RALINK_MT7603E if SUPPORT_OPENWRT
+- select MT7603E_MT_MAC if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7637E
+ bool "MT7637E"
++ depends on RALINK_MT7621
+ select WIFI_MT_MAC
+ select MT_MAC
+ select RALINK_MT7637E
+- select WIFI_MT7637E if SUPPORT_OPENWRT
+
+ config FIRST_IF_MT7615E
+ bool "MT7615E"
++ depends on RALINK_MT7621
++ select WIFI_MT_MAC
++ select MT_MAC
++ select CHIP_MT7615E
++
++ config FIRST_IF_MT7615E
++ bool "MT7615E"
++ depends on RALINK_MT7628
+ select WIFI_MT_MAC
+ select MT_MAC
+ select CHIP_MT7615E
+- select WIFI_MT7615E if SUPPORT_OPENWRT
+- select MT7615E_CHIP_MT7615E if SUPPORT_OPENWRT
+- select MT7615E_MT_MAC if SUPPORT_OPENWRT
+- select MT7615E_WIFI_MT_MAC if SUPPORT_OPENWRT
+
+ endchoice
+
+@@ -177,13 +177,11 @@ choice
+ bool "MT7610U"
+ select RLT_MAC
+ select RALINK_MT7610U
+- select WIFI_MT7610U if SUPPORT_OPENWRT
+
+ config SECOND_IF_MT7610E
+ bool "MT7610E"
+ select RLT_MAC
+ select RALINK_MT7610E
+- select WIFI_MT7610E if SUPPORT_OPENWRT
+
+ config SECOND_IF_RT8592
+ bool "RT85592"
+@@ -194,32 +192,21 @@ choice
+ bool "MT7612U"
+ select RLT_MAC
+ select RALINK_MT7612U
+- select WIFI_MT7612U if SUPPORT_OPENWRT
+
+ config SECOND_IF_MT7612E
+ bool "MT7612E"
+ select RLT_MAC
+ select RALINK_MT7612E
+- select WIFI_MT7612E if SUPPORT_OPENWRT
+- select MT76X2E_RALINK_MT7612E if SUPPORT_OPENWRT
+- select MT76X2E_RLT_MAC if SUPPORT_OPENWRT
+
+ config SECOND_IF_MT7602E
+ bool "MT7602E"
+ select RLT_MAC
+ select RALINK_MT7602E
+- select WIFI_MT7602E if SUPPORT_OPENWRT
+- select MT76X2E_RALINK_MT7602E if SUPPORT_OPENWRT
+- select MT76X2E_RLT_MAC if SUPPORT_OPENWRT
+
+ config SECOND_IF_MT7603E
+ bool "MT7603E"
+ select MT_MAC
+ select RALINK_MT7603E
+- select WIFI_MT7603E if SUPPORT_OPENWRT
+- select MT7603E_RALINK_MT7603E if SUPPORT_OPENWRT
+- select MT7603E_MT_MAC if SUPPORT_OPENWRT
+-
+
+ config SECOND_IF_MT7637E
+ bool "MT7637E"
+@@ -231,10 +218,6 @@ choice
+ bool "MT7615E"
+ select WIFI_MT_MAC
+ select CHIP_MT7615E
+- select WIFI_MT7615E if SUPPORT_OPENWRT
+- select MT7615E_CHIP_MT7615E if SUPPORT_OPENWRT
+- select MT7615E_MT_MAC if SUPPORT_OPENWRT
+- select MT7615E_WIFI_MT_MAC if SUPPORT_OPENWRT
+ endchoice
+
+ choice
+@@ -247,10 +230,6 @@ choice
+ select WIFI_MT_MAC
+ select MT_MAC
+ select CHIP_MT7615E
+- select WIFI_MT7615E if SUPPORT_OPENWRT
+- select MT7615E_CHIP_MT7615E if SUPPORT_OPENWRT
+- select MT7615E_MT_MAC if SUPPORT_OPENWRT
+- select MT7615E_WIFI_MT_MAC if SUPPORT_OPENWRT
+ endchoice
+
+ config RT_FIRST_CARD
+@@ -383,7 +362,6 @@ choice
+ endchoice
+
+
+-source "drivers/net/wireless/mtk/Kconfig"
+ #source "drivers/net/wireless/rt2860v2_ap/Kconfig"
+ #source "drivers/net/wireless/rt2860v2_sta/Kconfig"
+ #source "drivers/net/wireless/RTPCI_ap/Kconfig"
diff --git a/target/linux/ramips/patches/131-hwnat-panic-as-br-name.patch b/target/linux/ramips/patches/131-hwnat-panic-as-br-name.patch
new file mode 100644
index 0000000..b686830
--- /dev/null
+++ b/target/linux/ramips/patches/131-hwnat-panic-as-br-name.patch
@@ -0,0 +1,16 @@
+Index: linux-3.10.14/net/nat/hw_nat/ra_nat.c
+===================================================================
+--- linux-3.10.14.orig/net/nat/hw_nat/ra_nat.c
++++ linux-3.10.14/net/nat/hw_nat/ra_nat.c
+@@ -435,7 +435,11 @@ void get_bridge_info(void)
+ struct net_device *br0_dev;
+ struct in_device *br0_in_dev;
+
++#if defined (CONFIG_SUPPORT_OPENWRT)
++ br0_dev = dev_get_by_name_rcu(&init_net,"br-lan");
++#else
+ br0_dev = dev_get_by_name_rcu(&init_net,"br0");
++#endif
+ br0_in_dev = in_dev_get(br0_dev);
+ brNetmask = ntohl(br0_in_dev->ifa_list->ifa_mask);
+ br0Ip = ntohl(br0_in_dev->ifa_list->ifa_address);