Add support for uwe5622 wifi driver for Orange Pi Zero 2.

This commit is contained in:
pbiel 2023-03-16 09:53:25 +01:00
parent c4c91b604b
commit 8bdb29e399
16 changed files with 233324 additions and 1 deletions

View File

@ -10,4 +10,7 @@ UBOOT_MACHINE = "orangepi_zero2_defconfig"
SPL_BINARY = "u-boot-sunxi-with-spl.bin" SPL_BINARY = "u-boot-sunxi-with-spl.bin"
# as for now neither graphics nor audio is supported # as for now neither graphics nor audio is supported
MACHINE_FEATURES:remove = "alsa x11 bluetooth wifi" MACHINE_FEATURES:remove = "alsa x11"
MACHINE_FEATURES:append = "bluetooth wifi"
MACHINE_EXTRA_RRECOMMENDS = "uwe5622-firmware"

View File

@ -0,0 +1,45 @@
From bb564341bb6c64003abbf24fd5d5ef254060b040 Mon Sep 17 00:00:00 2001
From: pbiel <pbiel7@gmail.com>
Date: Thu, 19 Jan 2023 10:46:28 +0100
Subject: [PATCH] Fix incldue path for unisocwcn
---
drivers/net/wireless/uwe5622/Makefile | 4 +++-
drivers/net/wireless/uwe5622/unisocwcn/Makefile | 6 +++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/uwe5622/Makefile b/drivers/net/wireless/uwe5622/Makefile
index 313ea5123..e9a398584 100644
--- a/drivers/net/wireless/uwe5622/Makefile
+++ b/drivers/net/wireless/uwe5622/Makefile
@@ -2,7 +2,9 @@ obj-$(CONFIG_AW_WIFI_DEVICE_UWE5622) += unisocwcn/
obj-$(CONFIG_WLAN_UWE5622) += unisocwifi/
obj-$(CONFIG_TTY_OVERY_SDIO) += tty-sdio/
-UNISOCWCN_DIR := $(shell cd $(src)/unisocwcn/ && /bin/pwd)
+mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
+UNISOCWCN_DIR := $(dir $(mkfile_path))/unisocwcn/
+
UNISOC_BSP_INCLUDE := $(UNISOCWCN_DIR)/include
export UNISOC_BSP_INCLUDE
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/Makefile b/drivers/net/wireless/uwe5622/unisocwcn/Makefile
index b62652f63..ae6e1e25a 100644
--- a/drivers/net/wireless/uwe5622/unisocwcn/Makefile
+++ b/drivers/net/wireless/uwe5622/unisocwcn/Makefile
@@ -119,9 +119,9 @@ ccflags-y += -DCONFIG_WCN_UTILS
#### include path ######
ccflags-y += -I$(src)/../tty-sdio
-ccflags-y += -I$(src)/include/
-ccflags-y += -I$(src)/platform/
-ccflags-y += -I$(src)/platform/rf/
+ccflags-y += -I$(srctree)/$(src)/include/
+ccflags-y += -I$(srctree)/$(src)/platform/
+ccflags-y += -I$(srctree)/$(src)/platform/rf/
#### add cflag for Customer ######
### ---------- Hisilicon start ---------- ###
--
2.34.1

View File

