一、移植准备
1.下载移植需要的文件
下载路径:
链接:https://pan.baidu.com/s/1JEtQ_A3Pjw6APufDwCG9BQ?pwd=98m3
提取码:98m3
2.构建移植工程目录
解压内核,为了不影响官方移植好的代码,在kernel同级目录,自己建立一个内核辅助目录
kernel_aux目录结构如下
├── configs 内核配置文件
├── dts 涉及到修改的设备树
└── files 涉及到修改的c文件和Kconfig文件
将涉及到修改的内核文件放到files目录下,有以下文件
drivers/char/power_ctrl.c
drivers/misc/itop4412_relay.c //编译错误需要修改,跟wifi移植没有关系
drivers/misc/Kconfig
drivers/misc/Makefile
drivers/mmc/host/sdhci-s3c.c
drivers/net/wireless/Kconfig
drivers/net/wireless/Makfile
net/core/dev.c
net/wireless/wext-core.c
新增文件
include/linux/combo_mt66xx.h
拷贝驱动文件夹mediatek到kernel_aux/files/drivers/misc目录下,拷贝后目录有如下文件
zjgun@ubuntu:~/workplace/4412_SCP_5.3.18$ ls kernel_aux/files/drivers/misc/
itop4412_relay.c Kconfig Makefile mediatek
拷贝驱动文件夹combo_mt66xx到kernel_aux/files/drivers/net/wireless目录下,拷贝后目录有如下文件
zjgun@ubuntu:~/workplace/4412_SCP_5.3.18$ ls kernel_aux/files/drivers/net/wireless/
combo_mt66xx Kconfig Makefile
拷贝官方默认内核配置文件到configs目录下,并改名
cp kernel/arch/arm/configs/topeet4412_defconfig kernel_aux/configs/
cd kernel_aux/configs/;mv topeet4412_defconfig iTop-4412_scp_mt6620_config
新建一个makefile,用于构建内核,里面的内容如下
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CUR_DIR := $(shell dirname $(MKFILE_PATH))
KERNEL_AUX_PATH := $(CUR_DIR)/kernel_aux
KERNEL_PATH := $(CUR_DIR)/kernel
CUR_PRJ_LINUX_DEFCONFIG_FILE := $(KERNEL_AUX_PATH)/configs/iTop-4412_scp_mt6620_config
CUR_PRJ_LINUX_DTS_PATH :=$(KERNEL_AUX_PATH)/dts
prepare_kernel:
cp $(CUR_PRJ_LINUX_DEFCONFIG_FILE) $(KERNEL_PATH)/.config
rsync -av $(CUR_PRJ_LINUX_DTS_PATH)/* $(CUR_DIR)/kernel/arch/arm/boot/dts/
rsync -av $(KERNEL_AUX_PATH)/files/* $(CUR_DIR)/kernel/ -r
config_kernel:
pushd $(KERNEL_PATH);\
make menuconfig ARCH=arm \
CROSS_COMPILE=/usr/local/arm/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-;\
popd;
build_kernel:
make -C $(KERNEL_PATH) uImage LOADADDR=0x40007000\
ARCH=arm \
CROSS_COMPILE=/usr/local/arm/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- -j32
build_modules:
make -C $(KERNEL_PATH) modules\
ARCH=arm \
CROSS_COMPILE=/usr/local/arm/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- -j32
build_dtbs:
make -C $(KERNEL_PATH) dtbs\
ARCH=arm \
CROSS_COMPILE=/usr/local/arm/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- -j32
clean:
make -C $(KERNEL_PATH) clean\
ARCH=arm \
CROSS_COMPILE=/usr/local/arm/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-
二、修改驱动代码
1.修改kernel_aux/files/drivers/misc/mediatek目录驱动文件,适配新版本内核
涉及到修改的文件如下:
combo_mt66xx/fm/core/fm_module.c
combo_mt66xx/fm/core/fm_patch.c
combo_mt66xx/gps/gps.c
combo_mt66xx/Kconfig
combo_mt66xx/Makefile
combo mt66xx/wmt/core/psm core.c
combo_mt66xx/wmt/core/stp_core.c
combo mt66xx/wmt/core/wmt_conf.c
combo mt66xx/wmt/core/wmt_dbg.c
combo_mt66xx/wmt/linux/hif_sdio.c
combo_mt66xx/wmt/linux/hif_sdio_eint.c
combo_mt66xxwmt/linux/include/osal.h
combo_mt66xx/wmt/linux/osal.c
combo_mt66xx/wmt/linux/stp_dbg.c
combo_mt66xx/wmt/linux/stp_sdio.c
combo_mt66xx/wmt/linux/stp_uart.c
combo_mt66xx/wmt/linux/wmt_chrdev wifi.c
combo_mt66xx/wmt/inux/wmt_dev.c
combo_mt66xx/wmt/platform/vendor/wmt_plat.c
1.1 修改combo_mt66xx/fm/core/fm_module.c
添加头文件:
#include <linux/version.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
修改函数fm_ops_ioctl第二行
struct fm_platform *plat = container_of(file_inode(filp)->i_cdev, struct fm_platform, cdev);
改为:
struct fm_platform *plat = container_of(filp->f_dentry->d_inode->i_cdev, struct fm_platform, cdev);
修改fm_proc_read操作函数
static ssize_t fm_proc_read(char *page, char **start, off_t off, fm_s32 count, fm_s32 *eof, void *data)
改为:
static ssize_t fm_proc_read(struct file *fp, char __user *buf,
size_t size, loff_t *pos)
修改fm_proc_write操作函数
static ssize_t fm_proc_write(char *page, char **start, off_t off, fm_s32 count, fm_s32 *eof, void *data)
改为:
static ssize_t fm_proc_write(struct file *fp, const char __user *buf,
size_t size, loff_t *pos)
添加proc fs操作函数集
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
static const struct file_operations proc_fops=
{
.read=fm_proc_read,
.write=fm_proc_write,
.owner=THIS_MODULE,
};
#endif
修改create_proc_entry
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
g_fm_proc = create_proc_entry(FM_PROC_FILE, 0444, NULL);
#else
g_fm_proc = proc_create(FM_PROC_FILE, 0444, NULL, &proc_fops);
#endif
if (g_fm_proc == NULL) {
WCN_DBG(FM_ALT | MAIN, "create_proc_entry failed\n");
ret = -ENOMEM;
goto ERR_EXIT;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
else {
g_fm_proc->read_proc = fm_proc_read;
g_fm_proc->write_proc = fm_proc_write;
WCN_DBG(FM_NTC | MAIN, "create_proc_entry success\n");
}
#endif
1.2 修改combo_mt66xx/fm/core/fm_patch.c
vfs_read改为kernel_read
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
ret = kernel_read(fp,(char __user *)dst, len,&pos);
#else
ret = vfs_read(fp, (char __user *)dst, len, &pos);
#endif
1.3 修改combo_mt66xx/gps/gps.c
添加头文件
#include <linux/sched/types.h> // struct sched_param
#include <linux/sched/signal.h>
1.4 修改combo_mt66xx/Kconfig
添加如下配置
config MTK_COMBO_WIFI
tristate "MediaTek Combo Chip Wi-Fi support"
default y
#depends on MTK_COMBO_WMT
depends on MMC
depends on IPV6
select WIRELESS_EXT
select WEXT_PRIV
help
This module adds support for wireless adapters based on
MTK MT66XX chipset.
This driver uses the kernel's wireless extensions subsystem.
If you choose to build a module, it'll be called dhd. Say M if
unsure.
1.5 修改combo_mt66xx/Makefile
obj-$(CONFIG_MTK_COMBO_FM) += fm/
obj-$(CONFIG_MTK_COMBO_BT) += bt/
obj-$(CONFIG_MTK_COMBO_GPS) += gps/
1.6 修改combo mt66xx/wmt/core/psm core.c
修改_stp_psm_stp_is_idle
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
static inline void _stp_psm_stp_is_idle(struct timer_list *t)
#else
static inline void _stp_psm_stp_is_idle(ULONG data)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
OSAL_TIMER *osl_timer = from_timer(osl_timer, t, timer);
MTKSTP_PSM_T *stp_psm = (MTKSTP_PSM_T*)osl_timer->timeroutHandlerData;
#else
MTKSTP_PSM_T *stp_psm = (MTKSTP_PSM_T *)data;
#endif
1.7 修改combo_mt66xx/wmt/core/stp_core.c
修改函数stp_tx_timeout_handler
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
static void stp_tx_timeout_handler(struct timer_list *t);
#else
static void stp_tx_timeout_handler(ULONG data);
#endif
设置传输控制指令支持的协议
STP_SET_SUPPORT_PROTOCOL(stp_core_ctx, MTKSTP_UART_FULL_MODE);
1.8 修改combo mt66xx/wmt/core/wmt_conf.c
打开使用配置文件宏定义
#define CFG_HAS_WMT_CFG (1)
修改函数wmt_conf_read_file
#if 1
osal_memset(&gDevWmt.cWmtcfgName[0], 0, osal_sizeof(gDevWmt.cWmtcfgName));
osal_strncat(&(gDevWmt.cWmtcfgName[0]), CUST_CFG_WMT_PREFIX, osal_sizeof(CUST_CFG_WMT_PREFIX));
osal_strncat(&(gDevWmt.cWmtcfgName[0]), CUST_CFG_WMT, osal_sizeof(CUST_CFG_WMT));
#endif
1.9 修改combo mt66xx/wmt/core/wmt_dbg.c
修改wmt_dev_dbg_read函数
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
static INT32 wmt_dev_dbg_read(CHAR *page, CHAR **start, off_t off, INT32 count, INT32 *eof, void *data)
#else
static ssize_t wmt_dev_dbg_read(struct file *fp, char __user *buf,
size_t size, loff_t *pos)
#endif
修改wmt_dev_dbg_write函数
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
static INT32 wmt_dev_dbg_write(struct file *file, const CHAR *buffer, ULONG count, void *data)
#else
static ssize_t wmt_dev_dbg_write(struct file *fp, const char __user *buffer,
size_t count, loff_t *pos)
#endif
添加proc fs操作函数集
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
static const struct file_operations proc_fops=
{
.read=wmt_dev_dbg_read,
.write=wmt_dev_dbg_write,
.owner=THIS_MODULE,
};
#endif
1.10 修改combo_mt66xx/wmt/linux/hif_sdio.c
添加如下定义
#ifdef MTK_CMB_SDIO_EINT
#undef MTK_CMB_SDIO_EINT
#define MTK_CMB_SDIO_EINT (1) //add by dg
#endif
1.11 修改combo_mt66xx/wmt/linux/hif_sdio_eint.c
添加头文件
#include <linux/of_gpio.h>
添加add_quirk函数
static void __maybe_unused add_quirk(struct mmc_card *card, int data)
{
card->quirks |= data;
}
修改request_irq
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
ret = request_irq(mtk_sdio_eint.sdio_eirq, mtk_hif_eint_isr, IRQF_TRIGGER_LOW, "MTK_SDIO_EINT", NULL);
#else
ret = request_irq(mtk_sdio_eint.sdio_eirq, mtk_hif_eint_isr, IRQF_TRIGGER_LOW | IRQF_DISABLED, "MTK_SDIO_EINT", NULL);
#endif
修改mmc_card_id为dev_name
ret = mtk_hif_mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
if (ret) {
HIF_SDIO_INFO_FUNC("%s: error %d reading SDIO_CCCR_INTx\n",
dev_name(&(card)->dev), ret);
return ret;
}
用extern将__mmc_claim_host和mmc_release_host拓展出来,新版本内核不给外部使用
extern int __mmc_claim_host(struct mmc_host *host, struct mmc_ctx *ctx,
atomic_t *abort);
ret = __mmc_claim_host(host, NULL,&(mtk_sdio_eint.irq_thread_abort));
if (ret)
{
mutex_unlock(&(mtk_sdio_eint.lock));
break;
}
//do { //TODO make sure we will not lost irq.
ret = mtk_hif_process_sdio_pending_irqs(host->card);
//while(ret > 0);
extern void mmc_release_host(struct mmc_host *host);
mmc_release_host(host);
修改hif_sdio_plt_probe函数通过设备树获取设备信息
static int hif_sdio_plt_probe(struct platform_device *pdev)
{
struct mtk_sdio_eint_platform_data p;
// struct mtk_sdio_eint_platform_data *p = pdev->dev.platform_data;
int ret = -EINVAL;
HIF_SDIO_INFO_FUNC("hif_sdio_plt_probe\n");
struct device_node *np = pdev->dev.of_node;
p.sdio_eint = of_get_named_gpio(np, "eint-gpios", 0);
HIF_SDIO_INFO_FUNC("will check gpio:%d\n",p.sdio_eint);
if (gpio_is_valid(p.sdio_eint)) {
ret = gpio_request(p.sdio_eint, "MT66XX SDIO EINT");
if (ret) {
HIF_SDIO_INFO_FUNC("SDIO EINT gpio_request fail, ret = %d\n", ret);
mtk_sdio_eint.sdio_eirq = -EINVAL;
} else {
mtk_sdio_eint.sdio_eirq = gpio_to_irq(p.sdio_eint);
HIF_SDIO_INFO_FUNC("get SDIO EIRQ success: %d\n", mtk_sdio_eint.sdio_eirq);
}
} else {
HIF_SDIO_INFO_FUNC("invalid SDIO EINT gpio:%d\n", p.sdio_eint);
}
return ret;
}
修改hif_sdio_plt_remove函数,通过设备树接口获取设备信息
static int hif_sdio_plt_remove(struct platform_device *pdev)
{
struct mtk_sdio_eint_platform_data p;
// struct mtk_sdio_eint_platform_data *p = pdev->dev.platform_data;
struct device_node *np = pdev->dev.of_node;
p.sdio_eint = of_get_named_gpio(np, "eint-gpios", 0);
if (gpio_is_valid(p.sdio_eint)) {
mtk_sdio_eint.sdio_eirq = -EINVAL;
gpio_free(p.sdio_eint);
}
return 0;
}
添加match表
static const struct of_device_id mtk_sdio_eint_of_match[] = {
{
.compatible = "mtk_sdio_eint",
},
};
修改hif_sdio_plt_driver
static struct platform_driver hif_sdio_plt_driver = {
.probe = hif_sdio_plt_probe,
.remove = hif_sdio_plt_remove,
.driver = {
.name = "mtk_sdio_eint",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(mtk_sdio_eint_of_match),
},
};
1.12 修改combo_mt66xxwmt/linux/include/osal.h
注释掉唤醒锁
//#include <linux/wakelock.h>
typedef struct _OSAL_WAKE_LOCK_
{
// struct wake_lock wake_lock;
struct mutex wake_lock;
UINT8 name[MAX_WAKE_LOCK_NAME_LEN];
} OSAL_WAKE_LOCK, *P_OSAL_WAKE_LOCK;
修改定时器回调函数定义
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
typedef VOID (*P_TIMEOUT_HANDLER)(struct timer_list *);
#else
typedef VOID (*P_TIMEOUT_HANDLER)(ULONG);
#endif
1.13 修改combo_mt66xx/wmt/linux/osal.c
修改osal_timer_create
INT32 osal_timer_create(P_OSAL_TIMER pTimer)
{
struct timer_list *timer = &pTimer->timer;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
timer_setup(timer, pTimer->timeoutHandler, 0);
#else
init_timer(timer);
timer->function = pTimer->timeoutHandler;
timer->data = (ULONG)pTimer->timeroutHandlerData;
#endif
return 0;
}
注释掉唤醒锁相关函数,新版本内核暂不知道怎么添加
INT32 osal_wake_lock_init(P_OSAL_WAKE_LOCK pLock)
{
// if(!pLock)
// {
// return -1;
// }
// else
// {
// wake_lock_init(&pLock->wake_lock, WAKE_LOCK_SUSPEND, pLock->name);
device_init_wakeup
// return 0;
// }
return 0;
}
INT32 osal_wake_lock(P_OSAL_WAKE_LOCK pLock)
{
// if(!pLock)
// {
// return -1;
// }
// else
// {
// wake_lock(&pLock->wake_lock);
//
// return 0;
// }
return 0;
}
INT32 osal_wake_unlock(P_OSAL_WAKE_LOCK pLock)
{
// if(!pLock)
// {
// return -1;
// }
// else
// {
// wake_unlock(&pLock->wake_lock);
//
// return 0;
// }
return 0;
}
INT32 osal_wake_lock_count(P_OSAL_WAKE_LOCK pLock)
{
INT32 count = 0;
//
// if(!pLock)
// {
// return -1;
// }
// else
// {
// count = wake_lock_active(&pLock->wake_lock);
// return count;
// }
return count;
}
修改获取时间函数
osal_gettimeofday
INT32 osal_gettimeofday(PINT32 sec, PINT32 usec)
{
INT32 ret = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
struct timespec64 now;
ktime_get_real_ts64(&now);
#else
struct timeval now;
do_gettimeofday(&now);
#endif
if(sec != NULL)
*sec = now.tv_sec;
else
ret = -1;
if(usec != NULL)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
*usec = now.tv_nsec / 1000;
#else
*usec = now.tv_usec;
#endif
else
ret = -1;
return ret;
}
1.14 修改combo_mt66xx/wmt/linux/stp_dbg.c
定义宏#define GENL_ID_GENERATE 0
修改stp_dbg_netlink_ops
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,2))
static const struct genl_ops stp_dbg_netlink_ops[] = {
{
.cmd = STP_DBG_COMMAND_BIND,
.flags = 0,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0))
.policy = stp_dbg_genl_policy,
#endif
.doit = stp_dbg_nl_bind,
.dumpit = NULL,
},
{
.cmd = STP_DBG_COMMAND_RESET,
.flags = 0,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0))
.policy = stp_dbg_genl_policy,
#endif
.doit = stp_dbg_nl_reset,
.dumpit = NULL,
},
};
#else
/* operation definition */
static struct genl_ops stp_dbg_gnl_ops_bind = {
.cmd = STP_DBG_COMMAND_BIND,
.flags = 0,
.policy = stp_dbg_genl_policy,
.doit = stp_dbg_nl_bind,
.dumpit = NULL,
};
static struct genl_ops stp_dbg_gnl_ops_reset = {
.cmd = STP_DBG_COMMAND_RESET,
.flags = 0,
.policy = stp_dbg_genl_policy,
.doit = stp_dbg_nl_reset,
.dumpit = NULL,
};
#endif
新增变量stp_dbg_gnl_family
static struct genl_family stp_dbg_gnl_family = {
.id = GENL_ID_GENERATE,
.hdrsize = 0,
.name = STP_DBG_FAMILY_NAME,
.version = 1,
.maxattr = STP_DBG_ATTR_MAX,
.ops = stp_dbg_netlink_ops,
.n_ops = ARRAY_SIZE(stp_dbg_netlink_ops),
.module = THIS_MODULE,
};
修改core_dump_timeout_handler
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
static inline void core_dump_timeout_handler(struct timer_list *t)
#else
static void core_dump_timeout_handler(ULONG data)
#endif
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
OSAL_TIMER *OSalTimer = from_timer(OSalTimer, t, timer);
P_WCN_CORE_DUMP_T dmp = (P_WCN_CORE_DUMP_T)OSalTimer->timeroutHandlerData;
#else
P_WCN_CORE_DUMP_T dmp = (P_WCN_CORE_DUMP_T)data;
#endif
STP_DBG_INFO_FUNC(" start\n");
stp_btm_notify_coredump_timeout_wq(g_stp_dbg->btm);
STP_DBG_INFO_FUNC(" end\n");
if (dmp) {
dmp->sm = CORE_DUMP_TIMEOUT;
}
}
修改stp_dbg_fill_hdr内的时间戳获取函数
static int stp_dbg_fill_hdr(struct stp_dbg_pkt_hdr *hdr, int type, int ack, int seq, int crc, int dir, int len, int dbg_type){
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
struct timespec64 now;
#else
struct timeval now;
#endif
if(!hdr){
STP_DBG_ERR_FUNC("function invalid\n");
return -EINVAL;
} else {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
ktime_get_real_ts64(&now);
#else
do_gettimeofday(&now);
#endif
hdr->dbg_type = dbg_type;
hdr->ack = ack;
hdr->seq = seq;
hdr->sec = now.tv_sec;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
hdr->usec = now.tv_nsec/1000;
#else
hdr->usec = now.tv_usec;
#endif
hdr->crc = crc;
hdr->dir = dir;//rx
hdr->dmy = 0xffffffff;
hdr->len = len;
hdr->type = type;
return 0;
}
}
修改stp_dbg_nl_init
static void stp_dbg_nl_init(void)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,2))
if(genl_register_family(&stp_dbg_gnl_family) != 0)
{
STP_DBG_ERR_FUNC("%s(): GE_NELINK family registration fail\n", __func__);
}
#else
if(genl_register_family(&stp_dbg_gnl_family) != 0)
{
STP_DBG_ERR_FUNC("%s(): GE_NELINK family registration fail\n", __func__);
}
else
{
if(genl_register_ops(&stp_dbg_gnl_family, &stp_dbg_gnl_ops_bind) != 0)
{
STP_DBG_ERR_FUNC("%s(): BIND operation registration fail\n", __func__);
}
if(genl_register_ops(&stp_dbg_gnl_family, &stp_dbg_gnl_ops_reset) != 0)
{
STP_DBG_ERR_FUNC("%s(): RESET operation registration fail\n", __func__);
}
}
#endif
return;
}
修改stp_dbg_nl_bind
if(num_bind_process < MAX_BIND_PROCESS)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,2))
bind_pid[num_bind_process] = info->snd_portid;
num_bind_process++;
STP_DBG_INFO_FUNC("%s():-> pid = %d\n", __func__, info->snd_portid);
#else
bind_pid[num_bind_process] = info->snd_pid;
num_bind_process++;
STP_DBG_INFO_FUNC("%s():-> pid = %d\n", __func__, info->snd_pid);
#endif
}
else
{
STP_DBG_ERR_FUNC("%s(): exceeding binding limit %d\n", __func__, MAX_BIND_PROCESS);
}
1.15 修改combo_mt66xx/wmt/linux/stp_sdio.c
修改stp_sdio_rxdbg_read
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
static int
stp_sdio_rxdbg_read (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data
)
#else
static ssize_t stp_sdio_rxdbg_read(struct file *fp, char __user *buf,
size_t size, loff_t *pos)
#endif
修改stp_sdio_rxdbg_write
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
static int
stp_sdio_rxdbg_write (
struct file *file,
const char *buffer,
unsigned long count,
void *data
)
#else
static ssize_t stp_sdio_rxdbg_write(
struct file *filp, const char __user *buffer,
size_t count, loff_t *ppos)
#endif
添加proc fs操作函数集
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
static const struct file_operations stp_sdio_rxdbg__proc_fopss = {
.read=stp_sdio_rxdbg_read,
.write=stp_sdio_rxdbg_write,
.owner=THIS_MODULE,
};
#endif
修改stp_sdio_rxdbg_setup
INT32
stp_sdio_rxdbg_setup(VOID)
{
stp_sdio_rxdbg_cnt = 0;
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
gStpSdioRxDbgEntry = create_proc_entry(STP_SDIO_RXDBG_PROCNAME, 0666, NULL);
if (gStpSdioRxDbgEntry == NULL){
printk(KERN_WARNING DFT_TAG"Unable to create /proc entry\n\r");
return -1;
}
gStpSdioRxDbgEntry->read_proc = stp_sdio_rxdbg_read;
gStpSdioRxDbgEntry->write_proc = stp_sdio_rxdbg_write;
#else
gStpSdioRxDbgEntry = proc_create(STP_SDIO_RXDBG_PROCNAME, 0666, NULL, &stp_sdio_rxdbg__proc_fopss);
if(gStpSdioRxDbgEntry == NULL) {
printk(KERN_WARNING DFT_TAG"Unable to create /proc entry\n\r");
return -1;
}
#endif
return 0;
}
修改stp_sdio_txdbg_read
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
static int
stp_sdio_txdbg_read (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data
)
#else
static ssize_t stp_sdio_txdbg_read(struct file *fp, char __user *buf,
size_t size, loff_t *pos)
#endif
{
// if (off > 0){
// return 0;
// }
stp_sdio_txdbg_dump();
stp_sdio_txperf_dump();
return 0;
}
修改stp_sdio_txdbg_write
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
static int
stp_sdio_txdbg_write (
struct file *file,
const char *buffer,
unsigned long count,
void *data
)
#else
static ssize_t stp_sdio_txdbg_write (
struct file *filp, const char __user *buffer,
size_t count, loff_t *ppos)
#endif
{
size_t len = count;
printk(KERN_INFO DFT_TAG"write parameter len = %d\n\r", (int)len);
return len;
}
修改stp_sdio_owndbg_read
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
static int
stp_sdio_owndbg_read (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data
)
#else
static ssize_t stp_sdio_owndbg_read(struct file *fp, char __user *buf,
size_t size, loff_t *pos)
#endif
{
// if (off > 0){
// return 0;
// }
return 0;
}
修改stp_sdio_owndbg_write
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
static int stp_sdio_owndbg_write (
struct file *file,
const char *buffer,
unsigned long count,
void *data
)
#else
static ssize_t stp_sdio_owndbg_write(
struct file *filp, const char __user *buffer,
size_t count, loff_t *ppos)
#endif
添加操作函数集
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
static const struct file_operations stp_sdio_txdbg_proc_fopss = {
.read=stp_sdio_txdbg_read,
.write=stp_sdio_txdbg_write,
.owner=THIS_MODULE,
};
#endif
修改stp_sdio_txdbg_setup,create_proc_entry改为proc_create
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
gStpSdioTxDbgEntry = create_proc_entry(STP_SDIO_TXDBG_PROCNAME, 0666, NULL);
if (gStpSdioTxDbgEntry == NULL){
printk(KERN_WARNING DFT_TAG"Unable to create /proc entry\n\r");
return -1;
}
gStpSdioTxDbgEntry->read_proc = stp_sdio_txdbg_read;
gStpSdioTxDbgEntry->write_proc = stp_sdio_txdbg_write;
#else
gStpSdioTxDbgEntry = proc_create(STP_SDIO_TXDBG_PROCNAME, 0666, NULL, &stp_sdio_txdbg_proc_fopss);
if(gStpSdioTxDbgEntry == NULL) {
printk(KERN_WARNING DFT_TAG"Unable to create /proc entry\n\r");
return -1;
}
#endif
添加操作函数集
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
static const struct file_operations stp_sdio_owndbg_setup_proc_fopss = {
.read=stp_sdio_owndbg_read,
.write=stp_sdio_owndbg_write,
.owner=THIS_MODULE,
};
#endif
修改create_proc_entry为proc_create
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
gStpSdioOwnEntry = create_proc_entry(STP_SDIO_OWNDBG_PROCNAME, 0660, NULL);
if (gStpSdioOwnEntry == NULL){
printk(KERN_WARNING DFT_TAG"Unable to create /proc entry\n\r");
return -1;
}
gStpSdioOwnEntry->read_proc = stp_sdio_owndbg_read;
gStpSdioOwnEntry->write_proc = stp_sdio_owndbg_write;
#else
gStpSdioOwnEntry = proc_create(STP_SDIO_OWNDBG_PROCNAME, 0660, NULL, &stp_sdio_owndbg_setup_proc_fopss);
if(gStpSdioOwnEntry == NULL) {
printk(KERN_WARNING DFT_TAG"Unable to create /proc entry\n\r");
return -1;
}
#endif
1.16 修改combo_mt66xx/wmt/linux/stp_uart.c
修改函数stp_uart_tty_open
tty->low_latency = 1;
改为
tty->port->low_latency = 1;
1.17 修改combo_mt66xx/wmt/linux/wmt_chrdev wifi.c
注释掉extern int dev_change_name(struct net_device *dev, const char *newname)
//extern int dev_change_name(struct net_device *dev, const char *newname);
1.18 修改combo_mt66xx/wmt/inux/wmt_dev.c
添加头文件
#include <linux/of_device.h>
#include <linux/cred.h>
去掉fd->f_op->read判断
// if (!fd || IS_ERR(fd) || !fd->f_op || !fd->f_op->read) {
if (!fd || IS_ERR(fd) || !fd->f_op) {
修改fd->f_op->read
read_len = kernel_read(fd,(char __user *)pBuf + padSzBuf, file_len,&fd->f_pos);
修改wmt_dev_patch_get函数
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,2))
kuid_t orig_uid;
kgid_t orig_gid;
#else
uid_t orig_uid;
gid_t orig_gid;
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,2))
orig_uid = cred->fsuid;
orig_gid = cred->fsgid;
cred->fsuid.val = 0;
cred->fsgid.val = 0;
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
orig_uid = cred->fsuid;
orig_gid = cred->fsgid;
cred->fsuid = cred->fsgid = 0;
#else
orig_uid = current->fsuid;
orig_gid = current->fsgid;
current->fsuid = current->fsgid = 0;
#endif
修改宏定义
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
#define WMT_IOCTL_SET_PATCH_NAME _IOW(WMT_IOC_MAGIC,4,char*)
#define WMT_IOCTL_SET_STP_MODE _IOW(WMT_IOC_MAGIC,5,int)
#define WMT_IOCTL_FUNC_ONOFF_CTRL _IOW(WMT_IOC_MAGIC,6,int)
#define WMT_IOCTL_LPBK_POWER_CTRL _IOW(WMT_IOC_MAGIC,7,int)
#define WMT_IOCTL_LPBK_TEST _IOWR(WMT_IOC_MAGIC,8,char*)
#define WMT_IOCTL_GET_CHIP_INFO _IOR(WMT_IOC_MAGIC,12,int)
#define WMT_IOCTL_SET_LAUNCHER_KILL _IOW(WMT_IOC_MAGIC,13,int)
#define WMT_IOCTL_SET_PATCH_NUM _IOW(WMT_IOC_MAGIC,14,int)
#define WMT_IOCTL_SET_PATCH_INFO _IOW(WMT_IOC_MAGIC,15,char*)
#define WMT_IOCTL_PORT_NAME _IOWR(WMT_IOC_MAGIC, 20, char*)
#define WMT_IOCTL_WMT_CFG_NAME _IOWR(WMT_IOC_MAGIC, 21, char*)
#define WMT_IOCTL_WMT_QUERY_CHIPID _IOR(WMT_IOC_MAGIC, 22, int)
#define WMT_IOCTL_WMT_TELL_CHIPID _IOW(WMT_IOC_MAGIC, 23, int)
#define WMT_IOCTL_WMT_COREDUMP_CTRL _IOW(WMT_IOC_MAGIC, 24, int)
#else
#define WMT_IOCTL_SET_PATCH_NAME 4
#define WMT_IOCTL_SET_STP_MODE 5
#define WMT_IOCTL_FUNC_ONOFF_CTRL 6
#define WMT_IOCTL_LPBK_POWER_CTRL 7
#define WMT_IOCTL_LPBK_TEST 8
#define WMT_IOCTL_GET_CHIP_INFO 12
#define WMT_IOCTL_SET_LAUNCHER_KILL 13
#define WMT_IOCTL_SET_PATCH_NUM 14
#define WMT_IOCTL_SET_PATCH_INFO 15
#define WMT_IOCTL_PORT_NAME 20
#define WMT_IOCTL_WMT_CFG_NAME 21
#define WMT_IOCTL_WMT_QUERY_CHIPID 22
#define WMT_IOCTL_WMT_TELL_CHIPID 23
#define WMT_IOCTL_WMT_COREDUMP_CTRL 24
#endif
添加match表
static const struct of_device_id mtk_wmt_of_match[] = {
{
.compatible = "mtk_wmt,mtk_wmt-ctrl",
},
};
修改wmt_platform_driver
static struct platform_driver wmt_platform_driver = {
.probe = wmt_plt_probe,
.remove = wmt_plt_remove,
.driver = {
.name = "mtk_wmt",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(mtk_wmt_of_match),
},
};
1.19 修改combo_mt66xx/wmt/platform/vendor/wmt_plat.c
添加头文件
#include <linux/of_gpio.h>
删除头文件
//#include <mach/gpio.h>
//#include <mach/io.h>
修改函数wmt_plat_gpio_init
void wmt_plat_gpio_init(struct platform_device *pdev)
{
// struct mtk_wmt_platform_data *p = pdev->dev.platform_data;
struct device_node *np = pdev->dev.of_node;
wmt_pdata.pmu = of_get_named_gpio(np, "wmt-gpios", 0);
wmt_pdata.rst = of_get_named_gpio(np, "wmt-gpios", 1);
wmt_pdata.bgf_int = of_get_named_gpio(np, "wmt-gpios", 2);
// wmt_pdata.pmu = p->pmu;
// wmt_pdata.rst = p->rst;
// wmt_pdata.bgf_int = p->bgf_int;
// wmt_pdata.urt_cts = p->urt_cts;
// wmt_pdata.rtc = p->rtc;
// wmt_pdata.gps_sync = p->gps_sync;
// wmt_pdata.gps_lna = p->gps_lna;
wmt_plat_dump_pin_conf();
}
修改wmt_plat_sdio_ctrl
NT32 wmt_plat_sdio_ctrl (WMT_SDIO_SLOT_NUM sdioPortType, ENUM_FUNC_STATE on)
{
int ret = 0;
extern void power_mt6620_wlan_power_for_onoff(int on);
if (FUNC_OFF == on) {
/* add control logic here to generate SDIO CARD REMOVAL event to mmc/sd
* controller. SDIO card removal operation and remove success messages
* are expected.
*/
//add by dg 2015-04-14
power_mt6620_wlan_power_for_onoff(0);
}
else {
/* add control logic here to generate SDIO CARD INSERTION event to mmc/sd
* controller. SDIO card detection operation and detect success messages
* are expected.
*/
//add by dg 2015-04-14
power_mt6620_wlan_power_for_onoff(1);
}
//extern int omap_mmc_update_mtk_card_status(int state);
//ret = omap_mmc_update_mtk_card_status((FUNC_OFF == on)? 0: 1);
WMT_INFO_FUNC(KERN_INFO "%s, on=%d, ret=%d\n", __FUNCTION__, on, ret);
return ret;
}
修改request_irq入参,去掉IRQF_DISABLED
iRet = request_irq(g_bgf_irq, bgf_irq_handler, IRQF_TRIGGER_LOW | IRQF_DISABLED, "MTK6620_BT", NULL);
改为
iRet = request_irq(g_bgf_irq, bgf_irq_handler, IRQF_TRIGGER_LOW, "MTK6620_BT", NULL);
2.修改kernel_aux/files/drivers/net/wireless/combo_mt66xx目录驱动文件,适配新版本内核
涉及到修改的文件如下:
mt6620/wlan/mgmt/rlm.c
mt6620/wlan/mgmt/rsn.c
mt6620/wlan/os/linux/gl_bow.c
mt6620/wlan/os/linux/gl_cfg80211.c
mt6620/wlan/os/linux/gl_init.c
mt6620/wlan/os/linux/gl_kal.c
mt6620/wlan/os/linux/gl_p2p.c
mt6620/wlan/os/linux/gl_p2p_cfg80211.c
mt6620/wlan/os/linux/gl_p2p_kal.c
mt6620/wlan/os/linux/gl_rst.c
mt6620/wlan/os/linux/include/cfg80211.h
mt6620/wlan/os/linux/include/gl_kal.h
mt6620/wlan/os/linux/include/gl_p2p_ioctl.h
mt6620/wlan/os/linux/platform.c
mt6620/wlan/os/linux/gl_kal.c
2.1 修改mt6620/wlan/mgmt/rlm.c
修改函数rlmProcessSpecMgtAction
rlmProcessChannelSwitchIE(prAdapter, prRxFrame->aucInfoElem);
改为
rlmProcessChannelSwitchIE(prAdapter, (P_IE_CHANNEL_SWITCH_T)prRxFrame->aucInfoElem);
2.2 修改mt6620/wlan/mgmt/rsn.c
修改函数rsnParseRsnIE,在prRsnInfo->u4GroupKeyCipherSuite = u4GroupSuite;下面一行新增下面这行代码
prAdapter->rWifiVar.rConnSettings.rRsnInfo.u4GroupKeyCipherSuite = u4GroupSuite;
修改函数rsnIsSuitableBSS
if((prAdapter->rWifiVar.rConnSettings.rRsnInfo.u4GroupKeyCipherSuite & 0x000000FF) != \
GET_SELECTOR_TYPE(prBssRsnInfo->u4GroupKeyCipherSuite)){
改为
// if((prAdapter->rWifiVar.rConnSettings.rRsnInfo.u4GroupKeyCipherSuite & 0x000000FF) != \
GET_SELECTOR_TYPE(prBssRsnInfo->u4GroupKeyCipherSuite)){
if(GET_SELECTOR_TYPE(prAdapter->rWifiVar.rConnSettings.rRsnInfo.u4GroupKeyCipherSuite) != \
GET_SELECTOR_TYPE(prBssRsnInfo->u4GroupKeyCipherSuite)){
2.3 修改mt6620/wlan/os/linux/gl_bow.c
修改函数mt6620_ampc_ioctl
static long
mt6620_ampc_ioctl(
IN struct file *filp,
IN unsigned int cmd,
IN OUT unsigned long arg)
{
int err = 0;
P_GLUE_INFO_T prGlueInfo;
prGlueInfo = (P_GLUE_INFO_T)(filp->private_data);
ASSERT(prGlueInfo);
if ((prGlueInfo->rBowInfo.fgIsRegistered == FALSE) || (prGlueInfo->u4Flag & GLUE_FLAG_HALT)) {
return -EFAULT;
}
// permission check
if(_IOC_DIR(cmd) & _IOC_READ)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
err = !access_ok((void __user *)arg, _IOC_SIZE(cmd));
#else
err = !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd));
#endif
else if (_IOC_DIR(cmd) & _IOC_WRITE)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
err = !access_ok((void __user *)arg, _IOC_SIZE(cmd));
#else
err = !access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd));
#endif
if (err)
return -EFAULT;
// no ioctl is implemented yet
return 0;
}
修改函数kalInitBowDevice
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
prGlueInfo->rBowInfo.prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), prDevName,NET_NAME_UNKNOWN, ether_setup, CFG_MAX_TXQ_NUM);
#else
prGlueInfo->rBowInfo.prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), prDevName, ether_setup, CFG_MAX_TXQ_NUM);
#endif
2.4 修改mt6620/wlan/os/linux/gl_cfg80211.c
修改函数mtk_cfg80211_change_iface
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_change_iface (
struct wiphy *wiphy,
struct net_device *dev,
enum nl80211_iftype type,
struct vif_params *params)
#else
int
mtk_cfg80211_change_iface (
struct wiphy *wiphy,
struct net_device *ndev,
enum nl80211_iftype type,
u32 *flags,
struct vif_params *params
)
#endif
修改函数mtk_cfg80211_get_station
//第1处
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_get_station (
struct wiphy *wiphy,
struct net_device *dev,
const u8 *mac, struct station_info *sinfo)
#else
int
mtk_cfg80211_get_station (
struct wiphy *wiphy,
struct net_device *ndev,
const u8 *mac,
struct station_info *sinfo
)
#endif
//第2处
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
sinfo->filled |= STATION_INFO_TX_BITRATE;
#else
sinfo->filled |= NL80211_STA_INFO_TX_BITRATE;
#endif
//第3处
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
sinfo->filled |= STATION_INFO_SIGNAL;
#else
sinfo->filled |= NL80211_STA_INFO_SIGNAL;
#endif
//第4处
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
sinfo->filled |= STATION_INFO_TX_PACKETS;
#else
sinfo->filled |= NL80211_STA_INFO_TX_PACKETS;
#endif
//第5处
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
sinfo->filled |= STATION_INFO_TX_FAILED;
#else
sinfo->filled |= NL80211_STA_INFO_TX_FAILED;
#endif
修改函数mtk_cfg80211_scan
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_scan (struct wiphy *wiphy,
struct cfg80211_scan_request *request)
#else
int
mtk_cfg80211_scan (
struct wiphy *wiphy,
struct net_device *ndev,
struct cfg80211_scan_request *request
)
#endif
修改函数mtk_cfg80211_join_ibss
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
if(params->channel) {
u4ChnlFreq = nicChannelNum2Freq(params->channel->hw_value);
rStatus = kalIoctl(prGlueInfo,
wlanoidSetFrequency,
&u4ChnlFreq,
sizeof(u4ChnlFreq),
FALSE,
FALSE,
FALSE,
FALSE,
&u4BufLen);
if (rStatus != WLAN_STATUS_SUCCESS) {
return -EFAULT;
}
}
#else
if(params->chandef.chan) {
u4ChnlFreq = nicChannelNum2Freq(params->chandef.chan->hw_value);
rStatus = kalIoctl(prGlueInfo,
wlanoidSetFrequency,
&u4ChnlFreq,
sizeof(u4ChnlFreq),
FALSE,
FALSE,
FALSE,
FALSE,
&u4BufLen);
if (rStatus != WLAN_STATUS_SUCCESS) {
return -EFAULT;
}
}
#endif
修改函数mtk_cfg80211_remain_on_channel
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_remain_on_channel(
struct wiphy *wiphy,
struct wireless_dev *wdev,
struct ieee80211_channel *chan,
unsigned int duration,
u64 *cookie)
#else
int
mtk_cfg80211_remain_on_channel (
struct wiphy *wiphy,
struct net_device *ndev,
struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type,
unsigned int duration,
u64 *cookie
)
#endif
修改函数mtk_cfg80211_cancel_remain_on_channel
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_cancel_remain_on_channel (
struct wiphy *wiphy,
struct wireless_dev *wdev,
u64 cookie)
#else
int
mtk_cfg80211_cancel_remain_on_channel (
struct wiphy *wiphy,
struct net_device *ndev,
u64 cookie
)
#endif
修改函数mtk_cfg80211_mgmt_tx
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_mgmt_tx(
struct wiphy *wiphy,
struct wireless_dev *wdev,
struct cfg80211_mgmt_tx_params *params,
u64 *cookie)
#else
int
mtk_cfg80211_mgmt_tx (
struct wiphy *wiphy,
struct net_device *ndev,
struct ieee80211_channel *channel,
bool offscan,
enum nl80211_channel_type channel_type,
bool channel_type_valid,
unsigned int wait,
const u8 *buf,
size_t len,
bool no_cck,
bool dont_wait_for_ack,
u64 *cookie
)
#endif
修改函数mtk_cfg80211_mgmt_tx_cancel_wait
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_mgmt_tx_cancel_wait (
struct wiphy *wiphy,
struct wireless_dev *wdev,
u64 cookie)
#else
int
mtk_cfg80211_mgmt_tx_cancel_wait (
struct wiphy *wiphy,
struct net_device *ndev,
u64 cookie
)
#endif
修改函数mtk_cfg80211_testmode_cmd
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int mtk_cfg80211_testmode_cmd(
struct wiphy *wiphy,
struct wireless_dev *wdev,
void *data, int len)
#else
int mtk_cfg80211_testmode_cmd(
IN struct wiphy *wiphy,
IN void *data,
IN int len
)
#endif
2.5 修改mt6620/wlan/os/linux/gl_init.c
修改宏定义CHAN2G
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
#define CHAN2G(_channel, _freq, _flags) \
{ \
.band = NL80211_BAND_2GHZ, \
.center_freq = (_freq), \
.hw_value = (_channel), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
}
#else
#define CHAN2G(_channel, _freq, _flags) \
{ \
.band = IEEE80211_BAND_2GHZ, \
.center_freq = (_freq), \
.hw_value = (_channel), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
}
#endif
修改宏定义CHAN5G
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
#define CHAN5G(_channel, _flags) \
{ \
.band = NL80211_BAND_5GHZ, \
.center_freq = 5000 + (5 * (_channel)), \
.hw_value = (_channel), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
}
#else
#define CHAN5G(_channel, _flags) \
{ \
.band = IEEE80211_BAND_5GHZ, \
.center_freq = 5000 + (5 * (_channel)), \
.hw_value = (_channel), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
}
#endif
修改变量mtk_band_2ghz
struct ieee80211_supported_band mtk_band_2ghz = {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
.band = NL80211_BAND_2GHZ,
#else
.band = IEEE80211_BAND_2GHZ,
#endif
.channels = mtk_2ghz_channels,
.n_channels = ARRAY_SIZE(mtk_2ghz_channels),
.bitrates = mtk_g_rates,
.n_bitrates = mtk_g_rates_size,
.ht_cap = MT6620_HT_CAP,
};
修改变量mtk_band_5ghz
struct ieee80211_supported_band mtk_band_5ghz = {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
.band = NL80211_BAND_5GHZ,
#else
.band = IEEE80211_BAND_5GHZ,
#endif
.channels = mtk_5ghz_channels,
.n_channels = ARRAY_SIZE(mtk_5ghz_channels),
.bitrates = mtk_a_rates,
.n_bitrates = mtk_a_rates_size,
.ht_cap = MT6620_HT_CAP,
};
修改函数wlanSelectQueue
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
static UINT_16
wlanSelectQueue (struct net_device *dev,
struct sk_buff *skb,
struct net_device *sb_dev)
#else
static UINT_16
wlanSelectQueue(
struct net_device *dev,
struct sk_buff *skb)
#endif
修改函数wlanNetCreate
第1处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
prWdev->wiphy->bands[NL80211_BAND_2GHZ] = &mtk_band_2ghz;
//for the WPS probe request suband issue
//prWdev->wiphy->bands[NL80211_BAND_5GHZ] = &mtk_band_5ghz;
prWdev->wiphy->bands[NL80211_BAND_5GHZ] = NULL;
#else
prWdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &mtk_band_2ghz;
//for the WPS probe request suband issue
//prWdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &mtk_band_5ghz;
prWdev->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
#endif
第2处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
prWdev->wiphy->flags = WIPHY_FLAG_SUPPORTS_FW_ROAM;
#else
prWdev->wiphy->flags = WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_SUPPORTS_FW_ROAM;
#endif
第3处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
prGlueInfo->prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), NIC_INF_NAME, NET_NAME_UNKNOWN,ether_setup, CFG_MAX_TXQ_NUM);
#else
prGlueInfo->prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), NIC_INF_NAME,ether_setup, CFG_MAX_TXQ_NUM);
#endif
第4处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
prGlueInfo->prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), LEGACY_IN_AP_MODE, NET_NAME_UNKNOWN,ether_setup, CFG_MAX_TXQ_NUM);
#else
prGlueInfo->prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), LEGACY_IN_AP_MODE,ether_setup, CFG_MAX_TXQ_NUM);
#endif
修改函数wlanProbe
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
prWdev->wiphy->bands[NL80211_BAND_5GHZ] = &mtk_band_5ghz;
#else
prWdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &mtk_band_5ghz;
#endif
修改函数wlanRemove
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
flush_workqueue(workq.wq);
#else
flush_delayed_work_sync(&workq);
#endif
2.6 修改mt6620/wlan/os/linux/gl_kal.c
修改函数kalFirmwareOpen
第1处修改
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18))
struct cred *cred = (struct cred *) get_current_cred();
orgfsuid = cred->fsuid.val;
orgfsgid = cred->fsgid.val;
cred->fsuid.val = cred->fsgid.val = 0;
#else
struct cred *cred = (struct cred *) get_current_cred();
orgfsuid = cred->fsuid;
orgfsgid = cred->fsgid;
cred->fsuid = cred->fsgid = 0;
#endif
第2处修改
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18))
set_fs(KERNEL_DS);
#else
set_fs(get_ds());
#endif
第3处修改
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
current->fsuid = orgfsuid;
current->fsgid = orgfsgid;
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18))
cred->fsuid.val = orgfsuid;
cred->fsgid.val = orgfsgid;
put_cred(cred);
#else
cred->fsuid = orgfsuid;
cred->fsgid = orgfsgid;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
put_cred(cred);
#endif
#endif
修改函数kalFirmwareClose
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18))
cred->fsuid.val = orgfsuid;
cred->fsgid.val = orgfsgid;
#else
cred->fsuid = orgfsuid;
cred->fsgid = orgfsgid;
#endif
修改函数kalFirmwareLoad
WLAN_STATUS
kalFirmwareLoad (
IN P_GLUE_INFO_T prGlueInfo,
OUT PVOID prBuf,
IN UINT_32 u4Offset,
OUT PUINT_32 pu4Size
)
{
ASSERT(prGlueInfo);
ASSERT(pu4Size);
ASSERT(prBuf);
//l = filp->f_path.dentry->d_inode->i_size;
/* the object must have a read method */
// if ((filp == NULL) || IS_ERR(filp) || (filp->f_op == NULL) || (filp->f_op->read == NULL)) {
if ((filp == NULL) || IS_ERR(filp) || (filp->f_op == NULL)) {
DBGLOG(INIT, ERROR, ( " error\n"));
goto error_read;
} else {
filp->f_pos = u4Offset;
// *pu4Size = filp->f_op->read(filp, prBuf, *pu4Size, &filp->f_pos);
*pu4Size = kernel_read(filp,(char __user *)prBuf, *pu4Size,&filp->f_pos);
}
DBGLOG(INIT, INFO, ( " succes\n"));
return WLAN_STATUS_SUCCESS;
error_read:
return WLAN_STATUS_FAILURE;
}
修改函数kalRxIndicatePkts
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
prNetDev->last_rx = jiffies;
#endif
修改函数kalIndicateStatusAndComplete
第1处修改
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18))
if(ucChannelNum <= 14) {
prChannel = ieee80211_get_channel(priv_to_wiphy(prGlueInfo), ieee80211_channel_to_frequency(ucChannelNum, NL80211_BAND_2GHZ));
}
else {
prChannel = ieee80211_get_channel(priv_to_wiphy(prGlueInfo), ieee80211_channel_to_frequency(ucChannelNum, NL80211_BAND_5GHZ));
}
#else
if(ucChannelNum <= 14) {
prChannel = ieee80211_get_channel(priv_to_wiphy(prGlueInfo), ieee80211_channel_to_frequency(ucChannelNum, IEEE80211_BAND_2GHZ));
}
else {
prChannel = ieee80211_get_channel(priv_to_wiphy(prGlueInfo), ieee80211_channel_to_frequency(ucChannelNum, IEEE80211_BAND_5GHZ));
}
#endif
第2处修改
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18))
/* ensure BSS exists */
bss = cfg80211_get_bss(priv_to_wiphy(prGlueInfo), prChannel, arBssid,
ssid.aucSsid, ssid.u4SsidLen,
prGlueInfo->prDevHandler->ieee80211_ptr->conn_bss_type,
IEEE80211_PRIVACY_ANY);
#else
/* ensure BSS exists */
bss = cfg80211_get_bss(priv_to_wiphy(prGlueInfo), prChannel, arBssid,
ssid.aucSsid, ssid.u4SsidLen,
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
#endif
第3处修改
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18))
bss = cfg80211_inform_bss(priv_to_wiphy(prGlueInfo),
prChannel,
CFG80211_BSS_FTYPE_BEACON,
arBssid,
0, /* TSF */
WLAN_CAPABILITY_ESS,
prBssDesc->u2BeaconInterval, /* beacon interval */
prBssDesc->aucIEBuf, /* IE */
prBssDesc->u2IELength, /* IE Length */
RCPI_TO_dBm(prBssDesc->ucRCPI) * 100, /* MBM */
GFP_KERNEL);
#else
bss = cfg80211_inform_bss(priv_to_wiphy(prGlueInfo),
prChannel,
arBssid,
0, /* TSF */
WLAN_CAPABILITY_ESS,
prBssDesc->u2BeaconInterval, /* beacon interval */
prBssDesc->aucIEBuf, /* IE */
prBssDesc->u2IELength, /* IE Length */
RCPI_TO_dBm(prBssDesc->ucRCPI) * 100, /* MBM */
GFP_KERNEL);
#endif
第四处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
if(eStatus == WLAN_STATUS_MEDIA_CONNECT) {
struct wireless_dev *wdev = prGlueInfo->prDevHandler->ieee80211_ptr;
memcpy(wdev->ssid, ssid.aucSsid, ssid.u4SsidLen);
wdev->ssid_len = ssid.u4SsidLen;
cfg80211_connect_result(prGlueInfo->prDevHandler,
arBssid,
prGlueInfo->aucReqIe,
prGlueInfo->u4ReqIeLength,
prGlueInfo->aucRspIe,
prGlueInfo->u4RspIeLength,
WLAN_STATUS_SUCCESS,
GFP_KERNEL);
}
else if(eStatus == WLAN_STATUS_ROAM_OUT_FIND_BEST) {
struct ieee80211_channel *prChannel = NULL;
UINT_8 ucChannelNum = wlanGetChannelNumberByNetwork(prGlueInfo->prAdapter, NETWORK_TYPE_AIS_INDEX);
if(ucChannelNum <= 14) {
prChannel = ieee80211_get_channel(priv_to_wiphy(prGlueInfo), ieee80211_channel_to_frequency(ucChannelNum, NL80211_BAND_2GHZ));
}
else {
prChannel = ieee80211_get_channel(priv_to_wiphy(prGlueInfo), ieee80211_channel_to_frequency(ucChannelNum, NL80211_BAND_5GHZ));
}
struct cfg80211_roam_info roam_info;
roam_info.channel = prChannel;
roam_info.bssid = arBssid;
roam_info.req_ie = prGlueInfo->aucReqIe;
roam_info.req_ie_len = prGlueInfo->u4ReqIeLength;
roam_info.resp_ie = prGlueInfo->aucRspIe;
roam_info.resp_ie_len = prGlueInfo->u4RspIeLength;
cfg80211_roamed(prGlueInfo->prDevHandler,&roam_info,GFP_KERNEL);
}
#else
if(eStatus == WLAN_STATUS_MEDIA_CONNECT
&& prGlueInfo->prDevHandler->ieee80211_ptr->sme_state == CFG80211_SME_CONNECTING) {
cfg80211_connect_result(prGlueInfo->prDevHandler,
arBssid,
prGlueInfo->aucReqIe,
prGlueInfo->u4ReqIeLength,
prGlueInfo->aucRspIe,
prGlueInfo->u4RspIeLength,
WLAN_STATUS_SUCCESS,
GFP_KERNEL);
}
else if(eStatus == WLAN_STATUS_ROAM_OUT_FIND_BEST
&& prGlueInfo->prDevHandler->ieee80211_ptr->sme_state == CFG80211_SME_CONNECTED) {
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 3, 0)
cfg80211_roamed_bss(prGlueInfo->prDevHandler,
bss,
prGlueInfo->aucReqIe,
prGlueInfo->u4ReqIeLength,
prGlueInfo->aucRspIe,
prGlueInfo->u4RspIeLength,
GFP_KERNEL);
#else
struct ieee80211_channel *prChannel = NULL;
UINT_8 ucChannelNum = wlanGetChannelNumberByNetwork(prGlueInfo->prAdapter, NETWORK_TYPE_AIS_INDEX);
if(ucChannelNum <= 14) {
prChannel = ieee80211_get_channel(priv_to_wiphy(prGlueInfo), ieee80211_channel_to_frequency(ucChannelNum, IEEE80211_BAND_2GHZ));
}
else {
prChannel = ieee80211_get_channel(priv_to_wiphy(prGlueInfo), ieee80211_channel_to_frequency(ucChannelNum, IEEE80211_BAND_5GHZ));
}
cfg80211_roamed(prGlueInfo->prDevHandler,
prChannel,
arBssid,
prGlueInfo->aucReqIe,
prGlueInfo->u4ReqIeLength,
prGlueInfo->aucRspIe,
prGlueInfo->u4RspIeLength,
GFP_KERNEL);
#endif
}
#endif
第5处修改
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18))
if(prGlueInfo->fgIsRegistered == TRUE) {
cfg80211_disconnected(prGlueInfo->prDevHandler, 0, NULL, 0,true, GFP_KERNEL);
}
#else
if(prGlueInfo->fgIsRegistered == TRUE
&& prGlueInfo->prDevHandler->ieee80211_ptr->sme_state == CFG80211_SME_CONNECTED) {
/* CFG80211 Indication */
cfg80211_disconnected(prGlueInfo->prDevHandler, 0, NULL, 0, GFP_KERNEL);
}
#endif
第6处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
cfg80211_connect_result(prGlueInfo->prDevHandler,
prGlueInfo->prAdapter->rWifiVar.rAisFsmInfo.prTargetBssDesc->aucBSSID,
prGlueInfo->aucReqIe,
prGlueInfo->u4ReqIeLength,
prGlueInfo->aucRspIe,
prGlueInfo->u4RspIeLength,
REASON_CODE_UNSPECIFIED,
GFP_KERNEL);
#else
/* indicate AIS Jion fail event */
if(prGlueInfo->prDevHandler->ieee80211_ptr->sme_state == CFG80211_SME_CONNECTING) {
cfg80211_connect_result(prGlueInfo->prDevHandler,
prGlueInfo->prAdapter->rWifiVar.rAisFsmInfo.prTargetBssDesc->aucBSSID,
prGlueInfo->aucReqIe,
prGlueInfo->u4ReqIeLength,
prGlueInfo->aucRspIe,
prGlueInfo->u4RspIeLength,
REASON_CODE_UNSPECIFIED,
GFP_KERNEL);
}
#endif
修改函数kalOsTimerInitialize
VOID
kalOsTimerInitialize (
IN P_GLUE_INFO_T prGlueInfo,
IN PVOID prTimerHandler
)
{
ASSERT(prGlueInfo);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
timer_setup(&prGlueInfo->tickfn, prTimerHandler, 0);
#else
init_timer(&(prGlueInfo->tickfn));
prGlueInfo->tickfn.function = prTimerHandler;
prGlueInfo->tickfn.data = (unsigned long) prGlueInfo;
#endif
}
修改函数kalTimeoutHandler
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
VOID kalTimeoutHandler(struct timer_list *t)
#else
VOID kalTimeoutHandler (unsigned long arg)
#endif
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
P_GLUE_INFO_T prGlueInfo = from_timer(prGlueInfo, t, tickfn);
#else
P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T) arg;
#endif
ASSERT(prGlueInfo);
/* Notify tx thread for timeout event */
set_bit(GLUE_FLAG_TIMEOUT_BIT, &prGlueInfo->u4Flag);
wake_up_interruptible(&prGlueInfo->waitq);
return;
}
修改函数kalFileOpen
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
set_fs(KERNEL_DS);
#else
set_fs(get_ds());
#endif
修改函数kalFileRead
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
set_fs(KERNEL_DS);
#else
set_fs(get_ds());
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
ret = kernel_read(file,(char __user *)data, size,&offset);
#else
ret = vfs_read(file, data, size, &offset);
#endif
修改函数kalFileWrite
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
set_fs(KERNEL_DS);
#else
set_fs(get_ds());
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
ret = kernel_write(file,(char __user *)data, size,&offset);
#else
ret = vfs_write(file, data, size, &offset);
#endif
修改函数kalIndicateBssInfo
第1处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
if(ucChannelNum <= 14) {
prChannel = ieee80211_get_channel(wiphy, ieee80211_channel_to_frequency(ucChannelNum, NL80211_BAND_2GHZ));
}
else {
prChannel = ieee80211_get_channel(wiphy, ieee80211_channel_to_frequency(ucChannelNum, NL80211_BAND_5GHZ));
}
#else
if(ucChannelNum <= 14) {
prChannel = ieee80211_get_channel(wiphy, ieee80211_channel_to_frequency(ucChannelNum, IEEE80211_BAND_2GHZ));
}
else {
prChannel = ieee80211_get_channel(wiphy, ieee80211_channel_to_frequency(ucChannelNum, IEEE80211_BAND_5GHZ));
}
#endif
第2处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
cfg80211_put_bss(wiphy,bss);
#else
cfg80211_put_bss(bss);
#endif
2.7修改mt6620/wlan/os/linux/gl_p2p.c
修改变量mtk_band_2ghz
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
.band = NL80211_BAND_2GHZ,
#else
.band = IEEE80211_BAND_2GHZ,
#endif
修改变量mtk_band_5ghz
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
.band = NL80211_BAND_5GHZ,
#else
.band = IEEE80211_BAND_5GHZ,
#endif
修改mtk_p2p_config_ops
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
.set_monitor_channel = mtk_p2p_cfg80211_set_channel,
#else
.set_channel = mtk_p2p_cfg80211_set_channel,
#endif
修改p2pSelectQueue
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
static UINT_16
p2pSelectQueue(
struct net_device *dev,
struct sk_buff *skb,
struct net_device *sb_dev)
#else
static UINT_16
p2pSelectQueue(
struct net_device *dev,
struct sk_buff *skb)
#endif
修改glRegisterP2P
第1处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
prGlueInfo->prP2PInfo->wdev.wiphy->bands[NL80211_BAND_2GHZ] = &mtk_band_2ghz;
if(prAdapter->fgEnable5GBand) {
prGlueInfo->prP2PInfo->wdev.wiphy->bands[NL80211_BAND_5GHZ] = &mtk_band_5ghz;
}
#else
prGlueInfo->prP2PInfo->wdev.wiphy->bands[IEEE80211_BAND_2GHZ] = &mtk_band_2ghz;
if(prAdapter->fgEnable5GBand) {
prGlueInfo->prP2PInfo->wdev.wiphy->bands[IEEE80211_BAND_5GHZ] = &mtk_band_5ghz;
}
#endif
第2处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
prGlueInfo->prP2PInfo->wdev.wiphy->flags = WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
#else
prGlueInfo->prP2PInfo->wdev.wiphy->flags = WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
#endif
第3处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
prGlueInfo->prP2PInfo->prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), prDevName, NET_NAME_UNKNOWN,ether_setup, CFG_MAX_TXQ_NUM);
#else
prGlueInfo->prP2PInfo->prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), prDevName,ether_setup, CFG_MAX_TXQ_NUM);
#endif
2.8 修改mt6620/wlan/os/linux/gl_p2p_cfg80211.c
第1处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
int mtk_p2p_cfg80211_get_station (
struct wiphy *wiphy,
struct net_device *ndev,
const u8 *mac,
struct station_info *sinfo
)
#else
int mtk_p2p_cfg80211_get_station(
struct wiphy *wiphy,
struct net_device *ndev,
u8 *mac,
struct station_info *sinfo
)
#endif
第2处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
sinfo->filled |= NL80211_STA_INFO_INACTIVE_TIME;
#else
sinfo->filled |= STATION_INFO_INACTIVE_TIME;
#endif
修改函数mtk_p2p_cfg80211_scan
第1处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
int
mtk_p2p_cfg80211_scan (
struct wiphy *wiphy,
struct cfg80211_scan_request *request
)
#else
int
mtk_p2p_cfg80211_scan (
struct wiphy *wiphy,
struct net_device *ndev,
struct cfg80211_scan_request *request
)
#endif
第2处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
case NL80211_BAND_2GHZ:
#else
case IEEE80211_BAND_2GHZ:
#endif
第3处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
case NL80211_BAND_5GHZ:
#else
case IEEE80211_BAND_5GHZ:
#endif
修改函数mtk_p2p_cfg80211_set_txpower
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
int
mtk_p2p_cfg80211_set_txpower (
struct wiphy *wiphy,
struct wireless_dev *wdev,
enum nl80211_tx_power_setting type,
int mbm
)
#else
int
mtk_p2p_cfg80211_set_txpower(
struct wiphy *wiphy,
enum nl80211_tx_power_setting type,
int mbm
)
#endif
修改函数mtk_p2p_cfg80211_get_txpower
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
int
mtk_p2p_cfg80211_get_txpower (
struct wiphy *wiphy,
struct wireless_dev *wdev,
int *dbm
)
#else
int
mtk_p2p_cfg80211_get_txpower(
struct wiphy *wiphy,
int *dbm
)
#endif
修改函数mtk_p2p_cfg80211_remain_on_channel
第1处修改
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
int
mtk_p2p_cfg80211_remain_on_channel (
struct wiphy *wiphy,
struct wireless_dev *dev,
struct ieee80211_channel *chan,
unsigned int duration,
u64 *cookie
)
#else
int
mtk_p2p_cfg80211_remain_on_channel (
struct wiphy *wiphy,
struct net_device *dev,
struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type,
unsigned int duration,
u64 *cookie
)
#endif
第2处修改点
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
mtk_p2p_cfg80211func_channel_format_switch(chan,
cfg80211_get_chandef_type(&dev->chandef),
&prMsgChnlReq->rChannelInfo,
&prMsgChnlReq->eChnlSco);
#else
mtk_p2p_cfg80211func_channel_format_switch(chan,
channel_type,
&prMsgChnlReq->rChannelInfo,
&prMsgChnlReq->eChnlSco);
#endif
修改函数mtk_p2p_cfg80211_cancel_remain_on_channel
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_cancel_remain_on_channel (
struct wiphy *wiphy,
struct wireless_dev *dev,
u64 cookie
)
#else
int
mtk_p2p_cfg80211_cancel_remain_on_channel (
struct wiphy *wiphy,
struct net_device *dev,
u64 cookie
)
#endif
修改函数mtk_p2p_cfg80211_mgmt_tx
第1处修改点
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_mgmt_tx (
struct wiphy *wiphy,
struct wireless_dev *dev,
struct cfg80211_mgmt_tx_params *params,
u64 *cookie
)
#else
int
mtk_p2p_cfg80211_mgmt_tx (
struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_channel *chan, bool offchan,
enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait,
const u8 *buf,
size_t len,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
bool no_cck,
bool dont_wait_for_ack,
#endif
u64 *cookie
)
#endif
第2处修改点
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
if(params == NULL) {
return i4Rslt;
}
u8 *buf = params->buf;
size_t len = params->len;
#endif
修改函数mtk_p2p_cfg80211_mgmt_tx_cancel_wait
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_mgmt_tx_cancel_wait (
struct wiphy *wiphy,
struct wireless_dev *wdev,
u64 cookie
)
#else
int
mtk_p2p_cfg80211_mgmt_tx_cancel_wait (
struct wiphy *wiphy,
struct net_device *ndev,
u64 cookie
)
#endif
修改函数mtk_p2p_cfg80211_del_station
第1处修改点
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_del_station (
struct wiphy *wiphy, struct net_device *dev,
struct station_del_parameters *params)
#else
int
mtk_p2p_cfg80211_del_station (
struct wiphy *wiphy,
struct net_device *dev,
u8 *mac
)
#endif
第2处修改点
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
if(params == NULL) {
return i4Rslt;
}
u8 *mac = params->mac;
#endif
修改函数mtk_p2p_cfg80211_change_iface
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_change_iface (
struct wiphy *wiphy,
struct net_device *ndev,
enum nl80211_iftype type,
struct vif_params *params)
#else
int
mtk_p2p_cfg80211_change_iface (
IN struct wiphy *wiphy,
IN struct net_device *ndev,
IN enum nl80211_iftype type,
IN u32 *flags,
IN struct vif_params *params
)
#endif
修改函数mtk_p2p_cfg80211_set_channel
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int mtk_p2p_cfg80211_set_channel(struct wiphy *wiphy,
struct cfg80211_chan_def *chandef)
{
INT_32 i4Rslt = -EINVAL;
P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL;
RF_CHANNEL_INFO_T rRfChnlInfo;
do {
if ((wiphy == NULL) ||
(chandef == NULL)) {
break;
}
DBGLOG(P2P, STATE, ("mtk_p2p_cfg80211_set_channel.\n"));
prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy));
mtk_p2p_cfg80211func_channel_format_switch(chandef->chan,
cfg80211_get_chandef_type(chandef),
&rRfChnlInfo,
NULL);
p2pFuncSetChannel(prGlueInfo->prAdapter, &rRfChnlInfo);
i4Rslt = 0;
}
while (FALSE);
return i4Rslt;
}
#else
int
mtk_p2p_cfg80211_set_channel (
IN struct wiphy *wiphy,
IN struct net_device *dev,
IN struct ieee80211_channel *chan,
IN enum nl80211_channel_type channel_type)
{
INT_32 i4Rslt = -EINVAL;
P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL;
RF_CHANNEL_INFO_T rRfChnlInfo;
do {
if ((wiphy == NULL) ||
(dev == NULL) ||
(chan == NULL)) {
break;
}
DBGLOG(P2P, STATE, ("mtk_p2p_cfg80211_set_channel.\n"));
prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy));
mtk_p2p_cfg80211func_channel_format_switch(chan,
channel_type,
&rRfChnlInfo,
NULL);
p2pFuncSetChannel(prGlueInfo->prAdapter, &rRfChnlInfo);
i4Rslt = 0;
}
while (FALSE);
return i4Rslt;
}
#endif
修改函数mtk_p2p_cfg80211_mgmt_frame_register
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
void
mtk_p2p_cfg80211_mgmt_frame_register (
struct wiphy *wiphy,
struct wireless_dev *dev,
u16 frame_type, bool reg)
#else
void
mtk_p2p_cfg80211_mgmt_frame_register (
IN struct wiphy *wiphy,
IN struct net_device *dev,
IN u16 frame_type,
IN bool reg
)
#endif
修改函数mtk_p2p_cfg80211func_channel_format_switch
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
case NL80211_BAND_2GHZ:
#else
case IEEE80211_BAND_2GHZ:
#endif
prRfChnlInfo->eBand = BAND_2G4;
break;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
case NL80211_BAND_5GHZ:
#else
case IEEE80211_BAND_5GHZ:
#endif
修改函数mtk_p2p_cfg80211_testmode_cmd
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
int mtk_p2p_cfg80211_testmode_cmd (struct wiphy *wiphy,
struct wireless_dev *wdev,
void *data, int len)
#else
int mtk_p2p_cfg80211_testmode_cmd(
IN struct wiphy *wiphy,
IN void *data,
IN int len
)
#endif
2.9 修改mt6620/wlan/os/linux/gl_p2p_kal.c
修改函数kalP2PIndicateChannelReady
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
cfg80211_ready_on_channel(&prGlueInfo->prP2PInfo->wdev, //struct net_device * dev,
u8SeqNum, //u64 cookie,
prIEEE80211ChnlStruct, //struct ieee80211_channel * chan,
u4Duration, //enum nl80211_channel_type channel_type,
GFP_KERNEL); //gfp_t gfp /* allocation flags */
#else
cfg80211_ready_on_channel(prGlueInfo->prP2PInfo->prDevHandler, //struct net_device * dev,
u8SeqNum, //u64 cookie,
prIEEE80211ChnlStruct, //struct ieee80211_channel * chan,
eChnlType, //enum nl80211_channel_type channel_type,
u4Duration, //unsigned int duration,
GFP_KERNEL); //gfp_t gfp /* allocation flags */
#endif
修改函数kalP2PIndicateChannelExpired
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
cfg80211_remain_on_channel_expired(&prGlueInfo->prP2PInfo->wdev, //struct net_device * dev,
prChnlReqInfo->u8Cookie,
prIEEE80211ChnlStruct,
GFP_KERNEL);
#else
cfg80211_remain_on_channel_expired(prGlueP2pInfo->prDevHandler, //struct net_device * dev,
prChnlReqInfo->u8Cookie,
prIEEE80211ChnlStruct,
eChnlType,
GFP_KERNEL);
#endif
修改函数kalP2PIndicateBssInfo
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
cfg80211_put_bss(prGlueP2pInfo->wdev.wiphy,prCfg80211Bss);
#else
cfg80211_put_bss(prCfg80211Bss);
#endif
修改函数kalP2PIndicateMgmtTxStatus
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
cfg80211_mgmt_tx_status(&prGlueInfo->prP2PInfo->wdev, //struct wireless_dev *wdev
u8Cookie,
pucFrameBuf,
u4FrameLen,
fgIsAck,
GFP_KERNEL);
#else
cfg80211_mgmt_tx_status(prGlueP2pInfo->prDevHandler, //struct net_device * dev,
u8Cookie,
pucFrameBuf,
u4FrameLen,
fgIsAck,
GFP_KERNEL);
#endif
修改函数kalP2PIndicateRxMgmtFrame
cfg80211_rx_mgmt(prGlueP2pInfo->prDevHandler, //struct net_device * dev,
i4Freq,
RCPI_TO_dBm(prSwRfb->prHifRxHdr->ucRcpi),
prSwRfb->pvHeader,
prSwRfb->u2PacketLen,
GFP_KERNEL);
改为
cfg80211_rx_mgmt(&prGlueP2pInfo->wdev, //struct wireless_dev *wdev,
i4Freq,
RCPI_TO_dBm(prSwRfb->prHifRxHdr->ucRcpi),
prSwRfb->pvHeader,
prSwRfb->u2PacketLen,
GFP_KERNEL);
修改函数kalP2PGCIndicateConnectionStatus
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
/* Disconnect, what if u2StatusReason == 0? */
cfg80211_disconnected(prGlueP2pInfo->prDevHandler, //struct net_device * dev,
u2StatusReason,
pucRxIEBuf,
u2RxIELen,
true,
GFP_KERNEL);
#else
/* Disconnect, what if u2StatusReason == 0? */
cfg80211_disconnected(prGlueP2pInfo->prDevHandler, //struct net_device * dev,
u2StatusReason,
pucRxIEBuf,
u2RxIELen,
GFP_KERNEL);
#endif
修改函数kalP2PGOStationUpdate
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
rStationInfo.filled = NL80211_STA_INFO_TX_RETRIES;
#else
rStationInfo.filled = STATION_INFO_ASSOC_REQ_IES;
#endif
修改函数ieee80211_channel
第1次修改点
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
prTargetChannelEntry = prP2pInfo->wdev.wiphy->bands[NL80211_BAND_2GHZ]->channels;
u4TblSize = prP2pInfo->wdev.wiphy->bands[NL80211_BAND_2GHZ]->n_channels;
#else
prTargetChannelEntry = prP2pInfo->wdev.wiphy->bands[IEEE80211_BAND_2GHZ]->channels;
u4TblSize = prP2pInfo->wdev.wiphy->bands[IEEE80211_BAND_2GHZ]->n_channels;
#endif
第2处修改点
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,18)
prTargetChannelEntry = prP2pInfo->wdev.wiphy->bands[NL80211_BAND_5GHZ]->channels;
u4TblSize = prP2pInfo->wdev.wiphy->bands[NL80211_BAND_5GHZ]->n_channels;
#else
prTargetChannelEntry = prP2pInfo->wdev.wiphy->bands[IEEE80211_BAND_5GHZ]->channels;
u4TblSize = prP2pInfo->wdev.wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels;
#endif
2.10 修改mt6620/wlan/os/linux/gl_rst.c
修改函数mtk_wifi_reset声明
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
static int mtk_wifi_reset (struct sk_buff *skb,
struct genl_info *info);
#else
static int mtk_wifi_reset(
void
);
#endif
修改变量mtk_wifi_gnl_ops_bind
/* operation definition */
static struct genl_ops mtk_wifi_gnl_ops_bind = {
.cmd = MTK_WIFI_COMMAND_BIND,
.flags = 0,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
.policy = mtk_wifi_genl_policy,
#endif
// .doit = mtk_wifi_bind,
.dumpit = NULL,
};
修改变量mtk_wifi_gnl_ops_reset
static struct genl_ops mtk_wifi_gnl_ops_reset = {
.cmd = MTK_WIFI_COMMAND_RESET,
.flags = 0,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
.policy = mtk_wifi_genl_policy,
#endif
.doit = mtk_wifi_reset,
.dumpit = NULL,
};
新增变量
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
static const struct genl_ops hwsim_ops[] = {
{
.cmd = MTK_WIFI_COMMAND_BIND,
.flags = 0,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
.policy = mtk_wifi_genl_policy,
#endif
.doit = mtk_wifi_bind,
.dumpit = NULL
},
{
.cmd = MTK_WIFI_COMMAND_RESET,
.flags = 0,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
.policy = mtk_wifi_genl_policy,
#endif
.doit = mtk_wifi_reset,
.dumpit = NULL
},
};
#endif
/* family definition */
static struct genl_family mtk_wifi_gnl_family = {
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
.id = GENL_ID_GENERATE,
#endif
.hdrsize = 0,
.name = MTK_WIFI_FAMILY_NAME,
.version = 1,
.maxattr = MTK_WIFI_ATTR_MAX,
.ops = hwsim_ops,
.n_ops = ARRAY_SIZE(hwsim_ops),
};
新增函数声明
static void mtk_wifi_reset2(struct work_struct *work);
修改函数glResetInit,屏蔽掉代码
VOID
glResetInit(
VOID
)
{
/* 1. register for reset callback */
mtk_wcn_wmt_msgcb_reg(WMTDRV_TYPE_WIFI, (PF_WMT_CB)glResetCallback);
/* 2.1 registration for NETLINK_GENERIC family */
if(genl_register_family(&mtk_wifi_gnl_family) != 0) {
DBGLOG(INIT, WARN, ("%s(): GE_NELINK family registration fail\n", __func__));
}
else {
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 18)
/* 2.2 operation registration */
if(genl_register_ops(&mtk_wifi_gnl_family, &mtk_wifi_gnl_ops_bind) != 0) {
DBGLOG(INIT, WARN, ("%s(): BIND operation registration fail\n", __func__));
}
if(genl_register_ops(&mtk_wifi_gnl_family, &mtk_wifi_gnl_ops_reset) != 0) {
DBGLOG(INIT, WARN, ("%s(): RESET operation registration fail\n", __func__));
}
#endif
}
INIT_DELAYED_WORK(&work_rst, mtk_wifi_reset2);
return;
}
修改函数mtk_wifi_bind
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
bind_pid[num_bind_process] = info->snd_portid;
#else
bind_pid[num_bind_process] = info->snd_pid;
#endif
新增一个函数mtk_wifi_reset2
static void mtk_wifi_reset2(struct work_struct *work)
{
PARAM_CUSTOM_P2P_SET_STRUC_T p2pmode;
struct net_device *netdev = NULL;
DBGLOG(INIT, STATE, ("%s(): begin to reset WIFI\n", __func__));
if (wlan_mode==1) //AP mode
{
printk("Whole-chip reset:indicate power-off in AP mode\n");
power_state=0;
}
else if (wlan_mode==2)//P2P mode
{
if (MTK_WCN_BOOL_FALSE == mtk_wcn_wmt_func_on(WMTDRV_TYPE_WIFI)) {
printk("Whole-chip reset:WMT turn on WIFI fail!\n");
}
else {
printk("Whole-chip reset:WMT turn on WIFI OK!\n");
msleep(300);
printk("Whole-chip reset:begin to turn on P2P mode\n");
netdev = dev_get_by_name(&init_net,"wlan0");
p2pmode.u4Enable = 1;
p2pmode.u4Mode = 0;
pf_set_p2p_mode(netdev, p2pmode);
printk("Whole-chip reset:turn on P2P mode\n");
dev_put(netdev);
netdev = NULL;
}
}
return 0;
}
修改函数mtk_wifi_reset
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
static int mtk_wifi_reset (struct sk_buff *skb,
struct genl_info *info)
#else
static int mtk_wifi_reset(void)
#endif
{
PARAM_CUSTOM_P2P_SET_STRUC_T p2pmode;
struct net_device *netdev = NULL;
DBGLOG(INIT, STATE, ("%s(): begin to reset WIFI\n", __func__));
if (wlan_mode==1) //AP mode
{
printk("Whole-chip reset:indicate power-off in AP mode\n");
power_state=0;
}
else if (wlan_mode==2)//P2P mode
{
if (MTK_WCN_BOOL_FALSE == mtk_wcn_wmt_func_on(WMTDRV_TYPE_WIFI)) {
printk("Whole-chip reset:WMT turn on WIFI fail!\n");
}
else {
printk("Whole-chip reset:WMT turn on WIFI OK!\n");
msleep(300);
printk("Whole-chip reset:begin to turn on P2P mode\n");
netdev = dev_get_by_name(&init_net,"wlan0");
p2pmode.u4Enable = 1;
p2pmode.u4Mode = 0;
pf_set_p2p_mode(netdev, p2pmode);
printk("Whole-chip reset:turn on P2P mode\n");
dev_put(netdev);
netdev = NULL;
}
}
return 0;
}
2.11 修改mt6620/wlan/os/linux/include/cfg80211.h
修改函数mtk_cfg80211_change_iface
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_change_iface (
struct wiphy *wiphy,
struct net_device *dev,
enum nl80211_iftype type,
struct vif_params *params);
#else
int
mtk_cfg80211_change_iface (
struct wiphy *wiphy,
struct net_device *ndev,
enum nl80211_iftype type,
u32 *flags,
struct vif_params *params
);
#endif
修改函数mtk_cfg80211_get_station
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_get_station (
struct wiphy *wiphy,
struct net_device *dev,
const u8 *mac,
struct station_info *sinfo);
#else
int
mtk_cfg80211_get_station (
struct wiphy *wiphy,
struct net_device *ndev,
u8 *mac,
struct station_info *sinfo
);
#endif
修改函数mtk_cfg80211_scan
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_scan (struct wiphy *wiphy,
struct cfg80211_scan_request *request);
#else
int
mtk_cfg80211_scan (
struct wiphy *wiphy,
struct net_device *ndev,
struct cfg80211_scan_request *request
);
#endif
修改函数mtk_cfg80211_remain_on_channel
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_remain_on_channel(
struct wiphy *wiphy,
struct wireless_dev *wdev,
struct ieee80211_channel *chan,
unsigned int duration,
u64 *cookie);
#else
int
mtk_cfg80211_remain_on_channel (
struct wiphy *wiphy,
struct net_device *ndev,
struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type,
unsigned int duration,
u64 *cookie
);
#endif
修改函数mtk_cfg80211_cancel_remain_on_channel
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_cancel_remain_on_channel (
struct wiphy *wiphy,
struct wireless_dev *wdev,
u64 cookie);
#else
int
mtk_cfg80211_cancel_remain_on_channel (
struct wiphy *wiphy,
struct net_device *ndev,
u64 cookie
);
#endif
修改函数mtk_cfg80211_mgmt_tx
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_mgmt_tx(
struct wiphy *wiphy,
struct wireless_dev *wdev,
struct cfg80211_mgmt_tx_params *params,
u64 *cookie);
#else
int
mtk_cfg80211_mgmt_tx (
struct wiphy *wiphy,
struct net_device *ndev,
struct ieee80211_channel *channel,
bool offscan,
enum nl80211_channel_type channel_type,
bool channel_type_valid,
unsigned int wait,
const u8 *buf,
size_t len,
bool no_cck,
bool dont_wait_for_ack,
u64 *cookie
);
#endif
修改函数mtk_cfg80211_mgmt_tx_cancel_wait
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_cfg80211_mgmt_tx_cancel_wait (
struct wiphy *wiphy,
struct wireless_dev *wdev,
u64 cookie);
#else
int
mtk_cfg80211_mgmt_tx_cancel_wait (
struct wiphy *wiphy,
struct net_device *ndev,
u64 cookie
);
#endif
修改函数mtk_cfg80211_testmode_cmd
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int mtk_cfg80211_testmode_cmd(
struct wiphy *wiphy,
struct wireless_dev *wdev,
void *data, int len);
#else
int
mtk_cfg80211_testmode_cmd(
IN struct wiphy *wiphy,
IN void *data,
IN int len
);
#endif
2.12 修改mt6620/wlan/os/linux/include/gl_kal.h
去掉内联修饰符kalOidComplete
VOID
kalOidComplete (
IN P_GLUE_INFO_T prGlueInfo,
IN BOOLEAN fgSetQuery,
IN UINT_32 u4SetQueryInfoLen,
IN WLAN_STATUS rOidStatus
);
修改函数kalTimeoutHandler
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
VOID kalTimeoutHandler(struct timer_list *t);
#else
VOID kalTimeoutHandler (unsigned long arg);
#endif
2.13修改mt6620/wlan/os/linux/include/gl_p2p_ioctl.h
修改宏定义CHAN2G和CHAN5G
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
#define CHAN2G(_channel, _freq, _flags) \
{ \
.band = NL80211_BAND_2GHZ, \
.center_freq = (_freq), \
.hw_value = (_channel), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
}
#define CHAN5G(_channel, _flags) \
{ \
.band = NL80211_BAND_5GHZ, \
.center_freq = 5000 + (5 * (_channel)), \
.hw_value = (_channel), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
}
#else
#define CHAN2G(_channel, _freq, _flags) \
{ \
.band = IEEE80211_BAND_2GHZ, \
.center_freq = (_freq), \
.hw_value = (_channel), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
}
#define CHAN5G(_channel, _flags) \
{ \
.band = IEEE80211_BAND_5GHZ, \
.center_freq = 5000 + (5 * (_channel)), \
.hw_value = (_channel), \
.flags = (_flags), \
.max_antenna_gain = 0, \
.max_power = 30, \
}
#endif
修改函数mtk_p2p_cfg80211_change_iface
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_change_iface (
struct wiphy *wiphy,
struct net_device *dev,
enum nl80211_iftype type,
struct vif_params *params);
#else
int
mtk_p2p_cfg80211_change_iface (
IN struct wiphy *wiphy,
IN struct net_device *ndev,
IN enum nl80211_iftype type,
IN u32 *flags,
IN struct vif_params *params
);
#endif
修改函数mtk_p2p_cfg80211_get_station
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_get_station (
struct wiphy *wiphy,
struct net_device *dev,
const u8 *mac,
struct station_info *sinfo);
#else
int mtk_p2p_cfg80211_get_station(
struct wiphy *wiphy,
struct net_device *ndev,
u8 *mac,
struct station_info *sinfo
);
#endif
修改函数mtk_p2p_cfg80211_scan
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_scan (
struct wiphy *wiphy,
struct cfg80211_scan_request *request);
#else
int
mtk_p2p_cfg80211_scan (
struct wiphy *wiphy,
struct net_device *ndev,
struct cfg80211_scan_request *request
);
#endif
修改函数mtk_p2p_cfg80211_set_txpower
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_set_txpower (
struct wiphy *wiphy, struct wireless_dev *wdev,
enum nl80211_tx_power_setting type, int mbm);
#else
int
mtk_p2p_cfg80211_set_txpower(
struct wiphy *wiphy,
enum nl80211_tx_power_setting type,
int mbm
);
#endif
修改函数mtk_p2p_cfg80211_get_txpower
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_get_txpower (
struct wiphy *wiphy,
struct wireless_dev *wdev,
int *dbm);
#else
int
mtk_p2p_cfg80211_get_txpower(
struct wiphy *wiphy,
int *dbm
);
#endif
修改函数mtk_p2p_cfg80211_remain_on_channel
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_remain_on_channel (
struct wiphy *wiphy,
struct wireless_dev *wdev,
struct ieee80211_channel *chan,
unsigned int duration,
u64 *cookie);
#else
int
mtk_p2p_cfg80211_remain_on_channel (
struct wiphy *wiphy,
struct net_device *dev,
struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type,
unsigned int duration,
u64 *cookie
);
#endif
修改函数mtk_p2p_cfg80211_cancel_remain_on_channel
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_cancel_remain_on_channel (
struct wiphy *wiphy,
struct wireless_dev *dev,
u64 cookie);
#else
int
mtk_p2p_cfg80211_cancel_remain_on_channel (
struct wiphy *wiphy,
struct net_device *dev,
u64 cookie
);
#endif
修改函数mtk_p2p_cfg80211_mgmt_tx
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_mgmt_tx (
struct wiphy *wiphy,
struct wireless_dev *dev,
struct cfg80211_mgmt_tx_params *params,
u64 *cookie);
#else
int
mtk_p2p_cfg80211_mgmt_tx (
struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_channel *chan, bool offchan,
enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait,
const u8 *buf,
size_t len,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
bool no_cck,
bool dont_wait_for_ack,
#endif
u64 *cookie
);
#endif
修改函数mtk_p2p_cfg80211_mgmt_tx_cancel_wait
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_mgmt_tx_cancel_wait (
struct wiphy *wiphy,
struct wireless_dev *wdev,
u64 cookie);
#else
int
mtk_p2p_cfg80211_mgmt_tx_cancel_wait (
struct wiphy *wiphy,
struct net_device *ndev,
u64 cookie
);
#endif
修改函数mtk_p2p_cfg80211_del_station
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int
mtk_p2p_cfg80211_del_station (
struct wiphy *wiphy, struct net_device *dev,
struct station_del_parameters *params);
#else
int
mtk_p2p_cfg80211_del_station (
struct wiphy *wiphy,
struct net_device *dev,
u8 *mac
);
#endif
修改函数mtk_p2p_cfg80211_set_channel
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int mtk_p2p_cfg80211_set_channel(struct wiphy *wiphy,
struct cfg80211_chan_def *chandef);
#else
int
mtk_p2p_cfg80211_set_channel(
IN struct wiphy * wiphy,
IN struct net_device * dev,
IN struct ieee80211_channel * chan,
IN enum nl80211_channel_type channel_type
);
#endif
修改函数mtk_p2p_cfg80211_mgmt_frame_register
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
void
mtk_p2p_cfg80211_mgmt_frame_register (
struct wiphy *wiphy,
struct wireless_dev *wdev,
u16 frame_type, bool reg);
#else
void
mtk_p2p_cfg80211_mgmt_frame_register (
IN struct wiphy *wiphy,
IN struct net_device *dev,
IN u16 frame_type,
IN bool reg
);
#endif
修改函数mtk_p2p_cfg80211_testmode_cmd
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
int mtk_p2p_cfg80211_testmode_cmd (struct wiphy *wiphy,
struct wireless_dev *wdev,
void *data, int len);
#else
int mtk_p2p_cfg80211_testmode_cmd(
IN struct wiphy *wiphy,
IN void *data,
IN int len
);
#endif
2.14 修改mt6620/wlan/os/linux/platform.c
修改函数nvram_read
第1处修改点
// if ((fd->f_op == NULL) || (fd->f_op->read == NULL)) {
if (fd->f_op == NULL) {
DBGLOG(INIT, INFO, ( "[MT6620][nvram_read] : file can not be read!!\n"));
break;
}
第2处修改点
// retLen = fd->f_op->read(fd,
// buf,
// len,
// &fd->f_pos);
retLen = kernel_read(fd,(char __user *)buf, len,&fd->f_pos);
printk("retLen:%d\n",retLen);
2.15 修改mt6620/wlan/os/linux/gl_kal.c
修改函数kalFirmwareOpen
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 18)
set_fs(KERNEL_DS)
#else
set_fs(get_ds());
#endif
三、修改内核代码
涉及到修改有以下文件:
kernel_aux/dts/exyons4412-itop-elite.dts
kernel_aux/dts/exyons4412-itop-scp-core.dtsi
kernel_aux/files/drivers/char/power_ctrl.c
kernel_aux/files/drivers/misc/itop4412_relay.c //解决新版编译器报错,与wifi移植无关
kernel_aux/files/drivers/misc/Kconfig
kernel_aux/files/drivers/misc/Makefile
kernel_aux/files/drivers/mmc/host/sdhci-s3c.c
kernel_aux/files/drivers/net/wireless/Kconfig
kernel_aux/files/drivers/net/wireless/Makefile
kernel_aux/files/net/core/dev.c
kernel_aux/files/net/wireless/wext-core.c
新增设备树文件
kernel_aux/dts/topeet_mt6620.dts
1.修改设备树kernel_aux/dts/exyons4412-itop-scp-core.dtsi
第1处修改点,LDO24新增regulator-always-on属性
ldo24_reg: LDO24 {
regulator-name = "VDD33_A31";
regulator-min-microvolt = <3300000>; /*3300000 >> 3000000*/
regulator-max-microvolt = <3300000>; /*3300000 >> 3000000*/
regulator-always-on;
op_mode = <1>; /* Normal Mode */
};
第2处修改点,LDO26新增regulator-always-on属性
ldo26_reg: LDO26 {
regulator-name = "VDD18_A31";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
op_mode = <1>; /* Normal Mode */
};
2.新增设备树文件kernel_aux/dts/topeet_mt6620.dts
内容如下:
/*topeet_mt6620.dts*/
/ {
mt6620_eint:mt6620_eint{
compatible = "mtk_sdio_eint";
pinctrl-names = "default";
pinctrl-0 = <&mt6620_sdio_eint>;
eint-gpios = <&gpx2 5 GPIO_ACTIVE_LOW>;
status = "okay";
};
mtk_wmt:mtk_wmt{
compatible = "mtk_wmt,mtk_wmt-ctrl";
pinctrl-names = "default";
pinctrl-0 = <&mt6620_bgf_eint>,<&uart0_data>;
wmt-gpios = <&gpc1 0 GPIO_ACTIVE_LOW>,<&gpc1 1 GPIO_ACTIVE_LOW>,<&gpx2 4 GPIO_ACTIVE_LOW>;
status = "okay";
};
};
&pinctrl_0 {
mt6620_ctrl:mt6620_ctrl{
samsung,pins = "gpc1-0","gpc1-1";
samsung,pin-function = <EXYNOS_PIN_FUNC_OUTPUT>;
samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
};
};
&pinctrl_1 {
mt6620_chip_pwd:mt6620_chip_pwd{
samsung,pins = "gpx3-2";
samsung,pin-function = <EXYNOS_PIN_FUNC_OUTPUT>;
samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
};
mt6620_bgf_eint:mt6620_bgf_eint{
samsung,pins = "gpx2-4";
samsung,pin-function = <EXYNOS_PIN_FUNC_EINT>;
samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
};
mt6620_sdio_eint:mt6620_sdio_eint{
samsung,pins = "gpx2-5";
samsung,pin-function = <EXYNOS_PIN_FUNC_EINT>;
samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
};
};
&sdhci_3 {
bus-width = <4>;
pinctrl-0 = <&sd3_clk &sd3_cmd &sd3_bus4>;
pinctrl-names = "default";
cd-gpios = <&gpk3 2 GPIO_ACTIVE_LOW>;
cap-mmc-highspeed;
status = "okay";
};
&serial_0 {
status = "okay";
};
3.修改设备树kernel_aux/dts/exynos4412-itop-elite.dts文件
新增包含topeet_mt6620.dts文件
修改节点powerctrl
powerctrl{
compatible = "powerctrl-gpio";
pinctrl-names = "default";
pinctrl-0 = <&power_ctrl>,<&mt6620_chip_pwd>,<&mt6620_ctrl>;
gpios = <&gpl0 4 0>,<&gpl1 0 0>,<&gpl0 2 0>,<&gpl0 6 0>;
mt6620-ctl = <&gpc1 0 0>,<&gpc1 1 0>;
mt6620-chip_pwd = <&gpx3 2 1>;
};
4.修改文件kernel_aux/files/drivers/char/power_ctrl.c
4.1 添加以下变量
uint32_t MT6620_PMUEN = 0;
uint32_t MT6620_RESET = 0;
uint32_t MT6620_WLAN_CHIP_PWD = 0;
4.2 修改power_write,解决编译错误
static ssize_t power_write(struct file *filp, char *buffer, size_t count, loff_t *ppos)
改为
static ssize_t power_write(struct file *filp, const char __user *buffer, size_t count, loff_t *ppos)
4.3 新增函数power_mt6620_wlan_power_for_onoff
void power_mt6620_wlan_power_for_onoff(int on)
{
printk("%s[%d]:%s\n",__FUNCTION__,__LINE__,on?"on":"off");
if(on) {
gpio_set_value(MT6620_WLAN_CHIP_PWD,0);
}
else {
gpio_set_value(MT6620_WLAN_CHIP_PWD,1);
}
}
EXPORT_SYMBOL(power_mt6620_wlan_power_for_onoff);
4.3 新增函数power_mt6620_init
static int power_mt6620_init(struct platform_device *pdev)
{
int ret = 0;
int irq = -1;
struct device_node *np = pdev->dev.of_node;
MT6620_PMUEN = of_get_named_gpio(np, "mt6620-ctl", 0);
if (MT6620_PMUEN == -EPROBE_DEFER)
return MT6620_PMUEN;
if (MT6620_PMUEN < 0) {
dev_err(&pdev->dev, "error acquiring power gpio: %d\n", MT6620_PMUEN);
return MT6620_PMUEN;
}
ret = devm_gpio_request_one(&pdev->dev, MT6620_PMUEN, 0, "mt6620-gpio");
if(ret) {
dev_err(&pdev->dev, "error requesting power gpio: %d\n", ret);
return ret;
}
gpio_direction_output(MT6620_PMUEN, 0);
gpio_free(MT6620_PMUEN);
MT6620_RESET = of_get_named_gpio(np, "mt6620-ctl", 1);
if (MT6620_RESET == -EPROBE_DEFER)
return MT6620_RESET;
if (MT6620_RESET < 0) {
dev_err(&pdev->dev, "error acquiring power gpio: %d\n", MT6620_RESET);
return MT6620_RESET;
}
ret = devm_gpio_request_one(&pdev->dev, MT6620_RESET, 0, "mt6620-gpio");
if(ret) {
dev_err(&pdev->dev, "error requesting power gpio: %d\n", ret);
return ret;
}
gpio_direction_output(MT6620_RESET, 0);
gpio_free(MT6620_RESET);
MT6620_WLAN_CHIP_PWD = of_get_named_gpio(np, "mt6620-chip_pwd", 0);
if (MT6620_WLAN_CHIP_PWD == -EPROBE_DEFER)
return MT6620_WLAN_CHIP_PWD;
if (MT6620_WLAN_CHIP_PWD < 0) {
dev_err(&pdev->dev, "error acquiring power gpio: %d\n", MT6620_WLAN_CHIP_PWD);
return MT6620_WLAN_CHIP_PWD;
}
ret = devm_gpio_request_one(&pdev->dev, MT6620_WLAN_CHIP_PWD, 0, "mt6620-gpio1");
if(ret) {
dev_err(&pdev->dev, "error requesting power gpio: %d\n", ret);
return ret;
}
gpio_direction_output(MT6620_WLAN_CHIP_PWD, 1);
gpio_set_value(MT6620_WLAN_CHIP_PWD,1);
return ret;
}
4.4 修改函数power_probe,添加power_mt6620_init调用
ret = power_mt6620_init(pdev);
if(ret) {
dev_err(&pdev->dev, "error power_mt6620_init: %d\n", ret);
return ret;
}
5.修改文件kernel_aux/files/drivers/misc/Kconfig
新增如下内容
source "drivers/misc/mediatek/Kconfig"
6.修改文件kernel_aux/files/drivers/misc/Makefile
新增如下内容
obj-$(CONFIG_MTK_WIRELESS_SOLUTION) += mediatek/
7.修改文件kernel_aux/files/drivers/mmc/host/sdhci-s3c.c
修改函数sdhci_s3c_parse_dt
if (of_get_named_gpio(node, "cd-gpios", 0))
改为
if (of_get_named_gpio(node, "cd-gpios", 0) >= 0)
8.修改文件kernel_aux/files/drivers/net/wireless/Kconfig
新增如下内容
menuconfig MTK_WIRELESS_SOLUTION
bool "MTK wireless chip configuration"
help
"enable/disable and config MTK wireless solution"
if MTK_WIRELESS_SOLUTION
source "drivers/net/wireless/combo_mt66xx/Kconfig"
endif # MTK_WIRELESS_SOLUTION
9.修改文件kernel_aux/files/drivers/net/wireless/Makefile
新增如下内容
obj-$(CONFIG_MTK_COMBO_WIFI) += combo_mt66xx/
10.修改文件kernel_aux/files/net/core/dev.c
将函数dev_change_name导出
EXPORT_SYMBOL(dev_change_name);
11.修改文件kernel_aux/files/net/wireless/wext-core.c
修改函数wireless_process_ioctl,在函数结尾处新增如下内容
/* Old driver API : call driver ioctl handler */
if (dev->netdev_ops && dev->netdev_ops->ndo_do_ioctl)
return dev->netdev_ops->ndo_do_ioctl(dev, ( struct ifreq*)iwr, cmd);
12.修改文件kernel_aux/files/drivers/misc/itop4412_relay.c
static ssize_t itop4412_relay_write(struct file *filp, char *buffer, size_t count, loff_t *ppos)
改为
static ssize_t itop4412_relay_write(struct file *filp, const char __user *buffer, size_t count, loff_t *ppos)
四、编译内核和驱动
1 编译
1.1 执行prepare_kernel同步修改的文件到内核中
1.2 执行config_kernel进入图形界面,进行如下配置
1.
Device Drivers --->
[*] Network device support --->
[*] Wireless LAN --->
[*] MTK wireless chip configuration --->
[*] MediaTek combo_mt66xx WiFi Config --->
<M> MediaTek Combo Chip Wi-Fi support
2.
Device Drivers --->
Misc devices --->
[*] MTK wireless chip configuration --->
[*] MediaTek combo_mt66xx Config --->
<M> MediaTek Combo Chip wireless managment tool │ │
< > MediaTek Combo Chip BT driver │ │
< > MediaTek Combo Chip FM driver │ │
< > MediaTek GPS Support │ │
<M> MediaTek Combo Chip Wi-Fi support
3.
[*] Networking support --->
Wireless --->
[*] nl80211 testmode command
4.
[*] Networking support --->
Wireless --->
[*] cfg80211 wireless extensions compatibility
5.
Device Drivers --->
[*] Network device support --->
[*] Wireless LAN --->
<*> IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP
[*] Support downloading firmware images with Host AP driver
[*] Support for non-volatile firmware download
以下主要为了打开宏CONFIG_ZLIB_DEFLATE,解决这个编译错误
ERROR: "zlib_deflateInit2" [drivers/misc/mediatek/combo_mt66xx/wmt/mtk_stp_wmt.ko] undefined!
ERROR: "zlib_deflate_workspacesize" [drivers/misc/mediatek/combo_mt66xx/wmt/mtk_stp_wmt.ko] undefined!
ERROR: "zlib_deflateReset" [drivers/misc/mediatek/combo_mt66xx/wmt/mtk_stp_wmt.ko] undefined!
ERROR: "zlib_deflate" [drivers/misc/mediatek/combo_mt66xx/wmt/mtk_stp_wmt.ko] undefined!
ERROR: "zlib_deflateEnd" [drivers/misc/mediatek/combo_mt66xx/wmt/mtk_stp_wmt.ko] undefined!
6.
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
7.
File systems --->
[*] Miscellaneous filesystems --->
<*> Journalling Flash File System v2 (JFFS2) support
1.4 执行make build_kernel编译内核,生成uImage镜像
1.5 执行build_modules,编译驱动模块
1.6 执行build_dtbs编译设备树
2 烧录
通过fastboot烧录内核uImage和设备树/exynos4412-itop-elite.dtb到板端
五、工具移植和调试
1.移植wpa_supplicant工具
交叉编译生成wpa_passphrase和wpa_supplicant
复制到文件/usr/bin/目录下
执行,配置要连接的热点信息
wpa_passphrase WiFi名 WiFi密码 > /etc/wpa_supplicant.conf
2.移植mt6620后台服务程序6620_launcher到/usr/bin目录下
3.移植mt6620配置文件和固件
3.1 在etc目录下新增目录firmware文件夹
移植以下文件到这个目录
BT.cfg mfc_fw.bin
WIFI_RAM_CODE mt6620_patch_e3_0_hdr.bin
WIFI_RAM_CODE_E6 mt6620_patch_e3_1_hdr.bin
WMT.cfg mt6620_patch_e3_2_hdr.bin
fimc_is_fw.bin mt6620_patch_e3_3_hdr.bin
load_firmware
3.2 在文件系统根目录,执行mkdir -p system/etc/firmware/新增目录,将以下文件移植到system/etc/firmware/目录下
WIFI_RAM_CODE WIFI_RAM_CODE_E6 WMT.cfg
3.3 新建脚本文件mt6620,内容如下:
#!/bin/sh
echo Try to bring wlan0 interface up......>/dev/ttySAC2
mknod /dev/stpwmt c 190 0
mknod /dev/wmtWifi c 194 0
insmod /mt6620_modules/mt6620/mtk_hif_sdio.ko
insmod /mt6620_modules/mt6620/mtk_stp_wmt.ko
insmod /mt6620_modules/mt6620/mtk_stp_uart.ko
insmod /mt6620_modules/mt6620/mtk_wmt_wifi.ko WIFI_major=194
insmod /mt6620_modules/mt6620/wlan_mt6620.ko
chmod 0666 /dev/stpwmt
chmod 0666 /dev/wmtWifi
chmod 0660 /dev/ttySAC0
/usr/bin/6620_launcher -m 1 -b 115200 -n /etc/firmware/mt6620_patch_hdr.bin -d /dev/ttySAC0 &
echo Try to start wifi......>/dev/ttySAC2
sleep 1
echo 1 > /dev/wmtWifi
echo Try to connect wifi......>/dev/ttySAC2
sleep 1
wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant.conf -dd >/var/wifi_log &
udhcpc -i wlan0 >/var/udhcpc_log &
3.4 执行mkdir -p mt6620_modules/mt6620/新建一个目录存放驱动
拷贝以下驱动文件到mt6620_modules/mt6620/目录下
mtk_hif_sdio.ko mtk_stp_sdio.ko mtk_stp_uart.ko mtk_stp_wmt.ko mtk_wmt_wifi.ko wlan_mt6620.ko
3.5 执行/mt6620脚本启动WiFi模组并连接WiFi热点
移植成功,ping百度的效果
[root@Topeet]:/ # ping baidu.com
PING baidu.com (39.156.66.10): 56 data bytes
64 bytes from 39.156.66.10: seq=0 ttl=52 time=62.348 ms
64 bytes from 39.156.66.10: seq=1 ttl=52 time=62.226 ms
64 bytes from 39.156.66.10: seq=2 ttl=52 time=63.170 ms
64 bytes from 39.156.66.10: seq=3 ttl=52 time=63.010 ms
64 bytes from 39.156.66.10: seq=4 ttl=52 time=61.651 ms
64 bytes from 39.156.66.10: seq=5 ttl=52 time=60.913 ms
64 bytes from 39.156.66.10: seq=6 ttl=52 time=65.411 ms
64 bytes from 39.156.66.10: seq=7 ttl=52 time=63.694 ms
64 bytes from 39.156.66.10: seq=8 ttl=52 time=63.301 ms
64 bytes from 39.156.66.10: seq=9 ttl=52 time=62.615 ms
64 bytes from 39.156.66.10: seq=10 ttl=52 time=62.300 ms
六、遇到问题和解决办法
1.卡在startkernel
进入内核图形配置,去掉Exynos IOMMU Support,如下
Device Drivers --->
IOMMU Hardware Support --->
[ ] Exynos IOMMU Support
2.无法正常挂载根文件系统
修改内核启动项为
root=/dev/mmcblk2p2 rw console=ttySAC2,115200 init=/linuxrc