Ported MAC from DT patch by Hans de Goede
Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
This commit is contained in:
parent
89c045ff47
commit
942fadc305
2
Makefile
2
Makefile
|
@ -777,7 +777,7 @@ EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_$(MODULE_NAME).ma
|
|||
endif
|
||||
|
||||
#WIFIMAC_PATH
|
||||
USER_WIFIMAC_PATH ?= /data/misc/wifi/wifimac.txt
|
||||
USER_WIFIMAC_PATH ?= /lib/firmware/rtlwifi/rtl8723cs_mac.txt
|
||||
ifneq ($(USER_WIFIMAC_PATH),)
|
||||
EXTRA_CFLAGS += -DWIFIMAC_PATH=\"$(USER_WIFIMAC_PATH)\"
|
||||
else
|
||||
|
|
|
@ -1483,10 +1483,13 @@ extern char* rtw_initmac;
|
|||
* @out: buf to store mac address decided
|
||||
* @hw_mac_addr: mac address from efuse/epprom
|
||||
*/
|
||||
void rtw_macaddr_cfg(u8 *out, const u8 *hw_mac_addr)
|
||||
void rtw_macaddr_cfg(struct device *dev, u8 *out, const u8 *hw_mac_addr)
|
||||
{
|
||||
#define DEFAULT_RANDOM_MACADDR 1
|
||||
u8 mac[ETH_ALEN];
|
||||
struct device_node *np = dev->of_node;
|
||||
const unsigned char *addr;
|
||||
int len;
|
||||
|
||||
if (out == NULL) {
|
||||
rtw_warn_on(1);
|
||||
|
@ -1517,21 +1520,27 @@ void rtw_macaddr_cfg(u8 *out, const u8 *hw_mac_addr)
|
|||
|
||||
err_chk:
|
||||
if (rtw_check_invalid_mac_address(mac, _TRUE) == _TRUE) {
|
||||
#if DEFAULT_RANDOM_MACADDR
|
||||
DBG_871X_LEVEL(_drv_err_, "invalid mac addr:"MAC_FMT", assign random MAC\n", MAC_ARG(mac));
|
||||
*((u32 *)(&mac[2])) = rtw_random32();
|
||||
mac[0] = 0x00;
|
||||
mac[1] = 0xe0;
|
||||
mac[2] = 0x4c;
|
||||
#else
|
||||
DBG_871X_LEVEL(_drv_err_, "invalid mac addr:"MAC_FMT", assign default one\n", MAC_ARG(mac));
|
||||
mac[0] = 0x00;
|
||||
mac[1] = 0xe0;
|
||||
mac[2] = 0x4c;
|
||||
mac[3] = 0x87;
|
||||
mac[4] = 0x00;
|
||||
mac[5] = 0x00;
|
||||
#endif
|
||||
if (np &&
|
||||
(addr = of_get_property(np, "local-mac-address", &len)) &&
|
||||
len == ETH_ALEN) {
|
||||
memcpy(mac, addr, ETH_ALEN);
|
||||
} else {
|
||||
#if DEFAULT_RANDOM_MACADDR
|
||||
DBG_871X_LEVEL(_drv_err_, "invalid mac addr:"MAC_FMT", assign random MAC\n", MAC_ARG(mac));
|
||||
*((u32 *)(&mac[2])) = rtw_random32();
|
||||
mac[0] = 0x00;
|
||||
mac[1] = 0xe0;
|
||||
mac[2] = 0x4c;
|
||||
#else
|
||||
DBG_871X_LEVEL(_drv_err_, "invalid mac addr:"MAC_FMT", assign default one\n", MAC_ARG(mac));
|
||||
mac[0] = 0x00;
|
||||
mac[1] = 0xe0;
|
||||
mac[2] = 0x4c;
|
||||
mac[3] = 0x87;
|
||||
mac[4] = 0x00;
|
||||
mac[5] = 0x00;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
_rtw_memcpy(out, mac, ETH_ALEN);
|
||||
|
|
|
@ -1814,7 +1814,7 @@ int rtw_check_network_type(unsigned char *rate, int ratelen, int channel);
|
|||
void rtw_get_bcn_info(struct wlan_network *pnetwork);
|
||||
|
||||
u8 rtw_check_invalid_mac_address(u8 *mac_addr, u8 check_local_bit);
|
||||
void rtw_macaddr_cfg(u8 *out, const u8 *hw_mac_addr);
|
||||
void rtw_macaddr_cfg(struct device *dev, u8 *out, const u8 *hw_mac_addr);
|
||||
|
||||
u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI, unsigned char * MCS_rate);
|
||||
u8 rtw_ht_mcsset_to_nss(u8 *supp_mcs_set);
|
||||
|
|
|
@ -490,6 +490,7 @@ _adapter *rtw_sdio_if1_init(struct dvobj_priv *dvobj)
|
|||
{
|
||||
int status = _FAIL;
|
||||
PADAPTER padapter = NULL;
|
||||
PSDIO_DATA psdio = &dvobj->intf_data;
|
||||
|
||||
padapter = (_adapter *)rtw_zvmalloc(sizeof(*padapter));
|
||||
if (padapter == NULL)
|
||||
|
@ -561,7 +562,7 @@ _adapter *rtw_sdio_if1_init(struct dvobj_priv *dvobj)
|
|||
|
||||
//3 8. get WLan MAC address
|
||||
// set mac addr
|
||||
rtw_macaddr_cfg(adapter_mac_addr(padapter), get_hal_mac_addr(padapter));
|
||||
rtw_macaddr_cfg(&psdio->func->dev, adapter_mac_addr(padapter), get_hal_mac_addr(padapter));
|
||||
rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter));
|
||||
|
||||
rtw_hal_disable_interrupt(padapter);
|
||||
|
|
Loading…
Reference in a new issue