上次的nand flash移植 linux-2.6.38到tiny6410的移植手册(连载1)见
http://www.arm9home.net/read.php?tid-14196.html
今天做的是dm9000网卡移植,和nfs文件系统的搭建
1、vi include/linux/dm9000.h
28行增加
unsigned char param_addr[6];
2、vi arch/arm/mach-s3c64xx/mach-mini6410.c
为方便起见,将他的网卡结构体注释掉
#if 0
static struct resource mini6410_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 mini6410_dm9k_pdata = {
.flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};
static struct platform_device mini6410_device_eth = {
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(mini6410_dm9k_resource),
.resource = mini6410_dm9k_resource,
.dev = {
.platform_data = &mini6410_dm9k_pdata,
},
};
#endif
增加
#define S3C64XX_PA_DM9000 (0x18000000)
#define S3C64XX_SZ_DM9000 SZ_1M
#define S3C64XX_VA_DM9000 S3C_ADDR(0x03b00300)
static struct resource dm9000_resources[] = {
[0] = {
.start = S3C64XX_PA_DM9000,
.end = S3C64XX_PA_DM9000 + 3,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = S3C64XX_PA_DM9000 + 4,
.end = S3C64XX_PA_DM9000 + S3C64XX_SZ_DM9000 - 1,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_EINT(7),
.end = IRQ_EINT(7),
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
},
};
static struct dm9000_plat_data dm9000_setup = {
.flags = DM9000_PLATF_16BITONLY,
.dev_addr = { 0x08, 0x90, 0x00, 0xa0, 0x90, 0x90 },
};
static struct platform_device s3c_device_dm9000 = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(dm9000_resources),
.resource = dm9000_resources,
.dev = {
.platform_data = &dm9000_setup,
}
};
如果不嫌麻烦,也可以直接在原代码上改,S3C64XX_PA_XM0CSN1的值也为0x18000000的。
增加mac地址设置函数
static int __init dm9000_set_mac(char *str) {
unsigned char addr[6];
unsigned int val;
int idx = 0;
char *p = str, *end;
while (*p && idx < 6) {
val = simple_strtoul(p, &end, 16);
if (end <= p) {
/* convert failed */
break;
} else {
addr[idx++] = val;
p = end;
if (*p == ':'|| *p == '-') {
p++;
} else {
break;
}
}
}
if (idx == 6) {
printk("Setup ethernet address to %pMn", addr);
memcpy(dm9000_setup.param_addr, addr, 6);
}
return 1;
}
__setup("ethmac=", dm9000_set_mac);
增加IO映射
增加映射结构体
static struct map_desc mini6410_iodesc[] = {
#ifdef CONFIG_DM9000
{
.virtual = (u32)S3C64XX_VA_DM9000,
.pfn = __phys_to_pfn(S3C64XX_PA_DM9000),
.length = S3C64XX_SZ_DM9000,
.type = MT_DEVICE,
},
#endif
};
然后在static void __init mini6410_map_io(void)函数中
将s3c64xx_init_io(NULL, 0);改成
s3c64xx_init_io(mini6410_iodesc, ARRAY_SIZE(mini6410_iodesc));
最后在static struct platform_device *mini6410_devices[] __initdata 的初始化设备中
将 &mini6410_device_eth,
改成 &s3c_device_dm9000,
3、vi drivers/net/dm9000.c
大概1586行
将mac_src = "platform data";
memcpy(ndev->dev_addr, pdata->dev_addr, 6);
改成
mac_src = "param data";
memcpy(ndev->dev_addr, pdata->param_addr, 6);
大概1598行
增加
if (!is_valid_ether_addr(ndev->dev_addr) && pdata != NULL) {
mac_src = "platform data";
memcpy(ndev->dev_addr, pdata->dev_addr, 6);
}
4、make menuconfig
[*] Networking support --->
Networking options --->
<*> Packet socket
<*> Unix domain sockets
[*] TCP/IP networking
[*] IP: kernel level autoconfiguration
[*] IP: DHCP support
[*] IP: BOOTP support
[*] IP: RARP support
Device Drivers --->
[*] Network device support --->
[*] Ethernet (10 or 100Mbit) --->
<*> DM9000 support
[ ] Ethernet (1000 Mbit) ---> 去掉
其他的默认
编译出来,在引导信息中就能看到dm9000网卡信息了。
dm9000 Ethernet Driver, V1.31
eth0: dm9000a at d0930000,d0e00004 IRQ 108 MAC: 08:90:90:90:。。。。
5、增加NFS挂载功能
make menuconfig
File systems --->
Network File Systems --->
<*> NFS client support
[*] Root file system on NFS 这个一点要选
<*> NFS server support
之后编译出来的内核就能挂载nfs文件系统了
我的是setenv bootargs console=ttySAC0 root=/dev/nfs nfsroot=58.154.51.164:/root/my_root ip=58.154.51.199:58.154.51.164:58.154.51.199:255.255.255.0 :kiss:eth0:off
如
mmc1: mmc_rescan_try_freq: trying to init card at 100000 Hz
eth0: link down
eth0: link up, 100Mbps, full-duplex, lpa 0xC1E1
IP-Config: Complete:
device=eth0, addr=58.154.51.199, mask=255.255.255.0, gw=58.154.51.199,
host=58.154.51.199, domain=, nis-domain=(none),
bootserver=58.154.51.164, rootserver=58.154.51.164, rootpath=
VFS: Mounted root (nfs filesystem) on device 0:11.
Freeing init memory: 120K
Please press Enter to activate this console. [root@kissBaofish /]#
[root@kissBaofish /]#
[root@kissBaofish /]#
[root@kissBaofish /]# [*] Touchscreens --->
<*> S3C touchscreen driver for Mini6410
<*> Mini6410 1-Wire host and Touch Screen Driver
lcd好用了,开机出现了那只小企鹅,挂NFS后触摸屏也能用了。
上一篇:linux-2.6.38到tiny6410的移植手册(连载1)__nand flash
下一篇:ARM7 VS Cortex-M3
推荐阅读最新更新时间:2024-11-20 11:13
设计资源 培训 开发板 精华推荐
- LTC6990HS6#TRMPBF 温度到频率转换器的典型应用。从 -20 oC (fOUT - 20kHz) 到 75 oC (fOUT - 25kHz) 的线性度为 3%
- NSV45020T1G 大电流 LED 灯串的典型应用
- 3d打印机控制板-6轴上下位机一体
- 2000W可控硅调速器模块
- LP2951 固定输出 5V 稳压器的典型应用
- KIT07XS6517EVB: 评估套件 - MC07XS6517,三通道高边开关
- ADR5040B 2.048 Vout 精密微功耗并联模式电压基准的典型应用
- 具有高阻抗输入源的 LT3976EMSE 4V 降压转换器的典型应用电路
- 基于瑞萨芯片时钟台灯系统
- REF195 精密微功耗、低压差电压基准的典型应用