diff options
author | root <root@lamia.panaceas.james.local> | 2016-11-10 10:20:42 +0000 |
---|---|---|
committer | root <root@lamia.panaceas.james.local> | 2016-11-10 10:20:42 +0000 |
commit | a0e9b4c2ecdc394b21ffa77aa0c578818edad4f1 (patch) | |
tree | 201144b9b4ee9483a634c2aa9624ee664ba97622 /master/more-rom | |
parent | f84bb1e6f499eccbf06605884b0b2cbb7adfb46e (diff) | |
download | trunk-47381-pq-master.tar.gz trunk-47381-pq-master.tar.bz2 trunk-47381-pq-master.zip |
Diffstat (limited to 'master/more-rom')
-rw-r--r-- | master/more-rom | 1330 |
1 files changed, 1330 insertions, 0 deletions
diff --git a/master/more-rom b/master/more-rom new file mode 100644 index 0000000..9975798 --- /dev/null +++ b/master/more-rom @@ -0,0 +1,1330 @@ +diff --git a/.config b/.config +index bba31bd..089b228 100644 +--- a/.config ++++ b/.config +@@ -437,7 +437,7 @@ CONFIG_OPKGSMIME_PASSPHRASE=y + # Base system + # + CONFIG_PACKAGE_base-files=y +-# CONFIG_PACKAGE_block-mount is not set ++CONFIG_PACKAGE_block-mount=m + # CONFIG_PACKAGE_bridge is not set + CONFIG_PACKAGE_busybox=y + # CONFIG_BUSYBOX_CUSTOM is not set +@@ -1464,7 +1464,7 @@ CONFIG_PACKAGE_usign=y + # CONFIG_PACKAGE_kmod-md-mod is not set + # CONFIG_PACKAGE_kmod-nbd is not set + # CONFIG_PACKAGE_kmod-scsi-cdrom is not set +-# CONFIG_PACKAGE_kmod-scsi-core is not set ++CONFIG_PACKAGE_kmod-scsi-core=m + # CONFIG_PACKAGE_kmod-scsi-generic is not set + + # +@@ -1542,7 +1542,7 @@ CONFIG_PACKAGE_usign=y + # CONFIG_PACKAGE_kmod-fs-ntfs is not set + # CONFIG_PACKAGE_kmod-fs-reiserfs is not set + # CONFIG_PACKAGE_kmod-fs-udf is not set +-# CONFIG_PACKAGE_kmod-fs-vfat is not set ++CONFIG_PACKAGE_kmod-fs-vfat=m + # CONFIG_PACKAGE_kmod-fs-xfs is not set + # CONFIG_PACKAGE_kmod-fuse is not set + +@@ -1607,7 +1607,7 @@ CONFIG_PACKAGE_kmod-lib-crc-ccitt=y + # CONFIG_PACKAGE_kmod-lib-crc8 is not set + # CONFIG_PACKAGE_kmod-lib-lz4 is not set + # CONFIG_PACKAGE_kmod-lib-lzo is not set +-# CONFIG_PACKAGE_kmod-lib-textsearch is not set ++CONFIG_PACKAGE_kmod-lib-textsearch=m + # CONFIG_PACKAGE_kmod-lib-zlib is not set + + # +@@ -1616,7 +1616,7 @@ CONFIG_PACKAGE_kmod-lib-crc-ccitt=y + CONFIG_PACKAGE_kmod-nls-base=y + # CONFIG_PACKAGE_kmod-nls-cp1250 is not set + # CONFIG_PACKAGE_kmod-nls-cp1251 is not set +-# CONFIG_PACKAGE_kmod-nls-cp437 is not set ++CONFIG_PACKAGE_kmod-nls-cp437=m + # CONFIG_PACKAGE_kmod-nls-cp775 is not set + # CONFIG_PACKAGE_kmod-nls-cp850 is not set + # CONFIG_PACKAGE_kmod-nls-cp852 is not set +@@ -1624,7 +1624,7 @@ CONFIG_PACKAGE_kmod-nls-base=y + # CONFIG_PACKAGE_kmod-nls-cp864 is not set + # CONFIG_PACKAGE_kmod-nls-cp866 is not set + # CONFIG_PACKAGE_kmod-nls-cp932 is not set +-# CONFIG_PACKAGE_kmod-nls-iso8859-1 is not set ++CONFIG_PACKAGE_kmod-nls-iso8859-1=m + # CONFIG_PACKAGE_kmod-nls-iso8859-13 is not set + # CONFIG_PACKAGE_kmod-nls-iso8859-15 is not set + # CONFIG_PACKAGE_kmod-nls-iso8859-2 is not set +@@ -1647,7 +1647,7 @@ CONFIG_PACKAGE_kmod-ip6tables=y + # CONFIG_PACKAGE_kmod-ipt-compat-xtables is not set + # CONFIG_PACKAGE_kmod-ipt-condition is not set + CONFIG_PACKAGE_kmod-ipt-conntrack=y +-# CONFIG_PACKAGE_kmod-ipt-conntrack-extra is not set ++CONFIG_PACKAGE_kmod-ipt-conntrack-extra=m + CONFIG_PACKAGE_kmod-ipt-core=y + # CONFIG_PACKAGE_kmod-ipt-debug is not set + # CONFIG_PACKAGE_kmod-ipt-delude is not set +@@ -1686,15 +1686,15 @@ CONFIG_PACKAGE_kmod-ipt-nat=y + # CONFIG_PACKAGE_kmod-ipt-u32 is not set + # CONFIG_PACKAGE_kmod-ipt-ulog is not set + CONFIG_PACKAGE_kmod-nf-conntrack=y +-# CONFIG_PACKAGE_kmod-nf-conntrack-netlink is not set ++CONFIG_PACKAGE_kmod-nf-conntrack-netlink=m + CONFIG_PACKAGE_kmod-nf-conntrack6=y + CONFIG_PACKAGE_kmod-nf-ipt=y + CONFIG_PACKAGE_kmod-nf-ipt6=y + CONFIG_PACKAGE_kmod-nf-nat=y + # CONFIG_PACKAGE_kmod-nf-nat6 is not set +-# CONFIG_PACKAGE_kmod-nf-nathelper is not set +-# CONFIG_PACKAGE_kmod-nf-nathelper-extra is not set +-# CONFIG_PACKAGE_kmod-nfnetlink is not set ++CONFIG_PACKAGE_kmod-nf-nathelper=m ++CONFIG_PACKAGE_kmod-nf-nathelper-extra=m ++CONFIG_PACKAGE_kmod-nfnetlink=m + # CONFIG_PACKAGE_kmod-nfnetlink-log is not set + # CONFIG_PACKAGE_kmod-nfnetlink-queue is not set + # CONFIG_PACKAGE_kmod-nft-core is not set +@@ -1878,7 +1878,7 @@ CONFIG_PACKAGE_kmod-usb-core=y + # CONFIG_PACKAGE_kmod-usb-ohci-pci is not set + # CONFIG_PACKAGE_kmod-usb-printer is not set + # CONFIG_PACKAGE_kmod-usb-serial is not set +-# CONFIG_PACKAGE_kmod-usb-storage is not set ++CONFIG_PACKAGE_kmod-usb-storage=m + # CONFIG_PACKAGE_kmod-usb-storage-extras is not set + # CONFIG_PACKAGE_kmod-usb-uhci is not set + # CONFIG_PACKAGE_kmod-usb-wdm is not set +@@ -2631,7 +2631,7 @@ CONFIG_PACKAGE_liblzo=m + # CONFIG_PACKAGE_libmicroxml is not set + # CONFIG_PACKAGE_libminiupnpc is not set + # CONFIG_PACKAGE_libmms is not set +-# CONFIG_PACKAGE_libmnl is not set ++CONFIG_PACKAGE_libmnl=m + # CONFIG_PACKAGE_libmodbus is not set + # CONFIG_PACKAGE_libmosquitto is not set + # CONFIG_PACKAGE_libmosquitto-nossl is not set +@@ -2649,15 +2649,15 @@ CONFIG_PACKAGE_libncurses=m + # CONFIG_PACKAGE_libnet-1.2.x is not set + # CONFIG_PACKAGE_libnetconf is not set + # CONFIG_PACKAGE_libnetfilter-acct is not set +-# CONFIG_PACKAGE_libnetfilter-conntrack is not set +-# CONFIG_PACKAGE_libnetfilter-cthelper is not set +-# CONFIG_PACKAGE_libnetfilter-cttimeout is not set ++CONFIG_PACKAGE_libnetfilter-conntrack=m ++CONFIG_PACKAGE_libnetfilter-cthelper=m ++CONFIG_PACKAGE_libnetfilter-cttimeout=m + # CONFIG_PACKAGE_libnetfilter-log is not set +-# CONFIG_PACKAGE_libnetfilter-queue is not set ++CONFIG_PACKAGE_libnetfilter-queue=m + # CONFIG_PACKAGE_libnetsnmp is not set + # CONFIG_PACKAGE_libnettle is not set + # CONFIG_PACKAGE_libnfc is not set +-# CONFIG_PACKAGE_libnfnetlink is not set ++CONFIG_PACKAGE_libnfnetlink=m + # CONFIG_PACKAGE_libnftnl is not set + # CONFIG_PACKAGE_libnl is not set + # CONFIG_PACKAGE_libnl-core is not set +@@ -2695,7 +2695,7 @@ CONFIG_PACKAGE_libpopt=m + # CONFIG_PACKAGE_libprotobuf-c is not set + # CONFIG_PACKAGE_libqrencode is not set + # CONFIG_PACKAGE_libradcli is not set +-# CONFIG_PACKAGE_libreadline is not set ++CONFIG_PACKAGE_libreadline=m + # CONFIG_PACKAGE_libroxml is not set + # CONFIG_PACKAGE_librpc is not set + # CONFIG_PACKAGE_librrd1 is not set +@@ -2809,23 +2809,23 @@ CONFIG_PACKAGE_zlib=y + # CONFIG_LUCI_LANG_pt is not set + # CONFIG_LUCI_LANG_no is not set + # CONFIG_LUCI_LANG_en is not set +-# CONFIG_LUCI_LANG_el is not set ++# CONFIG_LUCI_LANG_pl is not set + # CONFIG_LUCI_LANG_sk is not set +-# CONFIG_LUCI_LANG_ja is not set ++# CONFIG_LUCI_LANG_ru is not set + # CONFIG_LUCI_LANG_vi is not set +-# CONFIG_LUCI_LANG_de is not set ++# CONFIG_LUCI_LANG_he is not set + # CONFIG_LUCI_LANG_ro is not set +-# CONFIG_LUCI_LANG_pt-br is not set + # CONFIG_LUCI_LANG_ms is not set +-# CONFIG_LUCI_LANG_pl is not set + # CONFIG_LUCI_LANG_zh-cn is not set +-# CONFIG_LUCI_LANG_he is not set ++# CONFIG_LUCI_LANG_de is not set + # CONFIG_LUCI_LANG_zh-tw is not set + # CONFIG_LUCI_LANG_tr is not set + # CONFIG_LUCI_LANG_sv is not set +-# CONFIG_LUCI_LANG_ru is not set ++# CONFIG_LUCI_LANG_ja is not set ++# CONFIG_LUCI_LANG_el is not set + # CONFIG_LUCI_LANG_ca is not set + # CONFIG_LUCI_LANG_es is not set ++# CONFIG_LUCI_LANG_pt-br is not set + # CONFIG_LUCI_LANG_cs is not set + # CONFIG_LUCI_LANG_fr is not set + # CONFIG_LUCI_LANG_it is not set +@@ -3051,7 +3051,7 @@ CONFIG_RSYNC_zlib=y + # Firewall + # + # CONFIG_PACKAGE_arptables is not set +-# CONFIG_PACKAGE_conntrack-tools is not set ++CONFIG_PACKAGE_conntrack-tools=m + # CONFIG_PACKAGE_ebtables is not set + # CONFIG_PACKAGE_fwknop is not set + # CONFIG_PACKAGE_fwknopd is not set +@@ -3064,7 +3064,7 @@ CONFIG_PACKAGE_iptables=y + # CONFIG_PACKAGE_iptables-mod-cluster is not set + # CONFIG_PACKAGE_iptables-mod-clusterip is not set + # CONFIG_PACKAGE_iptables-mod-condition is not set +-# CONFIG_PACKAGE_iptables-mod-conntrack-extra is not set ++CONFIG_PACKAGE_iptables-mod-conntrack-extra=m + # CONFIG_PACKAGE_iptables-mod-delude is not set + # CONFIG_PACKAGE_iptables-mod-dhcpmac is not set + # CONFIG_PACKAGE_iptables-mod-dnetmap is not set +@@ -3260,7 +3260,19 @@ CONFIG_PACKAGE_iptables=y + # CONFIG_PACKAGE_mcproxy is not set + # CONFIG_PACKAGE_mwan3 is not set + # CONFIG_PACKAGE_olsrd is not set +-# CONFIG_PACKAGE_quagga is not set ++CONFIG_PACKAGE_quagga=m ++# CONFIG_PACKAGE_quagga-babeld is not set ++CONFIG_PACKAGE_quagga-bgpd=m ++# CONFIG_PACKAGE_quagga-isisd is not set ++# CONFIG_PACKAGE_quagga-libospf is not set ++CONFIG_PACKAGE_quagga-libzebra=m ++# CONFIG_PACKAGE_quagga-ospf6d is not set ++# CONFIG_PACKAGE_quagga-ospfd is not set ++# CONFIG_PACKAGE_quagga-ripd is not set ++# CONFIG_PACKAGE_quagga-ripngd is not set ++CONFIG_PACKAGE_quagga-vtysh=m ++CONFIG_PACKAGE_quagga-watchquagga=m ++CONFIG_PACKAGE_quagga-zebra=m + # CONFIG_PACKAGE_relayd is not set + # CONFIG_PACKAGE_smcroute is not set + # CONFIG_PACKAGE_ss is not set +@@ -3640,7 +3652,8 @@ CONFIG_PACKAGE_ppp-mod-pppoe=y + # CONFIG_PACKAGE_remserial is not set + # CONFIG_PACKAGE_rssileds is not set + # CONFIG_PACKAGE_samba36-client is not set +-# CONFIG_PACKAGE_samba36-server is not set ++CONFIG_PACKAGE_samba36-server=m ++CONFIG_PACKAGE_SAMBA_MAX_DEBUG_LEVEL=-1 + # CONFIG_PACKAGE_scapy is not set + # CONFIG_PACKAGE_sctp is not set + # CONFIG_PACKAGE_sctp-tools is not set +diff --git a/bits/dev-ap9x-pci.c b/bits/dev-ap9x-pci.c +new file mode 100644 +index 0000000..19ba3da +--- /dev/null ++++ b/bits/dev-ap9x-pci.c +@@ -0,0 +1,174 @@ ++/* ++ * Atheros AP9X reference board PCI initialization ++ * ++ * Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org> ++ * ++ * 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/pci.h> ++#include <linux/ath9k_platform.h> ++#include <linux/delay.h> ++ ++#include <asm/mach-ath79/ath79.h> ++ ++#include "dev-ap9x-pci.h" ++#include "pci-ath9k-fixup.h" ++#include "pci.h" ++ ++static struct ath9k_platform_data ap9x_wmac0_data = { ++ .led_pin = -1, ++}; ++static struct ath9k_platform_data ap9x_wmac1_data = { ++ .led_pin = -1, ++}; ++static char ap9x_wmac0_mac[6]; ++static char ap9x_wmac1_mac[6]; ++ ++__init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin) ++{ ++ switch (wmac) { ++ case 0: ++ ap9x_wmac0_data.led_pin = pin; ++ break; ++ case 1: ++ ap9x_wmac1_data.led_pin = pin; ++ break; ++ } ++} ++ ++__init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac) ++{ ++ switch (wmac) { ++ case 0: ++ return &ap9x_wmac0_data; ++ ++ case 1: ++ return &ap9x_wmac1_data; ++ } ++ ++ return NULL; ++} ++ ++__init void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val) ++{ ++ switch (wmac) { ++ case 0: ++ ap9x_wmac0_data.gpio_mask = mask; ++ ap9x_wmac0_data.gpio_val = val; ++ break; ++ case 1: ++ ap9x_wmac1_data.gpio_mask = mask; ++ ap9x_wmac1_data.gpio_val = val; ++ break; ++ } ++} ++ ++__init void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds, ++ int num_leds) ++{ ++ switch (wmac) { ++ case 0: ++ ap9x_wmac0_data.leds = leds; ++ ap9x_wmac0_data.num_leds = num_leds; ++ break; ++ case 1: ++ ap9x_wmac1_data.leds = leds; ++ ap9x_wmac1_data.num_leds = num_leds; ++ break; ++ } ++} ++ ++static int ap91_pci_plat_dev_init(struct pci_dev *dev) ++{ ++ switch (PCI_SLOT(dev->devfn)) { ++ case 0: ++ dev->dev.platform_data = &ap9x_wmac0_data; ++ break; ++ } ++ ++ return 0; ++} ++ ++__init void ap91_pci_init(u8 *cal_data, u8 *mac_addr) ++{ ++ if (cal_data) ++ memcpy(ap9x_wmac0_data.eeprom_data, cal_data, ++ sizeof(ap9x_wmac0_data.eeprom_data)); ++ ++ if (mac_addr) { ++ memcpy(ap9x_wmac0_mac, mac_addr, sizeof(ap9x_wmac0_mac)); ++ ap9x_wmac0_data.macaddr = ap9x_wmac0_mac; ++ } ++ ++ pci_enable_ath9k_fixup(0, ap9x_wmac0_data.eeprom_data); ++ ++ ath79_pci_set_plat_dev_init(ap91_pci_plat_dev_init); ++ ath79_register_pci(); ++} ++ ++__init void ap91_pci_init_late(u8 *cal_data, u8 *mac_addr) ++{ ++ if (cal_data) ++ memcpy(ap9x_wmac0_data.eeprom_data, cal_data, ++ sizeof(ap9x_wmac0_data.eeprom_data)); ++ ++ if (mac_addr) { ++ memcpy(ap9x_wmac0_mac, mac_addr, sizeof(ap9x_wmac0_mac)); ++ ap9x_wmac0_data.macaddr = ap9x_wmac0_mac; ++ } ++ ++ pci_late_ath9k_fixup(); ++} ++ ++ ++__init void ap91_pci_init_simple(void) ++{ ++ ap91_pci_init(NULL, NULL); ++ ap9x_wmac0_data.eeprom_name = "pci_wmac0.eeprom"; ++} ++ ++static int ap94_pci_plat_dev_init(struct pci_dev *dev) ++{ ++ switch (PCI_SLOT(dev->devfn)) { ++ case 17: ++ dev->dev.platform_data = &ap9x_wmac0_data; ++ break; ++ ++ case 18: ++ dev->dev.platform_data = &ap9x_wmac1_data; ++ break; ++ } ++ ++ return 0; ++} ++ ++__init void ap94_pci_init(u8 *cal_data0, u8 *mac_addr0, ++ u8 *cal_data1, u8 *mac_addr1) ++{ ++ if (cal_data0) ++ memcpy(ap9x_wmac0_data.eeprom_data, cal_data0, ++ sizeof(ap9x_wmac0_data.eeprom_data)); ++ ++ if (cal_data1) ++ memcpy(ap9x_wmac1_data.eeprom_data, cal_data1, ++ sizeof(ap9x_wmac1_data.eeprom_data)); ++ ++ if (mac_addr0) { ++ memcpy(ap9x_wmac0_mac, mac_addr0, sizeof(ap9x_wmac0_mac)); ++ ap9x_wmac0_data.macaddr = ap9x_wmac0_mac; ++ } ++ ++ if (mac_addr1) { ++ memcpy(ap9x_wmac1_mac, mac_addr1, sizeof(ap9x_wmac1_mac)); ++ ap9x_wmac1_data.macaddr = ap9x_wmac1_mac; ++ } ++ ++ ath79_pci_set_plat_dev_init(ap94_pci_plat_dev_init); ++ ath79_register_pci(); ++ ++ pci_enable_ath9k_fixup(17, ap9x_wmac0_data.eeprom_data); ++ pci_enable_ath9k_fixup(18, ap9x_wmac1_data.eeprom_data); ++} +diff --git a/bits/dev-ap9x-pci.h b/bits/dev-ap9x-pci.h +new file mode 100644 +index 0000000..ea0a5ac +--- /dev/null ++++ b/bits/dev-ap9x-pci.h +@@ -0,0 +1,49 @@ ++/* ++ * Atheros AP9X reference board PCI initialization ++ * ++ * Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org> ++ * ++ * 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. ++ */ ++ ++#ifndef _ATH79_DEV_AP9X_PCI_H ++#define _ATH79_DEV_AP9X_PCI_H ++ ++struct gpio_led; ++struct ath9k_platform_data; ++ ++#if defined(CONFIG_ATH79_DEV_AP9X_PCI) ++void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin); ++void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val); ++void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds, ++ int num_leds); ++struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac); ++ ++void ap91_pci_init(u8 *cal_data, u8 *mac_addr); ++void ap91_pci_init_late(u8 *cal_data, u8 *mac_addr); ++void ap91_pci_init_simple(void); ++void ap94_pci_init(u8 *cal_data0, u8 *mac_addr0, ++ u8 *cal_data1, u8 *mac_addr1); ++ ++#else ++static inline void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin) {} ++static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac, ++ u32 mask, u32 val) {} ++static inline void ap9x_pci_setup_wmac_leds(unsigned wmac, ++ struct gpio_led *leds, ++ int num_leds) {} ++static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac) ++{ ++ return NULL; ++} ++ ++static inline void ap91_pci_init(u8 *cal_data, u8 *mac_addr) {} ++static inline void ap91_pci_init_simple(void) {} ++static inline void ap94_pci_init(u8 *cal_data0, u8 *mac_addr0, ++ u8 *cal_data1, u8 *mac_addr1) {} ++#endif ++ ++#endif /* _ATH79_DEV_AP9X_PCI_H */ ++ +diff --git a/bits/mach-tl-wdr4300.c b/bits/mach-tl-wdr4300.c +new file mode 100644 +index 0000000..426b1fa +--- /dev/null ++++ b/bits/mach-tl-wdr4300.c +@@ -0,0 +1,260 @@ ++/* ++ * TP-LINK TL-WDR4300 board support ++ * ++ * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org> ++ * ++ * 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/pci.h> ++#include <linux/phy.h> ++#include <linux/gpio.h> ++#include <linux/platform_device.h> ++#include <linux/ath9k_platform.h> ++#include <linux/ar8216_platform.h> ++ ++#include <asm/mach-ath79/ar71xx_regs.h> ++ ++#include <linux/mtd/mtd.h> ++#include <linux/ath9k_platform.h> ++#include <linux/pci.h> ++ ++ ++#include "common.h" ++#include "dev-ap9x-pci.h" ++#include "dev-eth.h" ++#include "dev-gpio-buttons.h" ++#include "dev-leds-gpio.h" ++#include "dev-m25p80.h" ++#include "dev-spi.h" ++#include "dev-usb.h" ++#include "dev-wmac.h" ++#include "machtypes.h" ++ ++#define WDR4300_GPIO_LED_USB1 11 ++#define WDR4300_GPIO_LED_USB2 12 ++#define WDR4300_GPIO_LED_WLAN2G 13 ++#define WDR4300_GPIO_LED_SYSTEM 14 ++#define WDR4300_GPIO_LED_QSS 15 ++ ++#define WDR4300_GPIO_BTN_WPS 16 ++#define WDR4300_GPIO_BTN_RFKILL 17 ++ ++#define WDR4300_GPIO_EXTERNAL_LNA0 18 ++#define WDR4300_GPIO_EXTERNAL_LNA1 19 ++ ++#define WDR4300_GPIO_USB1_POWER 22 ++#define WDR4300_GPIO_USB2_POWER 21 ++ ++#define WDR4300_KEYS_POLL_INTERVAL 20 /* msecs */ ++#define WDR4300_KEYS_DEBOUNCE_INTERVAL (3 * WDR4300_KEYS_POLL_INTERVAL) ++ ++#define WDR4300_MAC0_OFFSET 0 ++#define WDR4300_MAC1_OFFSET 6 ++#define WDR4300_WMAC_CALDATA_OFFSET 0x1000 ++#define WDR4300_PCIE_CALDATA_OFFSET 0x5000 ++ ++#define MAC_LEN 6 ++ ++#define CONFIG_OFFSET 0x1fc00 ++#define ART_OFFSET 0x1000 ++ ++static const char *wdr4300_part_probes[] = { ++ "tp-link", ++ NULL, ++}; ++ ++static struct flash_platform_data wdr4300_flash_data = { ++ .part_probes = wdr4300_part_probes, ++}; ++ ++static struct gpio_led wdr4300_leds_gpio[] __initdata = { ++ { ++ .name = "tp-link:blue:qss", ++ .gpio = WDR4300_GPIO_LED_QSS, ++ .active_low = 1, ++ }, ++ { ++ .name = "tp-link:blue:system", ++ .gpio = WDR4300_GPIO_LED_SYSTEM, ++ .active_low = 1, ++ }, ++ { ++ .name = "tp-link:green:usb1", ++ .gpio = WDR4300_GPIO_LED_USB1, ++ .active_low = 1, ++ }, ++ { ++ .name = "tp-link:green:usb2", ++ .gpio = WDR4300_GPIO_LED_USB2, ++ .active_low = 1, ++ }, ++ { ++ .name = "tp-link:blue:wlan2g", ++ .gpio = WDR4300_GPIO_LED_WLAN2G, ++ .active_low = 1, ++ }, ++}; ++ ++static struct gpio_keys_button wdr4300_gpio_keys[] __initdata = { ++ { ++ .desc = "QSS button", ++ .type = EV_KEY, ++ .code = KEY_WPS_BUTTON, ++ .debounce_interval = WDR4300_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = WDR4300_GPIO_BTN_WPS, ++ .active_low = 1, ++ }, ++ { ++ .desc = "RFKILL switch", ++ .type = EV_SW, ++ .code = KEY_RFKILL, ++ .debounce_interval = WDR4300_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = WDR4300_GPIO_BTN_RFKILL, ++ .active_low = 1, ++ }, ++}; ++ ++static const struct ar8327_led_info wdr4300_leds_ar8327[] __initconst = { ++ AR8327_LED_INFO(PHY0_0, HW, "tp-link:blue:wan"), ++ AR8327_LED_INFO(PHY1_0, HW, "tp-link:blue:lan1"), ++ AR8327_LED_INFO(PHY2_0, HW, "tp-link:blue:lan2"), ++ AR8327_LED_INFO(PHY3_0, HW, "tp-link:blue:lan3"), ++ AR8327_LED_INFO(PHY4_0, HW, "tp-link:blue:lan4"), ++}; ++ ++static struct ar8327_pad_cfg wdr4300_ar8327_pad0_cfg = { ++ .mode = AR8327_PAD_MAC_RGMII, ++ .txclk_delay_en = true, ++ .rxclk_delay_en = true, ++ .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, ++ .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, ++}; ++ ++static struct ar8327_led_cfg wdr4300_ar8327_led_cfg = { ++ .led_ctrl0 = 0xc737c737, ++ .led_ctrl1 = 0x00000000, ++ .led_ctrl2 = 0x00000000, ++ .led_ctrl3 = 0x0030c300, ++ .open_drain = false, ++}; ++ ++static struct ar8327_platform_data wdr4300_ar8327_data = { ++ .pad0_cfg = &wdr4300_ar8327_pad0_cfg, ++ .port0_cfg = { ++ .force_link = 1, ++ .speed = AR8327_PORT_SPEED_1000, ++ .duplex = 1, ++ .txpause = 1, ++ .rxpause = 1, ++ }, ++ .led_cfg = &wdr4300_ar8327_led_cfg, ++ .num_leds = ARRAY_SIZE(wdr4300_leds_ar8327), ++ .leds = wdr4300_leds_ar8327, ++}; ++ ++static struct mdio_board_info wdr4300_mdio0_info[] = { ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 0, ++ .platform_data = &wdr4300_ar8327_data, ++ }, ++}; ++ ++static u8 *mac, *art; ++ ++ ++ ++static void notify_add(struct mtd_info *mtd) ++{ ++ size_t len; ++ u8 tmpmac[ETH_ALEN]; ++ ++ if (!strcmp(mtd->name, "u-boot") && !mac) { ++ mac = kmalloc(MAC_LEN, GFP_KERNEL); ++ if (!mac) return; ++ ++ mtd_read(mtd, CONFIG_OFFSET, MAC_LEN, &len, mac); ++ ++ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); ++ ++ mdiobus_register_board_info(wdr4300_mdio0_info, ++ ARRAY_SIZE(wdr4300_mdio0_info)); ++ ++ ath79_register_mdio(0, 0x0); ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, mac, -2); ++ ++ /* GMAC0 is connected to an AR8327N switch */ ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ++ ath79_eth0_data.phy_mask = BIT(0); ++ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ++ ath79_eth0_pll_data.pll_1000 = 0x06000000; ++ ath79_register_eth(0); ++ } ++ ++ if (!strcmp(mtd->name, "art") && !art) { ++ art = kmalloc(mtd->size, GFP_KERNEL); ++ if (!art) return; ++ ++ mtd_read(mtd, 0, mtd->size, &len, art); ++ } ++ ++ ++ if (mac && art) { ++ ath79_init_mac(tmpmac, mac, -1); ++ ath79_register_wmac(art + WDR4300_WMAC_CALDATA_OFFSET, tmpmac); ++ ++ ath79_init_mac(tmpmac, mac, 0); ++ ap9x_pci_setup_wmac_led_pin(0, 0); ++ ap91_pci_init_late(art + WDR4300_PCIE_CALDATA_OFFSET, tmpmac); ++ ++ kfree(art); ++ art = NULL; ++ ++ kfree(mac); ++ mac = NULL; ++ } ++} ++ ++static void notify_remove(struct mtd_info *mtd) ++{ ++} ++ ++static struct mtd_notifier spi_notifier = { ++ .add = notify_add, ++ .remove = notify_remove ++}; ++ ++static void __init wdr4300_setup(void) ++{ ++ ++ register_mtd_user(&spi_notifier); ++ ++ ath79_register_m25p80(&wdr4300_flash_data); ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(wdr4300_leds_gpio), ++ wdr4300_leds_gpio); ++ ath79_register_gpio_keys_polled(-1, WDR4300_KEYS_POLL_INTERVAL, ++ ARRAY_SIZE(wdr4300_gpio_keys), ++ wdr4300_gpio_keys); ++ ++ ath79_wmac_set_ext_lna_gpio(0, WDR4300_GPIO_EXTERNAL_LNA0); ++ ath79_wmac_set_ext_lna_gpio(1, WDR4300_GPIO_EXTERNAL_LNA1); ++ ++ ap91_pci_init_simple(); ++ ++ ++ gpio_request_one(WDR4300_GPIO_USB1_POWER, ++ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, ++ "USB1 power"); ++ gpio_request_one(WDR4300_GPIO_USB2_POWER, ++ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, ++ "USB2 power"); ++ ath79_register_usb(); ++} ++ ++MIPS_MACHINE(ATH79_MACH_TL_WDR4300, "TL-WDR4300", ++ "TP-LINK TL-WDR3600/4300/4310", ++ wdr4300_setup); +diff --git a/bits/pci-ath9k-fixup.c b/bits/pci-ath9k-fixup.c +new file mode 100644 +index 0000000..2fc022f +--- /dev/null ++++ b/bits/pci-ath9k-fixup.c +@@ -0,0 +1,136 @@ ++/* ++ * Atheros AP94 reference board PCI initialization ++ * ++ * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org> ++ * ++ * 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/pci.h> ++#include <linux/delay.h> ++ ++#include <asm/mach-ath79/ar71xx_regs.h> ++#include <asm/mach-ath79/ath79.h> ++ ++struct ath9k_fixup { ++ u16 *cal_data; ++ unsigned slot; ++}; ++ ++static int ath9k_num_fixups; ++static struct ath9k_fixup ath9k_fixups[2]; ++ ++static void ath9k_pci_fixup(struct pci_dev *dev) ++{ ++ void __iomem *mem; ++ u16 *cal_data = NULL; ++ u16 cmd; ++ u32 bar0; ++ u32 val; ++ unsigned i; ++ ++ for (i = 0; i < ath9k_num_fixups; i++) { ++ if (ath9k_fixups[i].cal_data == NULL) ++ continue; ++ ++ if (ath9k_fixups[i].slot != PCI_SLOT(dev->devfn)) ++ continue; ++ ++ cal_data = ath9k_fixups[i].cal_data; ++ break; ++ } ++ ++ printk(KERN_ERR "ath9k_pci_fixup devfn %x cal_data %p\n",dev->devfn,cal_data); ++ ++ if (cal_data == NULL) ++ return; ++ ++ if (*cal_data != 0xa55a) { ++ pr_err("pci %s: invalid calibration data\n", pci_name(dev)); ++ return; ++ } ++ ++ pr_info("pci %s: fixup device configuration\n", pci_name(dev)); ++ ++ mem = ioremap(AR71XX_PCI_MEM_BASE, 0x10000); ++ if (!mem) { ++ pr_err("pci %s: ioremap error\n", pci_name(dev)); ++ return; ++ } ++ ++ pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar0); ++ ++ switch (ath79_soc) { ++ case ATH79_SOC_AR7161: ++ pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, ++ AR71XX_PCI_MEM_BASE); ++ break; ++ case ATH79_SOC_AR7240: ++ pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0xffff); ++ break; ++ ++ case ATH79_SOC_AR7241: ++ case ATH79_SOC_AR7242: ++ pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0x1000ffff); ++ break; ++ case ATH79_SOC_AR9344: ++ pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0x1000ffff); ++ break; ++ ++ default: ++ BUG(); ++ } ++ ++ pci_read_config_word(dev, PCI_COMMAND, &cmd); ++ cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; ++ pci_write_config_word(dev, PCI_COMMAND, cmd); ++ ++ /* set pointer to first reg address */ ++ cal_data += 3; ++ while (*cal_data != 0xffff) { ++ u32 reg; ++ reg = *cal_data++; ++ val = *cal_data++; ++ val |= (*cal_data++) << 16; ++ ++ __raw_writel(val, mem + reg); ++ udelay(100); ++ } ++ ++ pci_read_config_dword(dev, PCI_VENDOR_ID, &val); ++ dev->vendor = val & 0xffff; ++ dev->device = (val >> 16) & 0xffff; ++ ++ pci_read_config_dword(dev, PCI_CLASS_REVISION, &val); ++ dev->revision = val & 0xff; ++ dev->class = val >> 8; /* upper 3 bytes */ ++ ++ pci_read_config_word(dev, PCI_COMMAND, &cmd); ++ cmd &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); ++ pci_write_config_word(dev, PCI_COMMAND, cmd); ++ ++ pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, bar0); ++ ++ iounmap(mem); ++} ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup); ++ ++void __init pci_enable_ath9k_fixup(unsigned slot, u16 *cal_data) ++{ ++ if (ath9k_num_fixups >= ARRAY_SIZE(ath9k_fixups)) ++ return; ++ ++ ath9k_fixups[ath9k_num_fixups].slot = slot; ++ ath9k_fixups[ath9k_num_fixups].cal_data = cal_data; ++ ath9k_num_fixups++; ++} ++ ++void __init pci_late_ath9k_fixup(void) ++{ ++ struct pci_dev *dev = NULL; ++ ++ for_each_pci_dev(dev) ++ pci_fixup_device(pci_fixup_early, dev); ++} +diff --git a/bits/pci-ath9k-fixup.h b/bits/pci-ath9k-fixup.h +new file mode 100644 +index 0000000..28ecb2d +--- /dev/null ++++ b/bits/pci-ath9k-fixup.h +@@ -0,0 +1,7 @@ ++#ifndef _PCI_ATH9K_FIXUP ++#define _PCI_ATH9K_FIXUP ++ ++void pci_enable_ath9k_fixup(unsigned slot, u16 *cal_data) __init; ++void pci_late_ath9k_fixup(void) __init; ++ ++#endif /* _PCI_ATH9K_FIXUP */ +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index 7bf2f27..55d141c 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -295,27 +295,86 @@ endef + define Device/tplink-16mlzma + $(Device/tplink) + TPLINK_FLASHLAYOUT := 16Mlzma +- IMAGE_SIZE := 15872k ++ IMAGE_SIZE := 16128k ++endef ++ ++define Device/tplink-32mlzma ++$(Device/tplink) ++ TPLINK_FLASHLAYOUT := 32Mlzma ++ IMAGE_SIZE := 32512k + endef + +-define Device/tl-wdr4300-v1 ++define Device/tplink-64mlzma ++$(Device/tplink) ++ TPLINK_FLASHLAYOUT := 64Mlzma ++ IMAGE_SIZE := 65024k ++ BLOCKSIZE := 256k ++endef ++ ++define Device/tl-wdr4300-v1-8m + $(Device/tplink-8mlzma) + BOARDNAME = TL-WDR4300 + DEVICE_PROFILE = TLWDR4300 + TPLINK_HWID := 0x43000001 + endef + ++define Device/tl-wdr4300-v1-16m ++$(Device/tplink-16mlzma) ++ BOARDNAME = TL-WDR4300 ++ DEVICE_PROFILE = TLWDR4300 ++ TPLINK_HWID := 0x43000001 ++endef ++ ++define Device/tl-wdr4300-v1-32m ++$(Device/tplink-32mlzma) ++ BOARDNAME = TL-WDR4300 ++ DEVICE_PROFILE = TLWDR4300 ++ TPLINK_HWID := 0x43000001 ++endef ++ ++define Device/tl-wdr4300-v1-64m ++$(Device/tplink-64mlzma) ++ BOARDNAME = TL-WDR4300 ++ DEVICE_PROFILE = TLWDR4300 ++ TPLINK_HWID := 0x43000001 ++endef ++ + define Device/tl-wdr3500-v1 + $(Device/tl-wdr4300-v1) + BOARDNAME = TL-WDR3500 + TPLINK_HWID := 0x35000001 + endef + +-define Device/tl-wdr3600-v1 +-$(Device/tl-wdr4300-v1) ++define Device/tl-wdr3600-v1-8m ++$(Device/tplink-8mlzma) ++ BOARDNAME = TL-WDR4300 ++ DEVICE_PROFILE = TLWDR4300 + TPLINK_HWID := 0x36000001 + endef + ++define Device/tl-wdr3600-v1-16m ++$(Device/tplink-16mlzma) ++ BOARDNAME = TL-WDR4300 ++ DEVICE_PROFILE = TLWDR4300 ++ TPLINK_HWID := 0x36000001 ++endef ++ ++define Device/tl-wdr3600-v1-32m ++$(Device/tplink-32mlzma) ++ BOARDNAME = TL-WDR4300 ++ DEVICE_PROFILE = TLWDR4300 ++ TPLINK_HWID := 0x36000001 ++endef ++ ++ ++define Device/tl-wdr3600-v1-64m ++$(Device/tplink-64mlzma) ++ BOARDNAME = TL-WDR4300 ++ DEVICE_PROFILE = TLWDR4300 ++ TPLINK_HWID := 0x36000001 ++endef ++ ++ + define Device/tl-wdr4300-v1-il + $(Device/tl-wdr4300-v1) + TPLINK_HWID := 0x43008001 +@@ -330,7 +389,7 @@ define Device/mw4530r-v1 + $(Device/tl-wdr4300-v1) + TPLINK_HWID := 0x45300001 + endef +-TARGET_DEVICES += tl-wdr3500-v1 tl-wdr3600-v1 tl-wdr4300-v1 tl-wdr4300-v1-il tl-wdr4310-v1 mw4530r-v1 ++TARGET_DEVICES += tl-wdr3500-v1 tl-wdr3600-v1-8m tl-wdr3600-v1-16m tl-wdr3600-v1-32m tl-wdr3600-v1-64m tl-wdr4300-v1-8m tl-wdr4300-v1-16m tl-wdr4300-v1-32m tl-wdr4300-v1-64m tl-wdr4300-v1-il tl-wdr4310-v1 mw4530r-v1 + + define Device/tl-wdr6500-v2 + $(Device/tplink-8mlzma) +diff --git a/target/linux/ar71xx/patches-4.1/999-always-bitbang-spi.patch b/target/linux/ar71xx/patches-4.1/999-always-bitbang-spi.patch +index 1030c31..e9ebded 100644 +--- a/target/linux/ar71xx/patches-4.1/999-always-bitbang-spi.patch ++++ b/target/linux/ar71xx/patches-4.1/999-always-bitbang-spi.patch +@@ -76,24 +76,164 @@ Index: linux-4.1.11/drivers/mtd/tplinkpart.c + =================================================================== + --- linux-4.1.11.orig/drivers/mtd/tplinkpart.c + +++ linux-4.1.11/drivers/mtd/tplinkpart.c +-@@ -149,7 +149,7 @@ static int tplink_parse_partitions_offse +- parts[0].name = "u-boot"; +- parts[0].offset = 0; +- parts[0].size = offset; +-- parts[0].mask_flags = MTD_WRITEABLE; +-+ //parts[0].mask_flags = MTD_WRITEABLE; ++@@ -24,9 +24,10 @@ ++ #define TPLINK_HEADER_V2 0x02000000 ++ #define MD5SUM_LEN 16 ++ ++-#define TPLINK_ART_LEN 0x10000 +++#define TPLINK_ART_LEN 0x20000 ++ #define TPLINK_KERNEL_OFFS 0x20000 ++ #define TPLINK_64K_KERNEL_OFFS 0x10000 +++#define TPLINK_256K_KERNEL_OFFS 0x40000 ++ ++ struct tplink_fw_header { ++ uint32_t version; /* header version */ ++@@ -111,12 +112,12 @@ static int tplink_check_rootfs_magic(str ++ static int tplink_parse_partitions_offset(struct mtd_info *master, ++ struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data, ++- size_t offset) +++ size_t offset,size_t art_offset) ++ { ++ struct mtd_partition *parts; ++ struct tplink_fw_header *header; ++ int nr_parts; ++- size_t art_offset; +++ size_t art_len; ++ size_t rootfs_offset; ++ size_t squashfs_offset; ++ int ret; ++@@ -130,7 +131,7 @@ static int tplink_parse_partitions_offse ++ ++ header = tplink_read_header(master, offset); ++ if (!header) { ++- pr_notice("%s: no TP-Link header found\n", master->name); +++ pr_notice("%s: no TP-Link header found at 0x%x\n", master->name, offset); ++ ret = -ENODEV; ++ goto err_free_parts; ++ } ++@@ -144,29 +145,62 @@ static int tplink_parse_partitions_offse ++ else ++ rootfs_offset = offset + be32_to_cpu(header->rootfs_ofs); + +- parts[1].name = "kernel"; +- parts[1].offset = offset; +-@@ -162,7 +162,7 @@ static int tplink_parse_partitions_offse +- parts[3].name = "art"; +- parts[3].offset = art_offset; +- parts[3].size = TPLINK_ART_LEN; ++- art_offset = master->size - TPLINK_ART_LEN; ++ ++- parts[0].name = "u-boot"; ++- parts[0].offset = 0; ++- parts[0].size = offset; ++- parts[0].mask_flags = MTD_WRITEABLE; ++- ++- parts[1].name = "kernel"; ++- parts[1].offset = offset; ++- parts[1].size = rootfs_offset - offset; ++- ++- parts[2].name = "rootfs"; ++- parts[2].offset = rootfs_offset; ++- parts[2].size = art_offset - rootfs_offset; ++- ++- parts[3].name = "art"; ++- parts[3].offset = art_offset; ++- parts[3].size = TPLINK_ART_LEN; + - parts[3].mask_flags = MTD_WRITEABLE; +-+ //parts[3].mask_flags = MTD_WRITEABLE; ++- ++- parts[4].name = "firmware"; ++- parts[4].offset = offset; ++- parts[4].size = art_offset - offset; +++ if (!art_offset) { +++ art_offset = master->size - TPLINK_ART_LEN; +++ +++ parts[0].name = "u-boot"; +++ parts[0].offset = 0; +++ parts[0].size = offset; +++ //parts[0].mask_flags = MTD_WRITEABLE; +++ +++ parts[1].name = "kernel"; +++ parts[1].offset = offset; +++ parts[1].size = rootfs_offset - offset; +++ +++ parts[2].name = "rootfs"; +++ parts[2].offset = rootfs_offset; +++ parts[2].size = art_offset - rootfs_offset; +++ +++ +++ parts[3].name = "art"; +++ parts[3].offset = art_offset; +++ parts[3].size = TPLINK_ART_LEN; +++ //parts[3].mask_flags = MTD_WRITEABLE; +++ +++ parts[4].name = "firmware"; +++ parts[4].offset = offset; +++ parts[4].size = art_offset - offset; +++ } else { +++ nr_parts++; +++ +++ parts[0].name = "u-boot"; +++ parts[0].offset = 0; +++ parts[0].size = art_offset; +++ //parts[0].mask_flags = MTD_WRITEABLE; +++ +++ parts[1].name = "kernel"; +++ parts[1].offset = offset; +++ parts[1].size = rootfs_offset - offset; +++ +++ parts[2].name = "rootfs"; +++ parts[2].offset = rootfs_offset; +++ parts[2].size = master->size - rootfs_offset; +++ +++ +++ parts[3].name = "art"; +++ parts[3].offset = art_offset; +++ parts[3].size = TPLINK_ART_LEN; +++ //parts[3].mask_flags = MTD_WRITEABLE; +++ +++ parts[4].name = "firmware"; +++ parts[4].offset = offset; +++ parts[4].size = master-> size - offset; +++ +++ parts[5].name = "bootloader"; +++ parts[5].offset = 0; +++ parts[5].size = offset; +++ } ++ ++ vfree(header); ++ ++@@ -184,8 +218,17 @@ static int tplink_parse_partitions(struc ++ struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++ { ++- return tplink_parse_partitions_offset(master, pparts, data, ++- TPLINK_KERNEL_OFFS); +++ int ret; +++ +++ ret = tplink_parse_partitions_offset(master, pparts, data, +++ TPLINK_KERNEL_OFFS, 0); +++ +++ if (ret > 0) return ret; +++ +++ ret = tplink_parse_partitions_offset(master, pparts, data, +++ TPLINK_256K_KERNEL_OFFS, TPLINK_KERNEL_OFFS); +++ +++ return ret; ++ } + +- parts[4].name = "firmware"; +- parts[4].offset = offset; ++ static int tplink_parse_64k_partitions(struct mtd_info *master, ++@@ -193,7 +236,7 @@ static int tplink_parse_64k_partitions(s ++ struct mtd_part_parser_data *data) ++ { ++ return tplink_parse_partitions_offset(master, pparts, data, ++- TPLINK_64K_KERNEL_OFFS); +++ TPLINK_64K_KERNEL_OFFS, 0); ++ } ++ ++ static struct mtd_part_parser tplink_parser = { ++@@ -208,6 +251,7 @@ static struct mtd_part_parser tplink_64k ++ .name = "tp-link-64k", ++ }; ++ +++ ++ static int __init tplink_parser_init(void) ++ { ++ register_mtd_parser(&tplink_parser); + Index: linux-4.1.11/include/linux/mtd/spi-nor.h + =================================================================== + --- linux-4.1.11.orig/include/linux/mtd/spi-nor.h +@@ -105,127 +245,21 @@ Index: linux-4.1.11/include/linux/mtd/spi-nor.h + +void spi_nor_reboot_hook(struct spi_nor *nor, const char *name); + + + #endif +-Index: linux-4.1.11/arch/mips/ath79/mach-tl-mr3x20.c ++Index: linux-4.1.11/arch/mips/ath79/mach-tl-wdr4300.c + =================================================================== +---- linux-4.1.11.orig/arch/mips/ath79/mach-tl-mr3x20.c +-+++ linux-4.1.11/arch/mips/ath79/mach-tl-mr3x20.c +-@@ -11,6 +11,11 @@ +- #include <linux/gpio.h> +- +- #include <asm/mach-ath79/ath79.h> +-+#include <linux/mtd/mtd.h> +-+#include <linux/ath9k_platform.h> +-+#include <linux/pci.h> +-+ +-+ +- +- #include "dev-eth.h" +- #include "dev-ap9x-pci.h" +-@@ -75,28 +80,76 @@ static struct gpio_keys_button tl_mr3x20 +- } +- }; +- +-+ +-+#define MAC_LEN 6 +-+#define ART_LEN (ATH9K_PLAT_EEP_MAX_WORDS << 1) +-+ +-+#define CONFIG_OFFSET 0x1fc00 +-+#define ART_OFFSET 0x1000 +-+ +-+static u8 *mac, *art; +-+ +-+static void notify_add(struct mtd_info *mtd) +-+{ +-+ size_t len; +-+ +-+ if (!strcmp(mtd->name, "u-boot") && !mac) { +-+ mac = kmalloc(MAC_LEN, GFP_KERNEL); +-+ if (!mac) return; +-+ +-+ mtd_read(mtd, CONFIG_OFFSET, MAC_LEN, &len, mac); +-+ +-+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); +-+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); +-+ +-+ ath79_register_mdio(0, 0x0); +-+ +-+ /* LAN ports */ +-+ ath79_register_eth(1); +-+ /* WAN port */ +-+ ath79_register_eth(0); +-+ } +-+ +-+ if (!strcmp(mtd->name, "art") && !art) { +-+ art = kmalloc(ART_LEN, GFP_KERNEL); +-+ if (!art) return; +-+ +-+ mtd_read(mtd, ART_OFFSET, ART_LEN, &len, art); +-+ } +-+ +-+ +-+ if (mac && art) { +-+ ap91_pci_init(art, mac); +-+ +-+ pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq); +-+ +-+ kfree(art); +-+ art = NULL; +-+ +-+ kfree(mac); +-+ mac = NULL; +-+ } +-+} +-+ +-+static void notify_remove(struct mtd_info *mtd) +-+{ +-+} +-+ +-+static struct mtd_notifier spi_notifier = { +-+ .add = notify_add, +-+ .remove = notify_remove +-+}; +-+ +-+ +- static void __init tl_ap99_setup(void) ++--- linux-4.1.11.orig/arch/mips/ath79/mach-tl-wdr4300.c +++++ linux-4.1.11/arch/mips/ath79/mach-tl-wdr4300.c ++@@ -156,9 +156,12 @@ static struct mdio_board_info wdr4300_md ++ static void __init wdr4300_setup(void) + { +-- u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); +-- u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); +-+ register_mtd_user(&spi_notifier); +- +- ath79_register_m25p80(&tl_mr3x20_flash_data); ++ u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); ++- u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); +++ u8 *art = (u8 *) KSEG1ADDR(0x1f020000); ++ u8 tmpmac[ETH_ALEN]; + +- ath79_register_gpio_keys_polled(-1, TL_MR3X20_KEYS_POLL_INTERVAL, +- ARRAY_SIZE(tl_mr3x20_gpio_keys), +- tl_mr3x20_gpio_keys); +-- +-- ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); +-- ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); +-- +-- ath79_register_mdio(0, 0x0); +-- +-- /* LAN ports */ +-- ath79_register_eth(1); +-- /* WAN port */ +-- ath79_register_eth(0); +-- +-- ap91_pci_init(ee, mac); +- } +- +- static void __init tl_mr3x20_usb_setup(void) +-Index: linux-4.1.11/arch/mips/ath79/dev-ap9x-pci.c +-=================================================================== +---- linux-4.1.11.orig/arch/mips/ath79/dev-ap9x-pci.c +-+++ linux-4.1.11/arch/mips/ath79/dev-ap9x-pci.c +-@@ -103,10 +103,10 @@ __init void ap91_pci_init(u8 *cal_data, +- ap9x_wmac0_data.macaddr = ap9x_wmac0_mac; +- } +- +-+ pci_enable_ath9k_fixup(0, ap9x_wmac0_data.eeprom_data); +++ if ((art[0]==1) && !art[1] && !art[2] && !art[3]) +++ art = (u8 *) KSEG1ADDR(0x1fff0000); + + +- ath79_pci_set_plat_dev_init(ap91_pci_plat_dev_init); +- ath79_register_pci(); +-- +-- pci_enable_ath9k_fixup(0, ap9x_wmac0_data.eeprom_data); +- } +- +- __init void ap91_pci_init_simple(void) ++ ath79_register_m25p80(&wdr4300_flash_data); ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(wdr4300_leds_gpio), ++ wdr4300_leds_gpio); +diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c +index 4922afb..b0d4410 100644 +--- a/tools/firmware-utils/src/mktplinkfw.c ++++ b/tools/firmware-utils/src/mktplinkfw.c +@@ -212,6 +212,24 @@ static struct flash_layout layouts[] = { + .kernel_ep = 0x80060000, + .rootfs_ofs = 0x100000, + }, { ++ .id = "16Mlzma", ++ .fw_max_len = 0xfc0000, ++ .kernel_la = 0x80060000, ++ .kernel_ep = 0x80060000, ++ .rootfs_ofs = 0x100000, ++ }, { ++ .id = "32Mlzma", ++ .fw_max_len = 0x1fc0000, ++ .kernel_la = 0x80060000, ++ .kernel_ep = 0x80060000, ++ .rootfs_ofs = 0x100000, ++ }, { ++ .id = "64Mlzma", ++ .fw_max_len = 0x3f80000, ++ .kernel_la = 0x80060000, ++ .kernel_ep = 0x80060000, ++ .rootfs_ofs = 0x100000, ++ }, { + .id = "16Mppc", + .fw_max_len = 0xf80000, + .kernel_la = 0x00000000, |