分类: LINUX
2009-02-20 11:26:28
2.在arch/arm/plat-s3c24xx中的devs.c中添加dm9000的platform_device。
#include
static struct resource andy_dm9000_resource[] = {
[0]= {
.start = 0x18000000, //utu2440上接到了bank3 重要!
.end = 0x18000003,
.flags = IORESOURCE_MEM,
},
[1]={
.start = 0x18000004,
.end = 0x18000007,
.flags = IORESOURCE_MEM,
},
[2]={
.start = IRQ_EINT9,
.end = IRQ_EINT9,
.flags = IORESOURCE_IRQ,
}
};
static struct dm9000_plat_data andy_dm9000_platdata ={
.flags = DM9000_PLATF_16BITONLY,//work in 16bit mode
};
struct platform_device andy_dm9000_device = {
.name = "dm9000",
.id = -1,
.num_resources = 3,
.resource = andy_dm9000_resource,
.dev = {
.platform_data = &andy_dm9000_platdata,
}
};
EXPORT_SYMBOL(andy_dm9000_device);
3.在arch/arm/plat-s3c24xx/include/plat/devs.h中 声明平台设备 andy_dm9000_device :
extern struct platform_device andy_dm9000_device;
4.在arch/arm/mach-s3c2440/mach-smdk2440.c中将andy_dm9000_device添加到平台设备列表中(151行附近):
static struct platform_device *smdk2440_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
&andy_dm9000_device, //add dm9000 by andykuo
&s3c_device_nand,
};
5.OK,经过上述努力,Dm9000设备已经成功注册进入驱动核心。下面进入driver/net/dm9000.C中,还需要做两方面的工作:设置芯片MAC地址,使能DM9000的中断。
根据2440资料。有几个地方需要设置:
1)设置GPGCON 使GPG1功能设置为EINT9 。
这可以用函数实现:s3c2410_gpio_cfgpin(S3C2410_GPG1, S3C2410_GPF3_EINT9);
2)外部中断EXTINT1 的[6:4]位 置100 上升沿触发中断
#define EINTMASK (0x560000a4) //外部中断屏蔽
#define EXTINT1 (0x5600008c) //外部中断方式
#define INTMSK (0x4A000008) //中断屏蔽