[][MAC80211][WiFi6/7][app][Add eMMC support in atenl]

[Description]
Add eMMC support in atenl
1. add mtd/mmc open/write function
2. add new opt for specifying partition name and offset
   Usage:
    - atenl -i phy0 -c "sync eeprom all" -p <name>:<offset>
    - <offset> can be specified as decimal (e.g. 2560) or
      hexadecimal (0xa000)

[Release-log]
N/A

Change-Id: I10c19e15d2500cb287793a5e77f1b336eb6870a5
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9897396
diff --git a/feed/app/atenl/src/main.c b/feed/app/atenl/src/main.c
index ef13245..0dbcb41 100644
--- a/feed/app/atenl/src/main.c
+++ b/feed/app/atenl/src/main.c
@@ -87,7 +87,9 @@
 	       "  -h = show help text\n"
 	       "  -i = phy name of driver interface, please use first phy for dbdc\n"
 	       "  -u = use unicast to respond to HQADLL\n"
-	       "  -b = specify your bridge name\n");
+	       "  -b = specify your bridge name\n"
+	       "  -c = eeprom-related command\n"
+	       "  -p = specify the flash partition name and offset (<name>:<offs>)\n");
 	printf("examples:\n"
 	       "  %s -u -i phy0 -b br-lan\n", progname);
 
@@ -124,6 +126,7 @@
 {
 	int opt, phy_idx, ret = 0;
 	char *phy = "phy0", *cmd = NULL;
+	char *token;
 	struct atenl *an;
 
 	progname = argv[0];
@@ -133,7 +136,7 @@
 		return -ENOMEM;
 
 	while(1) {
-		opt = getopt(argc, argv, "hi:uc:b:");
+		opt = getopt(argc, argv, "hi:uc:b:p:");
 		if (opt == -1)
 			break;
 
@@ -154,6 +157,13 @@
 			case 'c':
 				cmd = optarg;
 				break;
+			case 'p':
+				token = strtok(optarg, ":");
+				if (!token)
+					break;
+				an->flash_part = token;
+				an->flash_offset = strtol(strtok(NULL, ":"), NULL, 0);
+				break;
 			default:
 				atenl_err("Not supported option: %c\n", opt);
 				goto out;