From ba72a4de8aaba230d171ef63b36d84bd2845b55d Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Wed, 25 Nov 2020 14:20:34 +0100 Subject: [PATCH 218/478] 8723cs: Load the MAC address from local-mac-address Signed-off-by: Ondrej Jirman --- drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c b/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c index 5a84037f3745..c20c136d111d 100644 --- a/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c +++ b/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c @@ -823,6 +823,10 @@ _adapter *rtw_sdio_primary_adapter_init(struct dvobj_priv *dvobj) { int status = _FAIL; PADAPTER padapter = NULL; + PSDIO_DATA psdio = &dvobj->intf_data; + struct device_node *np = psdio->func->dev.of_node; + const unsigned char *addr; + int len; padapter = (_adapter *)rtw_zvmalloc(sizeof(*padapter)); if (padapter == NULL) @@ -883,8 +887,11 @@ _adapter *rtw_sdio_primary_adapter_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)); + if (np && (addr = of_get_property(np, "local-mac-address", &len)) && len == ETH_ALEN) { + memcpy(adapter_mac_addr(padapter), addr, ETH_ALEN); + } else { + rtw_macaddr_cfg(adapter_mac_addr(padapter), get_hal_mac_addr(padapter)); + } #ifdef CONFIG_MI_WITH_MBSSID_CAM rtw_mbid_camid_alloc(padapter, adapter_mac_addr(padapter)); -- 2.35.3