SSV6256 WiFi芯片
------------------------------------------------------
diff --git a/longan/kernel/linux-4.9/drivers/net/wireless/ssv6x5x/smac/efuse.c b/longan/kernel/linux-4.9/drivers/net/wireless/ssv6x5x/smac/efuse.c
index 2b9e12f710..ab85d83201 100755
--- a/longan/kernel/linux-4.9/drivers/net/wireless/ssv6x5x/smac/efuse.c
+++ b/longan/kernel/linux-4.9/drivers/net/wireless/ssv6x5x/smac/efuse.c
@@ -22,7 +22,7 @@
#include <ssv6200.h>
#include "efuse.h"
#include <hal.h>
-
+#define CUSTOMER_HW_ALLWINNER
mm_segment_t oldfs;
struct file *openFile(char *path,int flag,int mode)
{
@@ -257,11 +257,20 @@ extern char* ssv_initmac;
#ifdef ROCKCHIP_3126_SUPPORT
extern int rockchip_wifi_mac_addr(unsigned char *buf);
#endif
+
+#ifdef CUSTOMER_HW_ALLWINNER
+//extern void sunxi_wlan_custom_mac_address(u8 *mac);
+extern int get_wifi_custom_mac_address(char *addr_str);
+#endif
+
void efuse_read_all_map(struct ssv_hw *sh)
{
u8 mac[ETH_ALEN] = {0};
int jj,kk;
+ int ret = 0;
+ char addr_str[20];
+ u8 mac_addr_efuse[ETH_ALEN];
u8 efuse_mapping_table[EFUSE_HWSET_MAX_SIZE/8];
#ifndef CONFIG_SSV_RANDOM_MAC
u8 pseudo_mac0[ETH_ALEN] = { 0x00, 0x33, 0x33, 0x33, 0x33, 0x33 };
@@ -346,6 +355,18 @@ void efuse_read_all_map(struct ssv_hw *sh)
goto Done;
}
}
+#endif
+#ifdef CUSTOMER_HW_ALLWINNER
+ ret = get_wifi_custom_mac_address(addr_str);
+ if (ret >= 0) {
+ printk("=========ssv6256> get mac address from flash.\n");
+ sscanf(addr_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
+ &mac_addr_efuse[0], &mac_addr_efuse[1], &mac_addr_efuse[2],
+ &mac_addr_efuse[3], &mac_addr_efuse[4], &mac_addr_efuse[5]);
+ memcpy(&sh->cfg.maddr[0][0],addr_str,ETH_ALEN);
+ addr_increase_copy(&sh->cfg.maddr[1][0],addr_str);
+ goto Done;
+ }
#endif
//Priority 2. From e-fuse
if(!sh->cfg.ignore_efuse_mac)
------------------------------------------------------
Realtek rtl8189fs 模组,Realtek其他模组可以参考此修改:
--- a/longan/kernel/linux-4.9/drivers/net/wireless/rtl8189fs/core/rtw_ieee80211.c
+++ b/longan/kernel/linux-4.9/drivers/net/wireless/rtl8189fs/core/rtw_ieee80211.c
@@ -1543,6 +1543,7 @@ u8 rtw_check_invalid_mac_address(u8 *mac_addr, u8 check_local_bit)
}
extern char *rtw_initmac;
+extern int get_wifi_custom_mac_address(char *addr_str);
/**
* rtw_macaddr_cfg - Decide the mac address used
* @out: buf to store mac address decided
@@ -1552,6 +1553,7 @@ void rtw_macaddr_cfg(u8 *out, const u8 *hw_mac_addr)
{
#define DEFAULT_RANDOM_MACADDR 1
u8 mac[ETH_ALEN];
+ u8 addr_str[20];
if (out == NULL) {
rtw_warn_on(1);
@@ -1573,6 +1575,11 @@ void rtw_macaddr_cfg(u8 *out, const u8 *hw_mac_addr)
if (rtw_get_mac_addr_intel(mac) == 0)
goto err_chk;
#endif
+ if (get_wifi_custom_mac_address(addr_str) != -1) {
+ sscanf(addr_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
+ &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
+ goto err_chk;
+ }
/* Use the mac address stored in the Efuse */
if (hw_mac_addr) {
-------------------------------------------------------------------------------
uwe5621DS 展锐模组:
--- a/longan/kernel/linux-4.9/drivers/net/wireless/uwe5622/unisocwifi/main.c
+++ b/longan/kernel/linux-4.9/drivers/net/wireless/uwe5622/unisocwifi/main.c
@@ -1155,16 +1155,12 @@ static int sprdwl_get_mac_from_file(struct sprdwl_vif *vif, u8 *addr)
return 0;
}
+//#ifdef CONFIG_SUNXI_ADDR_MGT
+extern int get_wifi_custom_mac_address(char *addr_str);
+//#endif
static void sprdwl_set_mac_addr(struct sprdwl_vif *vif, u8 *pending_addr,
u8 *addr)
{
int default_mac_valid = 0;
enum nl80211_iftype type = vif->wdev.iftype;
struct sprdwl_priv *priv = vif->priv;
+ u8 addr_str[20];
u8 custom_mac[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
int ret;
(void)addr_str;
@@ -1173,14 +1169,6 @@ static void sprdwl_set_mac_addr(struct sprdwl_vif *vif, u8 *pending_addr,
if (!addr) {
return;
}
+//#ifdef CONFIG_SUNXI_ADDR_MGT
+ ret = get_wifi_custom_mac_address(addr_str);
+ if (ret != -1) {
+ sscanf(addr_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
+ &custom_mac[0], &custom_mac[1], &custom_mac[2],
+ &custom_mac[3], &custom_mac[4], &custom_mac[5]);
+ }
+//#endif
if (is_valid_ether_addr(custom_mac)) {
ether_addr_copy(addr, custom_mac);
------------------------------------------------------------------------------------
全志H313 平台上定制WIFI MAC 地址
于 2024-01-02 14:01:56 首次发布