From 5c58234e76b00d1584e4a3046d9020375d790a19 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Wed, 28 Nov 2018 23:07:10 +0800 Subject: [PATCH] ar71xx: add mdio hack patch --- target/linux/ar71xx/config-4.14 | 7 +- target/linux/ar71xx/config-4.9 | 8 +++ ...mtd_fix_cfi_cmdset_0002_status_check.patch | 64 ------------------- ...mtd-cfi_cmdset_0002-force-word-write.patch | 6 +- .../patches-4.14/500-MIPS-fw-myloader.patch | 2 +- ...MIPS-ath79-add-more-register-defines.patch | 4 +- .../patches-4.14/604-MIPS-ath79-no-of.patch | 2 +- .../408-mtd-redboot_partition_scan.patch | 6 +- ...mtd-cfi_cmdset_0002-force-word-write.patch | 6 +- ...MIPS-ath79-add-more-register-defines.patch | 4 +- ...MIPS-ath79-add-routerboard-detection.patch | 3 +- .../910-unaligned_access_hacks.patch | 10 +-- .../ar71xx/patches-4.9/999-mdio_hack.patch | 20 ++++++ 13 files changed, 58 insertions(+), 84 deletions(-) delete mode 100644 target/linux/ar71xx/patches-4.14/403-mtd_fix_cfi_cmdset_0002_status_check.patch create mode 100644 target/linux/ar71xx/patches-4.9/999-mdio_hack.patch diff --git a/target/linux/ar71xx/config-4.14 b/target/linux/ar71xx/config-4.14 index 9a524fae4..62dea32a7 100644 --- a/target/linux/ar71xx/config-4.14 +++ b/target/linux/ar71xx/config-4.14 @@ -130,7 +130,6 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_GL_INET is not set # CONFIG_ATH79_MACH_GL_MIFI is not set # CONFIG_ATH79_MACH_GL_USB150 is not set -# CONFIG_ATH79_MACH_GS_MINIBOX_V32 is not set # CONFIG_ATH79_MACH_GS_OOLITE_V1 is not set # CONFIG_ATH79_MACH_GS_OOLITE_V5_2 is not set # CONFIG_ATH79_MACH_HIVEAP_121 is not set @@ -223,6 +222,8 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_TL_WR1043ND_V2 is not set # CONFIG_ATH79_MACH_TL_WR1043ND_V4 is not set # CONFIG_ATH79_MACH_TL_WR1043N_V5 is not set +# CONFIG_ATH79_MACH_TL_WR2041N_V1 is not set +# CONFIG_ATH79_MACH_TL_WR2041N_V2 is not set # CONFIG_ATH79_MACH_TL_WR2543N is not set # CONFIG_ATH79_MACH_TL_WR703N is not set # CONFIG_ATH79_MACH_TL_WR720N_V3 is not set @@ -236,10 +237,13 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_TL_WR841N_V1 is not set # CONFIG_ATH79_MACH_TL_WR841N_V8 is not set # CONFIG_ATH79_MACH_TL_WR841N_V9 is not set +# CONFIG_ATH79_MACH_TL_WR880N_V1 is not set +# CONFIG_ATH79_MACH_TL_WR881N_V1 is not set # CONFIG_ATH79_MACH_TL_WR902AC_V1 is not set # CONFIG_ATH79_MACH_TL_WR940N_V4 is not set # CONFIG_ATH79_MACH_TL_WR941ND is not set # CONFIG_ATH79_MACH_TL_WR941ND_V6 is not set +# CONFIG_ATH79_MACH_TL_WR941N_V7 is not set # CONFIG_ATH79_MACH_TL_WR942N_V1 is not set # CONFIG_ATH79_MACH_TS_D084 is not set # CONFIG_ATH79_MACH_TUBE2H is not set @@ -484,3 +488,4 @@ CONFIG_SYS_SUPPORTS_ZBOOT=y CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_USB_SUPPORT=y +CONFIG_MIPS_FPU_EMULATOR=y diff --git a/target/linux/ar71xx/config-4.9 b/target/linux/ar71xx/config-4.9 index 8aa0b41ae..ed44e39ac 100644 --- a/target/linux/ar71xx/config-4.9 +++ b/target/linux/ar71xx/config-4.9 @@ -52,6 +52,7 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set # CONFIG_ATH79_MACH_ARCHER_C58_V1 is not set # CONFIG_ATH79_MACH_ARCHER_C59_V1 is not set +# CONFIG_ATH79_MACH_ARCHER_C59_V2 is not set # CONFIG_ATH79_MACH_ARCHER_C60_V1 is not set # CONFIG_ATH79_MACH_ARCHER_C60_V2 is not set # CONFIG_ATH79_MACH_ARCHER_C7 is not set @@ -124,6 +125,7 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_GL_AR300 is not set # CONFIG_ATH79_MACH_GL_AR300M is not set # CONFIG_ATH79_MACH_GL_AR750 is not set +# CONFIG_ATH79_MACH_GL_AR750S is not set # CONFIG_ATH79_MACH_GL_DOMINO is not set # CONFIG_ATH79_MACH_GL_INET is not set # CONFIG_ATH79_MACH_GL_MIFI is not set @@ -220,6 +222,8 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_TL_WR1043ND_V2 is not set # CONFIG_ATH79_MACH_TL_WR1043ND_V4 is not set # CONFIG_ATH79_MACH_TL_WR1043N_V5 is not set +# CONFIG_ATH79_MACH_TL_WR2041N_V1 is not set +# CONFIG_ATH79_MACH_TL_WR2041N_V2 is not set # CONFIG_ATH79_MACH_TL_WR2543N is not set # CONFIG_ATH79_MACH_TL_WR703N is not set # CONFIG_ATH79_MACH_TL_WR720N_V3 is not set @@ -233,10 +237,13 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_TL_WR841N_V1 is not set # CONFIG_ATH79_MACH_TL_WR841N_V8 is not set # CONFIG_ATH79_MACH_TL_WR841N_V9 is not set +# CONFIG_ATH79_MACH_TL_WR880N_V1 is not set +# CONFIG_ATH79_MACH_TL_WR881N_V1 is not set # CONFIG_ATH79_MACH_TL_WR902AC_V1 is not set # CONFIG_ATH79_MACH_TL_WR940N_V4 is not set # CONFIG_ATH79_MACH_TL_WR941ND is not set # CONFIG_ATH79_MACH_TL_WR941ND_V6 is not set +# CONFIG_ATH79_MACH_TL_WR941N_V7 is not set # CONFIG_ATH79_MACH_TL_WR942N_V1 is not set # CONFIG_ATH79_MACH_TS_D084 is not set # CONFIG_ATH79_MACH_TUBE2H is not set @@ -480,3 +487,4 @@ CONFIG_SYS_SUPPORTS_ZBOOT=y CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_USB_SUPPORT=y +CONFIG_MIPS_FPU_EMULATOR=y diff --git a/target/linux/ar71xx/patches-4.14/403-mtd_fix_cfi_cmdset_0002_status_check.patch b/target/linux/ar71xx/patches-4.14/403-mtd_fix_cfi_cmdset_0002_status_check.patch deleted file mode 100644 index 3c1f62fa0..000000000 --- a/target/linux/ar71xx/patches-4.14/403-mtd_fix_cfi_cmdset_0002_status_check.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -1635,8 +1635,8 @@ static int __xipram do_write_oneword(str - break; - } - -- if (chip_ready(map, adr)) -- break; -+ if (chip_good(map, adr, datum)) -+ goto enable_xip; - - /* Latency issues. Drop the lock, wait a while and retry */ - UDELAY(map, chip, adr, 1); -@@ -1652,6 +1652,8 @@ static int __xipram do_write_oneword(str - - ret = -EIO; - } -+ -+ enable_xip: - xip_enable(map, chip, adr); - op_done: - if (mode == FL_OTP_WRITE) -@@ -2230,7 +2232,6 @@ static int cfi_amdstd_panic_write(struct - return 0; - } - -- - /* - * Handle devices with one erase region, that only implement - * the chip erase command. -@@ -2298,7 +2299,7 @@ static int __xipram do_erase_chip(struct - } - - if (chip_good(map, adr, map_word_ff(map))) -- break; -+ goto op_done; - - if (time_after(jiffies, timeo)) { - printk(KERN_WARNING "MTD %s(): software timeout\n", -@@ -2322,6 +2323,7 @@ static int __xipram do_erase_chip(struct - } - } - -+ op_done: - chip->state = FL_READY; - xip_enable(map, chip, adr); - DISABLE_VPP(map); -@@ -2395,7 +2397,7 @@ static int __xipram do_erase_oneblock(st - - if (chip_good(map, adr, map_word_ff(map))) { - xip_enable(map, chip, adr); -- break; -+ goto op_done; - } - - if (time_after(jiffies, timeo)) { -@@ -2421,6 +2423,7 @@ static int __xipram do_erase_oneblock(st - } - } - -+ op_done: - chip->state = FL_READY; - DISABLE_VPP(map); - put_chip(map, chip, adr); diff --git a/target/linux/ar71xx/patches-4.14/411-mtd-cfi_cmdset_0002-force-word-write.patch b/target/linux/ar71xx/patches-4.14/411-mtd-cfi_cmdset_0002-force-word-write.patch index 3862dfd14..b28d6c1c2 100644 --- a/target/linux/ar71xx/patches-4.14/411-mtd-cfi_cmdset_0002-force-word-write.patch +++ b/target/linux/ar71xx/patches-4.14/411-mtd-cfi_cmdset_0002-force-word-write.patch @@ -35,7 +35,7 @@ /* Atmel chips don't use the same PRI format as AMD chips */ static void fixup_convert_atmel_pri(struct mtd_info *mtd) -@@ -1794,6 +1798,7 @@ static int cfi_amdstd_write_words(struct +@@ -1792,6 +1796,7 @@ static int cfi_amdstd_write_words(struct /* * FIXME: interleaved mode not tested, and probably not supported! */ @@ -43,7 +43,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, unsigned long adr, const u_char *buf, int len) -@@ -1922,7 +1927,6 @@ static int __xipram do_write_buffer(stru +@@ -1920,7 +1925,6 @@ static int __xipram do_write_buffer(stru return ret; } @@ -51,7 +51,7 @@ static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) { -@@ -1997,6 +2001,7 @@ static int cfi_amdstd_write_buffers(stru +@@ -1995,6 +1999,7 @@ static int cfi_amdstd_write_buffers(stru return 0; } diff --git a/target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch b/target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch index 5c526794f..4ac1fd193 100644 --- a/target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch +++ b/target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch @@ -10,7 +10,7 @@ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1152,6 +1152,9 @@ config MIPS_MSC +@@ -1151,6 +1151,9 @@ config MIPS_MSC config MIPS_NILE4 bool diff --git a/target/linux/ar71xx/patches-4.14/601-MIPS-ath79-add-more-register-defines.patch b/target/linux/ar71xx/patches-4.14/601-MIPS-ath79-add-more-register-defines.patch index d0f5b7890..77a646378 100644 --- a/target/linux/ar71xx/patches-4.14/601-MIPS-ath79-add-more-register-defines.patch +++ b/target/linux/ar71xx/patches-4.14/601-MIPS-ath79-add-more-register-defines.patch @@ -217,7 +217,7 @@ #define AR71XX_GPIO_COUNT 16 #define AR7240_GPIO_COUNT 18 #define AR7241_GPIO_COUNT 20 -@@ -570,4 +681,235 @@ +@@ -570,4 +681,237 @@ #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13 #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7 @@ -433,6 +433,8 @@ +#define QCA955X_GMAC_REG_ETH_CFG 0x00 + +#define QCA955X_ETH_CFG_RGMII_EN BIT(0) ++#define QCA955X_ETH_CFG_GE0_MII_EN BIT(1) ++#define QCA955X_ETH_CFG_GE0_MII_SLAVE BIT(4) +#define QCA955X_ETH_CFG_MII_GE0 BIT(1) +#define QCA955X_ETH_CFG_GMII_GE0 BIT(2) +#define QCA955X_ETH_CFG_MII_GE0_MASTER BIT(3) diff --git a/target/linux/ar71xx/patches-4.14/604-MIPS-ath79-no-of.patch b/target/linux/ar71xx/patches-4.14/604-MIPS-ath79-no-of.patch index 5be33f9b0..499145ecd 100644 --- a/target/linux/ar71xx/patches-4.14/604-MIPS-ath79-no-of.patch +++ b/target/linux/ar71xx/patches-4.14/604-MIPS-ath79-no-of.patch @@ -1,6 +1,6 @@ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -203,7 +203,6 @@ config ATH79 +@@ -202,7 +202,6 @@ config ATH79 select SYS_SUPPORTS_BIG_ENDIAN select SYS_SUPPORTS_MIPS16 select SYS_SUPPORTS_ZBOOT_UART_PROM diff --git a/target/linux/ar71xx/patches-4.9/408-mtd-redboot_partition_scan.patch b/target/linux/ar71xx/patches-4.9/408-mtd-redboot_partition_scan.patch index cd41e7ceb..18ff52aca 100644 --- a/target/linux/ar71xx/patches-4.9/408-mtd-redboot_partition_scan.patch +++ b/target/linux/ar71xx/patches-4.9/408-mtd-redboot_partition_scan.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/redboot.c +++ b/drivers/mtd/redboot.c -@@ -76,12 +76,18 @@ static int parse_redboot_partitions(stru +@@ -77,12 +77,18 @@ static int parse_redboot_partitions(stru static char nullstring[] = "unallocated"; #endif @@ -19,7 +19,7 @@ return -EIO; } offset -= master->erasesize; -@@ -94,10 +100,6 @@ static int parse_redboot_partitions(stru +@@ -95,10 +101,6 @@ static int parse_redboot_partitions(stru goto nogood; } } @@ -30,7 +30,7 @@ printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n", master->name, offset); -@@ -170,6 +172,11 @@ static int parse_redboot_partitions(stru +@@ -171,6 +173,11 @@ static int parse_redboot_partitions(stru } if (i == numslots) { /* Didn't find it */ diff --git a/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch b/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch index aa708e01a..ddd69f17e 100644 --- a/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch +++ b/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch @@ -35,7 +35,7 @@ /* Atmel chips don't use the same PRI format as AMD chips */ static void fixup_convert_atmel_pri(struct mtd_info *mtd) -@@ -1790,6 +1794,7 @@ static int cfi_amdstd_write_words(struct +@@ -1788,6 +1792,7 @@ static int cfi_amdstd_write_words(struct /* * FIXME: interleaved mode not tested, and probably not supported! */ @@ -43,7 +43,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, unsigned long adr, const u_char *buf, int len) -@@ -1918,7 +1923,6 @@ static int __xipram do_write_buffer(stru +@@ -1916,7 +1921,6 @@ static int __xipram do_write_buffer(stru return ret; } @@ -51,7 +51,7 @@ static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) { -@@ -1993,6 +1997,7 @@ static int cfi_amdstd_write_buffers(stru +@@ -1991,6 +1995,7 @@ static int cfi_amdstd_write_buffers(stru return 0; } diff --git a/target/linux/ar71xx/patches-4.9/601-MIPS-ath79-add-more-register-defines.patch b/target/linux/ar71xx/patches-4.9/601-MIPS-ath79-add-more-register-defines.patch index d0f5b7890..77a646378 100644 --- a/target/linux/ar71xx/patches-4.9/601-MIPS-ath79-add-more-register-defines.patch +++ b/target/linux/ar71xx/patches-4.9/601-MIPS-ath79-add-more-register-defines.patch @@ -217,7 +217,7 @@ #define AR71XX_GPIO_COUNT 16 #define AR7240_GPIO_COUNT 18 #define AR7241_GPIO_COUNT 20 -@@ -570,4 +681,235 @@ +@@ -570,4 +681,237 @@ #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13 #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7 @@ -433,6 +433,8 @@ +#define QCA955X_GMAC_REG_ETH_CFG 0x00 + +#define QCA955X_ETH_CFG_RGMII_EN BIT(0) ++#define QCA955X_ETH_CFG_GE0_MII_EN BIT(1) ++#define QCA955X_ETH_CFG_GE0_MII_SLAVE BIT(4) +#define QCA955X_ETH_CFG_MII_GE0 BIT(1) +#define QCA955X_ETH_CFG_GMII_GE0 BIT(2) +#define QCA955X_ETH_CFG_MII_GE0_MASTER BIT(3) diff --git a/target/linux/ar71xx/patches-4.9/701-MIPS-ath79-add-routerboard-detection.patch b/target/linux/ar71xx/patches-4.9/701-MIPS-ath79-add-routerboard-detection.patch index 64c7e881a..ae9e7772b 100644 --- a/target/linux/ar71xx/patches-4.9/701-MIPS-ath79-add-routerboard-detection.patch +++ b/target/linux/ar71xx/patches-4.9/701-MIPS-ath79-add-routerboard-detection.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/prom.c +++ b/arch/mips/ath79/prom.c -@@ -136,6 +136,31 @@ void __init prom_init(void) +@@ -136,6 +136,32 @@ void __init prom_init(void) initrd_end = initrd_start + fw_getenvl("initrd_size"); } #endif @@ -22,6 +22,7 @@ + strstr(arcs_cmdline, "board=map-hb") || + strstr(arcs_cmdline, "board=map2-hb") || + strstr(arcs_cmdline, "board=wap-hb") || ++ strstr(arcs_cmdline, "board=wap-lte") || + strstr(arcs_cmdline, "board=wapg-sc") || + strstr(arcs_cmdline, "board=2011L") || + strstr(arcs_cmdline, "board=2011r") || diff --git a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch index 7fb38784f..049ee78d3 100644 --- a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch +++ b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch @@ -621,7 +621,7 @@ #define IP6_MF 0x0001 #define IP6_OFFSET 0xFFF8 -@@ -436,8 +436,8 @@ static inline void __ipv6_addr_set_half( +@@ -443,8 +443,8 @@ static inline void __ipv6_addr_set_half( } #endif #endif @@ -632,7 +632,7 @@ } static inline void ipv6_addr_set(struct in6_addr *addr, -@@ -496,6 +496,8 @@ static inline bool ipv6_prefix_equal(con +@@ -503,6 +503,8 @@ static inline bool ipv6_prefix_equal(con const __be32 *a1 = addr1->s6_addr32; const __be32 *a2 = addr2->s6_addr32; unsigned int pdw, pbi; @@ -641,7 +641,7 @@ /* check complete u32 in prefix */ pdw = prefixlen >> 5; -@@ -504,7 +506,9 @@ static inline bool ipv6_prefix_equal(con +@@ -511,7 +513,9 @@ static inline bool ipv6_prefix_equal(con /* check incomplete u32 in prefix */ pbi = prefixlen & 0x1f; @@ -652,7 +652,7 @@ return false; return true; -@@ -633,13 +637,13 @@ static inline void ipv6_addr_set_v4mappe +@@ -655,13 +659,13 @@ static inline void ipv6_addr_set_v4mappe */ static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen) { @@ -668,7 +668,7 @@ if (xb) return i * 32 + 31 - __fls(ntohl(xb)); } -@@ -808,17 +812,18 @@ static inline int ip6_default_np_autolab +@@ -830,17 +834,18 @@ static inline int ip6_default_np_autolab static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, __be32 flowlabel) { diff --git a/target/linux/ar71xx/patches-4.9/999-mdio_hack.patch b/target/linux/ar71xx/patches-4.9/999-mdio_hack.patch new file mode 100644 index 000000000..846c6a52a --- /dev/null +++ b/target/linux/ar71xx/patches-4.9/999-mdio_hack.patch @@ -0,0 +1,20 @@ +--- a/drivers/net/phy/mdio-boardinfo.c ++++ b/drivers/net/phy/mdio-boardinfo.c +@@ -49,6 +49,7 @@ mdiobus_register_board_info(struct mdio_ + + for (i = 0; i < n; i++, be++, info++) { + memcpy(&be->board_info, info, sizeof(*info)); ++ be->board_info.phy_addr = be->board_info.mdio_addr; + mutex_lock(&__mdio_board_lock); + list_add_tail(&be->list, &__mdio_board_list); + mutex_unlock(&__mdio_board_lock); +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -872,6 +872,7 @@ extern struct bus_type mdio_bus_type; + + struct mdio_board_info { + const char *bus_id; ++ int mdio_addr; + int phy_addr; + + const void *platform_data;