移植内核之DM9000
移植步骤:
SETUP1:修改arch/arm/mach-s3c6410/mach-ut6410.c
1、 添加DM9000头文件
#include <linux/dm9000.h>
2、 添加网卡地址
#define UT6410_PA_DM9000 (0x18000000)
#define UT6410_VA_EXTDEV S3C_ADDR(0x02000000)
#define UT6410_PA_EXTDEV (0x30000000)
#define UT6410_EN_DM9000 (1<<14)
static __u32
ut6410_extdev_status;
3、添加必要的代码,支持DM9000驱动
/* DM9000AEP 10/100
ethernet controller */
static void __init
ut6410_dm9000_enable(void)
{
ut6410_extdev_status |= (UT6410_EN_DM9000 << 16);
__raw_writel(ut6410_extdev_status, UT6410_VA_EXTDEV);
}
static struct resource
ut6410_dm9000_resource[] = {
[0] = {
.start = UT6410_PA_DM9000,
.end =
UT6410_PA_DM9000 + 3,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = UT6410_PA_DM9000 + 4,
.end =
UT6410_PA_DM9000 + 4 + 500,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_EINT(7), /*根据电路图来的*/
.end =
IRQ_EINT(7),
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
},
};
static struct
dm9000_plat_data ut6410_dm9000_pdata = {
.flags = (DM9000_PLATF_16BITONLY |
DM9000_PLATF_NO_EEPROM),
.dev_addr = { 0x08,
0x90, 0x90, 0x90, 0x90, 0x90 }, /* MAC addr*/
/* dev_addr can be set to provide hwaddr. */
};
static struct
platform_device ut6410_device_eth = {
.name =
"dm9000",
.id = -1,
.num_resources =
ARRAY_SIZE(ut6410_dm9000_resource),
.resource =
ut6410_dm9000_resource,
.dev = {
.platform_data =
&ut6410_dm9000_pdata,
},
};
static struct map_desc
ut6410_iodesc[] __initdata = {
{
.virtual =
(unsigned long)UT6410_VA_EXTDEV,
.pfn =
__phys_to_pfn(UT6410_PA_EXTDEV),
.length =
SZ_64K,
.type =
MT_DEVICE,
},
};
/*****************************/
3、 在platform_device *ut6410_devices[]结构体中添加:
&ut6410_device_eth,
4、 在ut6410_machine_init(void)函数中添加:
ut6410_dm9000_enable();
SETUP2: 配置内核支持网卡
Device Drivers --->
[*] Network device support
--->
[*] Ethernet (10 or 100Mbit) --->
<*> DM9000 support
OK 编译好,烧写到开发板上,其中可能会遇到很多的问题,同过Google一般的都能解决。
参考网址:
http://blog.chinaunix.net/space.php?uid=20543672&do=blog&cuid=400516
http://wenx05124561.blog.163.com/blog/static/1240008052010451177625/ |