[OpenWrt-Devel] [PATCH] ar71xx: fix qca956x ge0 speed
when qca956x uses the internal fe switch, the dummy function should be used Signed-off-by: Weijie Gao --- target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c index b43c80a..f292800 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c @@ -1128,7 +1128,7 @@ void __init ath79_register_eth(unsigned int id) if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII) pdata->set_speed = qca956x_set_speed_sgmii; else - pdata->set_speed = ath79_set_speed_ge0; + pdata->set_speed = ath79_set_speed_dummy; } else { pdata->reset_bit = QCA955X_RESET_GE1_MAC | QCA955X_RESET_GE1_MDIO; -- 2.5.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2] ar71xx: fix qca956x ethernet initialization
Signed-off-by: Weijie Gao Complete internal switch initialization for QCA956X. Set default mdio device if the interface mode of GE0 is not SGMII (fix ticket #21520). --- target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c index 12a376e..b43c80a 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c @@ -271,6 +271,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) case ATH79_SOC_QCA956X: if (id == 1) mdio_data->builtin_switch = 1; + mdio_data->is_ar934x = 1; break; default: @@ -1123,16 +1124,25 @@ void __init ath79_register_eth(unsigned int id) if (id == 0) { pdata->reset_bit = QCA955X_RESET_GE0_MAC | QCA955X_RESET_GE0_MDIO; + if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII) pdata->set_speed = qca956x_set_speed_sgmii; else - /* FIXME */ - pdata->set_speed = ath79_set_speed_dummy; + pdata->set_speed = ath79_set_speed_ge0; } else { pdata->reset_bit = QCA955X_RESET_GE1_MAC | QCA955X_RESET_GE1_MDIO; - /* FIXME */ + pdata->set_speed = ath79_set_speed_dummy; + + pdata->switch_data = &ath79_switch_data; + + pdata->speed = SPEED_1000; + pdata->duplex = DUPLEX_FULL; + + /* reset the built-in switch */ + ath79_device_reset_set(AR934X_RESET_ETH_SWITCH); + ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH); } pdata->ddr_flush = ath79_ddr_no_flush; @@ -1196,6 +1206,11 @@ void __init ath79_register_eth(unsigned int id) /* don't assign any MDIO device by default */ break; + case ATH79_SOC_QCA956X: + if (pdata->phy_if_mode != PHY_INTERFACE_MODE_SGMII) + pdata->mii_bus_dev = &ath79_mdio1_device.dev; + break; + default: pdata->mii_bus_dev = &ath79_mdio0_device.dev; break; -- 2.5.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: fix qca956x ethernet initialization
Signed-off-by: Weijie Gao fix ticket #21520 --- target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c index 12a376e..b43c80a 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c @@ -271,6 +271,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) case ATH79_SOC_QCA956X: if (id == 1) mdio_data->builtin_switch = 1; + mdio_data->is_ar934x = 1; break; default: @@ -1123,16 +1124,25 @@ void __init ath79_register_eth(unsigned int id) if (id == 0) { pdata->reset_bit = QCA955X_RESET_GE0_MAC | QCA955X_RESET_GE0_MDIO; + if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII) pdata->set_speed = qca956x_set_speed_sgmii; else - /* FIXME */ - pdata->set_speed = ath79_set_speed_dummy; + pdata->set_speed = ath79_set_speed_ge0; } else { pdata->reset_bit = QCA955X_RESET_GE1_MAC | QCA955X_RESET_GE1_MDIO; - /* FIXME */ + pdata->set_speed = ath79_set_speed_dummy; + + pdata->switch_data = &ath79_switch_data; + + pdata->speed = SPEED_1000; + pdata->duplex = DUPLEX_FULL; + + /* reset the built-in switch */ + ath79_device_reset_set(AR934X_RESET_ETH_SWITCH); + ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH); } pdata->ddr_flush = ath79_ddr_no_flush; @@ -1196,6 +1206,11 @@ void __init ath79_register_eth(unsigned int id) /* don't assign any MDIO device by default */ break; + case ATH79_SOC_QCA956X: + if (pdata->phy_if_mode != PHY_INTERFACE_MODE_SGMII) + pdata->mii_bus_dev = &ath79_mdio1_device.dev; + break; + default: pdata->mii_bus_dev = &ath79_mdio0_device.dev; break; -- 2.5.0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] ramips: reset m25p80 when shutdown
2015-11-08 4:42 GMT+08:00 Shonn Lu : > Signed-off-by: Shonn Lu > --- > .../0064-reset-m25p80-when-shutdown.patch | 24 > ++ > 1 file changed, 24 insertions(+) > create mode 100644 > target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch > > diff --git > a/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch > b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch > new file mode 100644 > index 000..76f916a > --- /dev/null > +++ > b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch > @@ -0,0 +1,24 @@ > +--- a/drivers/mtd/devices/m25p80.c > b/drivers/mtd/devices/m25p80.c > +@@ -319,6 +319,12 @@ > + { > + struct m25p *flash = spi_get_drvdata(spi); > + > ++//play4fun: add spi flash reset code > ++ flash->command[0] = 0x66; > ++ spi_write(flash->spi, flash->command, 1); > ++ flash->command[0] = 0x99; > ++ spi_write(flash->spi, flash->command, 1); > ++ > + /* Clean up MTD stuff. */ > + return mtd_device_unregister(&flash->mtd); > + } > +@@ -382,6 +388,8 @@ > + .id_table = m25p_ids, > + .probe = m25p_probe, > + .remove = m25p_remove, > ++ // play4fun add shutdown method to reset spi flash > ++ .shutdown = m25p_remove, > + > + /* REVISIT: many of these chips have deep power-down modes, which > +* should clearly be entered on suspend() to minimize power use. > -- > 1.9.1 > ___ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel This is not enough for w25q256. The Extended Address Register (EAR) must be cleared, or the higher half 16MB may be accessed in 3-byte addressing mode, and this will cause a boot failure. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 3/7] ar71xx/image: migrate tl-wdr6500-v2 to new image build steps
2015-10-31 22:20 GMT+08:00 Felix Fietkau : > On 2015-10-31 15:02, Weijie Gao wrote: > > HI, > > > > I have this router and I submitted this router's mach. > > > > Have you noticed that the TPLINK-64K generates a U-Boot image for the > > kernel at first? > > The normal routine does not do that. > > > > So this firmware has two headers, first the tp-link header then the > > u-boot header. > > > > If the u-boot header disappear, the bootloader won't boot the firmware. > Does this fix the issue? > --- > --- a/target/linux/ar71xx/image/Makefile > +++ b/target/linux/ar71xx/image/Makefile > @@ -334,6 +334,8 @@ TARGET_DEVICES += tl-wdr3500-v1 tl-wdr3600-v1 > tl-wdr4300-v1 tl-wdr4300-v1-il tl- > > define Device/tl-wdr6500-v2 > $(Device/tplink-8mlzma) > + KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma > + KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | uImage lzma | > mktplinkfw-initramfs >BOARDNAME = TL-WDR6500-v2 >DEVICE_PROFILE = TLWDR6500V2 >TPLINK_HWID := 0x6502 > I‘ve tested and it does fix the issue. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 3/7] ar71xx/image: migrate tl-wdr6500-v2 to new image build steps
I'll have a try. But there's another issue. The firmware uses a version 2 magic, specified by "-m 2" cmdline passed to mktplinkfw. Directly call mktplinkfw-initramfs or mktplinkfw will create a version 1 firmware. 2015-10-31 22:20 GMT+08:00 Felix Fietkau : > On 2015-10-31 15:02, Weijie Gao wrote: > > HI, > > > > I have this router and I submitted this router's mach. > > > > Have you noticed that the TPLINK-64K generates a U-Boot image for the > > kernel at first? > > The normal routine does not do that. > > > > So this firmware has two headers, first the tp-link header then the > > u-boot header. > > > > If the u-boot header disappear, the bootloader won't boot the firmware. > Does this fix the issue? > --- > --- a/target/linux/ar71xx/image/Makefile > +++ b/target/linux/ar71xx/image/Makefile > @@ -334,6 +334,8 @@ TARGET_DEVICES += tl-wdr3500-v1 tl-wdr3600-v1 > tl-wdr4300-v1 tl-wdr4300-v1-il tl- > > define Device/tl-wdr6500-v2 > $(Device/tplink-8mlzma) > + KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma > + KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | uImage lzma | > mktplinkfw-initramfs >BOARDNAME = TL-WDR6500-v2 >DEVICE_PROFILE = TLWDR6500V2 >TPLINK_HWID := 0x6502 > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 3/7] ar71xx/image: migrate tl-wdr6500-v2 to new image build steps
HI, I have this router and I submitted this router's mach. Have you noticed that the TPLINK-64K generates a U-Boot image for the kernel at first? The normal routine does not do that. So this firmware has two headers, first the tp-link header then the u-boot header. If the u-boot header disappear, the bootloader won't boot the firmware. Regards, Weijie 2015-10-31 21:47 GMT+08:00 Alexander Couzens : > Hi Weijie, > > the old image also used mktplink. > Do you have a wdr6500? If so it would be nice if you can test the new > image. > > Best > lynxis > > old image code: > > $(eval $(call > SingleProfile,TPLINK-64K,64kraw,TLWDR6500V2,tl-wdr6500-v2,TL-WDR6500-v2,ttyS0,115200,0x6502,1,8Mlzma)) > > define Image/Build/TPLINK-64K >-$(STAGING_DIR_HOST)/bin/mkimage \ >-A mips -O linux -T kernel -a 0x8006 -C lzma \ >-e 0x8006 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ >-d $$(KDIR_TMP)/vmlinux-$(2).bin.lzma > $(KDIR_TMP)/vmlinux-$(2).bin.lzma.img >-$(STAGING_DIR_HOST)/bin/mktplinkfw \ >-H $(4) -W $(5) -F $(6) -N OpenWrt -m 2 -V $(REVISION) $(7) > \ >-X 0x2 \ >-k $(KDIR_TMP)/vmlinux-$(2).bin.lzma.img \ >-r $(KDIR)/root.$(1) \ >-a $(call rootfs_align,$(1)) -j \ >-o $(call factoryname,$(1),$(2)) >-$(STAGING_DIR_HOST)/bin/mktplinkfw \ >-H $(4) -W $(5) -F $(6) -N OpenWrt -m 2 -V $(REVISION) $(7) > -s \ >-X 0x2 \ >-k $(KDIR_TMP)/vmlinux-$(2).bin.lzma.img \ >-r $(KDIR)/root.$(1) \ >-a $(call rootfs_align,$(1)) -j \ >-o $(call sysupname,$(1),$(2)) > endef > > -- > Alexander Couzens > > mail: lyn...@fe80.eu > jabber: lyn...@fe80.eu > mobile: +4915123277221 > gpg: 390D CF78 8BF9 AA50 4F8F F1E2 C29E 9DA6 A0DF 8604 > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 3/7] ar71xx/image: migrate tl-wdr6500-v2 to new image build steps
Hi, The TL-WDR6500 v2 does not use the standard TP-LINK firmware header. The kernel has a U-Boot header. If you use tplink-8mlzma, the bootloader won't recognize it. Please revert this patch. Regards, Weijie 2015-10-31 8:54 GMT+08:00 Alexander Couzens : > Signed-off-by: Alexander Couzens > --- > target/linux/ar71xx/image/Makefile | 11 +-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/target/linux/ar71xx/image/Makefile > b/target/linux/ar71xx/image/Makefile > index f0c3a66..be7cf9f 100644 > --- a/target/linux/ar71xx/image/Makefile > +++ b/target/linux/ar71xx/image/Makefile > @@ -332,6 +332,15 @@ $(Device/tl-wdr4300-v1) > endef > TARGET_DEVICES += tl-wdr3500-v1 tl-wdr3600-v1 tl-wdr4300-v1 > tl-wdr4300-v1-il tl-wdr4310-v1 mw4530r-v1 > > +define Device/tl-wdr6500-v2 > +$(Device/tplink-8mlzma) > + BOARDNAME = TL-WDR6500-v2 > + DEVICE_PROFILE = TLWDR6500V2 > + TPLINK_HWID := 0x6502 > + TPLINK_HEADER_VERSION := 2 > +endef > +TARGET_DEVICES += tl-wdr6500-v2 > + > define Device/tl-wdr3320-v2 > $(Device/tplink-4mlzma) >BOARDNAME = TL-WDR3320-v2 > @@ -2377,8 +2386,6 @@ $(eval $(call > SingleProfile,Senao,squashfs-only,EAP300V2,eap300v2,EAP300V2,ttyS0 > > $(eval $(call > SingleProfile,TPLINKOLD,squashfs-only,TLWR841NV15,tl-wr841nd-v1.5,TL-WR841N-v1.5,ttyS0,115200,0x08410002,2,4M)) > > -$(eval $(call > SingleProfile,TPLINK-64K,64kraw,TLWDR6500V2,tl-wdr6500-v2,TL-WDR6500-v2,ttyS0,115200,0x6502,1,8Mlzma)) > - > $(eval $(call > SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510)) > > $(eval $(call > SingleProfile,WHRHPG300N,64kraw,WHRG301N,whr-g301n,WHR-G301N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-G301N)) > -- > 2.6.2 > ___ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: add TP-LINK TL-WDR3320 v2 support
Signed-off-by: Weijie Gao This patch adds support for TP-LINK TL-WDR3320 v2. This router uses a chinese version 2 firmware header,. --- target/linux/ar71xx/base-files/etc/diag.sh | 1 + .../ar71xx/base-files/etc/uci-defaults/01_leds | 4 + .../ar71xx/base-files/etc/uci-defaults/02_network | 1 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 6 + .../ar71xx/base-files/lib/upgrade/platform.sh | 1 + target/linux/ar71xx/config-4.1 | 1 + .../files/arch/mips/ath79/mach-tl-wdr3320-v2.c | 146 + target/linux/ar71xx/generic/profiles/tp-link.mk| 11 ++ target/linux/ar71xx/image/Makefile | 46 ++- .../816-MIPS-ath79-add-tl-wdr3320-v2-support.patch | 40 ++ 10 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3320-v2.c create mode 100644 target/linux/ar71xx/patches-4.1/816-MIPS-ath79-add-tl-wdr3320-v2-support.patch diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 36de775..0dcc844 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -256,6 +256,7 @@ get_status_led() { tl-wa901nd | \ tl-wa901nd-v2 | \ tl-wa901nd-v3 | \ + tl-wdr3320-v2 | \ tl-wdr3500 | \ tl-wr1041n-v2 | \ tl-wr1043nd | \ diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds index e7f7a4c..4dafc1e 100644 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds @@ -425,6 +425,10 @@ tl-wa901nd-v2) ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt" ;; +tl-wdr3320-v2) + ucidef_set_led_wlan "wlan5g" "WLAN5G" "tp-link:green:wlan5g" "phy0tpt" + ;; + tl-wdr3500) ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1" ucidef_set_led_wlan "wlan2g" "WLAN2G" "tp-link:green:wlan2g" "phy0tpt" diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network index 686fce9..37d5a63 100644 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -435,6 +435,7 @@ tew-712br |\ tl-mr3220 |\ tl-mr3220-v2 |\ tl-mr3420 |\ +tl-wdr3320-v2 |\ tl-wdr3500 |\ tl-wr741nd |\ tl-wr741nd-v4 |\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index e1f345e..c5440f9 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -221,6 +221,9 @@ tplink_board_detect() { "342000"*) model="TP-Link TL-MR3420" ;; + "332000"*) + model="TP-Link TL-WDR3320" + ;; "35"*) model="TP-Link TL-WDR3500" ;; @@ -763,6 +766,9 @@ ar71xx_board_detect() { *"TL-WA901ND v3") name="tl-wa901nd-v3" ;; + *"TL-WDR3320 v2") + name="tl-wdr3320-v2" + ;; *"TL-WDR3500") name="tl-wdr3500" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index c1962e4..1d56d99 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -338,6 +338,7 @@ platform_check_image() { tl-wa901nd | \ tl-wa901nd-v2 | \ tl-wa901nd-v3 | \ + tl-wdr3320-v2 | \ tl-wdr3500 | \ tl-wdr4300 | \ tl-wdr4900-v2 | \ diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1 index 21c4601..d0a6602 100644 --- a/target/linux/ar71xx/config-4.1 +++ b/target/linux/ar71xx/config-4.1 @@ -121,6 +121,7 @@ CONFIG_ATH79_MACH_TL_WA830RE_V2=y CONFIG_ATH79_MACH_TL_WA901ND=y CONFIG_ATH79_MACH_TL_WA901ND_V2=y CONFIG_ATH79_MACH_TL_WAX50RE=y +CONFIG_ATH79_MACH_TL_WDR3320_V2=y CONFIG_ATH79_MACH_TL_WDR3500=y CONFIG_ATH79_MACH_TL_WDR4300=y CONFIG_ATH79_MACH_TL_WDR6500_V2=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3320-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3320-v2.c new file mode 100644 index 000..3e452f2 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3320-v2.c @@ -0,0 +1,146 @@ +/* + * TP-LINK TL-WDR3320 v2 board support + * + * Copyright (C) 2012 Gabor Juhos +
[OpenWrt-Devel] [PATCH] ar71xx: fix ar724x clock calculation
Signed-off-by: Weijie Gao According to the AR7242 datasheet section 2.8, AR724X CPUs use a 40MHz input clock as the REF_CLK instead of 5MHz. The correct CPU PLL calculation procedure is as follows: CPU_PLL = (DIV * REF_CLK) / REF_DIV / 2. This patch is compatible with the current calculation procedure with default DIV and REF_DIV values. Test on both AR7240, AR7241 and AR7242. --- ...MIPS-ath79-ar724x-clock-calculation-fixes.patch | 22 ++ 1 file changed, 22 insertions(+) create mode 100644 target/linux/ar71xx/patches-4.1/634-MIPS-ath79-ar724x-clock-calculation-fixes.patch diff --git a/target/linux/ar71xx/patches-4.1/634-MIPS-ath79-ar724x-clock-calculation-fixes.patch b/target/linux/ar71xx/patches-4.1/634-MIPS-ath79-ar724x-clock-calculation-fixes.patch new file mode 100644 index 000..16d4621 --- /dev/null +++ b/target/linux/ar71xx/patches-4.1/634-MIPS-ath79-ar724x-clock-calculation-fixes.patch @@ -0,0 +1,22 @@ +--- a/arch/mips/ath79/clock.c b/arch/mips/ath79/clock.c +@@ -25,7 +25,7 @@ + #include "common.h" + + #define AR71XX_BASE_FREQ 4000 +-#define AR724X_BASE_FREQ 500 ++#define AR724X_BASE_FREQ 4000 + #define AR913X_BASE_FREQ 500 + + struct clk { +@@ -99,8 +99,8 @@ + div = ((pll >> AR724X_PLL_DIV_SHIFT) & AR724X_PLL_DIV_MASK); + freq = div * ref_rate; + +- div = ((pll >> AR724X_PLL_REF_DIV_SHIFT) & AR724X_PLL_REF_DIV_MASK); +- freq *= div; ++ div = ((pll >> AR724X_PLL_REF_DIV_SHIFT) & AR724X_PLL_REF_DIV_MASK) * 2; ++ freq /= div; + + cpu_rate = freq; + -- 2.1.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 3/3] ar71xx: add support for TP-Link TL-WDR6500 v2
Signed-off-by: Weijie Gao This patch adds support for TP-Link TL-WDR6500 v2. The firmware has a U-Boot header for kernel, and a TP-LINK v2 header for the whole firmware, so I have to create a new firmware creation method. --- target/linux/ar71xx/base-files/etc/diag.sh | 3 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 + .../ar71xx/base-files/etc/uci-defaults/01_leds | 8 ++ .../ar71xx/base-files/etc/uci-defaults/02_network | 1 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 6 + .../ar71xx/base-files/lib/upgrade/platform.sh | 11 +- target/linux/ar71xx/config-4.1 | 1 + .../files/arch/mips/ath79/mach-tl-wdr6500-v2.c | 141 + target/linux/ar71xx/generic/profiles/tp-link.mk| 11 ++ target/linux/ar71xx/image/Makefile | 33 + ...PS-ath79-add-tplink-tl-wdr6500-v2-support.patch | 40 ++ 11 files changed, 258 insertions(+), 1 deletion(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr6500-v2.c create mode 100644 target/linux/ar71xx/patches-4.1/814-MIPS-ath79-add-tplink-tl-wdr6500-v2-support.patch diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 561c5da..80f4ccd 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -286,6 +286,9 @@ get_status_led() { tl-wr2543n) status_led="tp-link:green:wps" ;; + tl-wdr6500-v2) + status_led="tp-link:white:system" + ;; tube2h) status_led="alfa:green:signal4" ;; diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 7111630..a79643e 100644 --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -54,6 +54,10 @@ case "$FIRMWARE" in ath10kcal_extract "art" 20480 2116 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1) ;; + tl-wdr6500-v2) + ath10kcal_extract "art" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) + ;; r6100) ath10kcal_extract "caldata" 20480 2116 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) +2) diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds index 2aced37..51c3b9a 100644 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds @@ -439,6 +439,14 @@ tl-wdr4900-v2) ucidef_set_led_wlan "wlan5g" "WLAN5G" "tp-link:blue:wlan5g" "phy1tpt" ;; +tl-wdr6500-v2) + ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1" + ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x02" + ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x04" + ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x08" + ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x10" + ;; + archer-c5|\ archer-c7) ucidef_set_led_usbdev "usb1" "USB1" "tp-link:green:usb1" "1-1" diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network index 2893e62..d81145c 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -227,6 +227,7 @@ tl-mr3420-v2 |\ tl-wr841n-v8 |\ tl-wr842n-v2 |\ tl-wr941nd-v5 |\ +tl-wdr6500-v2 |\ wnr2000-v3 |\ wnr2000-v4 |\ wnr2200 |\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 256bd10..b59ad96 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -240,6 +240,9 @@ tplink_board_detect() { "4902") model="TP-Link TL-WDR4900" ;; + "6502") + model="TP-Link TL-WDR6500" + ;; "453000"*) model="MERCURY MW4530R" ;; @@ -766,6 +769,9 @@ ar71xx_board_detect() { *"TL
[OpenWrt-Devel] [PATCH 2/3] ar71xx: add 64kb bootloader mtd parser for tplinkpart
Signed-off-by: Weijie Gao This patch adds flash layout parser for TP-Link firmwares which have a 64kb bootloader. This is used for TP-Link TL-WDR6500 v2. --- target/linux/ar71xx/files/drivers/mtd/tplinkpart.c | 35 ++ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c b/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c index ab952b6..b967e25 100644 --- a/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c +++ b/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c @@ -18,10 +18,12 @@ #define TPLINK_NUM_PARTS 5 #define TPLINK_HEADER_V1 0x0100 +#define TPLINK_HEADER_V2 0x0200 #define MD5SUM_LEN 16 #define TPLINK_ART_LEN 0x1 #define TPLINK_KERNEL_OFFS 0x2 +#define TPLINK_64K_KERNEL_OFFS 0x1 struct tplink_fw_header { uint32_tversion;/* header version */ @@ -70,7 +72,7 @@ tplink_read_header(struct mtd_info *mtd, size_t offset) /* sanity checks */ t = be32_to_cpu(header->version); - if (t != TPLINK_HEADER_V1) + if ((t != TPLINK_HEADER_V1) && (t != TPLINK_HEADER_V2)) goto err_free_header; t = be32_to_cpu(header->kernel_ofs); @@ -106,14 +108,14 @@ static int tplink_check_rootfs_magic(struct mtd_info *mtd, size_t offset) return 0; } -static int tplink_parse_partitions(struct mtd_info *master, +static int tplink_parse_partitions_offset(struct mtd_info *master, struct mtd_partition **pparts, - struct mtd_part_parser_data *data) + struct mtd_part_parser_data *data, + size_t offset) { struct mtd_partition *parts; struct tplink_fw_header *header; int nr_parts; - size_t offset; size_t art_offset; size_t rootfs_offset; size_t squashfs_offset; @@ -126,8 +128,6 @@ static int tplink_parse_partitions(struct mtd_info *master, goto err; } - offset = TPLINK_KERNEL_OFFS; - header = tplink_read_header(master, offset); if (!header) { pr_notice("%s: no TP-Link header found\n", master->name); @@ -180,15 +180,38 @@ err: return ret; } +static int tplink_parse_partitions(struct mtd_info *master, + struct mtd_partition **pparts, + struct mtd_part_parser_data *data) +{ + return tplink_parse_partitions_offset(master, pparts, data, + TPLINK_KERNEL_OFFS); +} + +static int tplink_parse_64k_partitions(struct mtd_info *master, + struct mtd_partition **pparts, + struct mtd_part_parser_data *data) +{ + return tplink_parse_partitions_offset(master, pparts, data, + TPLINK_64K_KERNEL_OFFS); +} + static struct mtd_part_parser tplink_parser = { .owner = THIS_MODULE, .parse_fn = tplink_parse_partitions, .name = "tp-link", }; +static struct mtd_part_parser tplink_64k_parser = { + .owner = THIS_MODULE, + .parse_fn = tplink_parse_64k_partitions, + .name = "tp-link-64k", +}; + static int __init tplink_parser_init(void) { register_mtd_parser(&tplink_parser); + register_mtd_parser(&tplink_64k_parser); return 0; } -- 2.1.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 1/3] tools/firmware-utils: add header version 2 support for mktplinkfw
Signed-off-by: Weijie Gao This patch adds header version 2 option for mktplinkfw. The version 2 header is used for AR/QCA firmwares and is not the same as the header generated by mktplinkfw2. Instead, it is nearly the same as version 1 header except for the header version and the RSA signature. The header version 2 support is used for newer TP-Link routers which have only a 64kb bootloader part, e.g. TL-WDR6500 v2. --- tools/firmware-utils/src/mktplinkfw.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c index 12420ad..1302d46 100644 --- a/tools/firmware-utils/src/mktplinkfw.c +++ b/tools/firmware-utils/src/mktplinkfw.c @@ -30,6 +30,7 @@ #define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); }) #define HEADER_VERSION_V1 0x0100 +#define HEADER_VERSION_V2 0x0200 #define HWID_ANTMINER_S1 0x04440001 #define HWID_ANTMINER_S3 0x04440003 #define HWID_GL_INET_V10x0801 @@ -130,6 +131,7 @@ static char *progname; static char *vendor = "TP-LINK Technologies"; static char *version = "ver. 1.0"; static char *fw_ver = "0.0.0"; +static uint32_t hdr_ver = HEADER_VERSION_V1; static char *board_id; static struct board_info *board; @@ -139,6 +141,7 @@ static char *opt_hw_id; static uint32_t hw_id; static char *opt_hw_rev; static uint32_t hw_rev; +static uint32_t opt_hdr_ver = 1; static int fw_ver_lo; static int fw_ver_mid; static int fw_ver_hi; @@ -526,6 +529,7 @@ static void usage(int status) " -N set image vendor to \n" " -V set image version to \n" " -v set firmware version to \n" +" -m set header version to \n" " -iinspect given firmware file \n" " -x extract kernel and rootfs while inspecting (requires -i)\n" " -Xreserve bytes in the firmware image (hexval prefixed with 0x)\n" @@ -723,6 +727,15 @@ static int check_options(void) return -1; } + if (opt_hdr_ver == 1) { + hdr_ver = HEADER_VERSION_V1; + } else if (opt_hdr_ver == 2) { + hdr_ver = HEADER_VERSION_V2; + } else { + ERR("invalid header version '%u'", opt_hdr_ver); + return -1; + } + return 0; } @@ -732,7 +745,7 @@ static void fill_header(char *buf, int len) memset(hdr, 0, sizeof(struct fw_header)); - hdr->version = htonl(HEADER_VERSION_V1); + hdr->version = htonl(hdr_ver); strncpy(hdr->vendor_name, vendor, sizeof(hdr->vendor_name)); strncpy(hdr->fw_version, version, sizeof(hdr->fw_version)); hdr->hw_id = htonl(hw_id); @@ -972,8 +985,9 @@ static int inspect_fw(void) inspect_fw_pstr("File name", inspect_info.file_name); inspect_fw_phexdec("File size", inspect_info.file_size); - if (ntohl(hdr->version) != HEADER_VERSION_V1) { - ERR("file does not seem to have V1 header!\n"); + if ((ntohl(hdr->version) != HEADER_VERSION_V1) && + (ntohl(hdr->version) != HEADER_VERSION_V2)) { + ERR("file does not seem to have V1/V2 header!\n"); goto out_free_buf; } @@ -1108,7 +1122,7 @@ int main(int argc, char *argv[]) while ( 1 ) { int c; - c = getopt(argc, argv, "a:B:H:E:F:L:V:N:W:ci:k:r:R:o:xX:hsSjv:"); + c = getopt(argc, argv, "a:B:H:E:F:L:m:V:N:W:ci:k:r:R:o:xX:hsSjv:"); if (c == -1) break; @@ -1134,6 +1148,9 @@ int main(int argc, char *argv[]) case 'L': sscanf(optarg, "0x%x", &kernel_la); break; + case 'm': + sscanf(optarg, "%u", &opt_hdr_ver); + break; case 'V': version = optarg; break; -- 2.1.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for qca956x soc
在 2014/12/13 23:16, Felix Fietkau 写道: > On 2014-12-12 16:13, Weijie Gao wrote: >> This patch adds soc support for QCA9561 and TP9343. >> TP9343 is a reduced version of QCA9561, which can be found in TP-LINK >> routers in China. >> The qca956x_wmac has not yet been supported by ath9k. >> >> tested on TL-WDR6500 and TL-WR882N v1 (Chinese version) >> >> Signed-off-by: Weijie Gao > At a first glance, this patch looks good, though I'm a bit surprised > about the odd chip name TP9343, which I can't find many mentions of. > What codebase is this patch based on? Can I find a public kernel source > somewhere? > > Thanks, > > - Felix Hi, I uses the QSDK open-source found in https://www.codeaurora.org/xwiki/bin/QSDK/WebHome. Most of the QCA956X source codes are from this website. I have disassembled the uboot of a TP9343's factory fimware, and found it is nearly the same as the QCA956X except that it does not have USB and PCIe interfaces. There is no reference code of TP9343, so I wrote its support myself. Pictures of TP9343 SoC can be found here: http://www.right.com.cn/forum/thread-143640-1-1.html Weijie ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: add support for qca956x soc
This patch adds soc support for QCA9561 and TP9343. TP9343 is a reduced version of QCA9561, which can be found in TP-LINK routers in China. The qca956x_wmac has not yet been supported by ath9k. tested on TL-WDR6500 and TL-WR882N v1 (Chinese version) Signed-off-by: Weijie Gao --- target/linux/ar71xx/config-3.14| 1 + ...34-MIPS-ath79-add-support-for-QCA956x-SoC.patch | 767 + 2 files changed, 768 insertions(+) create mode 100644 target/linux/ar71xx/patches-3.14/734-MIPS-ath79-add-support-for-QCA956x-SoC.patch diff --git a/target/linux/ar71xx/config-3.14 b/target/linux/ar71xx/config-3.14 index 9ed184b..9f222c7 100644 --- a/target/linux/ar71xx/config-3.14 +++ b/target/linux/ar71xx/config-3.14 @@ -291,6 +291,7 @@ CONFIG_SOC_AR933X=y CONFIG_SOC_AR934X=y CONFIG_SOC_QCA953X=y CONFIG_SOC_QCA955X=y +CONFIG_SOC_QCA956X=y CONFIG_SPI=y CONFIG_SPI_AP83=y CONFIG_SPI_ATH79=y diff --git a/target/linux/ar71xx/patches-3.14/734-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-3.14/734-MIPS-ath79-add-support-for-QCA956x-SoC.patch new file mode 100644 index 000..6bbc43b --- /dev/null +++ b/target/linux/ar71xx/patches-3.14/734-MIPS-ath79-add-support-for-QCA956x-SoC.patch @@ -0,0 +1,767 @@ +--- a/arch/mips/ath79/clock.c b/arch/mips/ath79/clock.c +@@ -520,6 +520,100 @@ + clk_add_alias("uart", NULL, "ref", NULL); + } + ++static void __init qca956x_clocks_init(void) ++{ ++ unsigned long ref_rate; ++ unsigned long cpu_rate; ++ unsigned long ddr_rate; ++ unsigned long ahb_rate; ++ u32 pll, out_div, ref_div, nint, hfrac, lfrac, clk_ctrl, postdiv; ++ u32 cpu_pll, ddr_pll; ++ u32 bootstrap; ++ ++ bootstrap = ath79_reset_rr(QCA956X_RESET_REG_BOOTSTRAP); ++ if (bootstrap & QCA956X_BOOTSTRAP_REF_CLK_40) ++ ref_rate = 40 * 1000 * 1000; ++ else ++ ref_rate = 25 * 1000 * 1000; ++ ++ pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG_REG); ++ out_div = (pll >> QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & ++QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK; ++ ref_div = (pll >> QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT) & ++QCA956X_PLL_CPU_CONFIG_REFDIV_MASK; ++ ++ pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG1_REG); ++ nint = (pll >> QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT) & ++ QCA956X_PLL_CPU_CONFIG1_NINT_MASK; ++ hfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT) & ++ QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK; ++ lfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT) & ++ QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK; ++ ++ cpu_pll = nint * ref_rate / ref_div; ++ cpu_pll += (lfrac * ref_rate) / ((ref_div * 25) << 13); ++ cpu_pll += (hfrac >> 13) * ref_rate / ref_div; ++ cpu_pll /= (1 << out_div); ++ ++ pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG_REG); ++ out_div = (pll >> QCA956X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & ++QCA956X_PLL_DDR_CONFIG_OUTDIV_MASK; ++ ref_div = (pll >> QCA956X_PLL_DDR_CONFIG_REFDIV_SHIFT) & ++QCA956X_PLL_DDR_CONFIG_REFDIV_MASK; ++ pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG1_REG); ++ nint = (pll >> QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT) & ++ QCA956X_PLL_DDR_CONFIG1_NINT_MASK; ++ hfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT) & ++ QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK; ++ lfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT) & ++ QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK; ++ ++ ddr_pll = nint * ref_rate / ref_div; ++ ddr_pll += (lfrac * ref_rate) / ((ref_div * 25) << 13); ++ ddr_pll += (hfrac >> 13) * ref_rate / ref_div; ++ ddr_pll /= (1 << out_div); ++ ++ clk_ctrl = ath79_pll_rr(QCA956X_PLL_CLK_CTRL_REG); ++ ++ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & ++QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; ++ ++ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_PLL_BYPASS) ++ cpu_rate = ref_rate; ++ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL) ++ cpu_rate = ddr_pll / (postdiv + 1); ++ else ++ cpu_rate = cpu_pll / (postdiv + 1); ++ ++ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT) & ++QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_MASK; ++ ++ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_DDR_PLL_BYPASS) ++ ddr_rate = ref_rate; ++ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_DDRPLL) ++ ddr_rate = cpu_pll / (postdiv + 1); ++ else ++ ddr_rate = ddr_pll / (postdiv + 1); ++ ++ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT) & ++QCA956X_PLL_CLK_CTRL_AHB_PO
[OpenWrt-Devel] [PATCH] ar8216: enable cpu port to receive arp and broadcast frames for ar8236
Signed-off-by: Weijie Gao --- target/linux/generic/files/drivers/net/phy/ar8216.c | 9 + target/linux/generic/files/drivers/net/phy/ar8216.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 558b9f7..91e090a 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -947,6 +947,15 @@ ar8236_init_globals(struct ar8xxx_priv *priv) ar8xxx_rmw(priv, AR8216_REG_GLOBAL_CTRL, AR8316_GCTRL_MTU, 9018 + 8 + 2); + /* enable cpu port to receive arp frames */ + ar8xxx_rmw(priv, AR8216_REG_ATU_CTRL, + AR8236_ATU_CTRL_RES, AR8236_ATU_CTRL_RES); + + /* enable cpu port to receive multicast and broadcast frames */ + ar8xxx_rmw(priv, AR8216_REG_FLOOD_MASK, + AR8236_FM_CPU_BROADCAST_EN | AR8236_FM_CPU_BCAST_FWD_EN, + AR8236_FM_CPU_BROADCAST_EN | AR8236_FM_CPU_BCAST_FWD_EN); + /* Enable MIB counters */ ar8xxx_rmw(priv, AR8216_REG_MIB_FUNC, AR8216_MIB_FUNC | AR8236_MIB_EN, (AR8216_MIB_FUNC_NO_OP << AR8216_MIB_FUNC_S) | diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.h b/target/linux/generic/files/drivers/net/phy/ar8216.h index f6df7c8..d437398 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.h +++ b/target/linux/generic/files/drivers/net/phy/ar8216.h @@ -40,6 +40,8 @@ #define AR8216_REG_FLOOD_MASK 0x002C #define AR8216_FM_UNI_DEST_PORTS BITS(0, 6) #define AR8216_FM_MULTI_DEST_PORTS BITS(16, 6) +#define AR8236_FM_CPU_BROADCAST_EN BIT(26) +#define AR8236_FM_CPU_BCAST_FWD_EN BIT(25) #define AR8216_REG_GLOBAL_CTRL 0x0030 #define AR8216_GCTRL_MTU BITS(0, 11) @@ -93,6 +95,7 @@ #define AR8216_ATU_CTRL_AGE_EN BIT(17) #define AR8216_ATU_CTRL_AGE_TIME BITS(0, 16) #define AR8216_ATU_CTRL_AGE_TIME_S 0 +#define AR8236_ATU_CTRL_RES BIT(20) #define AR8216_REG_MIB_FUNC0x0080 #define AR8216_MIB_TIMER BITS(0, 16) -- 1.9.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] On support status of OpenWrt for Qihoo C301
Hi, The gap is not used in official firmware, so it is okay not to keep the gap. The seama header of factory firmware contains the whole firmware. So after openwrt created the rootfs_data partition, the MD5 digest is corrupted. Instead, the seama header of sysupgrade firmware only contains the kernel, the MD5 digest will not be corrupted. The three ethernet LEDs are directly configured in mach-qihoo-c301.c, so it is not necessary to defined as GPIO LEDs. BTW, there are two status LEDs in the front, one is green and another one is red. Weijie Gao. 于 2014年09月23日 17:00, Yousong Zhou 写道: > Sorry, just noticed the missing of subject line. > > On 23 September 2014 16:53, Yousong Zhou wrote: >> hi, Weijie >> >> I got 2 doubts on the support status of OpenWrt on Qihoo C301. Maybe >> you can help clear them out. Thanks in advance :) >> >> I noticed from the TTL output of original firmware that the "firmware" >> partition starts from 0x90f0 to 0x90f7, followed by a gap of >> 256KB, then comes the "warm start" partition. But in your patch, the >> "firmware" includes the gap. Are you sure about this? Hmm, that is >> the only difference I could find between factory images by Qihoo and >> OpenWrt. >> >> The observation is that U-Boot can successfully flash both factory and >> sysupgrade seama images. But only sysupgrade image can boot reliably. >> factory image can only boot one time, after that the OEM U-Boot would >> complain that checksum is bad and switch to backup firmware. >> >> Verifying Checksum ... >> csum: >> ȩ_�(�'�g] >> afterMD5_we_get_digest: >> ն�Zpk&�i" >> Bad Header Checksum. >> Retry another region >> >> The other doubt is about LED definition. I can see that only two were >> defined in your patch. Am I right that there should be 4 of them and >> GPIO numbers of the other 2 are currently unknown? >> >> Thank you for the good work. :) >> >> Regards. >> >>yousong ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH][RESEND.3] ar71xx:stops qihoo c301 booting into backup firmware
Hi, You need to register a account at patchwork.openwrt.org, and mark your previous patches Superseded. Weijie Gao On 2014/9/20 17:18, swigger wrote: > Openwrt recently adds Qihoo [NYSE:QIHU] C301 router support. > However, this router has a backup firmware in the second flash and the > current trunk can only boot 3 times before u-boot boots into that backup > firmware. This is a stratgy for unbricking. > > This patch makes u-boot happy. > > Signed-off-by: Xungneg li > --- > .../ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c | 87 > > 1 file changed, 87 insertions(+) > > diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c > b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c > index 08a602f..816a433 100644 > --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c > +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c > @@ -14,6 +14,8 @@ > #include > #include > #include > +#include > +#include > > #include > > @@ -79,6 +81,7 @@ static struct gpio_keys_button qihoo_c301_gpio_keys[] > __initdata = { > }, > }; > > +static int qihoo_c301_board = 0; > struct flash_platform_data flash __initdata = {NULL, NULL, 0}; > > static void qihoo_c301_get_mac(const char *name, char *mac) > @@ -98,6 +101,7 @@ static void __init qihoo_c301_setup(void) > u8 tmpmac[ETH_ALEN]; > > ath79_register_m25p80_multi(&flash); > + qihoo_c301_board = 1; > > ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); > > @@ -164,3 +168,86 @@ static void __init qihoo_c301_setup(void) > > MIPS_MACHINE(ATH79_MACH_QIHOO_C301, "QIHOO-C301", "Qihoo 360 C301", >qihoo_c301_setup); > + > + > +//the following code stops qihoo's uboot booting into the backup system. > +static void erase_callback(struct erase_info *erase) > +{ > + char * buf = (char*) erase->priv; > + int ret; > + size_t nb=0; > + > + if (erase->state == MTD_ERASE_DONE) > + { > + ret = mtd_write(erase->mtd, 0, 0x1, &nb, buf); > + } > + kfree(erase); > + kfree(buf); > +} > + > +static int qihoo_reset_trynum(void) > +{ > + size_t nb = 0; > + char *buf=0, *p; > + const char * match = "image1trynum="; > + size_t matchlen = strlen(match); > + struct erase_info *erase; > + struct mtd_info * mtd; > + unsigned int newcrc; > + int ret; > + > + if (! qihoo_c301_board) > + return 0; > + > + mtd = get_mtd_device_nm("action_image_config"); > + if (IS_ERR(mtd)) > + { > + return PTR_ERR(mtd); > + } > + if (mtd->size!=0x1) > + { > + return -1; > + } > + buf = kzalloc(0x1+4, GFP_KERNEL); > + ret = mtd_read(mtd, 0, 0x1, &nb, buf); > + if (nb != 0x1) > + { > + kfree(buf); > + return -1; > + } > + for (p=buf+4; *p; p+=strlen(p)+1) > + { > + if (strncmp(p, match, matchlen)==0) > + { > + p += matchlen; > + while (*p) > + *p++ = '0'; > + break; > + } > + } > + > + newcrc = crc32(~0, buf+4, 0xfffc)^0x; > + memcpy(buf, &newcrc, 4); > + > + erase = kzalloc(sizeof(struct erase_info), GFP_KERNEL); > + if (!erase) > + { > + kfree(buf); > + return -1; > + } > + erase->mtd = mtd; > + erase->callback = erase_callback; > + erase->addr = 0; > + erase->len = 0x1; > + erase->priv = (u_long) buf; > + ret = mtd_erase(mtd, erase); > + > + if (ret) { > + kfree(buf); > + kfree(erase); > + return ret; > + } > + > + return 0; > +} > +late_initcall(qihoo_reset_trynum); ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] [ar71xx] stops qihoo 360 c301 booting into backup firmware
Hi, It's great. I hope this can be applied. However, your patch seems to be whitespace broken. Please fix it and resend. Weijie Gao On 2014/9/20 0:50, swigger wrote: > Openwrt recently adds Qihoo [NYSE:QIHU] C301 router support. > However, this router has a backup firmware in the second flash and the > current trunk can only boot 3 times before u-boot boots into that backup > firmware. This is a stratgy for unbricking. > > This patch makes u-boot happy. > > Signed-off-by: Xungneg li > > === > diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c > b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c > index 08a602f..774356f 100644 > --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c > +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c > @@ -14,6 +14,8 @@ > #include > #include > #include > +#include > +#include > > #include > > @@ -79,6 +81,7 @@ static struct gpio_keys_button qihoo_c301_gpio_keys[] > __initdata = { > }, > }; > > +static int qihoo_c301_board = 0; > struct flash_platform_data flash __initdata = {NULL, NULL, 0}; > > static void qihoo_c301_get_mac(const char *name, char *mac) @@ -98,6 +101,7 > @@ static void __init qihoo_c301_setup(void) > u8 tmpmac[ETH_ALEN]; > > ath79_register_m25p80_multi(&flash); > + qihoo_c301_board = 1; > > ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); > > @@ -164,3 +168,86 @@ static void __init qihoo_c301_setup(void) > > MIPS_MACHINE(ATH79_MACH_QIHOO_C301, "QIHOO-C301", "Qihoo 360 C301", >qihoo_c301_setup); > + > + > +//the following code stops qihoo's uboot booting into the backup system. > +static void erase_callback(struct erase_info *erase) { > + char * buf = (char*) erase->priv; > + int ret; > + size_t nb=0; > + > + if (erase->state == MTD_ERASE_DONE) > + { > + ret = mtd_write(erase->mtd, 0, 0x1, &nb, buf); > + } > + kfree(erase); > + kfree(buf); > +} > + > +static int qihoo_reset_trynum(void) > +{ > + size_t nb = 0; > + char *buf=0, *p; > + const char * match = "image1trynum="; > + size_t matchlen = strlen(match); > + struct erase_info *erase; > + struct mtd_info * mtd; > + unsigned int newcrc; > + int ret; > + > + if (! qihoo_c301_board) > + return 0; > + > + mtd = get_mtd_device_nm("action_image_config"); > + if (IS_ERR(mtd)) > + { > + return PTR_ERR(mtd); > + } > + if (mtd->size!=0x1) > + { > + return -1; > + } > + buf = kzalloc(0x1+4, GFP_KERNEL); > + ret = mtd_read(mtd, 0, 0x1, &nb, buf); > + if (nb != 0x1) > + { > + kfree(buf); > + return -1; > + } > + for (p=buf+4; *p; p+=strlen(p)+1) > + { > + if (strncmp(p, match, matchlen)==0) > + { > + p += matchlen; > + while (*p) > + *p++ = '0'; > + break; > + } > + } > + > + newcrc = crc32(~0, buf+4, 0xfffc)^0x; > + memcpy(buf, &newcrc, 4); > + > + erase = kzalloc(sizeof(struct erase_info), GFP_KERNEL); > + if (!erase) > + { > + kfree(buf); > + return -1; > + } > + erase->mtd = mtd; > + erase->callback = erase_callback; > + erase->addr = 0; > + erase->len = 0x1; > + erase->priv = (u_long) buf; > + ret = mtd_erase(mtd, erase); > + > + if (ret) { > + kfree(buf); > + kfree(erase); > + return ret; > + } > + > + return 0; > +} > +late_initcall(qihoo_reset_trynum); > ___ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2] ar71xx: add qihoo 360 c301 router support
Qihoo 360 C301 is a dual band wireless router supports 802.11n and 802.11ac. Its chipset is AR9344 + AR9882 with two 16MB flashes. This patch adds its initial support. v2: * use mtd_get_mac_ascii to fetch MAC address for ath10k. * use ath79_register_pci to initialize AR9882. Signed-off-by: Weijie Gao --- target/linux/ar71xx/base-files/etc/diag.sh | 3 + .../ar71xx/base-files/etc/uci-defaults/01_leds | 4 + .../ar71xx/base-files/etc/uci-defaults/02_network | 1 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + .../lib/preinit/81_load_ath10k_board_bin | 17 +++ .../ar71xx/base-files/lib/upgrade/platform.sh | 1 + target/linux/ar71xx/config-3.10| 1 + target/linux/ar71xx/config-3.14| 1 + .../ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c | 166 + target/linux/ar71xx/generic/profiles/qihoo.mk | 16 ++ target/linux/ar71xx/image/Makefile | 3 + .../601-MIPS-ath79-add-more-register-defines.patch | 3 +- ...726-MIPS-ath79-add-qihoo-360-c301-support.patch | 40 + .../601-MIPS-ath79-add-more-register-defines.patch | 3 +- ...726-MIPS-ath79-add-qihoo-360-c301-support.patch | 40 + 15 files changed, 300 insertions(+), 2 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c create mode 100644 target/linux/ar71xx/generic/profiles/qihoo.mk create mode 100644 target/linux/ar71xx/patches-3.10/726-MIPS-ath79-add-qihoo-360-c301-support.patch create mode 100644 target/linux/ar71xx/patches-3.14/726-MIPS-ath79-add-qihoo-360-c301-support.patch diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 1864b11..c16b7d7 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -166,6 +166,9 @@ get_status_led() { oolite) status_led="oolite:red:system" ;; + qihoo-c301) + status_led="qihoo:green:status" + ;; tew-632brp) status_led="tew-632brp:green:status" ;; diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds index d3b766d..9d2cd41 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds @@ -191,6 +191,10 @@ om5p) ucidef_set_led_netdev "port2" "port2" "om5p:blue:lan" "eth1" ;; +qihoo-c301) + ucidef_set_led_wlan "wlan2g" "WLAN2G" "qihoo:red:status" "phy1tpt" + ;; + smart-300) ucidef_set_led_netdev "wan" "WAN" "nc-link:green:wan" "eth0" ucidef_set_led_switch "lan1" "LAN1" "nc-link:green:lan1" "switch0" "0x04" diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network index c5cfd67..d5a43bd 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -346,6 +346,7 @@ hiwifi-hc6361 |\ ja76pf |\ mynet-n600 |\ oolite |\ +qihoo-c301 |\ rb-750 |\ rb-751 |\ tew-632brp |\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 1e96b6d..1c685c6 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -430,6 +430,9 @@ ar71xx_board_detect() { *PB92) name="pb92" ;; + *"Qihoo 360 C301") + name="qihoo-c301" + ;; *"RouterBOARD 411/A/AH") name="rb-411" ;; diff --git a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin index a28932f..2c06d7f 100644 --- a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin +++ b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin @@ -24,6 +24,23 @@ do_load_ath10k_board_bin() { bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin ;; + qihoo-c301) + local mac + + mac=$(mtd_get_mac_ascii devdata wlan5mac) + + if [ -z "$mac" ]; then + mac=$(macaddr_add $(cat /sys/class/net/eth0/address) -2) + fi + + dd if=/dev/mtdblock10 \ + bs=1 skip=20480 count=6 \ + of=/tmp/ath10k-board.bin +
[OpenWrt-Devel] [PATCH] [RESEND] ar71xx: add qihoo 360 c301 router support
Qihoo 360 C301 is a dual band wireless router supports 802.11n and 802.11ac. Its chipset is AR9344 + AR9882 with two 16MB flashes. This patch adds its initial support. Signed-off-by: Weijie Gao --- target/linux/ar71xx/base-files/etc/diag.sh | 3 + .../ar71xx/base-files/etc/uci-defaults/01_leds | 5 + .../ar71xx/base-files/etc/uci-defaults/02_network | 1 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + .../lib/preinit/81_load_ath10k_board_bin | 23 +++ .../ar71xx/base-files/lib/upgrade/platform.sh | 1 + target/linux/ar71xx/config-3.10| 1 + target/linux/ar71xx/config-3.14| 1 + .../ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c | 168 + target/linux/ar71xx/generic/profiles/qihoo.mk | 16 ++ target/linux/ar71xx/image/Makefile | 3 + .../601-MIPS-ath79-add-more-register-defines.patch | 3 +- .../610-MIPS-ath79-openwrt-machines.patch | 19 ++- .../601-MIPS-ath79-add-more-register-defines.patch | 3 +- .../610-MIPS-ath79-openwrt-machines.patch | 19 ++- 15 files changed, 261 insertions(+), 8 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c create mode 100644 target/linux/ar71xx/generic/profiles/qihoo.mk diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 1864b11..c16b7d7 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -166,6 +166,9 @@ get_status_led() { oolite) status_led="oolite:red:system" ;; + qihoo-c301) + status_led="qihoo:green:status" + ;; tew-632brp) status_led="tew-632brp:green:status" ;; diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds index d3b766d..872fc0d 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds @@ -191,6 +191,11 @@ om5p) ucidef_set_led_netdev "port2" "port2" "om5p:blue:lan" "eth1" ;; +qihoo-c301) + ucidef_set_led_wlan "wlan2g" "WLAN2G" "qihoo:green:status" "phy1tpt" + ucidef_set_led_wlan "wlan5g" "WLAN5G" "qihoo:red:status" "phy0tpt" + ;; + smart-300) ucidef_set_led_netdev "wan" "WAN" "nc-link:green:wan" "eth0" ucidef_set_led_switch "lan1" "LAN1" "nc-link:green:lan1" "switch0" "0x04" diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network index c5cfd67..d5a43bd 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -346,6 +346,7 @@ hiwifi-hc6361 |\ ja76pf |\ mynet-n600 |\ oolite |\ +qihoo-c301 |\ rb-750 |\ rb-751 |\ tew-632brp |\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 1e96b6d..1c685c6 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -430,6 +430,9 @@ ar71xx_board_detect() { *PB92) name="pb92" ;; + *"Qihoo 360 C301") + name="qihoo-c301" + ;; *"RouterBOARD 411/A/AH") name="rb-411" ;; diff --git a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin index a28932f..66ccb1f 100644 --- a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin +++ b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin @@ -24,6 +24,29 @@ do_load_ath10k_board_bin() { bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin ;; + qihoo-c301) + local mac + local tmp + + dd if=/dev/mtdblock2 of=/tmp/c301-nvram >/dev/null 2>/dev/null + + tmp=$(cat /tmp/c301-nvram | grep 'wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]\)') + + if [ $? == 0 ]; then + rm -f /tmp/c301-nvram + mac=$(echo ${tmp} | sed 's/wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]\)/\1/g') + else +
[OpenWrt-Devel] [PATCH] ar71xx: add qihoo 360 c301 router support
Add Qihoo 360 C301 router support Signed-off-by: Weijie Gao --- The hardware of Qihoo 360 C301 router is AR9344 + AR9882 with 128MB RAM and two 16MB flashes. The sysupgrade firmware can be upgraded directly in its offical bootloader. target/linux/ar71xx/base-files/etc/diag.sh |3 + .../ar71xx/base-files/etc/uci-defaults/01_leds |5 + .../ar71xx/base-files/etc/uci-defaults/02_network |1 + target/linux/ar71xx/base-files/lib/ar71xx.sh |3 + .../lib/preinit/81_load_ath10k_board_bin | 23 +++ .../ar71xx/base-files/lib/upgrade/platform.sh |1 + target/linux/ar71xx/config-3.10|1 + target/linux/ar71xx/config-3.14|1 + .../ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c | 168 target/linux/ar71xx/generic/profiles/qihoo.mk | 17 ++ target/linux/ar71xx/image/Makefile |3 + .../601-MIPS-ath79-add-more-register-defines.patch |3 +- .../610-MIPS-ath79-openwrt-machines.patch | 19 ++- .../601-MIPS-ath79-add-more-register-defines.patch |3 +- .../610-MIPS-ath79-openwrt-machines.patch | 19 ++- 15 files changed, 262 insertions(+), 8 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c create mode 100644 target/linux/ar71xx/generic/profiles/qihoo.mk diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 1864b11..c16b7d7 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -166,6 +166,9 @@ get_status_led() { oolite) status_led="oolite:red:system" ;; + qihoo-c301) + status_led="qihoo:green:status" + ;; tew-632brp) status_led="tew-632brp:green:status" ;; diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds index d3b766d..872fc0d 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds @@ -191,6 +191,11 @@ om5p) ucidef_set_led_netdev "port2" "port2" "om5p:blue:lan" "eth1" ;; +qihoo-c301) + ucidef_set_led_wlan "wlan2g" "WLAN2G" "qihoo:green:status" "phy1tpt" + ucidef_set_led_wlan "wlan5g" "WLAN5G" "qihoo:red:status" "phy0tpt" + ;; + smart-300) ucidef_set_led_netdev "wan" "WAN" "nc-link:green:wan" "eth0" ucidef_set_led_switch "lan1" "LAN1" "nc-link:green:lan1" "switch0" "0x04" diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network index c5cfd67..d5a43bd 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -346,6 +346,7 @@ hiwifi-hc6361 |\ ja76pf |\ mynet-n600 |\ oolite |\ +qihoo-c301 |\ rb-750 |\ rb-751 |\ tew-632brp |\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 1e96b6d..1c685c6 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -430,6 +430,9 @@ ar71xx_board_detect() { *PB92) name="pb92" ;; + *"Qihoo 360 C301") + name="qihoo-c301" + ;; *"RouterBOARD 411/A/AH") name="rb-411" ;; diff --git a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin index a28932f..66ccb1f 100644 --- a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin +++ b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin @@ -24,6 +24,29 @@ do_load_ath10k_board_bin() { bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin ;; + qihoo-c301) + local mac + local tmp + + dd if=/dev/mtdblock2 of=/tmp/c301-nvram >/dev/null 2>/dev/null + + tmp=$(cat /tmp/c301-nvram | grep 'wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f] :.[0-9A-Fa-f]\)') + + if [ $? == 0 ]; then + rm -f /tmp/c301-nvram + mac=$(echo ${tmp} | sed 's/wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa- f]:.[0-9A-Fa-f]\)/\1/g') + else