全部博文(668)
分类:
2008-09-03 16:19:36
好了,不罗嗦了,先把工作做完。
移植步骤
1. 修改arch/arm/plat-s3c24xx/devs.c,加入dm9000的信息,并使用EXPORT_SYMBOL 宏将platform_device s3c_device_dm9000导出,在smdk2410.c中会用到
//===========================================================================
// dm9000 ------yangdk
#define DM9000_BASE 0x28000300
//#define DM9000_IRQ IRQ_EINT3
static struct resource s3c_dm9000_resource[] = {
[0] = {
.start = DM9000_BASE,
.end = DM9000_BASE+ 0x3,
.flags = IORESOURCE_MEM
},
[1]={
.start = DM9000_BASE + 0x4,
.end = DM9000_BASE + 0x4 + 0x7c,
.flags = IORESOURCE_MEM
},
[2] = {
.start = IRQ_EINT3,
.end = IRQ_EINT3,
.flags = IORESOURCE_IRQ
}
};
static struct dm9000_plat_data s3c_device_dm9000_platdata = {
.flags= DM9000_PLATF_16BITONLY,
};
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);
//end of DM9000
//===========================================================================
2.在include/asm-arm/plat-s3c24xx/devs.h 文件中 添加一行
extern struct platform_device s3c_device_dm9000;
3.在arch/arm/mach-s3c2410/mach-smdk2410.c中将dm9000加入到要初始化的设备链表里去,内核启动时将会检测设备并加载驱动
static struct platform_device *smdk2410_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
&s3c_device_dm9000,
};
4.在arch/arm/mach-s3c2440/mach-smdk2440.c中加入对DM9000的地址映射
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 = S3C2410_ADDR(0x02100300),
.pfn = __phys_to_pfn(0x28000300), //DM9000 -----yangdk
.length = SZ_1M,
.type = MT_DEVICE,
}
};
5. 修改driver/net/dm9000.c
加入几个头文件,后面有用
在probe函数中加入
chinaunix网友2008-09-26 17:47:33
我大体上按照你这样做确实能把DM9000驱动加载了,发现了设备,也能ping通主机,但是我这里还是存在问题,主机不能ping通2410开发板,而且2410开发板也不能ping通自己