[][MAC80211][app][atenl: update package]

[Description]
Add following:
- modify some atenl commands
- update iwpriv and ated wrapper

[Release-log]
N/A

Change-Id: I2291aa5b471e0c0f3629e620833c38758d32a4d0
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/5723307
diff --git a/feed/atenl/files/ated.sh b/feed/atenl/files/ated.sh
index 13786d6..787dd2e 100755
--- a/feed/atenl/files/ated.sh
+++ b/feed/atenl/files/ated.sh
@@ -16,6 +16,11 @@
         cmd="${cmd} \"${i}\""
         add_quote="0"
     else
+        if [ ${i} = "ra0" ]; then
+            i="phy0"
+        elif [ ${i} = "rax0" ]; then
+            i="phy1"
+        fi
         cmd="${cmd} ${i}"
     fi
 done
diff --git a/feed/atenl/files/iwpriv.sh b/feed/atenl/files/iwpriv.sh
index c6b3c11..c7c7f71 100755
--- a/feed/atenl/files/iwpriv.sh
+++ b/feed/atenl/files/iwpriv.sh
@@ -3,6 +3,7 @@
 interface=$1	# phy0/phy1/ra0
 cmd_type=$2	    # set/show/e2p/mac
 full_cmd=$3
+interface_ori=${interface}
 
 work_mode="RUN" # RUN/PRINT/DEBUG
 tmp_file="/tmp/iwpriv_wrapper"
@@ -23,6 +24,12 @@
     esac
 }
 
+function print_debug() {
+    if [ "${work_mode}" = "DEBUG" ]; then
+        echo "$1"
+    fi
+}
+
 function write_dmesg() {
     echo "$1" > /dev/kmsg
 }
@@ -74,7 +81,7 @@
     elif [ "$1" = "ATETXFREQOFFSET" ]; then
         echo "freq_offset"
     else
-        echo "unknown"
+        echo "unknown param: $1"
     fi
 }
 
@@ -96,7 +103,7 @@
     elif [ "$1" = "11" ]; then
         echo "he_mu"
     else
-        echo "unknown"
+        echo "unknown tx mode: $1"
     fi
 }
 
@@ -170,7 +177,7 @@
             esac
             ;;
         *)
-            echo "unknown tx_rate_mode, can't transform gi"
+            print_debug "legacy mode no need gi"
     esac
 
     do_cmd "mt76-test ${interface} set tx_rate_sgi=${sgi} tx_ltf=${he_ltf}"
@@ -182,7 +189,7 @@
     local bw=$(get_config "ATETXBW" | cut -d ":" -f 1)
     local bw_str="HT20"
 
-    if [ -z "${band}" ] || [ "${band}" = "0" ]; then
+    if [[ $1 != *":"* ]] || [ "${band}" = "0" ]; then
         case ${bw} in
             "1")
                 if [ "${ch}" -ge "1" ] && [ "${ch}" -le "7" ]; then
@@ -305,12 +312,12 @@
     local wb_rssi=$(echo "${res}" | grep "last_wb_rssi" | cut -d "=" -f 2 | sed 's/,/ /g')
     local rx_ok=$(expr ${mdrdy} - ${fcs_error})
 
-    write_dmesg "rcpi: ${rcpi}"
-    write_dmesg "fagc rssi ib: ${ib_rssi}"
-    write_dmesg "fagc rssi wb: ${wb_rssi}"
-    write_dmesg "all_mac_rx_mdrdy_cnt: ${mdrdy}"
-    write_dmesg "all_mac_rx_fcs_err_cnt: ${fcs_error}"
-    write_dmesg "all_mac_rx_ok_cnt: ${rx_ok}"
+    write_dmesg "rcpi : ${rcpi}"
+    write_dmesg "fagc rssi ib : ${ib_rssi}"
+    write_dmesg "fagc rssi wb : ${wb_rssi}"
+    write_dmesg "all_mac_rx_mdrdy_cnt : ${mdrdy}"
+    write_dmesg "all_mac_rx_fcs_err_cnt : ${fcs_error}"
+    write_dmesg "all_mac_rx_ok_cnt : ${rx_ok}"
 }
 
 function change_band_idx {
@@ -371,6 +378,8 @@
                 do_cmd "iw phy ${interface} interface add mon${phy_idx} type monitor"
                 do_cmd "iw dev wlan${phy_idx} del"
                 do_cmd "ifconfig mon${phy_idx} up"
+                do_cmd "iw reg set VV"
+                do_cmd "mt76-test ${interface} set aid=1"
             fi
             ;;
         "ATESTOP")
@@ -380,6 +389,7 @@
                 echo "ATE does not start."
             else
                 do_cmd "mt76-test ${interface} set state=off"
+                do_cmd "mt76-test ${interface} set aid=0"
                 do_cmd "iw dev mon${phy_idx} del"
                 do_cmd "iw phy ${interface} interface add wlan${phy_idx} type managed"
             fi
@@ -389,7 +399,7 @@
         "TXFRAME")
             do_cmd "mt76-test ${interface} set state=tx_frames"
             ;;
