移植MT7620A+MT7610E驱动到Openwrt trunk(Linux Kernel 3.14.18)(续:MT7620A)
按照上一篇的内容修改文件重新编译后不会报错,但是烧到flash里后运行的时候有问题,如下:
[ 16.840000] mt7620: module license 'unspecified' taints kernel.
[ 16.840000] Disabling lock debugging due to kernel taint
[ 16.870000] mt7620: Unknown symbol ra_mtd_write_nm (err 0)
[ 16.880000] mt7620: Unknown symbol ra_mtd_read_nm (err 0)
[ 16.880000] mt7620: Unknown symbol procRegDir (err 0)
[ 17.290000] mt7610: Unknown symbol ra_mtd_write_nm (err 0)
[ 17.290000] mt7610: Unknown symbol ra_mtd_read_nm (err 0)
[ 17.290000] mt7610: Unknown symbol procRegDir (err 0)
[ 17.290000] mt7620: Unknown symbol ra_mtd_write_nm (err 0)
[ 17.290000] mt7620: Unknown symbol ra_mtd_read_nm (err 0)
[ 17.290000] mt7620: Unknown symbol procRegDir (err 0)
[ 17.290000] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 17.290000] mt7610: Unknown symbol ra_mtd_write_nm (err 0)
[ 17.620000] mt7610: Unknown symbol ra_mtd_read_nm (err 0)
[ 17.620000] mt7610: Unknown symbol procRegDir (err 0)
[ 17.670000] mt7620: Unknown symbol ra_mtd_write_nm (err 0)
[ 17.690000] mt7620: Unknown symbol ra_mtd_read_nm (err 0)
[ 17.690000] mt7620: Unknown symbol procRegDir (err 0)
[ 17.700000] nf_conntrack version 0.5.0 (1979 buckets, 7916 max)
[ 17.740000] xt_time: kernel timezone is -0000
[ 17.780000] mt7610: Unknown symbol ra_mtd_write_nm (err 0)
[ 17.800000] mt7610: Unknown symbol ra_mtd_read_nm (err 0)
[ 17.800000] mt7610: Unknown symbol procRegDir (err 0)
[ 17.860000] mt7620: Unknown symbol ra_mtd_write_nm (err 0)
[ 17.880000] mt7620: Unknown symbol ra_mtd_read_nm (err 0)
[ 17.880000] mt7620: Unknown symbol procRegDir (err 0)
[ 17.900000] PPP generic driver version 2.4.2
[ 17.900000] NET: Registered protocol family 24
[ 17.940000] mt7610: Unknown symbol ra_mtd_write_nm (err 0)
[ 17.960000] mt7610: Unknown symbol ra_mtd_read_nm (err 0)
[ 17.960000] mt7610: Unknown symbol procRegDir (err 0)
[ 18.020000] mt7620: Unknown symbol ra_mtd_write_nm (err 0)
[ 18.020000] mt7620: Unknown symbol ra_mtd_read_nm (err 0)
[ 18.040000] mt7620: Unknown symbol procRegDir (err 0)
[ 18.080000] mt7610: Unknown symbol ra_mtd_write_nm (err 0)
[ 18.090000] mt7610: Unknown symbol ra_mtd_read_nm (err 0)
[ 18.100000] mt7610: Unknown symbol procRegDir (err 0)
[ 18.160000] mt7620: Unknown symbol ra_mtd_write_nm (err 0)
[ 18.160000] mt7620: Unknown symbol ra_mtd_read_nm (err 0)
[ 18.180000] mt7620: Unknown symbol procRegDir (err 0)
[ 28.440000] device eth0.1 entered promiscuous mode
解决方法
移植7620
1. 添加os/linux/rt_flash.c 内容为
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
struct proc_dir_entry *procRegDir;
/*
* Flash API: ra_mtd_read, ra_mtd_write
* Arguments:
* - num: specific the mtd number
* - to/from: the offset to read from or written to
* - len: length
* - buf: data to be read/written
* Returns:
* - return -errno if failed
* - return the number of bytes read/written if successed
*/
int ra_mtd_write_nm(char *name, loff_t to, size_t len, const u_char *buf)
{
int ret = -1;
size_t rdlen, wrlen;
struct mtd_info *mtd;
struct erase_info ei;
u_char *bak = NULL;
mtd = get_mtd_device_nm(name);
if (IS_ERR(mtd)) {
ret = (int)mtd;
goto out;
}
if (len > mtd->erasesize) {
put_mtd_device(mtd);
ret = -E2BIG;
goto out;
}
bak = kzalloc(mtd->erasesize, GFP_KERNEL);
if (bak == NULL) {
put_mtd_device(mtd);
ret = -ENOMEM;
goto out;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
ret = mtd_read(mtd, 0, mtd->erasesize, &rdlen, bak);
#else
ret = mtd->read(mtd, 0, mtd->erasesize, &rdlen, bak);
#endif
if (ret) {
goto free_out;
}
if (rdlen != mtd->erasesize)
printk("warning: ra_mtd_write_nm: rdlen is not equal to erasesize\n");
memcpy(bak + to, buf, len);
ei.mtd = mtd;
ei.callback = NULL;
ei.addr = 0;
ei.len = mtd->erasesize;
ei.priv = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
ret = mtd_erase(mtd, &ei);
#else
ret = mtd->erase(mtd, &ei);
#endif
if (ret != 0)
goto free_out;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
ret = mtd_write(mtd, 0, mtd->erasesize, &wrlen, bak);
#else
ret = mtd->write(mtd, 0, mtd->erasesize, &wrlen, bak);
#endif
udelay(10); /* add delay after write */
free_out:
if (mtd)
put_mtd_device(mtd);
if (bak)
kfree(bak);
out:
return ret;
}
int ra_mtd_read_nm(char *name, loff_t from, size_t len, u_char *buf)
{
int ret;
size_t rdlen = 0;
struct mtd_info *mtd;
mtd = get_mtd_device_nm(name);
if (IS_ERR(mtd))
return (int)mtd;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
ret = mtd_read(mtd, from, len, &rdlen, buf);
#else
ret = mtd->read(mtd, from, len, &rdlen, buf);
#endif
if (rdlen != len)
printk("warning: ra_mtd_read_nm: rdlen is not equal to len\n");
put_mtd_device(mtd);
return ret;
}
EXPORT_SYMBOL(ra_mtd_write_nm);
EXPORT_SYMBOL(ra_mtd_read_nm);
EXPORT_SYMBOL(procRegDir);
MODULE_AUTHOR("Steven Liu ");
MODULE_DESCRIPTION("Ralink APSoC Flash Map");
MODULE_LICENSE("GPL");
2. 修改os/linux/rt_proc.c
将
struct proc_dir_entry *procRegDir
改为:
struct proc_dir_entry *procRegDir2860v2
并将该文件中所有调用procRegDir 的地方改为: procRegDir2860v2
3. 在Makefile中添加
rt2860v2_ap-objs += ../rt2860v2/os/linux/rt_flash.o
4. 修改 include/chip/rt2880.h
将:
#include
改为:
#include "rt_mmap.h" //fix
5. 修改 include/iface/rtmp_rbs.h
将:
#define RTMP_MAC_IRQ_NUM 4
改为
#define RTMP_MAC_IRQ_NUM 6
6. 修改 include/video.h
添加
VOID VideoTurbineDynamicTune(IN PRTMP_ADAPTER pAd);