Chinaunix首页 | 论坛 | 博客
  • 博客访问: 162017
  • 博文数量: 21
  • 博客积分: 2227
  • 博客等级: 大尉
  • 技术积分: 215
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-07 19:51
文章分类
文章存档

2012年(1)

2011年(1)

2009年(19)

分类: LINUX

2009-11-11 20:37:49

1)
# gedit arch/arm/mach-s3c2440/mach-smdk2440.c

static struct map_desc smdk2440_iodesc[] __initdata = {
        /* ISA IO Space map (memory space selected by A24) */
        {
            .virtual = (u32)S3C24XX_VA_ISA_WORD,
            .pfn = __phys_to_pfn(S3C2410_CS2),
            .length = 0x10000,
            .type = MT_DEVICE,
        }, {
            .virtual = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
            .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
            .length = SZ_4M,
            .type = MT_DEVICE,
        }, {
            .virtual = (u32)S3C24XX_VA_ISA_BYTE,
            .pfn = __phys_to_pfn(S3C2410_CS2),
            .length = 0x10000,
            .type = MT_DEVICE,
        }, {
            .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
            .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
            .length = SZ_4M,
            .type = MT_DEVICE,
        }
        //加入以下的内容
        ,
        {
            .virtual = (u32)S3C2410_ADDR(0x02100300),
            .pfn = __phys_to_pfn(0x20000300),
            .length = SZ_1M,
            .type = MT_DEVICE,
        }
};


static struct platform_device *smdk2440_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
        &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_rtc,
        &s3c_device_dm9000, //加入这一句
};

      
2)
# gedit arch/arm/plat-s3c24xx/devs.c
加入以下的内容:

/* DM9000 registrations */
#include <linux/dm9000.h>
#define DM9000_BASE 0x20000300
static struct resource s3c_dm9000_resource[] = {
        [0] = {
            .start = DM9000_BASE,
            .end = DM9000_BASE + 0x03,
            .flags = IORESOURCE_MEM,
        },
        [1] = {
            .start = DM9000_BASE + 0x04,
            .end = DM9000_BASE + 0x04 + 0x7c,
            .flags = IORESOURCE_MEM,
        },
        [2] = {
            .start = IRQ_EINT7,
            .end = IRQ_EINT7,
            .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
        }
};

static struct dm9000_plat_data s3c_device_dm9000_platdata = {
       .flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM,
};

struct platform_device s3c_device_dm9000 = {
        .name = "dm9000",
        .id = 0,
        .num_resources = ARRAY_SIZE(s3c_dm9000_resource),
        .resource = s3c_dm9000_resource,
        .dev = {
        .platform_data = &s3c_device_dm9000_platdata,
        }
};

EXPORT_SYMBOL(s3c_device_dm9000);


3)
# gedit arch/arm/plat-s3c/include/plat/devs.h
加入下面的一句:

extern struct platform_device s3c_device_dm9000;


4)
# make zImage

5)
启动后设置网卡的MAC地址:
# ifconfig eth0 down
# ifconfig eth0 hw ether 00:00:AA:BB:CC:DD
# ifconfig eth0 up

6)
Ping一下主机:
# ping 192.168.1.100                                       

PING 192.168.1.100 (192.168.1.100): 56 data bytes
64 bytes from 192.168.1.100: seq=0 ttl=64 time=0.794 ms
64 bytes from 192.168.1.100: seq=3 ttl=64 time=0.512 ms
^C
--- 192.168.1.100 ping statistics ---
8 packets transmitted, 2 packets received, 75% packet loss
round-trip min/avg/max = 0.512/0.653/0.794 ms

丢包率非常高!

7)
把友善之臂公司提供的linux 2.6.29/dirvers/net/下的 dm9000.c 和 dm9000.h
替换对应的,丢包现象明显改善~~

文件:dm9000.tar.gz
大小:11KB
下载:下载

8)
研究一下两者的差异
# diff dm9000_old.c dm9000.c > diff.txt

diff.txt内容如下:

40a41,44
    > #if defined(CONFIG_ARCH_S3C2410)
    > #include <mach/regs-mem.h>
    > #endif
    >
    562c566
    < struct delayed_work *dw = to_delayed_work(w);
    ---
    > struct delayed_work *dw = container_of(w, struct delayed_work, work);
    1189a1194,1198
    > # if defined(CONFIG_ARCH_S3C2410)
    > unsigned int oldval_bwscon = *(volatile unsigned int *)S3C2410_BWSCON;
    > unsigned int oldval_bankcon4 = *(volatile unsigned int *)S3C2410_BANKCON4;
    > # endif
    >
    1200a1210,1215
    > #if defined(CONFIG_ARCH_S3C2410)
    > *((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
    >
    1363a1379,1388
    > #if defined(CONFIG_ARCH_S3C2410)
    > printk("Now use the default MAC address: 08:90:90:90:90:90\n");
    > mac_src = "friendly-arm";
    > ndev->dev_addr[0] = 0x08;
    > ndev->dev_addr[1] = 0x90;
    > ndev->dev_addr[2] = 0x90;
    > ndev->dev_addr[3] = 0x90;
    > ndev->dev_addr[4] = 0x90;
    > ndev->dev_addr[5] = 0x90;
    > #else
    1385a1411
    > #endif
    1397a1424,1427
    > #if defined(CONFIG_ARCH_S3C2410)
    > *(volatile unsigned int *)S3C2410_BWSCON = oldval_bwscon;
    > *(volatile unsigned int *)S3C2410_BANKCON4 = oldval_bankcon4;
    > #endif


看来
友善之臂公司并没有对其作较大的修改!

阅读(2772) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~