-        "TXSTOP"|"RXSTOP"|"TXREVERT")
+        "TXSTOP"|"RXSTOP")
             do_cmd "mt76-test ${interface} set state=idle"
             ;;
         "RXFRAME")
@@ -398,16 +408,9 @@
         "TXCONT")
             do_cmd "mt76-test ${interface} set state=tx_cont"
             ;;
-        "TXCOMMIT")
-            tx_mode=$(convert_tx_mode $(get_config "ATETXMODE"))
-                case ${tx_mode} in
-                    "ht"|"vht"|"he_su")
-                        do_cmd "mt76-test ${interface} set aid=1"
-                        ;;
-                    *)
-                        ;;
-                esac
-            do_cmd "mt76-test ${interface} set state=idle"
+        *)
+            # skip TXCOMMIT/TXREVERT
+            print_debug "skip ${ate_cmd}"
             ;;
     esac
 }
@@ -482,7 +485,7 @@
             ;;
         "bufferMode")
             if [ "${param}" = "2" ]; then
-                do_cmd "ated -i ${interface} -c \"eeprom update\""
+                do_cmd "ated -i ${interface} -c \"eeprom update buffermode\""
             fi
             skip=1
             ;;
@@ -490,7 +493,7 @@
             skip=1
             ;;
         *)
-            echo "Unknown command to set"
+            print_debug "Unknown command to set: ${cmd}"
             skip=1
     esac
 
@@ -530,6 +533,7 @@
         v2=$(echo "${v2}" | grep "val =" | cut -d '(' -f 2 | grep -o -E '[0-9]+')
 
         param=$(printf "0x%s" ${param})
+        printf "%s       e2p:\n" ${interface_ori}
         printf "[0x%04x]:0x%02x%02x\n" ${param} ${v2} ${v1}
     fi
 
diff --git a/feed/atenl/src/atenl.h b/feed/atenl/src/atenl.h
index 0d4d6c6..a3ce244 100644
--- a/feed/atenl/src/atenl.h
+++ b/feed/atenl/src/atenl.h
@@ -380,7 +380,7 @@
 int atenl_nl_process_many(struct atenl *an, struct atenl_data *data);
 int atenl_nl_check_mtd(struct atenl *an);
 int atenl_nl_write_eeprom(struct atenl *an, u32 offset, u8 *val, int len);
-int atenl_nl_write_efuse_all(struct atenl *an, struct atenl_data *data);
+int atenl_nl_write_efuse_all(struct atenl *an);
 int atenl_nl_update_buffer_mode(struct atenl *an);
 int atenl_nl_set_state(struct atenl *an, u8 band,
 		       enum mt76_testmode_state state);
diff --git a/feed/atenl/src/eeprom.c b/feed/atenl/src/eeprom.c
index 73c0f8b..feec9ea 100644
--- a/feed/atenl/src/eeprom.c
+++ b/feed/atenl/src/eeprom.c
@@ -425,7 +425,7 @@
 
 			an->eeprom_data[offset] = val;
 			atenl_info("set offset 0x%x to 0x%x\n", offset, val);
-		} else if (!strncmp(s, "update", 6)) {
+		} else if (!strncmp(s, "update buffermode", 17)) {
 			atenl_eeprom_sync_to_driver(an);
 			atenl_nl_update_buffer_mode(an);
 		} else if (!strncmp(s, "write", 5)) {
@@ -434,8 +434,12 @@
 				return;
 			s++;
 
-			if (!strncmp(s, "flash", 5))
+			if (!strncmp(s, "flash", 5)) {
 				atenl_eeprom_write_mtd(an);
+            } else if (!strncmp(s, "to efuse", 8)) {
+                atenl_eeprom_sync_to_driver(an);
+                atenl_nl_write_efuse_all(an);
+            }
 		} else if (!strncmp(s, "read", 4)) {
 			u32 offset;
 
@@ -450,7 +454,9 @@
 
 			atenl_info("val = 0x%x (%u)\n", an->eeprom_data[offset],
 							an->eeprom_data[offset]);
-		}
+		} else {
+            atenl_err("Unknown eeprom command: %s\n", cmd);
+        }
 	} else {
 		atenl_err("Unknown command: %s\n", cmd);
 	}
diff --git a/feed/atenl/src/hqa.c b/feed/atenl/src/hqa.c
index 441825f..2196fe2 100644
--- a/feed/atenl/src/hqa.c
+++ b/feed/atenl/src/hqa.c
@@ -315,7 +315,7 @@
 
 		switch (buf_mode) {
 		case E2P_EFUSE_MODE:
-			atenl_nl_write_efuse_all(an, data);
+			atenl_nl_write_efuse_all(an);
 			break;
 		default:
 			break;
diff --git a/feed/atenl/src/nl.c b/feed/atenl/src/nl.c
index 47e3d76..e1d0d0f 100644
--- a/feed/atenl/src/nl.c
+++ b/feed/atenl/src/nl.c
@@ -1113,7 +1113,7 @@
 	return 0;
 }
 
-int atenl_nl_write_efuse_all(struct atenl *an, struct atenl_data *data)
+int atenl_nl_write_efuse_all(struct atenl *an)
 {
 	struct atenl_nl_priv nl_priv = {};
 	struct nl_msg *msg;