[][openwrt][switch][ARHT][update switch app to v1.0.7]
[Description]
Add below modification:
1). align switch app version to v1.0.7 with ARHT
2). fixed check_patch errors as much as possible in switch app
3). get_chip_name() directly return AN8855 to prevent 0x1f register
from being overwritten by reg_read
4). correct some files from Windos(CRLF) to UNIX(LF)
[Release-log]
N/A
Change-Id: I4913c8124ded81cffe0493748c0347fdb1fbb22f
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9453546
diff --git a/feed/app/switch/src/switch_753x.c b/feed/app/switch/src/switch_753x.c
index 9218e57..03e9778 100644
--- a/feed/app/switch/src/switch_753x.c
+++ b/feed/app/switch/src/switch_753x.c
@@ -15,11 +15,12 @@
#include "switch_fun.h"
#include "switch_fun_an8855.h"
-#define SWITCH_APP_VERSION "1.0.1"
+#define SWITCH_APP_VERSION "1.0.7"
struct mt753x_attr *attres;
int chip_name;
bool nl_init_flag;
+bool air_skip_check_flag;
struct switch_func_s *p_switch_func;
static void usage(char *cmd)
@@ -480,6 +481,12 @@
FILE *fp = NULL;
char buff[255];
+ /*judge an8855, must be placed before reg_read*/
+ if (air_skip_check_flag) {
+ temp = 0x8855;
+ return temp;
+ }
+
/*judge jaguar embedded switch */
fp = fopen("/proc/device-tree/compatible", "r");
if (fp != NULL) {
@@ -504,11 +511,6 @@
if (temp == 0x7531)
return temp;
- /*judge an8855 */
- reg_read(0x10005000, &temp);
- if (temp == 0x8855)
- return temp;
-
return -1;
}
@@ -639,6 +641,8 @@
int main(int argc, char *argv[])
{
int err = -EINVAL;
+ FILE *fp = NULL;
+ char buff[255];
attres = (struct mt753x_attr *)malloc(sizeof(struct mt753x_attr));
if (attres == NULL) {
@@ -649,28 +653,35 @@
attres->port_num = -1;
attres->phy_dev = -1;
nl_init_flag = true;
+ air_skip_check_flag = false;
- /* dsa netlink family might not be enabled. Try gsw netlink family. */
- err = mt753x_netlink_init(MT753X_DSA_GENL_NAME);
- if (!err)
- chip_name = get_chip_name();
+ fp = fopen("/proc/air_sw/device", "r");
+ if (fp != NULL) {
+ if (fgets(buff, 255, (FILE *) fp) && strstr(buff, "an8855"))
+ air_skip_check_flag = true;
- if (err < 0) {
- err = mt753x_netlink_init(MT753X_GENL_NAME);
- if (!err)
- chip_name = get_chip_name();
- }
+ if ((fclose(fp) == 0) && air_skip_check_flag) {
+ err = mt753x_netlink_init(AN8855_DSA_GENL_NAME);
+ if (!err)
+ chip_name = get_chip_name();
- if (err < 0) {
- err = mt753x_netlink_init(AN8855_DSA_GENL_NAME);
+ if (err < 0) {
+ err = mt753x_netlink_init(AN8855_GENL_NAME);
+ if (!err)
+ chip_name = get_chip_name();
+ }
+ }
+ } else {
+ /* dsa netlink family might not be enabled. Try gsw netlink family. */
+ err = mt753x_netlink_init(MT753X_DSA_GENL_NAME);
if (!err)
chip_name = get_chip_name();
- }
- if (err < 0) {
- err = mt753x_netlink_init(AN8855_GENL_NAME);
- if (!err)
- chip_name = get_chip_name();
+ if (err < 0) {
+ err = mt753x_netlink_init(MT753X_GENL_NAME);
+ if (!err)
+ chip_name = get_chip_name();
+ }
}
if (err < 0) {