|
//----------------------------------------------------------------------------------------------------------------------------
// 作者:armeasy
// 版权:www.9tripod.com
// 平台:九鼎创展x210ii/s5pv210开发板
// 发布日期:2012-04-20
// 最后修改:2012-04-20
// 论坛:http://bbs.9tripod.com
//-----------------------------------------------------------------------------------------------------------------------------
一、硬件接口[s5pv210+dm9000cep]
1、采用16bit模式;
2、INT接到S5PV210的IRQ_LAV/EINT10,INT脚为低时为有效中断信号,中断线为EINT10;
3、CS接到S5PV210的CSn1,CMD连接到V210的地址总线ADDR[2],故INDEX和DATA[15:0]的端口地址分别为0x88000000和0x88000004。
二、软件修改:
1、android_gingerbread_v10/android/kernel/arch/arm/mach-s5pv210/include/mach/map.h文件
//#define S5PV210_PA_DM9000 (0xA8000000)
//#define S5P_PA_DM9000 S5PV210_PA_DM9000
//lqm changed.
#define S5PV210_PA_DM9000 (0x88000000)
#define S5P_PA_DM9000 S5PV210_PA_DM9000 + 0x300
2、android_gingerbread_v10/android/kernel/arch/arm/plat-s5p/devs.c文件
/* DM9000 registrations */
#ifdef CONFIG_DM9000
static struct resource s5p_dm9000_resources[] = {
[0] = {
.start = S5P_PA_DM9000,
.end = S5P_PA_DM9000 + 3, //为什么要加3?
.flags = IORESOURCE_MEM,
},
[1] = {
#if defined(CONFIG_DM9000_16BIT)
.start = S5P_PA_DM9000 + 4, //为什么要加4?
.end = S5P_PA_DM9000 + 7, //为什么要加7?
.flags = IORESOURCE_MEM,
#else
.start = S5P_PA_DM9000 + 1,
.end = S5P_PA_DM9000 + 1,
.flags = IORESOURCE_MEM,
#endif
},
[2] = {
.start = IRQ_EINT10,
.end = IRQ_EINT10,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,//注意,这时为高电平产生中断,具体因硬件接法而定
}
};
static struct dm9000_plat_data s5p_dm9000_platdata = {
#if defined(CONFIG_DM9000_16BIT)
.flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM,
#else
.flags = DM9000_PLATF_8BITONLY | DM9000_PLATF_NO_EEPROM,
#endif
.dev_addr = {0x00,0x09,0xc0,0xff,0xec,0x48},
};
struct platform_device s5p_device_dm9000 = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(s5p_dm9000_resources),
.resource = s5p_dm9000_resources,
.dev = {
.platform_data = &s5p_dm9000_platdata,
}
};
3、android_gingerbread_v10/android/kernel/arch/arm/mach-s5pv210/mach-x210.c
#ifdef CONFIG_DM9000
static void __init smdkc110_dm9000_set(void)
{
unsigned int tmp;
/* initial dm9000 interrupt */
// lqm added.
int ret;
/* Input mode */
s3c_gpio_cfgpin(S5PV210_GPH1(2), S3C_GPIO_INPUT);
s3c_gpio_setpull(S5PV210_GPH1(2), S3C_GPIO_PULL_NONE);
ret = gpio_request(S5PV210_GPH1(2), "GPH1");
if(ret)
printk("mach-x210: request gpio GPH1(2) fail");
else
{
s3c_gpio_cfgpin(S5PV210_GPH1(2), 0xf);
s3c_gpio_setpull(S5PV210_GPH1(2), S3C_GPIO_PULL_NONE);
}
tmp = ((0<<28)|(0<<24)|(5<<16)|(0<<12)|(0<<8)|(0<<4)|(0<<0));
//CS1
__raw_writel(tmp, S5P_SROM_BC1);
tmp = __raw_readl(S5P_SROM_BW);
//CS1
tmp &= ~(0xf << 4);
tmp |= (1<<7) | (1<<6) | (1<<5) | (1<<4); // dm9000 16bit
__raw_writel(tmp, S5P_SROM_BW);
tmp = __raw_readl(S5PV210_MP01CON);
tmp &= ~(0xf << 4);
tmp |= (2 << 4);
__raw_writel(tmp, S5PV210_MP01CON);
}
#endif
4、make menuconfig选上DM9000和16bit的模式:
-*- Generic Media Independent Interface device support │ │
│ │ < > ASIX AX88796 NE2000 clone support │ │
│ │ < > SMC 91C9x/91C1xxx support │ │
│ │ <*> DM9000 support │ │
│ │ DM9000 16-bit │ │
│ │ (4) DM9000 maximum debug level │ │
│ │ [ ] Force simple NSR based PHY polling
5、确保dm9000.c驱动能正常工作:
android_gingerbread_v10/android/kernel/drivers/net/dm9000.c
如不能确认,请进我们论坛下载最新驱动,支持DM9000CEP。
下载地址:
http://bbs.9tripod.com/forum.php?mod=viewthread&tid=3588&extra=
再./mk -k生成映像文件zImage-android
6、更新内核后,插好网线,输入如下指令:
ifconfig eth0 192.168.1.5 up
注意,IP地址一定要设置在自己的局域网内。
这时应该就能PING通路由了。
/ # ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.494 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.236 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.242 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.217 ms
^C
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2997ms
rtt min/avg/max/mdev = 0.217/0.297/0.494/0.114 ms
/ #
但是这时还无法PING外网,输入如下指令:
busybox ip route add default via 192.168.1.1
setprop net.dns1 192.168.1.1
PING新浪网址:
/ # ping www.sina.com
PING gacrux.sina.com.cn (58.63.236.236) 56(84) bytes of data.
64 bytes from 58.63.236.236: icmp_seq=1 ttl=56 time=22.1 ms
64 bytes from 58.63.236.236: icmp_seq=2 ttl=56 time=21.2 ms
64 bytes from 58.63.236.236: icmp_seq=3 ttl=56 time=21.7 ms
^C
--- gacrux.sina.com.cn ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 21.213/21.698/22.173/0.410 ms
/ #
可见,已经能够正常PING通。点击浏览器,会弹出没有连接网络的提示,不用管它,应该能浏览网页了。
7、以上虽然能正常上网,但是每次都需手动设置IP和网关,比较麻烦,修改
android_gingerbread_v10/android/device/samsung/smdkv210目录下的init.smdkv210.rc
文件,修改dns为自己通用的DNS,我这里为192.168.1.1
on boot
mount debugfs /sys/kernel/debug /sys/kernel/debug
setprop ro.build.product smdkv210
setprop ro.product.device smdkv210
setprop ro.radio.noril no
setprop net.dns1 192.168.1.1
setprop net.dns2 192.168.1.1
修改android_gingerbread_v10/android/device/samsung/init.rc文件,在最末添加如下内容:
service eth_ifconfig /system/bin/ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
oneshot
service eth_route /system/bin/route add default gw 192.168.1.1 dev eth0
oneshot
再./mk -s,生成新的x210-uramdisk.img文件,使用fastboot更新,重启开发板,就能上网了。
注:init.rc和init.smdkv210.rc文件都保存在x210-uramdisk.img中,更新内核,文件系统都没有效果。
平时调试时,如果需要修改这些文件,没必要重新编译整个文件系统,可以直接把x210-uramdisk.img文件解压后
再修改,完了之后再打包即可。具体解压和打包的方法见x210ii源码包的脚本文件ramdisk.sh
内核源码:
|
|