linux作为网路系统,功能强大之处就在于对网络的支持完善,因此添加网卡驱动使其具有网络功能是非常必要的。
此开发板的网卡为DM9000,DM9000在内核是公开通用的,因此添加对它的支持非常简单。
在math-th6410.c文件中添加以下
1.包含头文件
#include <linux/dm9000.h>
2.设备配置结构体
/* add by chenpq at 2013.6.25 ***********/
/* DM9000AEP 10/100 ethernet controller */
static struct resource dm9k_resource[] = {
[0]= {
.start = S3C64XX_PA_XM0CSN1,
.end = S3C64XX_PA_XM0CSN1 + 1,
.flags = IORESOURCE_MEM
},
[1]= {
.start = S3C64XX_PA_XM0CSN1 + 4,
.end = S3C64XX_PA_XM0CSN1 + 5,
.flags = IORESOURCE_MEM
},
[2]= {
.start = S3C_EINT(7),
.end = S3C_EINT(7),
.flags = IORESOURCE_IRQ |IORESOURCE_IRQ_HIGHLEVEL
}
};
static struct dm9000_plat_data dm9k_pdata ={
.flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};
static struct platform_devices3c_device_dm9000 = {
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(dm9k_resource),
.resource = dm9k_resource,
.dev = {
.platform_data = &dm9k_pdata,
},
};
// add end by chenpq at 2013.6.25
3.平台设备数组数据中platform_device *th6410_devices[] __initdata中添加
#ifdef CONFIG_DM9000
&s3c_device_dm9000, //chenpq:dm9000:2013.6.25
#endif
4.makemenuconfig配置支持DM9000驱动
[*] Networkingsupport --->Networking options--->
<*> Packet socket
<*> Unix domain sockets
[*] TCP/IP networking
[*] IP: kernel level autoconfiguration
[*] IP: DHCP support
[*] IP: BOOTP support
[*] IP: RARPsupport
Device Drivers --->
[*] Network device support --->
[*] Ethernet (10 or 100Mbit) --->
<*> DM9000 support
[ ] Ethernet (1000 Mbit) ---> 去掉
其他的默认
烧录重启后查看网址
dm9000 dm9000: eth0: link down
Processing /etc/profile... Done
/ # ifconfig
eth0 Link encap:Ethernet HWaddr EA:E1:6E:74:88:A2
inet addr:192.168.0.15 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:108 Base address:0x6000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
/ #