@ -0,0 +1,177 @@
From 5f4d2d5fc32dfe41c73cac36ec6747c34e5562a3 Mon Sep 17 00:00:00 2001
From: pbiel <pbiel7@gmail.com>
Date: Wed, 15 Mar 2023 23:04:27 +0100
Subject: [PATCH] wireless: Adapt uwe5622 wifi driver to kernel 6.1
---
drivers/net/wireless/uwe5622/tty-sdio/lpm.c | 2 +-
.../uwe5622/unisocwcn/boot/wcn_integrate_dev.c | 2 +-
.../uwe5622/unisocwcn/platform/wcn_parn_parser.c | 2 +-
.../wireless/uwe5622/unisocwcn/platform/wcn_procfs.c | 2 +-
.../wireless/uwe5622/unisocwcn/usb/wcn_usb_download.c | 2 +-
.../net/wireless/uwe5622/unisocwcn/usb/wcn_usb_test.c | 6 +++---
drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c | 10 +++++-----
drivers/net/wireless/uwe5622/unisocwifi/cmdevt.c | 2 +-
8 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/net/wireless/uwe5622/tty-sdio/lpm.c b/drivers/net/wireless/uwe5622/tty-sdio/lpm.c
index b2d9a8994e5e..35e30651a921 100644
--- a/drivers/net/wireless/uwe5622/tty-sdio/lpm.c
+++ b/drivers/net/wireless/uwe5622/tty-sdio/lpm.c
@@ -70,7 +70,7 @@ static int btwrite_proc_show(struct seq_file *m, void *v)
static int bluesleep_open_proc_btwrite(struct inode *inode, struct file *file)
{
- return single_open(file, btwrite_proc_show, PDE_DATA(inode));
+ return single_open(file, btwrite_proc_show, pde_data(inode));
}
static const struct proc_ops lpm_proc_btwrite_fops = {
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/boot/wcn_integrate_dev.c b/drivers/net/wireless/uwe5622/unisocwcn/boot/wcn_integrate_dev.c
index 3ee6910e7cf7..29a3ec298bc1 100644
--- a/drivers/net/wireless/uwe5622/unisocwcn/boot/wcn_integrate_dev.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/boot/wcn_integrate_dev.c
@@ -562,7 +562,7 @@ static struct wcn_proc_data g_proc_data = {
static int wcn_platform_open(struct inode *inode, struct file *filp)
{
struct platform_proc_file_entry
- *entry = (struct platform_proc_file_entry *)PDE_DATA(inode);
+ *entry = (struct platform_proc_file_entry *)pde_data(inode);
WCN_INFO("entry name:%s\n!", entry->name);
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_parn_parser.c b/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_parn_parser.c
index aea7d6d0fe57..bd841f0b32d3 100644
--- a/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_parn_parser.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_parn_parser.c
@@ -146,7 +146,7 @@ static int prefixcmp(const char *str, const char *prefix)
}
#if KERNEL_VERSION(3, 19, 0) <= LINUX_VERSION_CODE
-static int find_callback(struct dir_context *ctx, const char *name, int namlen,
+static bool find_callback(struct dir_context *ctx, const char *name, int namlen,
loff_t offset, u64 ino, unsigned int d_type)
#else
static int find_callback(void *ctx, const char *name, int namlen,
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_procfs.c b/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_procfs.c
index 2edb7903d80e..9e453365bba8 100644
--- a/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_procfs.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/platform/wcn_procfs.c
@@ -431,7 +431,7 @@ static const struct proc_ops mdbg_snap_shoot_seq_fops = {
static int mdbg_proc_open(struct inode *inode, struct file *filp)
{
struct mdbg_proc_entry *entry =
- (struct mdbg_proc_entry *)PDE_DATA(inode);
+ (struct mdbg_proc_entry *)pde_data(inode);
filp->private_data = entry;
return 0;
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_download.c b/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_download.c
index 8f228d403909..750bfc0466cb 100644
--- a/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_download.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_download.c
@@ -82,7 +82,7 @@ static int wcn_usb_dopen(struct inode *inode, struct file *file)
{
struct wcn_usb_ddata *data;
- data = (struct wcn_usb_ddata *)PDE_DATA(inode);
+ data = (struct wcn_usb_ddata *)pde_data(inode);
if (!data)
return -EIO;
diff --git a/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_test.c b/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_test.c
index c2cccc658c0d..e7a9f258943e 100644
--- a/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_test.c
+++ b/drivers/net/wireless/uwe5622/unisocwcn/usb/wcn_usb_test.c
@@ -61,7 +61,7 @@ static int wcn_usb_channel_open(struct inode *inode, struct file *file)
{
struct channel *channel;
- channel = (struct channel *)PDE_DATA(inode);
+ channel = (struct channel *)pde_data(inode);
if (!channel)
return -EIO;
@@ -467,7 +467,7 @@ static int wcn_usb_chnmg_open(struct inode *inode, struct file *file)
{
struct chnmg *chnmg;
/* get channel_list head */
- chnmg = (struct chnmg *)PDE_DATA(inode);
+ chnmg = (struct chnmg *)pde_data(inode);
file->private_data = chnmg;
return 0;
@@ -916,7 +916,7 @@ static int print_level_open(struct inode *inode, struct file *file)
{
struct chnmg *chnmg;
/* get channel_list head */
- chnmg = (struct chnmg *)PDE_DATA(inode);
+ chnmg = (struct chnmg *)pde_data(inode);
file->private_data = chnmg;
return 0;
diff --git a/drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c b/drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c
index daef880ae3c0..2231388da70a 100644
--- a/drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c
+++ b/drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c
@@ -703,7 +703,7 @@ static int sprdwl_add_cipher_key(struct sprdwl_vif *vif, bool pairwise,
}
static int sprdwl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
- u8 key_index, bool pairwise,
+ int link_id, u8 key_index, bool pairwise,
const u8 *mac_addr,
struct key_params *params)
{
@@ -725,7 +725,7 @@ static int sprdwl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
}
static int sprdwl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
- u8 key_index, bool pairwise,
+ int link_id, u8 key_index, bool pairwise,
const u8 *mac_addr)
{
struct sprdwl_vif *vif = netdev_priv(ndev);
@@ -755,7 +755,7 @@ static int sprdwl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
static int sprdwl_cfg80211_set_default_key(struct wiphy *wiphy,
struct net_device *ndev,
- u8 key_index, bool unicast,
+ int link_id, u8 key_index, bool unicast,
bool multicast)
{
struct sprdwl_vif *vif = netdev_priv(ndev);
@@ -984,7 +984,7 @@ static int sprdwl_cfg80211_change_beacon(struct wiphy *wiphy,
return sprdwl_change_beacon(vif, beacon);
}
-static int sprdwl_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
+static int sprdwl_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id)
{
#ifdef DFS_MASTER
struct sprdwl_vif *vif = netdev_priv(ndev);
@@ -2367,7 +2367,7 @@ void sprdwl_report_connection(struct sprdwl_vif *vif,
conn_info->status == SPRDWL_ROAM_SUCCESS){
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
struct cfg80211_roam_info roam_info = {
- .bss = bss,
+ .links[0].bss = bss,
.req_ie = conn_info->req_ie,
.req_ie_len = conn_info->req_ie_len,
.resp_ie = conn_info->resp_ie,
diff --git a/drivers/net/wireless/uwe5622/unisocwifi/cmdevt.c b/drivers/net/wireless/uwe5622/unisocwifi/cmdevt.c
index e81619b12e39..1ecbfac5b490 100644
--- a/drivers/net/wireless/uwe5622/unisocwifi/cmdevt.c
+++ b/drivers/net/wireless/uwe5622/unisocwifi/cmdevt.c
@@ -3296,7 +3296,7 @@ void sprdwl_event_chan_changed(struct sprdwl_vif *vif, u8 *data, u16 len)
NL80211_CHAN_HT20);
else
wl_err("%s, ch is null!\n", __func__);
- cfg80211_ch_switch_notify(vif->ndev, &chandef);
+ cfg80211_ch_switch_notify(vif->ndev, &chandef, 0);
}
}
--
2.34.1

View File

@ -0,0 +1,35 @@
From 9211a92d07e9a43fce104f87f9d45e890257b699 Mon Sep 17 00:00:00 2001
From: pbiel <pbiel7@gmail.com>
Date: Tue, 7 Mar 2023 20:28:44 +0100
Subject: [PATCH] wireless: fix setting mac address for netdev in uwe5622
unisocwifi driver
---
drivers/net/wireless/uwe5622/unisocwifi/main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/uwe5622/unisocwifi/main.c b/drivers/net/wireless/uwe5622/unisocwifi/main.c
index 21efdf4e0..566a9a7f3 100644
--- a/drivers/net/wireless/uwe5622/unisocwifi/main.c
+++ b/drivers/net/wireless/uwe5622/unisocwifi/main.c
@@ -1356,6 +1356,7 @@ static struct sprdwl_vif *sprdwl_register_netdev(struct sprdwl_priv *priv,
struct wireless_dev *wdev;
struct sprdwl_vif *vif;
int ret;
+ u8 target_mac_addr[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))
ndev = alloc_netdev(sizeof(*vif), name, NET_NAME_UNKNOWN, ether_setup);
@@ -1411,7 +1412,8 @@ static struct sprdwl_vif *sprdwl_register_netdev(struct sprdwl_priv *priv,
ndev->features |= NETIF_F_SG;
SET_NETDEV_DEV(ndev, wiphy_dev(priv->wiphy));
- sprdwl_set_mac_addr(vif, addr, ndev->dev_addr);
+ sprdwl_set_mac_addr(vif, addr, target_mac_addr);
+ dev_addr_set(ndev, target_mac_addr);
#ifdef CONFIG_P2P_INTF
if (type == NL80211_IFTYPE_P2P_DEVICE)
--
2.34.1

View File

@ -0,0 +1,60 @@
From 452a691a83df1aab77cec33203cb04a817817a05 Mon Sep 17 00:00:00 2001
From: The-going <48602507+The-going@users.noreply.github.com>
Date: Thu, 5 May 2022 22:55:13 +0300
Subject: [PATCH] drv: nvmem: sunxi_sid: Add sunxi_get_soc_chipid,
sunxi_get_serial
---
drivers/nvmem/sunxi_sid.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 37a6abb0e..c81fac63d 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -37,6 +37,25 @@ struct sunxi_sid {
u32 value_offset;
};
+static unsigned int sunxi_soc_chipid[4];
+static unsigned int sunxi_serial[4];
+
+int sunxi_get_soc_chipid(unsigned char *chipid)
+{
+ memcpy(chipid, sunxi_soc_chipid, 16);
+
+ return 0;
+}
+EXPORT_SYMBOL(sunxi_get_soc_chipid);
+
+int sunxi_get_serial(unsigned char *serial)
+{
+ memcpy(serial, sunxi_serial, 16);
+
+ return 0;
+}
+EXPORT_SYMBOL(sunxi_get_serial);
+
static int sunxi_sid_read(void *context, unsigned int offset,
void *val, size_t bytes)
{
@@ -167,6 +186,15 @@ static int sunxi_sid_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, nvmem);
+ nvmem_cfg->reg_read(sid, 0, &sunxi_soc_chipid[0], sizeof(int));
+ nvmem_cfg->reg_read(sid, 4, &sunxi_soc_chipid[1], sizeof(int));
+ nvmem_cfg->reg_read(sid, 8, &sunxi_soc_chipid[2], sizeof(int));
+ nvmem_cfg->reg_read(sid, 12, &sunxi_soc_chipid[3], sizeof(int));
+
+ sunxi_serial[0] = sunxi_soc_chipid[3];
+ sunxi_serial[1] = sunxi_soc_chipid[2];
+ sunxi_serial[2] = (sunxi_soc_chipid[1] >> 16) & 0x0ffff;
+
return 0;
}
--
2.35.3

View File

@ -0,0 +1,612 @@
From 418436514e2e64e07e7fd2ef9d77ec4712d1033b Mon Sep 17 00:00:00 2001
From: pbiel <pbiel7@gmail.com>
Date: Fri, 24 Feb 2023 10:38:03 +0100
Subject: [PATCH 2/2] Add sunxi addr driver
---
drivers/misc/Kconfig | 1 +
drivers/misc/Makefile | 1 +
drivers/misc/sunxi-addr/Kconfig | 6 +
drivers/misc/sunxi-addr/Makefile | 5 +
drivers/misc/sunxi-addr/sha256.c | 178 +++++++++++++
drivers/misc/sunxi-addr/sunxi-addr.c | 358 +++++++++++++++++++++++++++
6 files changed, 549 insertions(+)
create mode 100644 drivers/misc/sunxi-addr/Kconfig
create mode 100644 drivers/misc/sunxi-addr/Makefile
create mode 100644 drivers/misc/sunxi-addr/sha256.c
create mode 100644 drivers/misc/sunxi-addr/sunxi-addr.c
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 358ad56f6..c59480dc8 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -514,4 +514,5 @@ source "drivers/misc/habanalabs/Kconfig"
source "drivers/misc/uacce/Kconfig"
source "drivers/misc/pvpanic/Kconfig"
source "drivers/misc/mchp_pci1xxxx/Kconfig"
+source "drivers/misc/sunxi-addr/Kconfig"
endmenu
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index ac9b3e757..487a2bf2d 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -62,3 +62,4 @@ obj-$(CONFIG_HI6421V600_IRQ) += hi6421v600-irq.o
obj-$(CONFIG_OPEN_DICE) += open-dice.o
obj-$(CONFIG_GP_PCI1XXXX) += mchp_pci1xxxx/
obj-$(CONFIG_VCPU_STALL_DETECTOR) += vcpu_stall_detector.o
+obj-$(CONFIG_SUNXI_ADDR_MGT) += sunxi-addr/
\ No newline at end of file
diff --git a/drivers/misc/sunxi-addr/Kconfig b/drivers/misc/sunxi-addr/Kconfig
new file mode 100644
index 000000000..801dd2c02
--- /dev/null
+++ b/drivers/misc/sunxi-addr/Kconfig
@@ -0,0 +1,6 @@
+config SUNXI_ADDR_MGT
+ tristate "Allwinner Network MAC Addess Manager"
+ depends on BT || ETHERNET || WLAN
+ depends on NVMEM_SUNXI_SID
+ help
+ allwinner network mac address management
diff --git a/drivers/misc/sunxi-addr/Makefile b/drivers/misc/sunxi-addr/Makefile
new file mode 100644
index 000000000..f01fd4783
--- /dev/null
+++ b/drivers/misc/sunxi-addr/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for wifi mac addr manager drivers
+#
+sunxi_addr-objs := sunxi-addr.o sha256.o
+obj-$(CONFIG_SUNXI_ADDR_MGT) += sunxi_addr.o
diff --git a/drivers/misc/sunxi-addr/sha256.c b/drivers/misc/sunxi-addr/sha256.c
new file mode 100644
index 000000000..78825810c
--- /dev/null
+++ b/drivers/misc/sunxi-addr/sha256.c
@@ -0,0 +1,178 @@
+/*
+ * Local implement of sha256.
+ *
+ * Copyright (C) 2013 Allwinner.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+#include <linux/kernel.h>
+#include <linux/string.h>
+
+/****************************** MACROS ******************************/
+#define ROTRIGHT(a, b) (((a) >> (b)) | ((a) << (32 - (b))))
+#define CH(x, y, z) (((x) & (y)) ^ (~(x) & (z)))
+#define MAJ(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
+#define EP0(x) (ROTRIGHT(x, 2) ^ ROTRIGHT(x, 13) ^ ROTRIGHT(x, 22))
+#define EP1(x) (ROTRIGHT(x, 6) ^ ROTRIGHT(x, 11) ^ ROTRIGHT(x, 25))
+#define SIG0(x) (ROTRIGHT(x, 7) ^ ROTRIGHT(x, 18) ^ ((x) >> 3))
+#define SIG1(x) (ROTRIGHT(x, 17) ^ ROTRIGHT(x, 19) ^ ((x) >> 10))
+
+/**************************** VARIABLES *****************************/
+static const uint32_t k[64] = {
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+ 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+ 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+ 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
+ 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
+ 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
+ 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
+ 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+ 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+};
+
+struct sha256_ctx {
+ uint8_t data[64]; /* current 512-bit chunk of message data, just like a buffer */
+ uint32_t datalen; /* sign the data length of current chunk */
+ uint64_t bitlen; /* the bit length of the total message */
+ uint32_t state[8]; /* store the middle state of hash abstract */
+};
+
+/*********************** FUNCTION DEFINITIONS ***********************/
+static void sha256_transform(struct sha256_ctx *ctx, const uint8_t *data)
+{
+ uint32_t a, b, c, d, e, f, g, h, i, j, t1, t2, m[64];
+
+ /* initialization */
+ for (i = 0, j = 0; i < 16; ++i, j += 4)
+ m[i] = (data[j] << 24) | (data[j + 1] << 16) |
+ (data[j + 2] << 8) | (data[j + 3]);
+ for ( ; i < 64; ++i)
+ m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16];
+
+ a = ctx->state[0];
+ b = ctx->state[1];
+ c = ctx->state[2];
+ d = ctx->state[3];
+ e = ctx->state[4];
+ f = ctx->state[5];
+ g = ctx->state[6];
+ h = ctx->state[7];
+
+ for (i = 0; i < 64; ++i) {
+ t1 = h + EP1(e) + CH(e, f, g) + k[i] + m[i];
+ t2 = EP0(a) + MAJ(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + t1;
+ d = c;
+ c = b;
+ b = a;
+ a = t1 + t2;
+ }
+
+ ctx->state[0] += a;
+ ctx->state[1] += b;
+ ctx->state[2] += c;
+ ctx->state[3] += d;
+ ctx->state[4] += e;
+ ctx->state[5] += f;
+ ctx->state[6] += g;
+ ctx->state[7] += h;
+}
+
+static void sha256_init(struct sha256_ctx *ctx)
+{
+ ctx->datalen = 0;
+ ctx->bitlen = 0;
+ ctx->state[0] = 0x6a09e667;
+ ctx->state[1] = 0xbb67ae85;
+ ctx->state[2] = 0x3c6ef372;
+ ctx->state[3] = 0xa54ff53a;
+ ctx->state[4] = 0x510e527f;
+ ctx->state[5] = 0x9b05688c;
+ ctx->state[6] = 0x1f83d9ab;
+ ctx->state[7] = 0x5be0cd19;
+}
+
+static void sha256_update(struct sha256_ctx *ctx, const uint8_t *data, size_t len)
+{
+ uint32_t i;
+
+ for (i = 0; i < len; ++i) {
+ ctx->data[ctx->datalen] = data[i];
+ ctx->datalen++;
+ if (ctx->datalen == 64) {
+ /* 64 byte = 512 bit means the buffer ctx->data has
+ * fully stored one chunk of message,
+ * so do the sha256 hash map for the current chunk.
+ */
+ sha256_transform(ctx, ctx->data);
+ ctx->bitlen += 512;
+ ctx->datalen = 0;
+ }
+ }
+}
+
+static void sha256_final(struct sha256_ctx *ctx, uint8_t *hash)
+{
+ uint32_t i;
+
+ i = ctx->datalen;
+
+ /* Pad whatever data is left in the buffer. */
+ if (ctx->datalen < 56) {
+ ctx->data[i++] = 0x80; /* pad 10000000 = 0x80 */
+ while (i < 56)
+ ctx->data[i++] = 0x00;
+ } else {
+ ctx->data[i++] = 0x80;
+ while (i < 64)
+ ctx->data[i++] = 0x00;
+ sha256_transform(ctx, ctx->data);
+ memset(ctx->data, 0, 56);
+ }
+
+ /* Append to the padding the total message's length in bits and transform. */
+ ctx->bitlen += ctx->datalen * 8;
+ ctx->data[63] = ctx->bitlen;
+ ctx->data[62] = ctx->bitlen >> 8;
+ ctx->data[61] = ctx->bitlen >> 16;
+ ctx->data[60] = ctx->bitlen >> 24;
+ ctx->data[59] = ctx->bitlen >> 32;
+ ctx->data[58] = ctx->bitlen >> 40;
+ ctx->data[57] = ctx->bitlen >> 48;
+ ctx->data[56] = ctx->bitlen >> 56;
+ sha256_transform(ctx, ctx->data);
+
+ /* copying the final state to the output hash(use big endian). */
+ for (i = 0; i < 4; ++i) {
+ hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0x000000ff;
+ hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff;
+ hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff;
+ hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff;
+ hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff;
+ hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff;
+ hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff;
+ hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff;
+ }
+}
+
+int hmac_sha256(const uint8_t *plaintext, ssize_t psize, uint8_t *output)
+{
+ struct sha256_ctx ctx;
+
+ sha256_init(&ctx);
+ sha256_update(&ctx, plaintext, psize);
+ sha256_final(&ctx, output);
+ return 0;
+}
diff --git a/drivers/misc/sunxi-addr/sunxi-addr.c b/drivers/misc/sunxi-addr/sunxi-addr.c
new file mode 100644
index 000000000..a812e4e82
--- /dev/null
+++ b/drivers/misc/sunxi-addr/sunxi-addr.c
@@ -0,0 +1,358 @@
+/*
+ * The driver of SUNXI NET MAC ADDR Manager.
+ *
+ * Copyright (C) 2013 Allwinner.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+#define DEBUG
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/miscdevice.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+#define ADDR_MGT_DBG(fmt, arg...) printk(KERN_DEBUG "[ADDR_MGT] %s: " fmt "\n",\
+ __func__, ## arg)
+#define ADDR_MGT_ERR(fmt, arg...) printk(KERN_ERR "[ADDR_MGT] %s: " fmt "\n",\
+ __func__, ## arg)
+
+#define MODULE_CUR_VERSION "v1.0.9"
+
+#define MATCH_STR_LEN 20
+#define ADDR_VAL_LEN 6
+#define ADDR_STR_LEN 18
+#define ID_LEN 16
+#define HASH_LEN 32
+
+#define TYPE_ANY 0
+#define TYPE_BURN 1
+#define TYPE_IDGEN 2
+#define TYPE_USER 3
+#define TYPE_RAND 4
+
+#define ADDR_FMT_STR 0
+#define ADDR_FMT_VAL 1
+
+#define IS_TYPE_INVALID(x) ((x < TYPE_ANY) || (x > TYPE_RAND))
+
+#define ADDR_CLASS_ATTR_ADD(name) \
+static ssize_t addr_##name##_show(struct class *class, \
+ struct class_attribute *attr, char *buffer) \
+{ \
+ char addr[ADDR_STR_LEN]; \
+ if (IS_TYPE_INVALID(get_addr_by_name(ADDR_FMT_STR, addr, #name))) \
+ return 0; \
+ return sprintf(buffer, "%.17s\n", addr); \
+} \
+static ssize_t addr_##name##_store(struct class *class, \
+ struct class_attribute *attr, \
+ const char *buffer, size_t count) \
+{ \
+ if (count != ADDR_STR_LEN) { \
+ ADDR_MGT_ERR("Length wrong."); \
+ return -EINVAL; \
+ } \
+ set_addr_by_name(TYPE_USER, ADDR_FMT_STR, buffer, #name); \
+ return count; \
+} \
+static CLASS_ATTR_RW(addr_##name);
+
+struct addr_mgt_info {
+ unsigned int type_def;
+ unsigned int type_cur;
+ unsigned int flag;
+ char *addr;
+ char *name;
+};
+
+static struct addr_mgt_info info[] = {
+ {TYPE_ANY, TYPE_ANY, 1, NULL, "wifi"},
+ {TYPE_ANY, TYPE_ANY, 0, NULL, "bt" },
+ {TYPE_ANY, TYPE_ANY, 1, NULL, "eth" },
+};
+
+extern int hmac_sha256(const uint8_t *plaintext, ssize_t psize, uint8_t *output);
+extern int sunxi_get_soc_chipid(unsigned char *chipid);
+
+static int addr_parse(int fmt, const char *addr, int check)
+{
+ char val_buf[ADDR_VAL_LEN];
+ char cmp_buf[ADDR_VAL_LEN];
+ int ret = ADDR_VAL_LEN;
+
+ if (fmt == ADDR_FMT_STR)
+ ret = sscanf(addr, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
+ &val_buf[0], &val_buf[1], &val_buf[2],
+ &val_buf[3], &val_buf[4], &val_buf[5]);
+ else
+ memcpy(val_buf, addr, ADDR_VAL_LEN);
+
+ if (ret != ADDR_VAL_LEN)
+ return -1;
+
+ if (check && (val_buf[0] & 0x3))
+ return -1;
+
+ memset(cmp_buf, 0x00, ADDR_VAL_LEN);
+ if (memcmp(val_buf, cmp_buf, ADDR_VAL_LEN) == 0)
+ return -1;
+
+ memset(cmp_buf, 0xFF, ADDR_VAL_LEN);
+ if (memcmp(val_buf, cmp_buf, ADDR_VAL_LEN) == 0)
+ return -1;
+
+ return 0;
+}
+
+static struct addr_mgt_info *addr_find_by_name(char *name)
+{
+ int i = 0;
+ for (i = 0; i < ARRAY_SIZE(info); i++) {
+ if (strcmp(info[i].name, name) == 0)
+ return &info[i];
+ }
+ return NULL;
+}
+
+static int get_addr_by_name(int fmt, char *addr, char *name)
+{
+ struct addr_mgt_info *t;
+
+ t = addr_find_by_name(name);
+ if (t == NULL) {
+ ADDR_MGT_ERR("can't find addr named: %s", name);
+ return -1;
+ }
+
+ if (IS_TYPE_INVALID(t->type_cur)) {
+ ADDR_MGT_ERR("addr type invalid");
+ return -1;
+ }
+
+ if (addr_parse(ADDR_FMT_VAL, t->addr, t->flag)) {
+ ADDR_MGT_ERR("addr parse fail(%s)", t->addr);
+ return -1;
+ }
+
+ if (fmt == ADDR_FMT_STR)
+ sprintf(addr, "%02X:%02X:%02X:%02X:%02X:%02X",
+ t->addr[0], t->addr[1], t->addr[2],
+ t->addr[3], t->addr[4], t->addr[5]);
+ else
+ memcpy(addr, t->addr, ADDR_VAL_LEN);
+
+ return t->type_cur;
+}
+
+static int set_addr_by_name(int type, int fmt, const char *addr, char *name)
+{
+ struct addr_mgt_info *t;
+
+ t = addr_find_by_name(name);
+ if (t == NULL) {
+ ADDR_MGT_ERR("can't find addr named: %s", name);
+ return -1;
+ }
+
+ if (addr_parse(fmt, addr, t->flag)) {
+ ADDR_MGT_ERR("addr parse fail(%s)", addr);
+ return -1;
+ }
+
+ t->type_cur = type;
+ if (fmt == ADDR_FMT_STR)
+ sscanf(addr, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
+ &t->addr[0], &t->addr[1], &t->addr[2],
+ &t->addr[3], &t->addr[4], &t->addr[5]);
+ else
+ memcpy(t->addr, addr, ADDR_VAL_LEN);
+
+ return 0;
+}
+
+int get_custom_mac_address(int fmt, char *name, char *addr)
+{
+ return get_addr_by_name(fmt, addr, name);
+}
+EXPORT_SYMBOL_GPL(get_custom_mac_address);
+
+static int addr_factory(struct device_node *np,
+ int idx, int type, char *mac, char *name)
+{
+ int ret, i;
+ char match[MATCH_STR_LEN];
+ const char *p;
+ char id[ID_LEN], hash[HASH_LEN], cmp_buf[ID_LEN];
+ struct timespec64 curtime;
+
+ switch (type) {
+ case TYPE_BURN:
+ sprintf(match, "addr_%s", name);
+ ret = of_property_read_string_index(np, match, 0, &p);
+ if (ret)
+ return -1;
+
+ ret = sscanf(p, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
+ &mac[0], &mac[1], &mac[2],
+ &mac[3], &mac[4], &mac[5]);
+
+ if (ret != ADDR_VAL_LEN)
+ return -1;
+ break;
+ case TYPE_IDGEN:
+ if (idx > HASH_LEN / ADDR_VAL_LEN - 1)
+ return -1;
+ if (sunxi_get_soc_chipid(id))
+ return -1;
+ memset(cmp_buf, 0x00, ID_LEN);
+ if (memcmp(id, cmp_buf, ID_LEN) == 0)
+ return -1;
+ if (hmac_sha256(id, ID_LEN, hash))
+ return -1;
+ memcpy(mac, &hash[idx * ADDR_VAL_LEN], ADDR_VAL_LEN);
+ break;
+ case TYPE_RAND:
+ for (i = 0; i < ADDR_VAL_LEN; i++) {
+ ktime_get_real_ts64(&curtime);
+ mac[i] = (char)curtime.tv_nsec;
+ }
+ break;
+ default:
+ ADDR_MGT_ERR("unsupport type: %d", type);
+ return -1;
+ }
+ return 0;
+}
+
+static int addr_init(struct platform_device *pdev)
+{
+ struct device_node *np = pdev->dev.of_node;
+ int type, i, j;
+ char match[MATCH_STR_LEN];
+ char addr[ADDR_VAL_LEN];
+ int type_tab[] = {TYPE_BURN, TYPE_IDGEN, TYPE_RAND};
+
+ /* init addr type and value */
+ for (i = 0; i < ARRAY_SIZE(info); i++) {
+ sprintf(match, "type_addr_%s", info[i].name);
+ if (of_property_read_u32(np, match, &type)) {
+ ADDR_MGT_DBG("Failed to get type_def_%s, use default: %d",
+ info[i].name, info[i].type_def);
+ } else {
+ info[i].type_def = type;
+ info[i].type_cur = type;
+ }
+
+ if (IS_TYPE_INVALID(info[i].type_def))
+ return -1;
+ if (info[i].type_def != TYPE_ANY) {
+ if (addr_factory(np, i, info[i].type_def, addr, info[i].name))
+ return -1;
+ } else {
+ for (j = 0; j < ARRAY_SIZE(type_tab); j++) {
+ if (!addr_factory(np, i, type_tab[j], addr, info[i].name)) {
+ info[i].type_cur = type_tab[j];
+ break;
+ }
+ }
+ }
+
+ if (info[i].flag)
+ addr[0] &= 0xFC;
+
+ if (addr_parse(ADDR_FMT_VAL, addr, info[i].flag))
+ return -1;
+ else {
+ info[i].addr = devm_kzalloc(&pdev->dev, ADDR_VAL_LEN, GFP_KERNEL);
+ memcpy(info[i].addr, addr, ADDR_VAL_LEN);
+ }
+ }
+ return 0;
+}
+
+static ssize_t summary_show(struct class *class,
+ struct class_attribute *attr, char *buffer)
+{
+ int i = 0, ret = 0;
+
+ ret += sprintf(&buffer[ret], "name cfg cur address\n");
+ for (i = 0; i < ARRAY_SIZE(info); i++) {
+ ret += sprintf(&buffer[ret],
+ "%4s %d %d %02X:%02X:%02X:%02X:%02X:%02X\n",
+ info[i].name, info[i].type_def, info[i].type_cur,
+ info[i].addr[0], info[i].addr[1], info[i].addr[2],
+ info[i].addr[3], info[i].addr[4], info[i].addr[5]);
+ }
+ return ret;
+}
+static CLASS_ATTR_RO(summary);
+
+ADDR_CLASS_ATTR_ADD(wifi);
+ADDR_CLASS_ATTR_ADD(bt);
+ADDR_CLASS_ATTR_ADD(eth);
+
+static struct attribute *addr_class_attrs[] = {
+ &class_attr_summary.attr,
+ &class_attr_addr_wifi.attr,
+ &class_attr_addr_bt.attr,
+ &class_attr_addr_eth.attr,
+ NULL
+};
+ATTRIBUTE_GROUPS(addr_class);
+
+static struct class addr_class = {
+ .name = "addr_mgt",
+ .owner = THIS_MODULE,
+ .class_groups = addr_class_groups,
+};
+
+static const struct of_device_id addr_mgt_ids[] = {
+ { .compatible = "allwinner,sunxi-addr_mgt" },
+ { /* Sentinel */ }
+};
+
+static int addr_mgt_probe(struct platform_device *pdev)
+{
+ int status;
+
+ ADDR_MGT_DBG("module version: %s", MODULE_CUR_VERSION);
+ status = class_register(&addr_class);
+ if (status < 0) {
+ ADDR_MGT_ERR("class register error, status: %d.", status);
+ return -1;
+ }
+
+ if (addr_init(pdev)) {
+ ADDR_MGT_ERR("failed to init addr.");
+ class_unregister(&addr_class);
+ return -1;
+ }
+ ADDR_MGT_DBG("success.");
+ return 0;
+}
+
+static int addr_mgt_remove(struct platform_device *pdev)
+{
+ class_unregister(&addr_class);
+ return 0;
+}
+
+static struct platform_driver addr_mgt_driver = {
+ .probe = addr_mgt_probe,
+ .remove = addr_mgt_remove,
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = "sunxi-addr-mgt",
+ .of_match_table = addr_mgt_ids,
+ },
+};
+
+module_platform_driver_probe(addr_mgt_driver, addr_mgt_probe);
+
+MODULE_AUTHOR("Allwinnertech");
+MODULE_DESCRIPTION("Network MAC Addess Manager");
+MODULE_LICENSE("GPL");
--
2.34.1

View File

@ -0,0 +1,32 @@
From 706dc6ed092e4a1b9d84893cb4186fbd354bb1c8 Mon Sep 17 00:00:00 2001
From: pbiel <pbiel7@gmail.com>
Date: Thu, 26 Jan 2023 09:51:22 +0100
Subject: [PATCH] Add addr_mgt device tree node
---
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
index d0b95d43a..15f45a3f9 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
@@ -591,5 +591,15 @@ sunxi-info {
compatible = "allwinner,sun50i-h616-sys-info";
status = "okay";
};
+
+ addr_mgt {
+ compatible = "allwinner,sunxi-addr_mgt";
+ type_addr_wifi = <0x00>;
+ type_addr_bt = <0x00>;
+ type_addr_eth = <0x00>;
+ status = "okay";
+ linux,phandle = <0x179>;
+ phandle = <0x179>;
+ };
};
};
--
2.34.1

View File

@ -0,0 +1,70 @@
From 899da8366afd97b1ca59b632036dc313777026da Mon Sep 17 00:00:00 2001
From: pbiel <pbiel7@gmail.com>
Date: Fri, 24 Feb 2023 22:14:58 +0100
Subject: [PATCH] Add wifi power regulator
---
.../allwinner/sun50i-h616-orangepi-zero2.dts | 47 +++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
index 02893f3ac..88234a139 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
@@ -49,6 +49,53 @@ reg_vcc5v: vcc5v {
regulator-max-microvolt = <5000000>;
regulator-always-on;
};
+
+ reg_vcc33_wifi: vcc33-wifi {
+ /* Always on 3.3V regulator for WiFi and BT */
+ compatible = "regulator-fixed";
+ regulator-name = "vcc33-wifi";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-always-on;
+ vin-supply = <&reg_vcc5v>;
+ };
+
+ reg_vcc_wifi_io: vcc-wifi-io {
+ /* Always on 1.8V/300mA regulator for WiFi and BT IO */
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-wifi-io";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-always-on;
+ vin-supply = <&reg_vcc33_wifi>;
+ };
+
+ wifi_pwrseq: wifi-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ clocks = <&rtc 1>;
+ clock-names = "osc32k-out";
+ reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>; /* PG18 */
+ post-power-on-delay-ms = <200>;
+ };
+};
+
+&mmc1 {
+ vmmc-supply = <&reg_vcc33_wifi>;
+ vqmmc-supply = <&reg_vcc_wifi_io>;
+ mmc-pwrseq = <&wifi_pwrseq>;
+ bus-width = <4>;
+ non-removable;
+ mmc-ddr-1_8v;
+ status = "okay";
+ uwe-bsp {
+ compatible = "unisoc,uwe_bsp";
+ keep-power-on;
+ data-irq;
+ //adma-tx;
+ adma-rx;
+ //blksz-512;
+ status = "okay";
+ };
};
&emac0 {
--
2.34.1

File diff suppressed because it is too large Load Diff

View File

@ -5,3 +5,17 @@ DESCRIPTION = "Mainline Longterm Linux kernel"
LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
SRC_URI[sha256sum] = "d60cf185693c386e7acd9f3eb3a94ae30ffbfee0a9447a20e83711e0bdf5922b" SRC_URI[sha256sum] = "d60cf185693c386e7acd9f3eb3a94ae30ffbfee0a9447a20e83711e0bdf5922b"
SRC_URI:append:orange-pi-zero2 = " \
file://defconfig \
file://0001-drv-wireless-add-uwe5622-wifi-driver.patch \
file://0002-drv-wireless-driver-for-uwe5622-allwinner-bugfix.patch \
file://0003-drv-fix-incldue-path-for-unisocwcn.patch \
file://0004-drv-wireless-adapt-uwe5622-wifi-driver-to-kernel-6.1.patch \
file://0005-drv-fix-setting-mac-address-for-netdev-in-uwe5622.patch \
file://0006-drv-add-dump_reg-and-sunxi-sysinfo-drivers.patch \
file://0007-drv-add-sunxi_get_soc_chipid-and-sunxi_get_serial.patch \
file://0008-drv-add-sunxi-addr-driver.patch \
file://0009-dts-add-addr_mgt-device-tree-node.patch \
file://0010-dts-add-wifi-power-regulator.patch \
"

Binary file not shown.

View File

@ -0,0 +1,177 @@
[Section 1: Version]
Major = 2
Minor = 2
[Section 2: Board Config]
Calib_Bypass = 11758
TxChain_Mask = 2
RxChain_Mask = 2
[Section 3: Board Config TPC]
DPD_LUT_idx = 0x33,0x33,0x0,0x11,0x22,0x33,0x33,0x33
TPC_Goal_Chain0 = 0,0,0,0,0,0,0,0
TPC_Goal_Chain1 = 159,167,162,152,159,167,162,152
[Section 4: TPC-LUT]
Chain0_LUT_0 = 6,0,40,0
Chain0_LUT_1 = 6,1,24,0
Chain0_LUT_2 = 6,2,8,0
Chain0_LUT_3 = 10,2,0,0
Chain0_LUT_4 = 14,2,0,0
Chain0_LUT_5 = 18,2,0,0
Chain0_LUT_6 = 22,2,0,0
Chain0_LUT_7 = 26,2,0,0
Chain1_LUT_0 = 6,0,40,0
Chain1_LUT_1 = 6,1,24,0
Chain1_LUT_2 = 6,2,8,0
Chain1_LUT_3 = 10,2,0,0
Chain1_LUT_4 = 14,2,0,0
Chain1_LUT_5 = 18,2,0,0
Chain1_LUT_6 = 22,2,0,0
Chain1_LUT_7 = 26,2,0,0
[Section 5: Board Config Frequency Compensation]
2G_Channel_Chain0 = 6,6,6,6,7,7,7,7,7,7,7,7,7,7
2G_Channel_Chain1 = 6,6,6,6,7,7,7,7,7,7,7,7,7,7
5G_Channel_Chain0 = 11,11,11,11,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,9,9,9,9,9
5G_Channel_Chain1 = 11,11,11,11,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,9,9,9,9,9
[Section 6: Rate To Power with BW 20M]
11b_Power = 20,20,20,20
11ag_Power = 28,32,36,44,28,32,36,48
11n_Power = 34,38,38,40,40,44,44,48,32,36,36,40,40,44,44,54,48
11ac_Power = 32,36,36,40,40,44,44,48,50,66,32,36,36,40,40,44,44,48,50,66
[Section 7: Power Backoff]
Green_WIFI_offset = 0
HT40_Power_offset = 0
VHT40_Power_offset = 0
VHT80_Power_offset = 0
SAR_Power_offset = 0
Mean_Power_offset = 36
[Section 8: Reg Domain]
reg_domain1 = 0x00000001
reg_domain2 = 0x00000002
[Section 9: Band Edge Power offset (MKK, FCC, ETSI)]
BW20M = 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41
BW40M = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21
BW80M = 6,5,4,3,2,1
[Section 10: TX Scale]
Chain0_1 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
Chain1_1 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
Chain0_2 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17
Chain1_2 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17
Chain0_3 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,18
Chain1_3 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,18
Chain0_4 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,19
Chain1_4 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,19
Chain0_5 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20
Chain1_5 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20
Chain0_6 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,21
Chain1_6 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,21
Chain0_7 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,22
Chain1_7 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,22
Chain0_8 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,23
Chain1_8 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,23
Chain0_9 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,24
Chain1_9 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,24
Chain0_10 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,25
Chain1_10 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,25
Chain0_11 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,26
Chain1_11 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,26
Chain0_12 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,27
Chain1_12 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,27
Chain0_13 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,28
Chain1_13 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,28
Chain0_14 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,29
Chain1_14 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,29
Chain0_36 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,30
Chain1_36 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,30
Chain0_40 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,31
Chain1_40 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,31
Chain0_44 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,32
Chain1_44 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,32
Chain0_48 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,33
Chain1_48 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,33
Chain0_52 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,34
Chain1_52 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,34
Chain0_56 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,35
Chain1_56 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,35
Chain0_60 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,36
Chain1_60 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,36
Chain0_64 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,37
Chain1_64 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,37
Chain0_100 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,38
Chain1_100 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,38
Chain0_104 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,39
Chain1_104 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,39
Chain0_108 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,40
Chain1_108 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,40
Chain0_112 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,41
Chain1_112 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,41
Chain0_116 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,42
Chain1_116 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,42
Chain0_120 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,43
Chain1_120 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,43
Chain0_124 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,44
Chain1_124 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,44
Chain0_128 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,45
Chain1_128 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,45
Chain0_132 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,46
Chain1_132 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,46
Chain0_136 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,47
Chain1_136 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,47
Chain0_140 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,48
Chain1_140 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,48
Chain0_144 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,49
Chain1_144 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,49
Chain0_149 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,50
Chain1_149 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,50
Chain0_153 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,51
Chain1_153 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,51
Chain0_157 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,52
Chain1_157 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,52
Chain0_161 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,53
Chain1_161 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,53
Chain0_165 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,54
Chain1_165 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,54
[Section 11: misc]
DFS_switch = 1
power_save_switch = 2
ex-Fem_and_ex-LNA_param_setup = 3
rssi_report_diff = 4
[Section 12: debug reg]
address = 0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0x10,0x11,0x12,0x13,0x14,0x15,0x16
value = 0x16,0x17,0x18,0x19,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x30,0x31
[Section 13: coex_config]
bt_performance_cfg0 = 0x01010101
bt_performance_cfg1 = 0x01000000
wifi_performance_cfg0 = 0x01050A01
wifi_performance_cfg2 = 0x00000000
strategy_cfg0 = 0x01010100
strategy_cfg1 = 0x03000000
strategy_cfg2 = 0x08020000
compatibility_cfg0 = 0x04040000
compatibility_cfg1 = 0x0
ant_cfg0 = 0x0
ant_cfg1 = 0x0
isolation_cfg0 = 0x0505
isolation_cfg1 = 0x0
reserved_cfg0 = 0x0
reserved_cfg1 = 0x0
reserved_cfg2 = 0x0
reserved_cfg3 = 0x0
reserved_cfg4 = 0x0
reserved_cfg5 = 0x0
reserved_cfg6 = 0x0
reserved_cfg7 = 0x0
[Section 14: rf_tlv_config]
rf_config = 0xAA,0x55,0x00,0xFF,0x8,0xA,0x0,0x5,0x0,0x0,0x0,0x0,0x0,0x0

View File

@ -0,0 +1,22 @@
DESCRIPTION = "UWE5622 Wifi firmware"
LICENSE = "CC0-1.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/${LICENSE};md5=0ceb3372c9595f0a8067e55da801e4a1"
S = "${WORKDIR}"
COMPATIBLE_MACHINE = "orange-pi-zero2"
SRC_URI:append = " \
file://wcnmodem.bin \
file://wifi_2355b001_1ant.ini \
"
do_install() {
install -d ${D}${base_libdir}/firmware
install -m 0644 ${S}/wcnmodem.bin ${D}${base_libdir}/firmware/wcnmodem.bin
install -m 0644 ${S}/wifi_2355b001_1ant.ini ${D}${base_libdir}/firmware/wifi_2355b001_1ant.ini
}
FILES:${PN} = "${base_libdir}/*"
PACKAGES = "${PN}"