首页 > 代码库 > FL2440移植LINUX-3.4.2(五)-- 添加DM9000的支持

FL2440移植LINUX-3.4.2(五)-- 添加DM9000的支持

1.参考mini2440拷贝:
linux-3.4.2\arch\arm\mach-s3c24xx\mach-mini2440.c
里的
/* DM9000AEP 10/100 ethernet controller */

 1 /* DM9000AEP 10/100 ethernet controller */ 2  3 static struct resource mini2440_dm9k_resource[] = { 4     [0] = { 5         .start = MACH_MINI2440_DM9K_BASE, 6         .end   = MACH_MINI2440_DM9K_BASE + 3, 7         .flags = IORESOURCE_MEM 8     }, 9     [1] = {10         .start = MACH_MINI2440_DM9K_BASE + 4,11         .end   = MACH_MINI2440_DM9K_BASE + 7,12         .flags = IORESOURCE_MEM13     },14     [2] = {15         .start = IRQ_EINT7,16         .end   = IRQ_EINT7,17         .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,18     }19 };20 21 /*22  * The DM9000 has no eeprom, and it‘s MAC address is set by23  * the bootloader before starting the kernel.24  */25 static struct dm9000_plat_data mini2440_dm9k_pdata =http://www.mamicode.com/ {26     .flags        = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),27 };28 29 static struct platform_device mini2440_device_eth = {30     .name        = "dm9000",31     .id        = -1,32     .num_resources    = ARRAY_SIZE(mini2440_dm9k_resource),33     .resource    = mini2440_dm9k_resource,34     .dev        = {35         .platform_data    = http://www.mamicode.com/&mini2440_dm9k_pdata,36     },37 };

到linux-3.4.2\arch\arm\mach-s3c24xx\mach-smdk2440.c文件里面

2.修改为如下:

 1 #include <linux/dm9000.h>    /* by zhutao 添加头文件*/  2 #define MACH_SMDK2440_DM9K_BASE (S3C2410_CS4 + 0x300) /* by zhutao 添加宏定义*/ 3  4 /* DM9000AEP 10/100 ethernet controller */ 5  6 static struct resource smdk2440_dm9k_resource[] = { 7     [0] = { 8         .start = MACH_SMDK2440_DM9K_BASE, 9         .end   = MACH_SMDK2440_DM9K_BASE + 3,10         .flags = IORESOURCE_MEM11     },12     [1] = {13         .start = MACH_SMDK2440_DM9K_BASE + 4,14         .end   = MACH_SMDK2440_DM9K_BASE + 7,15         .flags = IORESOURCE_MEM16     },17     [2] = {18         .start = IRQ_EINT7,19         .end   = IRQ_EINT7,20         .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,21     }22 };23 24 /*25  * The DM9000 has no eeprom, and it‘s MAC address is set by26  * the bootloader before starting the kernel.27  */28 static struct dm9000_plat_data smdk2440_dm9k_pdata =http://www.mamicode.com/ {29     .flags        = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),30 };31 32 static struct platform_device smdk2440_device_eth = {33     .name        = "dm9000",34     .id        = -1,35     .num_resources    = ARRAY_SIZE(smdk2440_dm9k_resource),36     .resource    = smdk2440_dm9k_resource,37     .dev        = {38         .platform_data    = http://www.mamicode.com/&smdk2440_dm9k_pdata,39     },40 };41 42 /* 增加平台设备 */43 static struct platform_device *smdk2440_devices[] __initdata =http://www.mamicode.com/ {44     &s3c_device_ohci,45     &s3c_device_lcd,46     &s3c_device_wdt,47     &s3c_device_i2c0,48     &s3c_device_iis,49     &smdk2440_device_eth, /* by zhutao */50 };

编译启动内核:

nfs挂接网络文件系统:

修改以下根文件系统inittab

1 #s3c2410_serial0::askfirst:-/bin/sh  /* 注释掉 */2 console::askfirst:-/bin/sh       /* 改成console */

 

 

FL2440移植LINUX-3.4.2(五)-- 添加DM9000的支持