[rdk-b][common][bsp][Refactor and sync kernel/wifi from Openwrt]
[Description]
Refactor and sync kernel/wifi from Openwrt
[Release-log]
N/A
diff --git a/recipes-connectivity/atenl/files/src/eeprom.c b/recipes-connectivity/atenl/files/src/eeprom.c
index 1c1cb6c..d18262e 100644
--- a/recipes-connectivity/atenl/files/src/eeprom.c
+++ b/recipes-connectivity/atenl/files/src/eeprom.c
@@ -9,60 +9,38 @@
#define EEPROM_PART_SIZE 0x64000
char *eeprom_file;
-static FILE *mtd_open(const char *mtd)
+static int
+atenl_create_file(struct atenl *an, bool flash_mode)
{
- char line[128], name[64];
- FILE *fp;
- int i;
-
- fp = fopen("/proc/mtd", "r");
- if (!fp)
- return NULL;
-
- snprintf(name, sizeof(name), "\"%s\"", mtd);
- while (fgets(line, sizeof(line), fp)) {
- if (!sscanf(line, "mtd%d:", &i) || !strstr(line, name))
- continue;
+ char fname[64], buf[1024];
+ ssize_t w, len, max_len, total_len = 0;
+ int fd_ori, fd, ret;
- snprintf(line, sizeof(line), "/dev/mtd%d", i);
- fclose(fp);
- return fopen(line, "r");
+ /* reserve space for pre-cal data in flash mode */
+ if (flash_mode) {
+ atenl_dbg("%s: init eeprom with flash mode\n", __func__);
+ max_len = EEPROM_PART_SIZE;
+ } else {
+ atenl_dbg("%s: init eeprom with efuse mode\n", __func__);
+ max_len = 0x1000;
}
- fclose(fp);
-
- return NULL;
-}
-static int
-atenl_flash_create_file(struct atenl *an)
-{
-#define READ_LEN_LIMIT 0x64000
- char buf[1024];
- ssize_t len, limit = 0;
- FILE *f;
- int fd, ret;
-
- f = mtd_open(an->mtd_part);
- if (!f) {
- atenl_err("Failed to open MTD device\n");
+ snprintf(fname, sizeof(fname),
+ "/sys/kernel/debug/ieee80211/phy%d/mt76/eeprom",
+ get_band_val(an, 0, phy_idx));
+ fd_ori = open(fname, O_RDONLY);
+ if (fd_ori < 0)
return -1;
- }
- fseek(f, an->mtd_offset, SEEK_SET);
fd = open(eeprom_file, O_RDWR | O_CREAT | O_EXCL, 00644);
if (fd < 0)
goto out;
- while ((len = fread(buf, 1, sizeof(buf), f)) > 0) {
- ssize_t w;
-
+ while ((len = read(fd_ori, buf, sizeof(buf))) > 0) {
retry:
w = write(fd, buf, len);
if (w > 0) {
- limit += len;
-
- if (limit >= READ_LEN_LIMIT)
- break;
+ total_len += len;
continue;
}
@@ -76,53 +54,27 @@
goto out;
}
- ret = lseek(fd, 0, SEEK_SET);
- if (ret) {
- fclose(f);
- close(fd);
- return ret;
- }
-
-out:
- fclose(f);
- return fd;
-}
-
-static int
-atenl_efuse_create_file(struct atenl *an)
-{
- char fname[64], buf[1024];
- ssize_t len;
- int fd_ori, fd, ret;
-
- snprintf(fname, sizeof(fname),
- "/sys/kernel/debug/ieee80211/phy%d/mt76/eeprom", get_band_val(an, 0, phy_idx));
- fd_ori = open(fname, O_RDONLY);
- if (fd_ori < 0)
- return -1;
-
- fd = open(eeprom_file, O_RDWR | O_CREAT | O_EXCL, 00644);
- if (fd < 0)
- goto out;
-
- while ((len = read(fd_ori, buf, sizeof(buf))) > 0) {
- ssize_t w;
-
-retry:
+ /* reserve space for pre-cal data in flash mode */
+ len = sizeof(buf);
+ memset(buf, 0, len);
+ while (total_len < max_len) {
w = write(fd, buf, len);
- if (w > 0)
- continue;
- if (errno == EINTR)
- goto retry;
+ if (w > 0) {
+ total_len += len;
+ continue;
+ }
- perror("write");
- unlink(eeprom_file);
- close(fd);
- fd = -1;
- goto out;
+ if (errno != EINTR) {
+ perror("write");
+ unlink(eeprom_file);
+ close(fd);
+ fd = -1;
+ goto out;
+ }
}
+
ret = lseek(fd, 0, SEEK_SET);
if (ret) {
close(fd_ori);
@@ -148,17 +100,8 @@
{
int fd;
- if (!atenl_eeprom_file_exists()) {
- if (flash_mode)
- atenl_dbg("%s: init eeprom with flash mode\n", __func__);
- else
- atenl_dbg("%s: init eeprom with efuse mode\n", __func__);
-
- if (flash_mode)
- return atenl_flash_create_file(an);
-
- return atenl_efuse_create_file(an);
- }
+ if (!atenl_eeprom_file_exists())
+ return atenl_create_file(an, flash_mode);
fd = open(eeprom_file, O_RDWR);
if (fd < 0)
diff --git a/recipes-connectivity/libnl-tiny/libnl-tiny_git.bb b/recipes-connectivity/libnl-tiny/libnl-tiny_git.bb
index d0ba98a..d751483 100644
--- a/recipes-connectivity/libnl-tiny/libnl-tiny_git.bb
+++ b/recipes-connectivity/libnl-tiny/libnl-tiny_git.bb
@@ -5,7 +5,7 @@
SECTION = "libs"
SRC_URI = "git://git.openwrt.org/project/libnl-tiny.git"
-SRCREV = "28c44ca97cd546ef8168e7476472a0da022b3421"
+SRCREV = "db3b2cdbca5277723326a2720024a59fb821ae36"
PV = "git${SRCPV}"
inherit cmake pkgconfig
diff --git a/recipes-connectivity/linux-mac80211/linux-mac80211.bb b/recipes-connectivity/linux-mac80211/linux-mac80211.bb
index 7c348fe..93c478b 100644
--- a/recipes-connectivity/linux-mac80211/linux-mac80211.bb
+++ b/recipes-connectivity/linux-mac80211/linux-mac80211.bb
@@ -64,12 +64,6 @@
do_install_append() {
# Module
cat ${D}/usr/include/linux-mac80211/Module.symvers >> ${TMPDIR}/work-shared/${MACHINE}/kernel-build-artifacts/Module.symvers
- install -d ${D}/lib/modules/${KERNEL_VERSION}/updates/compat/
- install -d ${D}/lib/modules/${KERNEL_VERSION}/updates/net/wireless
- install -d ${D}/lib/modules/${KERNEL_VERSION}/updates/net/mac80211
- install -m 0644 ${B}/compat/compat.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/compat/
- install -m 0644 ${B}/net/wireless/cfg80211.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/net/wireless/
- install -m 0644 ${B}/net/mac80211/mac80211.ko ${D}/lib/modules/${KERNEL_VERSION}/updates/net/mac80211/
}
PROVIDES += "kernel-module-compat"
diff --git a/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_rom_patch.bin b/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_rom_patch.bin
index c954b15..a734da1 100644
--- a/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_rom_patch.bin
+++ b/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_rom_patch.bin
Binary files differ
diff --git a/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_wa.bin b/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_wa.bin
index c239864..529ba6a 100644
--- a/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_wa.bin
+++ b/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_wa.bin
Binary files differ
diff --git a/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_wm.bin b/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_wm.bin
index dcfc7f4..8a0b654 100644
--- a/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_wm.bin
+++ b/recipes-connectivity/linux-mt76/files/src/firmware/mt7996_wm.bin
Binary files differ