OpenWrt Forum Archive

Topic: TP-Link TL-WR802N - double speed to classical TL-WR702N

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

Just got an announcement from TP-Link: they are making small and classical TL-Wr702N even more powerful! New TL-WR802N will have double speed - 300M!

Original announcement:
http://www.tp-link.com.cn/pages/promos/ … 013-08-12/

I already want it bad with OpenWrt!

1*100M WAN/LAN 1*MicroUSB
CPU:Qualcomm Atheros QCA9531-AL3A

wr802n
wr802n

(Last edited by peterwillcn on 8 Feb 2014, 04:11)

---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 13 ++++---
 drivers/net/wireless/ath/ath9k/ar9003_phy.c    | 14 ++++---
 drivers/net/wireless/ath/ath9k/hw.c            | 52 ++++++++++++++++++++------
 drivers/net/wireless/ath/ath9k/recv.c          |  2 +-
 4 files changed, 57 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index c8d22ec..25243cb 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -3598,7 +3598,7 @@ static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
     if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) {
         REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM,
                 AR_SWITCH_TABLE_COM_AR9462_ALL, value);
-    } else if (AR_SREV_9550(ah)) {
+    } else if (AR_SREV_9550(ah) || AR_SREV_9531(ah)) {
         REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM,
                 AR_SWITCH_TABLE_COM_AR9550_ALL, value);
     } else
@@ -3975,7 +3975,7 @@ static void ar9003_hw_apply_tuning_caps(struct ath_hw *ah)
     struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
     u8 tuning_caps_param = eep->baseEepHeader.params_for_tuning_caps[0];
 
-    if (AR_SREV_9340(ah))
+    if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
         return;
 
     if (eep->baseEepHeader.featureEnable & 0x40) {
@@ -4030,7 +4030,10 @@ static void ar9003_hw_xpa_timing_control_apply(struct ath_hw *ah, bool is2ghz)
     if (!(eep->baseEepHeader.featureEnable & 0x80))
         return;
 
-    if (!AR_SREV_9300(ah) && !AR_SREV_9340(ah) && !AR_SREV_9580(ah))
+    if (!AR_SREV_9300(ah) &&
+        !AR_SREV_9340(ah) &&
+        !AR_SREV_9580(ah) &&
+        !AR_SREV_9531(ah))
         return;
 
     xpa_ctl = ar9003_modal_header(ah, is2ghz)->txFrameToXpaOn;
@@ -4163,7 +4166,7 @@ static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah,
     ar9003_hw_xlna_bias_strength_apply(ah, is2ghz);
     ar9003_hw_atten_apply(ah, chan);
     ar9003_hw_quick_drop_apply(ah, chan->channel);
-    if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah))
+    if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah))
         ar9003_hw_internal_regulator_apply(ah);
     ar9003_hw_apply_tuning_caps(ah);
     ar9003_hw_apply_minccapwr_thresh(ah, chan);
@@ -4788,7 +4791,7 @@ static void ar9003_hw_power_control_override(struct ath_hw *ah,
     }
 
 tempslope:
