linux3.11.10,mini2440移植DM9000,ping不通,丢包率大,网络不稳定

Linux内核中已经支持了DM9000,但是直接使用的话,网络性能很差,丢包率基本上都是大于50%的,所以需要改一些东西,下面就列一下要改的东西(思路还是根据友善之臂给的linux移植pdf,下载网址)。

Linux内核版本是3.11.10

1.打开mach-mini2440.c

mini2440_dm9k_resource[]改为:

static struct resource mini2440_dm9k_resource[] = {  
        [0] = {  
                .start = MACH_MINI2440_DM9K_BASE,  
                .end   = MACH_MINI2440_DM9K_BASE + 3,  
                .flags = IORESOURCE_MEM  
        },  
        [1] = {  
                .start = MACH_MINI2440_DM9K_BASE + 4,  
                .end   = MACH_MINI2440_DM9K_BASE + 7,  
                .flags = IORESOURCE_MEM  
        },  
        [2] = {  
                .start = IRQ_EINT7,  
                .end   = IRQ_EINT7,  
                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,  
        }  
};

2.打开dm9000.c

2.1添加头文件

#include <mach/regs-mem.h>
这个问价在linux3.11.10内核里面没有,所以要去Linux2.6内核源码里面考,即将linux-2.6.32.2/arch/arm/mach-s3c2410/include/mach/regs-mem.h拷贝到linux-3.11.10/arch/arm/mach-s3c24xx/include/mach/

2.2添加init

配置DM9000所用片选总线的时序

static int __init
dm9000_init(void)
{
    //#if defined(CONFIG_ARCH_S3C2410)
    unsigned int oldval_bwscon = *(volatile unsigned int *)S3C2410_BWSCON;
    unsigned int oldval_bankcon4 = *(volatile unsigned int *)S3C2410_BANKCON4;
    *((volatile unsigned int *)S3C2410_BWSCON) = (oldval_bwscon  &  ~(3<<16))  |  S3C2410_BWSCON_DW4_16  |
    S3C2410_BWSCON_WS4 | S3C2410_BWSCON_ST4;
    *((volatile unsigned int *)S3C2410_BANKCON4) = 0x1f7c;
    //#endif
    
    printk(KERN_INFO "dm9000 init!");

    return 0;
}

module_init(dm9000_init);

然后make即可,启动后再利用ping命令检验一下

你可能感兴趣的:(mini2440,dm9000)