二、添加DM9000网卡的支持
(5)在board/fl2440/fl2440.c 中board_eth_init函数添加对dm9000的支持
- #ifdef CONFIG_CMD_NET
- int board_eth_init(bd_t *bis)
- {
- int rc = 0;
- #ifdef CONFIG_CS8900
- rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
- #endif
- #ifdef CONFIG_DRIVER_DM9000
- rc = dm9000_initialize(bis);
- #endif
- return rc;
- }
- #endif
(6)然后修改include/configs/fl2440.h文件中关于网卡的宏定义,将原来的:
- #define CONFIG_NET_MULTI
- #define CONFIG_CS8900 /* we have a CS8900 on-board */
- #define CONFIG_CS8900_BASE 0x19000300
- #define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
修改为:
- #define CONFIG_NET_MULTI 1
- #define CONFIG_DRIVER_DM9000 1
- #define CONFIG_DM9000_USE_16BIT 1
- #define CONFIG_DM9000_BASE 0x20000300
- #define DM9000_IO CONFIG_DM9000_BASE
- #define DM9000_DATA (CONFIG_DM9000_BASE + 4)
- #define CONFIG_DM9000_NO_SROM 1 //防止dm9000去从srom中读取物理地址信息
并在98行附近添加
- #define CONFIG_CMD_DHCP
- #define CONFIG_CMD_PING /*****add by yanghao*****/
- #define CONFIG_CMD_NET /*add by yanghao*/
并将104行附近
- /*#define CONFIG_ETHADDR 08:00:3e:26:0a:5b */
- #define CONFIG_NETMASK 255.255.255.0
- #define CONFIG_IPADDR 10.0.0.110
- #define CONFIG_SERVERIP 10.0.0.1
修改为:
- #define CONFIG_ETHADDR 08:00:3e:26:0a:5b
- #define CONFIG_NETMASK 255.255.255.0
- #define CONFIG_IPADDR 192.168.1.4
- #define CONFIG_SERVERIP 192.168.1.1
这里是修改开发板的IP地址和主机地址,需要将主机地址修改成“192.168.1.1”
(7)打开driver/net/dm9000x.c文件,修改函数dm9000_halt,防止uboot在ping通主机后又马上断开连接的问题
- static void dm9000_halt(struct eth_device *netdev)
- {
- DM9000_DBG("%s\n", __func__);
- #if 0 //为了防止dm9000建立连接后又马上断开的情况
- /* RESET devie */
- phy_write(0, 0x8000); /* PHY RESET */
- DM9000_iow(DM9000_GPR, 0x01); /* Power-Down PHY */
- DM9000_iow(DM9000_IMR, 0x80); /* Disable all interrupt */
- DM9000_iow(DM9000_RCR, 0x00); /* Disable RX */
- #endif
- }