-    if (AR_SREV_9550(ah)) {
+    if (AR_SREV_9550(ah) || AR_SREV_9531(ah)) {
         /*
          * AR955x has tempSlope register for each chain.
          * Check whether temp_compensation feature is enabled or not.
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 9b1494c..09facba 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -103,7 +103,7 @@ static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
             } else {
                 channelSel = CHANSEL_2G(freq) >> 1;
             }
-        } else if (AR_SREV_9550(ah)) {
+        } else if (AR_SREV_9550(ah) || AR_SREV_9531(ah)) {
             if (ah->is_clk_25mhz)
                 div = 75;
             else
@@ -118,7 +118,7 @@ static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
         /* Set to 2G mode */
         bMode = 1;
     } else {
-        if ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) &&
+        if ((AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) &&
             ah->is_clk_25mhz) {
             channelSel = freq / 75;
             chan_frac = ((freq % 75) * 0x20000) / 75;
@@ -810,10 +810,12 @@ static int ar9003_hw_process_ini(struct ath_hw *ah,
     /*
      * TXGAIN initvals.
      */
-    if (AR_SREV_9550(ah)) {
-        int modes_txgain_index;
+    if (AR_SREV_9550(ah) || AR_SREV_9531(ah)) {
+        int modes_txgain_index = 1;
+
+        if (AR_SREV_9550(ah))
+            modes_txgain_index = ar9550_hw_get_modes_txgain_index(ah, chan);
 
-        modes_txgain_index = ar9550_hw_get_modes_txgain_index(ah, chan);
         if (modes_txgain_index < 0)
             return -EINVAL;
 
@@ -1862,7 +1864,7 @@ bool ar9003_hw_bb_watchdog_check(struct ath_hw *ah)
     case 0x04000b09:
         return true;
     case 0x04000409:
-        if (AR_SREV_9340(ah))
+        if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
             return false;
         else
             return true;
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 2525cb1..f6a2e1b 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -757,7 +757,7 @@ static void ath9k_hw_init_pll(struct ath_hw *ah,
         /* program BB PLL phase_shift */
         REG_RMW_FIELD(ah, AR_CH0_BB_DPLL3,
                   AR_CH0_BB_DPLL3_PHASE_SHIFT, 0x1);
-    } else if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) {
+    } else if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) {
         u32 regval, pll2_divint, pll2_divfrac, refdiv;
 
         REG_WRITE(ah, AR_RTC_PLL_CONTROL, 0x1142c);
@@ -767,9 +767,15 @@ static void ath9k_hw_init_pll(struct ath_hw *ah,
         udelay(100);
 
         if (ah->is_clk_25mhz) {
-            pll2_divint = 0x54;
-            pll2_divfrac = 0x1eb85;
-            refdiv = 3;
+            if (AR_SREV_9531(ah)) {
+                pll2_divint = 0x1c;
+                pll2_divfrac = 0xa3d2;
+                refdiv = 1;
+            } else {
+                pll2_divint = 0x54;
+                pll2_divfrac = 0x1eb85;
+                refdiv = 3;
+            }
         } else {
             if (AR_SREV_9340(ah)) {
                 pll2_divint = 88;
@@ -783,7 +789,10 @@ static void ath9k_hw_init_pll(struct ath_hw *ah,
         }
 
         regval = REG_READ(ah, AR_PHY_PLL_MODE);
-        regval |= (0x1 << 16);
+        if (AR_SREV_9531(ah))
+            regval |= (0x1 << 22);
+        else
+            regval |= (0x1 << 16);
         REG_WRITE(ah, AR_PHY_PLL_MODE, regval);
         udelay(100);
 
@@ -793,14 +802,33 @@ static void ath9k_hw_init_pll(struct ath_hw *ah,
 
         regval = REG_READ(ah, AR_PHY_PLL_MODE);
         if (AR_SREV_9340(ah))
-            regval = (regval & 0x80071fff) | (0x1 << 30) |
-                 (0x1 << 13) | (0x4 << 26) | (0x18 << 19);
+            regval = (regval & 0x80071fff) |
+                (0x1 << 30) |
+                (0x1 << 13) |
+                (0x4 << 26) |
+                (0x18 << 19);
+        else if (AR_SREV_9531(ah))
+            regval = (regval & 0x01c00fff) |
+                (0x1 << 31) |
+                (0x2 << 29) |
+                (0xa << 25) |
+                (0x1 << 19) |
+                (0x6 << 12);
         else
-            regval = (regval & 0x80071fff) | (0x3 << 30) |
-                 (0x1 << 13) | (0x4 << 26) | (0x60 << 19);
+            regval = (regval & 0x80071fff) |
+                (0x3 << 30) |
+                (0x1 << 13) |
+                (0x4 << 26) |
+                (0x60 << 19);
         REG_WRITE(ah, AR_PHY_PLL_MODE, regval);
-        REG_WRITE(ah, AR_PHY_PLL_MODE,
-              REG_READ(ah, AR_PHY_PLL_MODE) & 0xfffeffff);
+
+        if (AR_SREV_9531(ah))
+            REG_WRITE(ah, AR_PHY_PLL_MODE,
+                  REG_READ(ah, AR_PHY_PLL_MODE) & 0xffbfffff);
+        else
+            REG_WRITE(ah, AR_PHY_PLL_MODE,
+                  REG_READ(ah, AR_PHY_PLL_MODE) & 0xfffeffff);
+
         udelay(1000);
     }
 
@@ -1614,7 +1642,7 @@ static void ath9k_hw_init_desc(struct ath_hw *ah)
         }
 #ifdef __BIG_ENDIAN
         else if (AR_SREV_9330(ah) || AR_SREV_9340(ah) ||
-             AR_SREV_9550(ah))
+             AR_SREV_9550(ah) || AR_SREV_9531(ah))
             REG_RMW(ah, AR_CFG, AR_CFG_SWRB | AR_CFG_SWTB, 0);
         else
             REG_WRITE(ah, AR_CFG, AR_CFG_SWTD | AR_CFG_SWRD);
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 470e1c0..bd7daf5 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -419,7 +419,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
         rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL;
     }
 
-    if (AR_SREV_9550(sc->sc_ah))
+    if (AR_SREV_9550(sc->sc_ah) || AR_SREV_9531(sc->sc_ah))
         rfilt |= ATH9K_RX_FILTER_4ADDRESS;
 
     return rfilt;
-- 
1.8.5.2

--

(Last edited by peterwillcn on 8 Feb 2014, 03:51)

Is anybody running OpenWrt on WR802N ?
Which firmware target are you using?

I'm interested in this too.
Is anyone using OpenWRT on a TL-WR802N ?
I got a TL-WR710N running OpenWRT without any problems but i'm not sure of the compatibility with the WR802N.
Thanks !

I tried to install OpenWRT on my TL-WR802Nv1 by downloading the version for the TL-WR841v9 as recommended other places. At first I thought I could upload OpenWRT through the firmware upload page in the UI. I got the error below. Then I tried uploading the same OpenWRT binary under the name for the factory firmware but that didn't work either.

Firmware details

Firmware upload error

I tried uploading a real firmware image which did actually work so I guessed something was up. I started by looking at the two binaries: new firmware and the latest applicable OpenWRT image.

$ binwalk openwrt-15.05-ar71xx-generic-tl-wr841n-v9-squashfs-factory.bin

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
512           0x200           LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: 3391996 bytes
1099100       0x10C55C        Squashfs filesystem, little endian, version 4.0, compression:xz, size: 2187934 bytes, 1098 inodes, blocksize: 262144 bytes, created: 2015-09-11 16:03:37
$ binwalk TL-WR802N_V1_150717/wr802nv1_en_3_16_9_up_boot\(150717\).bin

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             TP-Link firmware header, firmware version: 0.-16753.3, image version: "", product ID: 0x0, product version: 134348801, kernel load address: 0x0, kernel entry point: 0x80002000, kernel offset: 4063744, kernel length: 512, rootfs offset: 721952, rootfs length: 1048576, bootloader offset: 2883584, bootloader length: 0
13424         0x3470          U-Boot version string, "U-Boot 1.1.4 (Jul 17 2015 - 13:21:28)"
13472         0x34A0          CRC32 polynomial table, big endian
14756         0x39A4          uImage header, header size: 64 bytes, header CRC: 0xB3D299CF, created: 2015-07-17 05:21:29, image size: 34475 bytes, Data Address: 0x80010000, Entry Point: 0x80010000, data CRC: 0x9383ACE7, OS: Linux, CPU: MIPS, image type: Firmware Image, compression type: lzma, image name: "u-boot image"
14820         0x39E4          LZMA compressed data, properties: 0x5D, dictionary size: 33554432 bytes, uncompressed size: 90088 bytes
131584        0x20200         TP-Link firmware header, firmware version: 0.0.3, image version: "", product ID: 0x0, product version: 134348801, kernel load address: 0x0, kernel entry point: 0x80002000, kernel offset: 3932160, kernel length: 512, rootfs offset: 721952, rootfs length: 1048576, bootloader offset: 2883584, bootloader length: 0
132096        0x20400         LZMA compressed data, properties: 0x5D, dictionary size: 33554432 bytes, uncompressed size: 2103472 bytes
1180160       0x120200        Squashfs filesystem, little endian, version 4.0, compression:lzma, size: 2542608 bytes, 583 inodes, blocksize: 131072 bytes, created: 2015-07-17 05:37:08

Now I realize why it didn't work ... I bought this router to play with and don't mind breaking it apart if I have to for UART but I'd rather not if I don't have to. It doesn't look like it would go back together very nicely.

I'm new to OpenWRT as well. I would have thought that you could use the same binary as the TL-WR841NDv9 but apparently not. https://wiki.openwrt.org/toh/tp-link/tl … stallation

If this router is now supported officially, it might just warrant me to build OpenWRT from source. smile

Did you try to flash from the TP-Link GUI directly, or via TFTP? If via the GUI it might be the filename that is causing the problem. In the installation link you posted there is this note that the TL-WR841N firmware does not accept the OpenWRT filename. Maybe the TL-WR802 firmware is doing the same thing?

":!: Note: Newest version of tp link firmware (tested on TL-WR841N_V9_150310 / 3.16.9) does not accept openwrt firmware filename, so you have to rename the downloaded openwrt firmware to something what looks like stock firmware prior flashing, i.e. wr841nv9_wr841ndv9_en_3_16_9_up(150310).bin for V9 - check the zip with original firmware on tp link website for correct file name scheme - I'd suggest to remove "boot" word from filename, because openwrt firmware does not contain boot loader."

Thanks but that's what I tried first. Check my first post. smile

azend wrote:

Thanks but that's what I tried first. Check my first post. smile

Whoops! I guess it pays to read the whole post :-)

So far I've only tried flashing from the Web GUI. From what I understand, flashing via TFTP would require connecting via serial to tell U-Boot where to boot from. I don't mind soldering on some connections but I'd rather not destroy the screw less enclosure in the process.

azend wrote:

From what I understand, flashing via TFTP would require connecting via serial to tell U-Boot where to boot from.

The 841 can do TFTP without serial access via the bootloader (see: https://wiki.openwrt.org/toh/tp-link/tl … 9_v10_v11)

Don't know if the 802 supports that method or if the steps are the same. I haven't flashed a router via that method in years.

I saw that but read it as steps to reflash openwrt after you had already flashed before. If this did work from factory firmware it would be super convenient! smile

azend wrote:

So far I've only tried flashing from the Web GUI. From what I understand, flashing via TFTP would require connecting via serial to tell U-Boot where to boot from. I don't mind soldering on some connections but I'd rather not destroy the screw less enclosure in the process.

Did you update firmware from factory to openwrt? Can you tell me your method?  I think web gui must change  check firmware by RSA instead of MD5

I can confirm that TFTP works for loading both stock TP-Link firmware and DD-WRT as long as you set your PC IP to 192.168.0.66 and change the filename for the firmware you are uploading to "wr802nv1_tp_recovery.bin". I started with TL-WR802N_V1_150717 running on the router, but I'm not sure if that is a requirement or not. Currently I have DD-WRT v3.0-r27506 (07/09/15) std running on it.

Would moving to OpenWRT be as simple as flashing via the DD-WRT web GUI firmware update? Is there an OpenWRT build for the wr802n? I see that it is listed as being supported in trunk (as of January 21) but as I understand it a build would need to be compiled from trunk - that is beyond my current abilities.

(Last edited by CTXSi on 1 Feb 2016, 01:37)

Is WR802N CE and FCC certified?

valentt wrote:

Is WR802N CE and FCC certified?

I have the TL-WR802N Ver 1.0 and on the back it shows "FCC ID: TE7WR802N" and it has the symbol "C E 0700".

Hope this helps.

I just flashed my WR802Nv1 with OpenWRT from some Chinese forum (OpenWrt Barrier Breaker 14.07 / LuCI Branch (0.12+git-15.037.36195-f1e2a26), downloaded in pains from http://www.right.com.cn/FORUM/thread-162778-1-1.html), just uploaded it through native web UI (no filename changing or anything), and I'm happy to say that it seems to work!

Thanks maciejz. Have you seen anything about a Chaos Calmer version for the WR802N? As noted above in this thread there are some links that suggest it is now "officially" supported in trunk. For now I'm running DD-WRT on mine, but I would love to see if it would be possible to run OpenVPN on it via OpenWRT.

No, it's not yet officially supported. The link you mean - https://patchwork.ozlabs.org/patch/571269/ - is just a patch still waiting for merge - so for the moment it's not in the trunk yet. So either you build it yourself from the patched source, or wait for it to be integrated.

Hi all,
I have a WR802Nv1 with Chinese version and these last days I passed some time trying to upgrade my route to the US version or OpenWrt version. Try through the router web page, I can upgrade all the Chinese versions available on TP-Link web page, but all the rest, I always got Error code: 18005. Through tftp, I am doing all the steps described in this forum, but I could not ever saw the router connect on my server. No logs printed on log viewer.