1. 首页 > 电脑教程 > OK6410开发板上的DM9000网卡可以用啦

OK6410开发板上的DM9000网卡可以用啦

OKeU-Boot 1.1.6 (Nov 5 2010 - 09:50:08) for SMDK6410CPU: S3C6410@532MHzFclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode)Board: SMDK6410DRAM: 128 MBFlash: 0 kBNAND: 1024 MB*** Warning - bad CRC or NAND, using default environmentIn: serialOut: serialErr: serialHit any key to stop autoboot: 0SMDK6410 # tftp c0008000 /Image_Nanddm9000 i/o: 0x18000000, id: 0x90000a46MAC: 00:40:5c:26:0a:5boperating at 100M full duplex modeTFTP from server 192.168.1.12; our IP address is 192.168.1.20Filename '/Image_Nand'.Load address: 0xc0008000Loading: T T TAbortSMDK6410 # ping 192.168.1.12dm9000 i/o: 0x18000000, id: 0x90000a46MAC: 00:40:5c:26:0a:5boperating at 100M full duplex modehost 192.168.1.12 is aliveSMDK6410 # tftp c0008000 /Image_Nanddm9000 i/o: 0x18000000, id: 0x90000a46MAC: 00:40:5c:26:0a:5boperating at 100M full duplex modeTFTP from server 192.168.1.12; our IP address is 192.168.1.20Filename '/Image_Nand'.Load address: 0xc0008000Loading: ######################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################doneBytes transferred = 4040704 (3da800 hex)SMDK6410 #

这篇帖子是写在OK6410开发板的DM9000 10/100M网卡调试通过之后;上面的输出信息是通过网卡下载内核到mobile sdram的log。板卡是飞凌设计的OK6410,默认带的u-boot居然不支持tftp,ping这些基本的东西。下载个内核吭哧吭哧几十分钟,当然也可以用USB会快很多,但是作者爱瞎折腾,要把这个烂东西调通,DM9000AE,嗬,不知道这世界上还有没有人用这玩意。修改smdk6410.h的以下代码:#ifdef CONFIG_DRIVER_SMC911X #undef CONFIG_DRIVER_CS8900 #define CONFIG_DRIVER_SMC911X_BASE 0x18800300#else#define CONFIG_DRIVER_CS8900 0 /* we have a CS8900 on-board */#define CS8900_BASE 0x18800300#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */#endif改为:#define CONFIG_DRIVER_DM9000 1#define CONFIG_DM9000_BASE 0x18000000/*XM0CSN1*/#define DM9000_DATA 0x18000004/*ADDR2*/#define DM9000_IO CONFIG_DM9000_BASE//#define CONFIG_DM9000_DEBUG 1#define CONFIG_DM9000_USE_16BIT 1一般的网卡甚至USB,蓝牙芯片都会外接预留的EEPROM,用来存储地址等配置信息;DM9000也不例外,默认驱动就是使用EEPROM存地址的,飞凌为了省钱,直接悬空,因此MAC地址需要从Nand Flash上面读出来,再写到DM9000寄存器里。从Linux2.6.28内核中拷贝如下2个函数,后面判断空地址要用:/*** is_zero_ether_addr - Determine if give Ethernet address is all zeros.* @addr: Pointer to a six-byte array containing the Ethernet address** Return true if the address is all zeroes.*/static inline int is_zero_ether_addr(const u8 *addr){return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]);}/*** is_multicast_ether_addr - Determine if the Ethernet address is a multicast.* @addr: Pointer to a six-byte array containing the Ethernet address** Return true if the address is a multicast address.* By definition the broadcast address is also a multicast address.*/static inline int is_multicast_ether_addr(const u8 *addr){return (0x01 & addr[0]);}

无数的先贤采用了以下代码来设置MAC地址,外加空判断,算是很排场了:/* Set Node address */#ifdef DM9000AE_ZENGJUN_SHAREif (is_zero_ether_addr(bd->bi_enetaddr) ||is_multicast_ether_addr(bd->bi_enetaddr)) {/* try reading from environment */u8 i;char *s, *e;s = getenv ("ethaddr");for (i = 0; i < 6; ++i) {bd->bi_enetaddr = s ?simple_strtoul (s, &e, 16) : 0;if (s)s = (*e) ? e + 1 : e;}}#elsefor (i = 0; i < 6; i++)((u16 *) bd->bi_enetaddr) = read_srom_word(i);#endif另外参考内核代码rx之前一定要读两次MRR,估计是芯片设计缺陷,没什么理由:#ifndef DM9000AE_ZENGJUN_SHAREDM9000_ior(DM9000_MRRH);DM9000_ior(DM9000_MRRL);#endif/* Check packet ready or not */DM9000_ior(DM9000_MRCMDX); /* Dummy read */

最后,注空eth_halt函数,一切OK;设置好网关,服务器,就能下载内核了。

默认的是CS8900,有这个CS8900的好处是,他把XM0CSN1所在的BANK1初始化了,省的我再去配时序,下面是飞凌默认设置时的u-boot输出:OKsU-Boot 1.1.6 (Nov 5 2010 - 10:29:09) for SMDK6410CPU: S3C6410@532MHzFclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode)Board: SMDK6410DRAM: 128 MBFlash: 0 kBNAND: 1024 MB*** Warning - bad CRC or NAND, using default environmentIn: serialOut: serialErr: serialHit any key to stop autoboot: 0SMDK6410 # ping 192.168.1.10CS8900 Ethernet chip not found?!ping failed; host 192.168.1.10 is not aliveSMDK6410 # ping 192.168.1.10CS8900 Ethernet chip not found?!ping failed; host 192.168.1.10 is not aliveSMDK6410 #

声明:希维路由器教程网提供的内容,仅供网友学习交流,如有侵权请与我们联系删除,谢谢。ihuangque@qq.com
本文地址:https://www.ctrlcv.com.cn/diannao/169323123110595.html