Merge pull request #16 from kimocoder/v5.1.5

Makefile + EFUSE fix
This commit is contained in:
evilphish 2017-12-11 08:16:56 +01:00 committed by GitHub
commit 0939a11dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 105 additions and 38 deletions

View File

@ -1059,7 +1059,7 @@ EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
KVER := $(shell uname -r)
KVER ?= $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
@ -1071,7 +1071,7 @@ EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFO
ARCH := $(R_ARCH)
#CROSS_COMPILE := arm-none-linux-gnueabi-
CROSS_COMPILE := $(R_CROSS_COMPILE)
KVER:= 3.4.0
KVER ?= 3.4.0
#KSRC := ../../../../build/out/kernel
KSRC := $(KERNEL_BUILD_PATH)
MODULE_NAME :=wlan
@ -1134,10 +1134,10 @@ endif
ifeq ($(CONFIG_PLATFORM_MSTAR_TITANIA12), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR -DCONFIG_PLATFORM_MSTAR_TITANIA12
ARCH:=mips
ARCH :=mips
CROSS_COMPILE:= /usr/src/Mstar_kernel/mips-4.3/bin/mips-linux-gnu-
KVER:= 2.6.28.9
KSRC:= /usr/src/Mstar_kernel/2.6.28.9/
KVER ?= 2.6.28.9
KSRC := /usr/src/Mstar_kernel/2.6.28.9/
endif
ifeq ($(CONFIG_PLATFORM_MSTAR), y)
@ -1145,10 +1145,10 @@ EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR -DCONFIG_USE_USB_BUFFER_ALLOC_TX -DCONFIG_FIX_NR_BULKIN_BUFFER -DCONFIG_PREALLOC_RX_SKB_BUFFER
EXTRA_CFLAGS += -DCONFIG_PLATFORM_MSTAR_HIGH
ARCH:=arm
ARCH :=arm
CROSS_COMPILE:= /usr/src/bin/arm-none-linux-gnueabi-
KVER:= 3.1.10
KSRC:= /usr/src/Mstar_kernel/3.1.10/
KVER ?= 3.1.10
KSRC := /usr/src/Mstar_kernel/3.1.10/
endif
ifeq ($(CONFIG_PLATFORM_ANDROID_X86), y)
@ -1187,7 +1187,7 @@ ifeq ($(CONFIG_PLATFORM_ARM_PXA2XX), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := arm-none-linux-gnueabi-
KVER := 2.6.34.1
KVER ?= 2.6.34.1
KSRC ?= /usr/src/linux-2.6.34.1
endif
@ -1195,7 +1195,7 @@ ifeq ($(CONFIG_PLATFORM_ARM_S3C2K4), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := arm-linux-
KVER := 2.6.24.7_$(ARCH)
KVER ?= 2.6.24.7_$(ARCH)
KSRC := /usr/src/kernels/linux-$(KVER)
endif
@ -1203,40 +1203,40 @@ ifeq ($(CONFIG_PLATFORM_ARM_S3C6K4), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := arm-none-linux-gnueabi-
KVER := 2.6.34.1
KVER ?= 2.6.34.1
KSRC ?= /usr/src/linux-2.6.34.1
endif
ifeq ($(CONFIG_PLATFORM_RTD2880B), y)
EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN -DCONFIG_PLATFORM_RTD2880B
ARCH:=
ARCH :=
CROSS_COMPILE:=
KVER:=
KSRC:=
KVER ?=
KSRC :=
endif
ifeq ($(CONFIG_PLATFORM_MIPS_RMI), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH:=mips
ARCH :=mips
CROSS_COMPILE:=mipsisa32r2-uclibc-
KVER:=
KSRC:= /root/work/kernel_realtek
KVER ?=
KSRC := /root/work/kernel_realtek
endif
ifeq ($(CONFIG_PLATFORM_MIPS_PLM), y)
EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN
ARCH:=mips
ARCH :=mips
CROSS_COMPILE:=mipsisa32r2-uclibc-
KVER:=
KSRC:= /root/work/kernel_realtek
KVER ?=
KSRC := /root/work/kernel_realtek
endif
ifeq ($(CONFIG_PLATFORM_MSTAR389), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR389
ARCH:=mips
ARCH :=mips
CROSS_COMPILE:= mips-linux-gnu-
KVER:= 2.6.28.10
KSRC:= /home/mstar/mstar_linux/2.6.28.9/
KVER ?= 2.6.28.10
KSRC := /home/mstar/mstar_linux/2.6.28.9/
endif
ifeq ($(CONFIG_PLATFORM_MIPS_AR9132), y)
@ -1260,25 +1260,25 @@ EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
ifeq ($(CONFIG_USB_HCI), y)
_PLATFORM_FILES += platform/platform_RTK_DMP_usb.o
endif
ARCH:=mips
CROSS_COMPILE:=mipsel-linux-
KVER:=
ARCH :=mips
CROSS_COMPILE :=mipsel-linux-
KVER ?=
KSRC ?= /usr/src/DMP_Kernel/jupiter/linux-2.6.12
endif
ifeq ($(CONFIG_PLATFORM_MT53XX), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MT53XX
ARCH:= arm
ARCH := arm
CROSS_COMPILE:= arm11_mtk_le-
KVER:= 2.6.27
KSRC?= /proj/mtk00802/BD_Compare/BDP/Dev/BDP_V301/BDP_Linux/linux-2.6.27
KVER ?= 2.6.27
KSRC ?= /proj/mtk00802/BD_Compare/BDP/Dev/BDP_V301/BDP_Linux/linux-2.6.27
endif
ifeq ($(CONFIG_PLATFORM_ARM_MX51_241H), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_WISTRON_PLATFORM
ARCH := arm
CROSS_COMPILE := /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
KVER := 2.6.31
KVER ?= 2.6.31
KSRC ?= /lib/modules/2.6.31-770-g0e46b52/source
endif
@ -1293,7 +1293,7 @@ ifeq ($(CONFIG_PLATFORM_ACTIONS_ATJ227X), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ACTIONS_ATJ227X
ARCH := mips
CROSS_COMPILE := /home/cnsd4/project/actions/tools-2.6.27/bin/mipsel-linux-gnu-
KVER := 2.6.27
KVER ?= 2.6.27
KSRC := /home/cnsd4/project/actions/linux-2.6.27.28
endif
@ -1307,14 +1307,14 @@ ARCH := arm
CROSS_COMPILE := /opt/montavista/pro5.0/devkit/arm/v5t_le/bin/arm-linux-
KSRC:= /home/vivotek/lsp/DM365/kernel_platform/kernel/linux-2.6.18
KERNELOUTPUT := ${PRODUCTDIR}/tmp
KVER := 2.6.18
KVER ?= 2.6.18
endif
ifeq ($(CONFIG_PLATFORM_MOZART), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MOZART
ARCH := arm
CROSS_COMPILE := /home/vivotek/lsp/mozart3v2/Mozart3e_Toolchain/build_arm_nofpu/usr/bin/arm-linux-
KVER := $(shell uname -r)
KVER ?= $(shell uname -r)
KSRC:= /opt/Vivotek/lsp/mozart3v2/kernel_platform/kernel/mozart_kernel-1.17
KERNELOUTPUT := /home/pink/sample/ODM/IP8136W-VINT/tmp/kernel
endif
@ -1439,8 +1439,8 @@ ifeq ($(CONFIG_PLATFORM_SZEBOOK), y)
EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN
ARCH:=arm
CROSS_COMPILE:=/opt/crosstool2/bin/armeb-unknown-linux-gnueabi-
KVER:= 2.6.31.6
KSRC:= ../code/linux-2.6.31.6-2020/
KVER ?= 2.6.31.6
KSRC := ../code/linux-2.6.31.6-2020/
endif
#Add setting for MN10300
@ -1448,7 +1448,7 @@ ifeq ($(CONFIG_PLATFORM_MN10300), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MN10300
ARCH := mn10300
CROSS_COMPILE := mn10300-linux-
KVER := 2.6.32.2
KVER ?= 2.6.32.2
KSRC := /home/winuser/work/Plat_sLD2T_V3010/usr/src/linux-2.6.32.2
INSTALL_PREFIX :=
endif
@ -1474,7 +1474,7 @@ endif
ARCH := arm
#CROSS_COMPILE := arm-none-linux-gnueabi-
CROSS_COMPILE=/home/android_sdk/Allwinner/a10/android-jb42/lichee-jb42/buildroot/output/external-toolchain/bin/arm-none-linux-gnueabi-
KVER := 3.0.8
KVER ?= 3.0.8
#KSRC:= ../lichee/linux-3.0/
KSRC=/home/android_sdk/Allwinner/a10/android-jb42/lichee-jb42/linux-3.0
endif
@ -1760,7 +1760,7 @@ EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_RX
EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
ARCH ?= arm
CROSS_COMPILE := arm-linux-gnueabihf-
KVER := 3.8.0
KVER ?= 3.8.0
KSRC := /Custom/Novatek/TCL/linux-3.8_header
#KSRC := $(KERNELDIR)
endif

View File

@ -336,6 +336,62 @@ u16 rtw_get_efuse_mask_arraylen(PADAPTER pAdapter)
return 0;
}
VOID efuse_PreUpdateAction(
PADAPTER pAdapter,
pu4Byte BackupRegs)
{
if (IS_HARDWARE_TYPE_8812AU(pAdapter)) {
/* <20131115, Kordan> Turn off Rx to prevent from being busy when writing the EFUSE. (Asked by Chunchu.)*/
BackupRegs[0] = PHY_QueryMacReg(pAdapter, REG_RCR, bMaskDWord);
BackupRegs[1] = PHY_QueryMacReg(pAdapter, REG_RXFLTMAP0, bMaskDWord);
BackupRegs[2] = PHY_QueryMacReg(pAdapter, REG_RXFLTMAP0+4, bMaskDWord);
BackupRegs[3] = PHY_QueryMacReg(pAdapter, REG_AFE_MISC, bMaskDWord);
PlatformEFIOWrite4Byte(pAdapter, REG_RCR, 0x1);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0, 0);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+1, 0);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+2, 0);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+3, 0);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+4, 0);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+5, 0);
/* <20140410, Kordan> 0x11 = 0x4E, lower down LX_SPS0 voltage. (Asked by Chunchu)*/
PHY_SetMacReg(pAdapter, REG_AFE_MISC, bMaskByte1, 0x4E);
}
if (IS_HARDWARE_TYPE_8814AU(pAdapter)) {
/* <20131115, Kordan> Turn off Rx to prevent from being busy when writing the EFUSE. (Asked by Chunchu.)*/
BackupRegs[0] = PHY_QueryMacReg(pAdapter, REG_RCR, bMaskDWord);
BackupRegs[1] = PHY_QueryMacReg(pAdapter, REG_RXFLTMAP0, bMaskDWord);
BackupRegs[2] = PHY_QueryMacReg(pAdapter, REG_RXFLTMAP0+4, bMaskDWord);
BackupRegs[3] = PHY_QueryMacReg(pAdapter, REG_AFE_MISC, bMaskDWord);
PlatformEFIOWrite4Byte(pAdapter, REG_RCR, 0x1);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0, 0);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+1, 0);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+2, 0);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+3, 0);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+4, 0);
PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+5, 0);
/* <20140410, Kordan> 0x11 = 0x4E, lower down LX_SPS0 voltage. (Asked by Chunchu)*/
PHY_SetMacReg(pAdapter, REG_AFE_MISC, bMaskByte1, 0x4E);
}
}
VOID efuse_PostUpdateAction(
PADAPTER pAdapter,
pu4Byte BackupRegs)
{
if (IS_HARDWARE_TYPE_8812AU(pAdapter)) {
/* <20131115, Kordan> Turn on Rx and restore the registers. (Asked by Chunchu.)*/
PHY_SetMacReg(pAdapter, REG_RCR, bMaskDWord, BackupRegs[0]);
PHY_SetMacReg(pAdapter, REG_RXFLTMAP0, bMaskDWord, BackupRegs[1]);
PHY_SetMacReg(pAdapter, REG_RXFLTMAP0+4, bMaskDWord, BackupRegs[2]);
PHY_SetMacReg(pAdapter, REG_AFE_MISC, bMaskDWord, BackupRegs[3]);
}
}
#ifdef RTW_HALMAC
#include "../../hal/hal_halmac.h"
@ -1561,6 +1617,8 @@ efuse_OneByteWrite(
} else
rtw_write32(pAdapter, EFUSE_CTRL, efuseValue);
rtw_mdelay_os(1);
while ((0x80 & rtw_read8(pAdapter, EFUSE_CTRL + 3)) && (tmpidx < 100)) {
rtw_mdelay_os(1);
tmpidx++;
@ -1661,6 +1719,9 @@ u8 rtw_efuse_access(PADAPTER padapter, u8 bWrite, u16 start_addr, u16 cnts, u8 *
u16 real_content_len = 0, max_available_size = 0;
u8 res = _FAIL ;
u8(*rw8)(PADAPTER, u16, u8 *);
u32 backupRegs[4] = {0};
efuse_PreUpdateAction(padapter, backupRegs);
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, (PVOID)&real_content_len, _FALSE);
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE);
@ -1691,6 +1752,8 @@ u8 rtw_efuse_access(PADAPTER padapter, u8 bWrite, u16 start_addr, u16 cnts, u8 *
Efuse_PowerSwitch(padapter, bWrite, _FALSE);
efuse_PostUpdateAction(padapter, backupRegs);
return res;
}
/* ------------------------------------------------------------------------------ */
@ -1782,8 +1845,11 @@ u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
s32 i, j, idx;
u8 ret = _SUCCESS;
u16 mapLen = 0;
u32 backupRegs[4] = {0};
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
efuse_PreUpdateAction(padapter, backupRegs);
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, _FALSE);
if ((addr + cnts) > mapLen)
@ -1856,6 +1922,7 @@ u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
/*Efuse_PowerSwitch(padapter, _TRUE, _FALSE);*/
exit:
efuse_PostUpdateAction(padapter, backupRegs);
rtw_mfree(map, mapLen);